Merge remote-tracking branch 'upstream/development' into michabr/lyshine_shader_loc

This commit is contained in:
abrmich
2022-01-04 11:33:30 -08:00
98 changed files with 1709 additions and 220 deletions
@@ -3,8 +3,6 @@ Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
Fixture for clearing out 'MoveOutput' folders from \dev and \dev\PROJECT
"""
# Import builtin libraries
@@ -169,17 +169,17 @@ class TestsAssetRelocator_WindowsAndMac(object):
@pytest.mark.test_case_id("C21968388")
@pytest.mark.assetpipeline
def test_WindowsMacPlatforms_MoveCorruptedSliceFile_MoveSuccess(self, request, workspace, ap_setup_fixture,
def test_WindowsMacPlatforms_MoveCorruptedPrefabFile_MoveSuccess(self, request, workspace, ap_setup_fixture,
asset_processor):
"""
Asset with UUID/AssetId reference in non-standard format is
successfully scanned and relocated to the MoveOutput folder.
This test uses a pre-corrupted .slice file.
This test uses a pre-corrupted .prefab file.
Test Steps:
1. Create temporary testing environment with a corrupted slice
2. Attempt to move the corrupted slice
3. Verify that corrupted slice was moved successfully
1. Create temporary testing environment with a corrupted prefab
2. Attempt to move the corrupted prefab
3. Verify that corrupted prefab was moved successfully
"""
env = ap_setup_fixture
@@ -187,7 +187,7 @@ class TestsAssetRelocator_WindowsAndMac(object):
asset_folder = "C21968388"
source_dir, _ = asset_processor.prepare_test_environment(env["tests_dir"], asset_folder)
filename = "DependencyScannerAsset.slice"
filename = "DependencyScannerAsset.prefab"
file_path = os.path.join(source_dir, filename)
dst_rel_path = os.path.join("MoveOutput", filename)
dst_full_path = os.path.join(source_dir, dst_rel_path)
@@ -0,0 +1,908 @@
{
"ContainerEntity": {
"Id": "ContainerEntity",
"Name": "DependencyScannerAsset",
"Components": {
"Component_[10182366347512475253]": {
"$type": "EditorPrefabComponent",
"Id": 10182366347512475253
},
"Component_[12917798267488243668]": {
"$type": "EditorPendingCompositionComponent",
"Id": 12917798267488243668
},
"Component_[3261249813163778338]": {
"$type": "EditorOnlyEntityComponent",
"Id": 3261249813163778338
},
"Component_[3837204912784440039]": {
"$type": "EditorDisabledCompositionComponent",
"Id": 3837204912784440039
},
"Component_[4272963378099646759]": {
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
"Id": 4272963378099646759,
"Parent Entity": ""
},
"Component_[4848458548047175816]": {
"$type": "EditorVisibilityComponent",
"Id": 4848458548047175816
},
"Component_[5787060997243919943]": {
"$type": "EditorInspectorComponent",
"Id": 5787060997243919943
},
"Component_[7804170251266531779]": {
"$type": "EditorLockComponent",
"Id": 7804170251266531779
},
"Component_[7874177159288365422]": {
"$type": "EditorEntitySortComponent",
"Id": 7874177159288365422
},
"Component_[8018146290632383969]": {
"$type": "EditorEntityIconComponent",
"Id": 8018146290632383969
},
"Component_[8452360690590857075]": {
"$type": "SelectionComponent",
"Id": 8452360690590857075
}
}
},
"Entities": {
"Entity_[274004659287]": {
"Id": "Entity_[274004659287]",
"Name": "DependencyScannerAsset",
"Components": {
"Component_[10849460799799271301]": {
"$type": "EditorPendingCompositionComponent",
"Id": 10849460799799271301
},
"Component_[11098142762746045658]": {
"$type": "SelectionComponent",
"Id": 11098142762746045658
},
"Component_[11154538629717040387]": {
"$type": "EditorEntitySortComponent",
"Id": 11154538629717040387,
"Child Entity Order": [
"Entity_[305822185575]",
"Entity_[278299626583]",
"Entity_[282594593879]",
"Entity_[286889561175]",
"Entity_[291184528471]"
]
},
"Component_[1365196255752273753]": {
"$type": "EditorOnlyEntityComponent",
"Id": 1365196255752273753
},
"Component_[280906579560376421]": {
"$type": "EditorLockComponent",
"Id": 280906579560376421
},
"Component_[4629965429001113748]": {
"$type": "EditorDisabledCompositionComponent",
"Id": 4629965429001113748
},
"Component_[4876910656129741263]": {
"$type": "EditorEntityIconComponent",
"Id": 4876910656129741263
},
"Component_[5763306492614623496]": {
"$type": "EditorInspectorComponent",
"Id": 5763306492614623496,
"ComponentOrderEntryArray": [
{
"ComponentId": 7514977506847036117
}
]
},
"Component_[7327709568605458460]": {
"$type": "EditorVisibilityComponent",
"Id": 7327709568605458460
},
"Component_[7514977506847036117]": {
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
"Id": 7514977506847036117,
"Parent Entity": "ContainerEntity"
}
}
},
"Entity_[278299626583]": {
"Id": "Entity_[278299626583]",
"Name": "AssetIDMatch",
"Components": {
"Component_[10285740519857855186]": {
"$type": "EditorDisabledCompositionComponent",
"Id": 10285740519857855186
},
"Component_[11273731016303624898]": {
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
"Id": 11273731016303624898,
"Parent Entity": "Entity_[274004659287]"
},
"Component_[1136790983026972010]": {
"$type": "EditorVisibilityComponent",
"Id": 1136790983026972010
},
"Component_[12777313618328131055]": {
"$type": "EditorPendingCompositionComponent",
"Id": 12777313618328131055
},
"Component_[13256044902558773795]": {
"$type": "EditorLockComponent",
"Id": 13256044902558773795
},
"Component_[15834551022302435776]": {
"$type": "EditorInspectorComponent",
"Id": 15834551022302435776,
"ComponentOrderEntryArray": [
{
"ComponentId": 11273731016303624898
},
{
"ComponentId": 9671522714018290727,
"SortIndex": 1
}
]
},
"Component_[16345420368214930095]": {
"$type": "SelectionComponent",
"Id": 16345420368214930095
},
"Component_[5309075942188429052]": {
"$type": "EditorEntitySortComponent",
"Id": 5309075942188429052
},
"Component_[8639731896786645938]": {
"$type": "EditorEntityIconComponent",
"Id": 8639731896786645938
},
"Component_[9844585173698551415]": {
"$type": "EditorOnlyEntityComponent",
"Id": 9844585173698551415
}
}
},
"Entity_[282594593879]": {
"Id": "Entity_[282594593879]",
"Name": "UUIDMatch",
"Components": {
"Component_[10379494986254888760]": {
"$type": "EditorDisabledCompositionComponent",
"Id": 10379494986254888760
},
"Component_[10932830014545295552]": {
"$type": "SelectionComponent",
"Id": 10932830014545295552
},
"Component_[16077882919902242532]": {
"$type": "EditorEntitySortComponent",
"Id": 16077882919902242532
},
"Component_[2150375322459274584]": {
"$type": "EditorPendingCompositionComponent",
"Id": 2150375322459274584
},
"Component_[2645455411436465820]": {
"$type": "EditorEntityIconComponent",
"Id": 2645455411436465820
},
"Component_[5422214869037468733]": {
"$type": "EditorOnlyEntityComponent",
"Id": 5422214869037468733
},
"Component_[7238126895911071330]": {
"$type": "EditorInspectorComponent",
"Id": 7238126895911071330,
"ComponentOrderEntryArray": [
{
"ComponentId": 8407607000804893064
},
{
"ComponentId": 12952323341649885242,
"SortIndex": 1
}
]
},
"Component_[7981670269715131988]": {
"$type": "EditorVisibilityComponent",
"Id": 7981670269715131988
},
"Component_[8407607000804893064]": {
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
"Id": 8407607000804893064,
"Parent Entity": "Entity_[274004659287]"
},
"Component_[8567641786004090803]": {
"$type": "EditorLockComponent",
"Id": 8567641786004090803
}
}
},
"Entity_[286889561175]": {
"Id": "Entity_[286889561175]",
"Name": "RelativeProductMatch",
"Components": {
"Component_[10180645282669228972]": {
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
"Id": 10180645282669228972,
"Parent Entity": "Entity_[274004659287]"
},
"Component_[10200807690182688147]": {
"$type": "EditorDisabledCompositionComponent",
"Id": 10200807690182688147
},
"Component_[11014661873645081316]": {
"$type": "EditorInspectorComponent",
"Id": 11014661873645081316,
"ComponentOrderEntryArray": [
{
"ComponentId": 10180645282669228972
},
{
"ComponentId": 12869852248016369650,
"SortIndex": 1
}
]
},
"Component_[12869852248016369650]": {
"$type": "{77CDE991-EC1A-B7C1-B112-7456ABAC81A1} EditorSpawnerComponent",
"Id": 12869852248016369650,
"Slice": {
"assetId": {
"guid": "{29F14025-3BD2-5CA9-A9DE-B8B349268C2F}",
"subId": 2
},
"assetHint": "slices/bullet.dynamicslice"
}
},
"Component_[15136448544716183259]": {
"$type": "EditorOnlyEntityComponent",
"Id": 15136448544716183259
},
"Component_[15966001894874626764]": {
"$type": "SelectionComponent",
"Id": 15966001894874626764
},
"Component_[16167982631516160155]": {
"$type": "EditorEntityIconComponent",
"Id": 16167982631516160155
},
"Component_[16672905198052847867]": {
"$type": "EditorEntitySortComponent",
"Id": 16672905198052847867
},
"Component_[4506946122562404190]": {
"$type": "EditorPendingCompositionComponent",
"Id": 4506946122562404190
},
"Component_[6836304267269231429]": {
"$type": "EditorLockComponent",
"Id": 6836304267269231429
},
"Component_[8756593519140349183]": {
"$type": "EditorVisibilityComponent",
"Id": 8756593519140349183
}
}
},
"Entity_[291184528471]": {
"Id": "Entity_[291184528471]",
"Name": "RelativeSourceMatch",
"Components": {
"Component_[11694027325905361034]": {
"$type": "EditorEntitySortComponent",
"Id": 11694027325905361034
},
"Component_[13891029613307790064]": {
"$type": "EditorEntityIconComponent",
"Id": 13891029613307790064
},
"Component_[15933511034411930900]": {
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
"Id": 15933511034411930900,
"Parent Entity": "Entity_[274004659287]"
},
"Component_[17540827492846961803]": {
"$type": "EditorLockComponent",
"Id": 17540827492846961803
},
"Component_[2850297705939373458]": {
"$type": "SelectionComponent",
"Id": 2850297705939373458
},
"Component_[4809103331004345812]": {
"$type": "EditorPendingCompositionComponent",
"Id": 4809103331004345812
},
"Component_[5654779331777839943]": {
"$type": "EditorInspectorComponent",
"Id": 5654779331777839943,
"ComponentOrderEntryArray": [
{
"ComponentId": 15933511034411930900
},
{
"ComponentId": 10284025539900054207,
"SortIndex": 1
}
]
},
"Component_[6097019179005900386]": {
"$type": "EditorVisibilityComponent",
"Id": 6097019179005900386
},
"Component_[7748387730313625157]": {
"$type": "EditorDisabledCompositionComponent",
"Id": 7748387730313625157
},
"Component_[9822265453841229082]": {
"$type": "EditorOnlyEntityComponent",
"Id": 9822265453841229082
}
}
},
"Entity_[297232250983]": {
"Id": "Entity_[297232250983]",
"Name": "1151F14D38A65579888ABE3139882E68:[0]",
"Components": {
"Component_[11936148741777754959]": {
"$type": "EditorDisabledCompositionComponent",
"Id": 11936148741777754959
},
"Component_[12610073699988743015]": {
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
"Id": 12610073699988743015,
"Parent Entity": "Entity_[305822185575]"
},
"Component_[1603205169722765279]": {
"$type": "EditorLockComponent",
"Id": 1603205169722765279
},
"Component_[17691206348057560715]": {
"$type": "EditorPendingCompositionComponent",
"Id": 17691206348057560715
},
"Component_[2711821203680330048]": {
"$type": "SelectionComponent",
"Id": 2711821203680330048
},
"Component_[3887480309311474860]": {
"$type": "EditorVisibilityComponent",
"Id": 3887480309311474860
},
"Component_[5853968883842282450]": {
"$type": "EditorEntityIconComponent",
"Id": 5853968883842282450
},
"Component_[7679080692843343453]": {
"$type": "EditorCommentComponent",
"Id": 7679080692843343453,
"Configuration": "Asset ID that matches an existing dependency of this asset (am_grass1.mtl)"
},
"Component_[8024752235278898687]": {
"$type": "EditorOnlyEntityComponent",
"Id": 8024752235278898687
},
"Component_[8373296084678231042]": {
"$type": "EditorEntitySortComponent",
"Id": 8373296084678231042
},
"Component_[9782967158965587831]": {
"$type": "EditorInspectorComponent",
"Id": 9782967158965587831,
"ComponentOrderEntryArray": [
{
"ComponentId": 12610073699988743015
},
{
"ComponentId": 7679080692843343453,
"SortIndex": 1
}
]
}
}
},
"Entity_[301527218279]": {
"Id": "Entity_[301527218279]",
"Name": "Slices/bullet.dynamicslice",
"Components": {
"Component_[15613078542630153866]": {
"$type": "EditorInspectorComponent",
"Id": 15613078542630153866,
"ComponentOrderEntryArray": [
{
"ComponentId": 2483032678718995164
},
{
"ComponentId": 9734604379060902193,
"SortIndex": 1
}
]
},
"Component_[16098942854900817264]": {
"$type": "SelectionComponent",
"Id": 16098942854900817264
},
"Component_[16720139961856477500]": {
"$type": "EditorEntitySortComponent",
"Id": 16720139961856477500
},
"Component_[2483032678718995164]": {
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
"Id": 2483032678718995164,
"Parent Entity": "Entity_[305822185575]"
},
"Component_[2502984783426127018]": {
"$type": "EditorLockComponent",
"Id": 2502984783426127018
},
"Component_[46714013890147210]": {
"$type": "EditorOnlyEntityComponent",
"Id": 46714013890147210
},
"Component_[4907474530744780429]": {
"$type": "EditorDisabledCompositionComponent",
"Id": 4907474530744780429
},
"Component_[5420332829198300813]": {
"$type": "EditorPendingCompositionComponent",
"Id": 5420332829198300813
},
"Component_[7683578164681693579]": {
"$type": "EditorEntityIconComponent",
"Id": 7683578164681693579
},
"Component_[8312115250363172310]": {
"$type": "EditorVisibilityComponent",
"Id": 8312115250363172310
},
"Component_[9734604379060902193]": {
"$type": "EditorCommentComponent",
"Id": 9734604379060902193,
"Configuration": "Relative product path that matches an existing dependency of this asset"
}
}
},
"Entity_[305822185575]": {
"Id": "Entity_[305822185575]",
"Name": "AssetReferences",
"Components": {
"Component_[13422135993444528172]": {
"$type": "EditorPendingCompositionComponent",
"Id": 13422135993444528172
},
"Component_[13988015667379021413]": {
"$type": "EditorLockComponent",
"Id": 13988015667379021413
},
"Component_[14885956487876614434]": {
"$type": "EditorVisibilityComponent",
"Id": 14885956487876614434
},
"Component_[15550715415947731915]": {
"$type": "EditorDisabledCompositionComponent",
"Id": 15550715415947731915
},
"Component_[2576266145980379805]": {
"$type": "EditorInspectorComponent",
"Id": 2576266145980379805,
"ComponentOrderEntryArray": [
{
"ComponentId": 3176911836967955668
},
{
"ComponentId": 836721549453007197,
"SortIndex": 1
}
]
},
"Component_[3176911836967955668]": {
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
"Id": 3176911836967955668,
"Parent Entity": "Entity_[274004659287]"
},
"Component_[5613459137294642234]": {
"$type": "SelectionComponent",
"Id": 5613459137294642234
},
"Component_[6400873582148097152]": {
"$type": "EditorEntityIconComponent",
"Id": 6400873582148097152
},
"Component_[684670817803453913]": {
"$type": "EditorEntitySortComponent",
"Id": 684670817803453913,
"Child Entity Order": [
"Entity_[323002054759]",
"Entity_[327297022055]",
"Entity_[301527218279]",
"Entity_[318707087463]",
"Entity_[297232250983]",
"Entity_[314412120167]",
"Entity_[331591989351]",
"Entity_[310117152871]"
]
},
"Component_[8118206464926826097]": {
"$type": "EditorOnlyEntityComponent",
"Id": 8118206464926826097
},
"Component_[836721549453007197]": {
"$type": "EditorCommentComponent",
"Id": 836721549453007197,
"Configuration": "Entity names are used to trigger the missing dependency scanner. Comments are stripped from dynamic slices."
}
}
},
"Entity_[310117152871]": {
"Id": "Entity_[310117152871]",
"Name": "Materials/FakeMaterial.mtl",
"Components": {
"Component_[10593857511582714674]": {
"$type": "EditorInspectorComponent",
"Id": 10593857511582714674,
"ComponentOrderEntryArray": [
{
"ComponentId": 11797216659359478300
},
{
"ComponentId": 13816702107134233983,
"SortIndex": 1
}
]
},
"Component_[11797216659359478300]": {
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
"Id": 11797216659359478300,
"Parent Entity": "Entity_[305822185575]"
},
"Component_[13816702107134233983]": {
"$type": "EditorCommentComponent",
"Id": 13816702107134233983,
"Configuration": "Invalid path that does not match an existing dependency of this asset"
},
"Component_[14868583012186337705]": {
"$type": "EditorOnlyEntityComponent",
"Id": 14868583012186337705
},
"Component_[14965348027145283648]": {
"$type": "EditorEntitySortComponent",
"Id": 14965348027145283648
},
"Component_[15075774238648121688]": {
"$type": "EditorEntityIconComponent",
"Id": 15075774238648121688
},
"Component_[16157883709857447266]": {
"$type": "EditorLockComponent",
"Id": 16157883709857447266
},
"Component_[17712080510249108208]": {
"$type": "EditorVisibilityComponent",
"Id": 17712080510249108208
},
"Component_[2247408514677946398]": {
"$type": "SelectionComponent",
"Id": 2247408514677946398
},
"Component_[5565369976544134481]": {
"$type": "EditorPendingCompositionComponent",
"Id": 5565369976544134481
},
"Component_[6044814215558788086]": {
"$type": "EditorDisabledCompositionComponent",
"Id": 6044814215558788086
}
}
},
"Entity_[314412120167]": {
"Id": "Entity_[314412120167]",
"Name": "88888888-4444-4444-4444-CCCCCCCCCCCC",
"Components": {
"Component_[10072177500579430176]": {
"$type": "EditorLockComponent",
"Id": 10072177500579430176
},
"Component_[10853215476279564671]": {
"$type": "EditorCommentComponent",
"Id": 10853215476279564671,
"Configuration": "UUID that does not exist"
},
"Component_[13413154971272749631]": {
"$type": "SelectionComponent",
"Id": 13413154971272749631
},
"Component_[15316173756367163440]": {
"$type": "EditorInspectorComponent",
"Id": 15316173756367163440,
"ComponentOrderEntryArray": [
{
"ComponentId": 3266728630359207653
},
{
"ComponentId": 10853215476279564671,
"SortIndex": 1
}
]
},
"Component_[15809307959802829291]": {
"$type": "EditorEntitySortComponent",
"Id": 15809307959802829291
},
"Component_[17649652752752487081]": {
"$type": "EditorEntityIconComponent",
"Id": 17649652752752487081
},
"Component_[2130036493438440377]": {
"$type": "EditorPendingCompositionComponent",
"Id": 2130036493438440377
},
"Component_[3266728630359207653]": {
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
"Id": 3266728630359207653,
"Parent Entity": "Entity_[305822185575]"
},
"Component_[5892125564582966187]": {
"$type": "EditorVisibilityComponent",
"Id": 5892125564582966187
},
"Component_[597602776660257245]": {
"$type": "EditorOnlyEntityComponent",
"Id": 597602776660257245
},
"Component_[8238652007701465495]": {
"$type": "EditorDisabledCompositionComponent",
"Id": 8238652007701465495
}
}
},
"Entity_[318707087463]": {
"Id": "Entity_[318707087463]",
"Name": "BBA1A5494C73578894BF0692CDA5FC33",
"Components": {
"Component_[10222455787643359341]": {
"$type": "EditorPendingCompositionComponent",
"Id": 10222455787643359341
},
"Component_[11487845392038268864]": {
"$type": "SelectionComponent",
"Id": 11487845392038268864
},
"Component_[12135534290310046764]": {
"$type": "EditorVisibilityComponent",
"Id": 12135534290310046764
},
"Component_[14412623226519978498]": {
"$type": "EditorOnlyEntityComponent",
"Id": 14412623226519978498
},
"Component_[14516371382857751872]": {
"$type": "EditorEntityIconComponent",
"Id": 14516371382857751872
},
"Component_[16011611743122468576]": {
"$type": "EditorInspectorComponent",
"Id": 16011611743122468576,
"ComponentOrderEntryArray": [
{
"ComponentId": 4157328932578509254
},
{
"ComponentId": 8524796860605854850,
"SortIndex": 1
}
]
},
"Component_[3813931698067937301]": {
"$type": "EditorEntitySortComponent",
"Id": 3813931698067937301
},
"Component_[4157328932578509254]": {
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
"Id": 4157328932578509254,
"Parent Entity": "Entity_[305822185575]"
},
"Component_[8524796860605854850]": {
"$type": "EditorCommentComponent",
"Id": 8524796860605854850,
"Configuration": "UUID that matches an existing dependency of this asset (lumbertank_body.cgf)"
},
"Component_[8660819596448699427]": {
"$type": "EditorLockComponent",
"Id": 8660819596448699427
},
"Component_[8768262795169819026]": {
"$type": "EditorDisabledCompositionComponent",
"Id": 8768262795169819026
}
}
},
"Entity_[323002054759]": {
"Id": "Entity_[323002054759]",
"Name": "Materials/am_rockground.mtl",
"Components": {
"Component_[13459503224133892836]": {
"$type": "EditorEntityIconComponent",
"Id": 13459503224133892836
},
"Component_[1346698328271204385]": {
"$type": "EditorVisibilityComponent",
"Id": 1346698328271204385
},
"Component_[13662830241397426219]": {
"$type": "SelectionComponent",
"Id": 13662830241397426219
},
"Component_[14169735046939083706]": {
"$type": "EditorInspectorComponent",
"Id": 14169735046939083706,
"ComponentOrderEntryArray": [
{
"ComponentId": 833157791612452820
},
{
"ComponentId": 3573928838741352115,
"SortIndex": 1
}
]
},
"Component_[16049700338512950477]": {
"$type": "EditorDisabledCompositionComponent",
"Id": 16049700338512950477
},
"Component_[16191253524853449302]": {
"$type": "EditorOnlyEntityComponent",
"Id": 16191253524853449302
},
"Component_[1737139665005484521]": {
"$type": "EditorPendingCompositionComponent",
"Id": 1737139665005484521
},
"Component_[17562284119637289685]": {
"$type": "EditorEntitySortComponent",
"Id": 17562284119637289685
},
"Component_[3573928838741352115]": {
"$type": "EditorCommentComponent",
"Id": 3573928838741352115,
"Configuration": "Relative source path that matches an existing dependency of this asset"
},
"Component_[485401015869338526]": {
"$type": "EditorLockComponent",
"Id": 485401015869338526
},
"Component_[833157791612452820]": {
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
"Id": 833157791612452820,
"Parent Entity": "Entity_[305822185575]"
}
}
},
"Entity_[327297022055]": {
"Id": "Entity_[327297022055]",
"Name": "Config/Game.xml",
"Components": {
"Component_[11848260632907964142]": {
"$type": "EditorInspectorComponent",
"Id": 11848260632907964142,
"ComponentOrderEntryArray": [
{
"ComponentId": 497869813123895830
},
{
"ComponentId": 5248857300320701553,
"SortIndex": 1
}
]
},
"Component_[12842864953492512672]": {
"$type": "EditorEntitySortComponent",
"Id": 12842864953492512672
},
"Component_[16656501539883791157]": {
"$type": "EditorLockComponent",
"Id": 16656501539883791157
},
"Component_[17365661125603122123]": {
"$type": "EditorEntityIconComponent",
"Id": 17365661125603122123
},
"Component_[2967487135389707052]": {
"$type": "EditorDisabledCompositionComponent",
"Id": 2967487135389707052
},
"Component_[3356294263684362888]": {
"$type": "EditorOnlyEntityComponent",
"Id": 3356294263684362888
},
"Component_[497869813123895830]": {
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
"Id": 497869813123895830,
"Parent Entity": "Entity_[305822185575]"
},
"Component_[5248857300320701553]": {
"$type": "EditorCommentComponent",
"Id": 5248857300320701553,
"Configuration": "Valid path that does not match an existing dependency of this asset. Should report as a missing dependency"
},
"Component_[746309483212393367]": {
"$type": "SelectionComponent",
"Id": 746309483212393367
},
"Component_[8319831469290771470]": {
"$type": "EditorPendingCompositionComponent",
"Id": 8319831469290771470
},
"Component_[9369067377618608622]": {
"$type": "EditorVisibilityComponent",
"Id": 9369067377618608622
}
}
},
"Entity_[331591989351]": {
"Id": "Entity_[331591989351]",
"Name": "1151F14D38A65579888ABE3139882E68:[333]",
"Components": {
"Component_[104857639379046106]": {
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
"Id": 104857639379046106,
"Parent Entity": "Entity_[305822185575]"
},
"Component_[1061601983221247493]": {
"$type": "EditorLockComponent",
"Id": 1061601983221247493
},
"Component_[11028443253330664986]": {
"$type": "EditorVisibilityComponent",
"Id": 11028443253330664986
},
"Component_[13806275118632081006]": {
"$type": "EditorEntitySortComponent",
"Id": 13806275118632081006
},
"Component_[13922573109551604801]": {
"$type": "EditorEntityIconComponent",
"Id": 13922573109551604801
},
"Component_[17027032709917108335]": {
"$type": "EditorDisabledCompositionComponent",
"Id": 17027032709917108335
},
"Component_[17030988165269698825]": {
"$type": "EditorOnlyEntityComponent",
"Id": 17030988165269698825
},
"Component_[2294579021665535860]": {
"$type": "EditorPendingCompositionComponent",
"Id": 2294579021665535860
},
"Component_[5863078697041048226]": {
"$type": "EditorInspectorComponent",
"Id": 5863078697041048226,
"ComponentOrderEntryArray": [
{
"ComponentId": 104857639379046106
},
{
"ComponentId": 9466290982672370664,
"SortIndex": 1
}
]
},
"Component_[7608263859116142496]": {
"$type": "SelectionComponent",
"Id": 7608263859116142496
},
"Component_[9466290982672370664]": {
"$type": "EditorCommentComponent",
"Id": 9466290982672370664,
"Configuration": "Asset ID that does not exist (am_grass1.mtl UUID, no matching product ID)"
}
}
}
}
}
@@ -1,30 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "EditorDefs.h"
#include "AnimationBipedBoneNames.h"
namespace EditorAnimationBones::Biped
{
const char* Pelvis = "Bip01 Pelvis";
const char* Head = "Bip01 Head";
const char* Weapon = "weapon_bone";
const char* LeftEye = "eye_bone_left";
const char* RightEye = "eye_bone_right";
const char* Spine[5] = { "Bip01 Spine", "Bip01 Spine1", "Bip01 Spine2", "Bip01 Spine3", "Bip01 Spine4" };
const char* Neck[2] = { "Bip01 Neck", "Bip01 Neck1" };
const char* LeftHeel = "Bip01 L Heel";
const char* LeftToe[2] = { "Bip01 L Toe0", "Bip01 L Toe1" };
const char* RightHeel = "Bip01 R Heel";
const char* RightToe[2] = { "Bip01 R Toe0", "Bip01 R Toe1" };
} // namespace EditorAnimationBones::Biped
@@ -1,34 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#ifndef CRYINCLUDE_EDITOR_ANIMATION_ANIMATIONBIPEDBONENAMES_H
#define CRYINCLUDE_EDITOR_ANIMATION_ANIMATIONBIPEDBONENAMES_H
#pragma once
namespace EditorAnimationBones
{
namespace Biped
{
extern const char* Pelvis;
extern const char* Head;
extern const char* Weapon;
extern const char* Spine[5];
extern const char* Neck[2];
extern const char* LeftEye;
extern const char* RightEye;
extern const char* LeftHeel;
extern const char* RightHeel;
extern const char* LeftToe[2];
extern const char* RightToe[2];
}
}
#endif // CRYINCLUDE_EDITOR_ANIMATION_ANIMATIONBIPEDBONENAMES_H
-2
View File
@@ -297,8 +297,6 @@ set(FILES
Util/AffineParts.cpp
Objects/BaseObject.cpp
Objects/BaseObject.h
Animation/AnimationBipedBoneNames.cpp
Animation/AnimationBipedBoneNames.h
AnimationContext.cpp
AnimationContext.h
AzAssetBrowser/AzAssetBrowserRequestHandler.cpp
@@ -270,8 +270,6 @@ set(FILES
Physics/WindBus.h
Process/ProcessCommunicator.cpp
Process/ProcessCommunicator.h
Process/ProcessWatcher.cpp
Process/ProcessWatcher.h
Process/ProcessCommon_fwd.h
Process/ProcessCommunicator.h
Process/ProcessWatcher.cpp
@@ -83,4 +83,9 @@ namespace AzFramework
{
}
AZStd::string ProcessLauncher::ProcessLaunchInfo::GetCommandLineParametersAsString() const
{
return AZStd::string{};
}
} //namespace AzFramework
@@ -284,13 +284,14 @@ namespace O3DE::ProjectManager
{
currentButton = projectButtonIter.value();
currentButton->RestoreDefaultState();
m_projectsFlowLayout->addWidget(currentButton);
}
}
// Check whether project manager has successfully built the project
if (currentButton)
{
m_projectsFlowLayout->addWidget(currentButton);
bool projectBuiltSuccessfully = false;
SettingsInterface::Get()->GetProjectBuiltSuccessfully(projectBuiltSuccessfully, project);
@@ -341,6 +342,7 @@ namespace O3DE::ProjectManager
}
m_stack->setCurrentWidget(m_projectsContent);
m_projectsFlowLayout->update();
}
ProjectManagerScreen ProjectsScreen::GetScreenEnum()
@@ -399,7 +401,6 @@ namespace O3DE::ProjectManager
{
if (ProjectUtils::AddProjectDialog(this))
{
ResetProjectsContent();
emit ChangeScreenRequest(ProjectManagerScreen::Projects);
}
}
@@ -490,7 +491,6 @@ namespace O3DE::ProjectManager
// Open file dialog and choose location for copied project then register copy with O3DE
if (ProjectUtils::CopyProjectDialog(projectInfo.m_path, newProjectInfo, this))
{
ResetProjectsContent();
emit NotifyBuildProject(newProjectInfo);
emit ChangeScreenRequest(ProjectManagerScreen::Projects);
}
@@ -503,7 +503,6 @@ namespace O3DE::ProjectManager
// Unregister Project from O3DE and reload projects
if (ProjectUtils::UnregisterProject(projectPath))
{
ResetProjectsContent();
emit ChangeScreenRequest(ProjectManagerScreen::Projects);
}
}
@@ -10,6 +10,7 @@
#include <scenesrg.srgi>
#include <viewsrg.srgi>
#include <Atom/RPI/Math.azsli>
#include "Shadow.azsli"
#include "ShadowmapAtlasLib.azsli"
#include "BicubicPcfFilters.azsli"
@@ -25,6 +26,10 @@
enum class ShadowFilterMethod {None, Pcf, Esm, EsmPcf};
option ShadowFilterMethod o_directional_shadow_filtering_method = ShadowFilterMethod::None;
option bool o_directional_shadow_receiver_plane_bias_enable = true;
option bool o_blend_between_cascades_enable = false;
static const float CascadeBlendArea = 0.015f; // might be worth exposing this as a slider.
// DirectionalLightShadow calculates lit ratio for a directional light.
class DirectionalLightShadow
@@ -98,6 +103,8 @@ class DirectionalLightShadow
float SamplePcfBicubic(float3 shadowCoord, uint indexOfCascade);
float CalculateCascadeBlendAmount(const float3 texCoord);
uint m_lightIndex;
float3 m_shadowCoords[ViewSrg::MaxCascadeCount];
float m_slopeBias[ViewSrg::MaxCascadeCount];
@@ -174,6 +181,7 @@ bool2 DirectionalLightShadow::IsShadowed(float3 shadowCoord, uint indexOfCascade
const uint cascadeCount = ViewSrg::m_directionalLightShadows[m_lightIndex].m_cascadeCount;
Texture2DArray<float> shadowmap = PassSrg::m_directionalLightShadowmap;
[branch]
if (shadowCoord.x >= 0. && shadowCoord.x * size < size - PixelMargin &&
shadowCoord.y >= 0. && shadowCoord.y * size < size - PixelMargin)
{
@@ -213,20 +221,46 @@ float DirectionalLightShadow::GetVisibilityFromLightPcf()
static const float PixelMargin = 1.5; // avoiding artifact between cascade levels.
static const float DepthMargin = 1e-8; // avoiding artifact when near depth bounds.
bool cascadeFound = false;
int currentCascadeIndex = 0;
const uint size = ViewSrg::m_directionalLightShadows[m_lightIndex].m_shadowmapSize;
const uint cascadeCount = ViewSrg::m_directionalLightShadows[m_lightIndex].m_cascadeCount;
for (uint indexOfCascade = 0; indexOfCascade < cascadeCount; ++indexOfCascade)
{
const float3 shadowCoord = m_shadowCoords[indexOfCascade];
if (shadowCoord.x >= 0. && shadowCoord.x * size < size - PixelMargin &&
shadowCoord.y >= 0. && shadowCoord.y * size < size - PixelMargin &&
shadowCoord.z < 1. - DepthMargin)
{
m_debugInfo.m_cascadeIndex = indexOfCascade;
return SamplePcfBicubic(shadowCoord, indexOfCascade);
currentCascadeIndex = m_debugInfo.m_cascadeIndex = indexOfCascade;
cascadeFound = true;
break;
}
}
[branch]
if (cascadeFound)
{
float lit = SamplePcfBicubic(m_shadowCoords[currentCascadeIndex], currentCascadeIndex);
if(o_blend_between_cascades_enable)
{
const float blendBetweenCascadesAmount = CalculateCascadeBlendAmount(m_shadowCoords[currentCascadeIndex].xyz);
const int nextCascadeIndex = currentCascadeIndex + 1;
[branch]
if (blendBetweenCascadesAmount < 1.0f && nextCascadeIndex < cascadeCount)
{
const float nextLit = SamplePcfBicubic(m_shadowCoords[nextCascadeIndex], nextCascadeIndex);
lit = lerp(nextLit, lit, blendBetweenCascadesAmount);
}
}
return lit;
}
m_debugInfo.m_cascadeIndex = cascadeCount;
return 1.;
}
@@ -244,6 +278,8 @@ float DirectionalLightShadow::GetVisibilityFromLightEsm()
const float distanceMin = ViewSrg::m_esmsDirectional[indexOfCascade].m_lightDistanceOfCameraViewFrustum;
bool2 checkedShadowed = IsShadowed(shadowCoord, indexOfCascade);
const float depthDiff = shadowCoord.z - distanceMin;
[branch]
if (checkedShadowed.x && depthDiff >= 0)
{
const float distanceWithinCameraView = depthDiff / (1. - distanceMin);
@@ -274,6 +310,8 @@ float DirectionalLightShadow::GetVisibilityFromLightEsmPcf()
const float distanceMin = ViewSrg::m_esmsDirectional[indexOfCascade].m_lightDistanceOfCameraViewFrustum;
bool2 checkedShadowed = IsShadowed(shadowCoord, indexOfCascade);
const float depthDiff = shadowCoord.z - distanceMin;
[branch]
if (checkedShadowed.x && depthDiff >= 0)
{
const float distanceWithinCameraView = depthDiff / (1. - distanceMin);
@@ -319,6 +357,7 @@ float DirectionalLightShadow::SamplePcfBicubic(float3 shadowCoord, uint indexOfC
param.samplerState = SceneSrg::m_hwPcfSampler;
param.receiverPlaneDepthBias = o_directional_shadow_receiver_plane_bias_enable ? ComputeReceiverPlaneDepthBias(m_shadowPosDX[indexOfCascade], m_shadowPosDY[indexOfCascade]) : 0;
[branch]
if (filteringSampleCount <= 4)
{
return SampleShadowMapBicubic_4Tap(param);
@@ -420,3 +459,10 @@ float3 DirectionalLightShadow::AddDebugColoring(
}
return color;
}
float DirectionalLightShadow::CalculateCascadeBlendAmount(const float3 texCoord)
{
const float distanceToOneMin = min3(1.0f - texCoord);
const float currentPixelsBlendBandLocation = min(min(texCoord.x, texCoord.y), distanceToOneMin);
return currentPixelsBlendBandLocation / CascadeBlendArea;
}
@@ -368,16 +368,19 @@ void CullDecals(uint groupIndex, TileLightData tileLightData, float3 aabb_center
float3 decalPosition = WorldToView_Point(decal.m_position);
// just wrapping a bounding sphere around a cube for now to get a minor perf boost. i.e. the sphere radius is sqrt(x*x + y*y + z*z)
// ATOM-4224 - try AABB-AABB and implement depth binning for the decals
float maxHalfSize = max(max(decal.m_halfSize.x, decal.m_halfSize.y), decal.m_halfSize.z);
float boundingSphereRadiusSqr = maxHalfSize * maxHalfSize * 3;
// ATOM-4224 - try AABB-AABB
float boundingSphereRadiusSqr = dot(decal.m_halfSize, decal.m_halfSize);
bool potentiallyIntersects = TestSphereVsAabb(decalPosition, boundingSphereRadiusSqr, aabb_center, aabb_extents);
if (potentiallyIntersects)
{
// Implement and profile fine-grained light culling testing
// ATOM-3732
MarkLightAsVisibleInSharedMemory(decalIndex, 0xFFFF);
uint inside = 0;
float2 minmax = ComputePointLightMinMaxZ(sqrt(boundingSphereRadiusSqr), decalPosition);
if (IsObjectInsideTile(tileLightData, minmax, inside))
{
MarkLightAsVisibleInSharedMemory(decalIndex, inside);
}
}
}
}
@@ -163,6 +163,9 @@ namespace AZ
//! Reduces acne by biasing the shadowmap lookup along the geometric normal.
virtual void SetNormalShadowBias(LightHandle handle, float normalShadowBias) = 0;
//! Sets whether or not blending between shadow map cascades is enabled.
virtual void SetCascadeBlendingEnabled(LightHandle handle, bool enable) = 0;
};
} // namespace Render
} // namespace AZ
@@ -198,13 +198,15 @@ namespace AZ
if (m_shadowingLightHandle.IsValid())
{
uint32_t shadowFilterMethod = m_shadowData.at(nullptr).GetData(m_shadowingLightHandle.GetIndex()).m_shadowFilterMethod;
const uint32_t shadowFilterMethod = m_shadowData.at(nullptr).GetData(m_shadowingLightHandle.GetIndex()).m_shadowFilterMethod;
RPI::ShaderSystemInterface::Get()->SetGlobalShaderOption(m_directionalShadowFilteringMethodName, AZ::RPI::ShaderOptionValue{shadowFilterMethod});
RPI::ShaderSystemInterface::Get()->SetGlobalShaderOption(m_directionalShadowReceiverPlaneBiasEnableName, AZ::RPI::ShaderOptionValue{ m_shadowProperties.GetData(m_shadowingLightHandle.GetIndex()).m_isReceiverPlaneBiasEnabled });
RPI::ShaderSystemInterface::Get()->SetGlobalShaderOption(m_directionalShadowReceiverPlaneBiasEnableName, AZ::RPI::ShaderOptionValue{ m_shadowProperties.GetData(m_shadowingLightHandle.GetIndex()).m_isReceiverPlaneBiasEnabled });
const uint32_t cascadeCount = m_shadowData.at(nullptr).GetData(m_shadowingLightHandle.GetIndex()).m_cascadeCount;
ShadowProperty& property = m_shadowProperties.GetData(m_shadowingLightHandle.GetIndex());
RPI::ShaderSystemInterface::Get()->SetGlobalShaderOption(m_BlendBetweenCascadesEnableName, AZ::RPI::ShaderOptionValue{cascadeCount > 1 && m_shadowProperties.GetData(m_shadowingLightHandle.GetIndex()).m_blendBetwenCascades });
ShadowProperty& property = m_shadowProperties.GetData(m_shadowingLightHandle.GetIndex());
bool segmentsNeedUpdate = property.m_segments.empty();
for (const auto& passIt : m_cascadedShadowmapsPasses)
{
@@ -577,6 +579,11 @@ namespace AZ
m_shadowProperties.GetData(handle.GetIndex()).m_isReceiverPlaneBiasEnabled = enable;
}
void DirectionalLightFeatureProcessor::SetCascadeBlendingEnabled(LightHandle handle, bool enable)
{
m_shadowProperties.GetData(handle.GetIndex()).m_blendBetwenCascades = enable;
}
void DirectionalLightFeatureProcessor::SetShadowBias(LightHandle handle, float bias)
{
for (auto& it : m_shadowData)
@@ -176,6 +176,8 @@ namespace AZ
// If true, this will reduce the shadow acne introduced by large pcf kernels by estimating the angle of the triangle being shaded
// with the ddx/ddy functions.
bool m_isReceiverPlaneBiasEnabled = true;
bool m_blendBetwenCascades = false;
};
static void Reflect(ReflectContext* context);
@@ -215,6 +217,7 @@ namespace AZ
void SetShadowFilterMethod(LightHandle handle, ShadowFilterMethod method) override;
void SetFilteringSampleCount(LightHandle handle, uint16_t count) override;
void SetShadowReceiverPlaneBiasEnabled(LightHandle handle, bool enable) override;
void SetCascadeBlendingEnabled(LightHandle handle, bool enable) override;
void SetShadowBias(LightHandle handle, float bias) override;
void SetNormalShadowBias(LightHandle handle, float normalShadowBias) override;
@@ -367,6 +370,7 @@ namespace AZ
Name m_lightTypeName = Name("directional");
Name m_directionalShadowFilteringMethodName = Name("o_directional_shadow_filtering_method");
Name m_directionalShadowReceiverPlaneBiasEnableName = Name("o_directional_shadow_receiver_plane_bias_enable");
Name m_BlendBetweenCascadesEnableName = Name("o_blend_between_cascades_enable");
static constexpr const char* FeatureProcessorName = "DirectionalLightFeatureProcessor";
};
} // namespace Render
@@ -9,6 +9,7 @@
#include <AzCore/Debug/Profiler.h>
#include <AzCore/Casting/numeric_cast.h>
#include <AzCore/Debug/Profiler.h>
#include <AzCore/std/string/string.h>
#include <AzCore/std/string/conversions.h>
@@ -184,6 +184,14 @@ namespace AZ
//! Reduces acne by biasing the shadowmap lookup along the geometric normal.
//! @param normalShadowBias Sets the amount of normal shadow bias to apply.
virtual void SetNormalShadowBias(float normalShadowBias) = 0;
//! Gets whether the directional shadow map has cascade blending enabled.
//! This smooths out the border between cascades at the cost of some performance in the blend area.
virtual bool GetCascadeBlendingEnabled() const = 0;
//! Sets whether the directional shadow map has cascade blending enabled.
//! @param enable flag specifying whether to enable cascade blending.
virtual void SetCascadeBlendingEnabled(bool enable) = 0;
};
using DirectionalLightRequestBus = EBus<DirectionalLightRequests>;
@@ -115,6 +115,9 @@ namespace AZ
//! Reduces shadow acne by applying a small amount of offset along shadow-space z.
float m_shadowBias = 0.0f;
// If true, sample between two adjacent shadow map cascades in a small boundary area to smooth out the transition.
bool m_cascadeBlendingEnabled = false;
bool IsSplitManual() const;
bool IsSplitAutomatic() const;
bool IsCascadeCorrectionDisabled() const;
@@ -40,7 +40,8 @@ namespace AZ
->Field("PcfFilteringSampleCount", &DirectionalLightComponentConfig::m_filteringSampleCount)
->Field("ShadowReceiverPlaneBiasEnabled", &DirectionalLightComponentConfig::m_receiverPlaneBiasEnabled)
->Field("Shadow Bias", &DirectionalLightComponentConfig::m_shadowBias)
->Field("Normal Shadow Bias", &DirectionalLightComponentConfig::m_normalShadowBias);
->Field("Normal Shadow Bias", &DirectionalLightComponentConfig::m_normalShadowBias)
->Field("CascadeBlendingEnabled", &DirectionalLightComponentConfig::m_cascadeBlendingEnabled);
}
}
@@ -113,8 +114,7 @@ namespace AZ
bool DirectionalLightComponentConfig::IsShadowPcfDisabled() const
{
return !(m_shadowFilterMethod == ShadowFilterMethod::Pcf ||
m_shadowFilterMethod == ShadowFilterMethod::EsmPcf);
return !(m_shadowFilterMethod == ShadowFilterMethod::Pcf);
}
bool DirectionalLightComponentConfig::IsEsmDisabled() const
@@ -88,6 +88,8 @@ namespace AZ
->Event("SetShadowBias", &DirectionalLightRequestBus::Events::SetShadowBias)
->Event("GetNormalShadowBias", &DirectionalLightRequestBus::Events::GetNormalShadowBias)
->Event("SetNormalShadowBias", &DirectionalLightRequestBus::Events::SetNormalShadowBias)
->Event("GetCascadeBlendingEnabled", &DirectionalLightRequestBus::Events::GetCascadeBlendingEnabled)
->Event("SetCascadeBlendingEnabled", &DirectionalLightRequestBus::Events::SetCascadeBlendingEnabled)
->VirtualProperty("Color", "GetColor", "SetColor")
->VirtualProperty("Intensity", "GetIntensity", "SetIntensity")
->VirtualProperty("AngularDiameter", "GetAngularDiameter", "SetAngularDiameter")
@@ -104,7 +106,8 @@ namespace AZ
->VirtualProperty("FilteringSampleCount", "GetFilteringSampleCount", "SetFilteringSampleCount")
->VirtualProperty("ShadowReceiverPlaneBiasEnabled", "GetShadowReceiverPlaneBiasEnabled", "SetShadowReceiverPlaneBiasEnabled")
->VirtualProperty("ShadowBias", "GetShadowBias", "SetShadowBias")
->VirtualProperty("NormalShadowBias", "GetNormalShadowBias", "SetNormalShadowBias");
->VirtualProperty("NormalShadowBias", "GetNormalShadowBias", "SetNormalShadowBias")
->VirtualProperty("BlendBetweenCascadesEnabled", "GetCascadeBlendingEnabled", "SetCascadeBlendingEnabled");
;
}
}
@@ -537,6 +540,7 @@ namespace AZ
SetNormalShadowBias(m_configuration.m_normalShadowBias);
SetFilteringSampleCount(m_configuration.m_filteringSampleCount);
SetShadowReceiverPlaneBiasEnabled(m_configuration.m_receiverPlaneBiasEnabled);
SetCascadeBlendingEnabled(m_configuration.m_cascadeBlendingEnabled);
// [GFX TODO][ATOM-1726] share config for multiple light (e.g., light ID).
// [GFX TODO][ATOM-2416] adapt to multiple viewports.
@@ -636,5 +640,16 @@ namespace AZ
m_featureProcessor->SetShadowReceiverPlaneBiasEnabled(m_lightHandle, enable);
}
bool DirectionalLightComponentController::GetCascadeBlendingEnabled() const
{
return m_configuration.m_cascadeBlendingEnabled;
}
void DirectionalLightComponentController::SetCascadeBlendingEnabled(bool enable)
{
m_configuration.m_cascadeBlendingEnabled = enable;
m_featureProcessor->SetCascadeBlendingEnabled(m_lightHandle, enable);
}
} // namespace Render
} // namespace AZ
@@ -83,7 +83,9 @@ namespace AZ
float GetShadowBias() const override;
void SetShadowBias(float bias) override;
float GetNormalShadowBias() const override;
void SetNormalShadowBias(float bias) override;
void SetNormalShadowBias(float bias) override;
bool GetCascadeBlendingEnabled() const override;
void SetCascadeBlendingEnabled(bool enable) override;
private:
friend class EditorDirectionalLightComponent;
@@ -161,7 +161,11 @@ namespace AZ
->Attribute(Edit::Attributes::Min, 0.f)
->Attribute(Edit::Attributes::Max, 10.0f)
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
;
->DataElement(
Edit::UIHandlers::CheckBox, &DirectionalLightComponentConfig::m_cascadeBlendingEnabled,
"Blend between cascades\n", "Enables smooth blending between shadow map cascades.")
->Attribute(Edit::Attributes::ReadOnly, &DirectionalLightComponentConfig::IsShadowPcfDisabled)
;
}
}
@@ -688,7 +688,7 @@ namespace MCommon
const AZ::Vector3 nodeWorldPos = pose->GetWorldSpaceTransform(jointIndex).m_position;
const AZ::Vector3 parentWorldPos = pose->GetWorldSpaceTransform(parentIndex).m_position;
const AZ::Vector3 bone = parentWorldPos - nodeWorldPos;
const AZ::Vector3 boneDirection = MCore::SafeNormalize(bone);
const AZ::Vector3 boneDirection = bone.GetNormalizedSafe();
const float boneLength = MCore::SafeLength(bone);
const float boneScale = GetBoneScale(actorInstance, joint);
const float parentBoneScale = GetBoneScale(actorInstance, skeleton->GetNode(parentIndex));
@@ -258,9 +258,9 @@ namespace EMotionFX
// Calculate the matrix to rotate the solve plane.
void BlendTreeFootIKNode::CalculateMatrix(const AZ::Vector3& goal, const AZ::Vector3& bendDir, AZ::Matrix3x3* outForward)
{
const AZ::Vector3 x = MCore::SafeNormalize(goal);
const AZ::Vector3 x = goal.GetNormalizedSafe();
const float dot = bendDir.Dot(x);
const AZ::Vector3 y = MCore::SafeNormalize(bendDir - (dot * x));
const AZ::Vector3 y = (bendDir - (dot * x)).GetNormalizedSafe();
const AZ::Vector3 z = x.Cross(y);
outForward->SetRow(0, x);
outForward->SetRow(1, y);
@@ -189,11 +189,11 @@ namespace EMotionFX
void BlendTreeTwoLinkIKNode::CalculateMatrix(const AZ::Vector3& goal, const AZ::Vector3& bendDir, AZ::Matrix3x3* outForward)
{
// the inverse matrix defines a coordinate system whose x axis contains P, so X = unit(P).
const AZ::Vector3 x = MCore::SafeNormalize(goal);
const AZ::Vector3 x = goal.GetNormalizedSafe();
// the y axis of the inverse is perpendicular to P, so Y = unit( D - X(D . X) ).
const float dot = bendDir.Dot(x);
const AZ::Vector3 y = MCore::SafeNormalize(bendDir - (dot * x));
const AZ::Vector3 y = (bendDir - (dot * x)).GetNormalizedSafe();
// the z axis of the inverse is perpendicular to both X and Y, so Z = X x Y.
const AZ::Vector3 z = x.Cross(y);
@@ -372,11 +372,11 @@ namespace EMotionFX
if (m_relativeBendDir && !m_extractBendDir)
{
bendDir = actorInstance->GetWorldSpaceTransform().m_rotation.TransformVector(bendDir);
bendDir = MCore::SafeNormalize(bendDir);
bendDir.NormalizeSafe();
}
else
{
bendDir = MCore::SafeNormalize(bendDir);
bendDir.NormalizeSafe();
}
// if end node rotation is enabled
@@ -470,8 +470,8 @@ namespace EMotionFX
// calculate the differences between the current forward vector and the new one after IK
AZ::Vector3 oldForward = globalTransformB.m_position - globalTransformA.m_position;
AZ::Vector3 newForward = midPos - globalTransformA.m_position;
oldForward = MCore::SafeNormalize(oldForward);
newForward = MCore::SafeNormalize(newForward);
oldForward.NormalizeSafe();
newForward.NormalizeSafe();
// perform a delta rotation to rotate into the new direction after IK
float dotProduct = oldForward.Dot(newForward);
@@ -499,9 +499,8 @@ namespace EMotionFX
oldForward = endEffectorNodePos - globalTransformB.m_position;
}
oldForward = MCore::SafeNormalize(oldForward);
newForward = goal - globalTransformB.m_position;
newForward = MCore::SafeNormalize(newForward);
oldForward.NormalizeSafe();
newForward = (goal - globalTransformB.m_position).GetNormalizedSafe();
// calculate the delta rotation
dotProduct = oldForward.Dot(newForward);
@@ -581,8 +581,8 @@ namespace EMotionFX
&curTangent, &curBitangent);
// normalize the vectors
curTangent = MCore::SafeNormalize(curTangent);
curBitangent = MCore::SafeNormalize(curBitangent);
curTangent.NormalizeSafe();
curBitangent.NormalizeSafe();
// store the tangents in the orgTangents array
const AZ::Vector4 vec4Tangent(curTangent.GetX(), curTangent.GetY(), curTangent.GetZ(), 1.0f);
@@ -605,7 +605,7 @@ namespace EMotionFX
{
// get the normal
AZ::Vector3 normal(normals[i]);
normal = MCore::SafeNormalize(normal);
normal.NormalizeSafe();
// get the tangent
AZ::Vector3 tangent = AZ::Vector3(orgTangents[i].GetX(), orgTangents[i].GetY(), orgTangents[i].GetZ());
@@ -631,7 +631,7 @@ namespace EMotionFX
// Gram-Schmidt orthogonalize
AZ::Vector3 fixedTangent = tangent - (normal * normal.Dot(tangent));
fixedTangent = MCore::SafeNormalize(fixedTangent);
fixedTangent.NormalizeSafe();
// calculate handedness
const AZ::Vector3 crossResult = normal.Cross(tangent);
@@ -1671,7 +1671,7 @@ namespace EMotionFX
const AZ::Vector3& posA = positions[ indexA ];
const AZ::Vector3& posB = positions[ indexB ];
const AZ::Vector3& posC = positions[ indexC ];
AZ::Vector3 faceNormal = MCore::SafeNormalize((posB - posA).Cross(posC - posB));
AZ::Vector3 faceNormal = (posB - posA).Cross(posC - posB).GetNormalizedSafe();
// store the tangents in the orgTangents array
smoothNormals[ orgVerts[indexA] ] += faceNormal;
@@ -1684,7 +1684,7 @@ namespace EMotionFX
// normalize
for (uint32 i = 0; i < m_numOrgVerts; ++i)
{
smoothNormals[i] = MCore::SafeNormalize(smoothNormals[i]);
smoothNormals[i].NormalizeSafe();
}
for (uint32 i = 0; i < m_numVertices; ++i)
@@ -1721,7 +1721,7 @@ namespace EMotionFX
const AZ::Vector3& posA = positions[ indexA ];
const AZ::Vector3& posB = positions[ indexB ];
const AZ::Vector3& posC = positions[ indexC ];
AZ::Vector3 faceNormal = MCore::SafeNormalize((posB - posA).Cross(posC - posB));
AZ::Vector3 faceNormal = (posB - posA).Cross(posC - posB).GetNormalizedSafe();
// store the tangents in the orgTangents array
normals[indexA] = normals[indexA] + faceNormal;
@@ -1734,7 +1734,7 @@ namespace EMotionFX
// normalize the normals
for (uint32 i = 0; i < m_numVertices; ++i)
{
normals[i] = MCore::SafeNormalize(normals[i]);
normals[i].NormalizeSafe();
}
}
}
@@ -0,0 +1,83 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <EMotionFX/Source/Velocity.h>
#include <AzCore/Math/MathUtils.h>
namespace EMotionFX
{
AZ::Vector3 CalculateLinearVelocity(const AZ::Vector3& lastPosition,
const AZ::Vector3& currentPosition,
float timeDelta)
{
if (timeDelta <= AZ::Constants::FloatEpsilon)
{
return AZ::Vector3::CreateZero();
}
const AZ::Vector3 deltaPosition = currentPosition - lastPosition;
const AZ::Vector3 velocity = deltaPosition / timeDelta;
if (velocity.GetLength() > AZ::Constants::FloatEpsilon)
{
return velocity;
}
return AZ::Vector3::CreateZero();
}
AZ::Vector3 CalculateAngularVelocity(const AZ::Quaternion& lastRotation,
const AZ::Quaternion& currentRotation,
float timeDelta)
{
if (timeDelta <= AZ::Constants::FloatEpsilon)
{
return AZ::Vector3::CreateZero();
}
const AZ::Quaternion deltaRotation = currentRotation * lastRotation.GetInverseFull();
const AZ::Quaternion shortestEquivalent = deltaRotation.GetShortestEquivalent().GetNormalized();
const AZ::Vector3 scaledAxisAngle = shortestEquivalent.ConvertToScaledAxisAngle();
const AZ::Vector3 angularVelocity = scaledAxisAngle / timeDelta;
if (angularVelocity.GetLength() > AZ::Constants::FloatEpsilon)
{
return angularVelocity;
}
return AZ::Vector3::CreateZero();
}
void DebugDrawVelocity(AzFramework::DebugDisplayRequests& debugDisplay,
const AZ::Vector3& position, const AZ::Vector3& velocity, const AZ::Color& color)
{
// Don't visualize joints that remain motionless (zero velocity).
if (velocity.GetLength() < AZ::Constants::FloatEpsilon)
{
return;
}
const float scale = 0.15f;
const AZ::Vector3 arrowPosition = position + velocity;
debugDisplay.DepthTestOff();
debugDisplay.SetColor(color);
debugDisplay.DrawSolidCylinder(/*center=*/(arrowPosition + position) * 0.5f,
/*direction=*/(arrowPosition - position).GetNormalizedSafe(),
/*radius=*/0.003f,
/*height=*/(arrowPosition - position).GetLength(),
/*drawShaded=*/false);
debugDisplay.DrawSolidCone(position + velocity,
velocity,
0.1f * scale,
scale * 0.5f,
/*drawShaded=*/false);
}
} // namespace EMotionFX
@@ -0,0 +1,23 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <AzCore/Math/Vector3.h>
#include <AzCore/Math/Quaternion.h>
#include <AzFramework/Entity/EntityDebugDisplayBus.h>
#include <EMotionFX/Source/EMotionFXConfig.h>
namespace EMotionFX
{
AZ::Vector3 EMFX_API CalculateLinearVelocity(const AZ::Vector3& lastPosition, const AZ::Vector3& currentPosition, float timeDelta);
AZ::Vector3 EMFX_API CalculateAngularVelocity(const AZ::Quaternion& lastRotation, const AZ::Quaternion& currentRotation, float timeDelta);
void EMFX_API DebugDrawVelocity(AzFramework::DebugDisplayRequests& debugDisplay,
const AZ::Vector3& position, const AZ::Vector3& velocity, const AZ::Color& color);
} // namespace EMotionFX
@@ -144,6 +144,8 @@ set(FILES
Source/TransformData.h
Source/TriggerActionSetup.cpp
Source/TriggerActionSetup.h
Source/Velocity.cpp
Source/Velocity.h
Source/VertexAttributeLayer.cpp
Source/VertexAttributeLayer.h
Source/VertexAttributeLayerAbstractData.cpp
@@ -17,12 +17,14 @@
namespace MCore
{
//! @deprecated Use AZ::Vector3::NormalizeSafeWithLength()
inline float SafeLength(const AZ::Vector3& rhs)
{
const float lenSq = rhs.Dot(rhs);
return (lenSq > FLT_EPSILON) ? sqrtf(lenSq) : 0.0f;
}
//! @deprecated Use AZ::Vector3::GetNormalizedSafe()
inline AZ::Vector3 SafeNormalize(const AZ::Vector3& rhs)
{
AZ::Vector3 result(0.0f);
@@ -43,6 +45,7 @@ namespace MCore
return AZ::Vector3(vec.GetX() - fac * n.GetX(), vec.GetY() - fac * n.GetY(), vec.GetZ() - fac * n.GetZ());
}
//! @deprecated Use AZ::Vector3::Project()
MCORE_INLINE AZ::Vector3 Projected(const AZ::Vector3& vec, const AZ::Vector3& projectOnto)
{
AZ::Vector3 result = projectOnto;
@@ -60,6 +63,7 @@ namespace MCore
(MCore::Math::Abs(val.GetX() - val.GetZ()) < MCore::Math::epsilon));
}
//! @deprecated Use AZ::Vector3::Lerp()
template <>
MCORE_INLINE AZ::Vector3 LinearInterpolate(const AZ::Vector3& source, const AZ::Vector3& target, float timeValue)
{
@@ -6,7 +6,7 @@
*
*/
#include "ConstantGradientComponent.h"
#include <GradientSignal/Components/ConstantGradientComponent.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/Serialization/SerializeContext.h>
@@ -6,7 +6,7 @@
*
*/
#include "DitherGradientComponent.h"
#include <GradientSignal/Components/DitherGradientComponent.h>
#include <AzCore/Debug/Profiler.h>
#include <AzCore/Math/MathUtils.h>
#include <AzCore/RTTI/BehaviorContext.h>
@@ -6,7 +6,7 @@
*
*/
#include "GradientSurfaceDataComponent.h"
#include <GradientSignal/Components/GradientSurfaceDataComponent.h>
#include <AzCore/Debug/Profiler.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/EditContext.h>
@@ -6,7 +6,7 @@
*
*/
#include "GradientTransformComponent.h"
#include <GradientSignal/Components/GradientTransformComponent.h>
#include <AzCore/Math/Vector2.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/EditContext.h>
@@ -6,7 +6,7 @@
*
*/
#include "ImageGradientComponent.h"
#include <GradientSignal/Components/ImageGradientComponent.h>
#include <AzCore/Asset/AssetManager.h>
#include <AzCore/Asset/AssetSerializer.h>
#include <AzCore/Debug/Profiler.h>
@@ -6,7 +6,7 @@
*
*/
#include "InvertGradientComponent.h"
#include <GradientSignal/Components/InvertGradientComponent.h>
#include <AzCore/Math/MathUtils.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/EditContext.h>
@@ -6,7 +6,7 @@
*
*/
#include "LevelsGradientComponent.h"
#include <GradientSignal/Components/LevelsGradientComponent.h>
#include <AzCore/Debug/Profiler.h>
#include <AzCore/Math/MathUtils.h>
#include <AzCore/RTTI/BehaviorContext.h>
@@ -6,7 +6,7 @@
*
*/
#include "MixedGradientComponent.h"
#include <GradientSignal/Components/MixedGradientComponent.h>
#include <AzCore/Debug/Profiler.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/EditContext.h>
@@ -6,7 +6,7 @@
*
*/
#include "PerlinGradientComponent.h"
#include <GradientSignal/Components/PerlinGradientComponent.h>
#include <AzCore/Debug/Profiler.h>
#include <AzCore/Jobs/Job.h>
#include <AzCore/Jobs/JobFunction.h>
@@ -6,7 +6,7 @@
*
*/
#include "PosterizeGradientComponent.h"
#include <GradientSignal/Components/PosterizeGradientComponent.h>
#include <AzCore/Math/MathUtils.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/EditContext.h>
@@ -6,7 +6,7 @@
*
*/
#include "RandomGradientComponent.h"
#include <GradientSignal/Components/RandomGradientComponent.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/Serialization/SerializeContext.h>
@@ -6,7 +6,7 @@
*
*/
#include "ReferenceGradientComponent.h"
#include <GradientSignal/Components/ReferenceGradientComponent.h>
#include <AzCore/Debug/Profiler.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/EditContext.h>
@@ -6,7 +6,7 @@
*
*/
#include "ShapeAreaFalloffGradientComponent.h"
#include <GradientSignal/Components/ShapeAreaFalloffGradientComponent.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/Serialization/SerializeContext.h>
@@ -6,7 +6,7 @@
*
*/
#include "SmoothStepGradientComponent.h"
#include <GradientSignal/Components/SmoothStepGradientComponent.h>
#include <AzCore/Component/Entity.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/EditContext.h>
@@ -6,7 +6,7 @@
*
*/
#include "SurfaceAltitudeGradientComponent.h"
#include <GradientSignal/Components/SurfaceAltitudeGradientComponent.h>
#include <AzCore/Component/Entity.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/EditContext.h>
@@ -6,7 +6,7 @@
*
*/
#include "SurfaceMaskGradientComponent.h"
#include <GradientSignal/Components/SurfaceMaskGradientComponent.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/Serialization/SerializeContext.h>
@@ -6,7 +6,7 @@
*
*/
#include "SurfaceSlopeGradientComponent.h"
#include <GradientSignal/Components/SurfaceSlopeGradientComponent.h>
#include <AzCore/Component/Entity.h>
#include <AzCore/Math/MathUtils.h>
#include <AzCore/RTTI/BehaviorContext.h>
@@ -6,7 +6,7 @@
*
*/
#include "ThresholdGradientComponent.h"
#include <GradientSignal/Components/ThresholdGradientComponent.h>
#include <AzCore/Math/MathUtils.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/EditContext.h>
@@ -9,7 +9,7 @@
#pragma once
#include <GradientSignal/Editor/EditorGradientComponentBase.h>
#include <Components/ConstantGradientComponent.h>
#include <GradientSignal/Components/ConstantGradientComponent.h>
namespace GradientSignal
{
@@ -9,7 +9,7 @@
#pragma once
#include <GradientSignal/Editor/EditorGradientComponentBase.h>
#include <Components/DitherGradientComponent.h>
#include <GradientSignal/Components/DitherGradientComponent.h>
namespace GradientSignal
{
@@ -8,7 +8,7 @@
#pragma once
#include <Components/GradientSurfaceDataComponent.h>
#include <GradientSignal/Components/GradientSurfaceDataComponent.h>
#include <AzFramework/Entity/EntityDebugDisplayBus.h>
#include <LmbrCentral/Component/EditorWrappedComponentBase.h>
@@ -8,7 +8,7 @@
#pragma once
#include <Components/GradientTransformComponent.h>
#include <GradientSignal/Components/GradientTransformComponent.h>
#include <LmbrCentral/Component/EditorWrappedComponentBase.h>
namespace GradientSignal
@@ -9,7 +9,7 @@
#pragma once
#include <GradientSignal/Editor/EditorGradientComponentBase.h>
#include <Components/ImageGradientComponent.h>
#include <GradientSignal/Components/ImageGradientComponent.h>
namespace GradientSignal
{
@@ -9,7 +9,7 @@
#pragma once
#include <GradientSignal/Editor/EditorGradientComponentBase.h>
#include <Components/InvertGradientComponent.h>
#include <GradientSignal/Components/InvertGradientComponent.h>
namespace GradientSignal
{
@@ -9,7 +9,7 @@
#pragma once
#include <GradientSignal/Editor/EditorGradientComponentBase.h>
#include <Components/LevelsGradientComponent.h>
#include <GradientSignal/Components/LevelsGradientComponent.h>
namespace GradientSignal
{
@@ -9,7 +9,7 @@
#pragma once
#include <GradientSignal/Editor/EditorGradientComponentBase.h>
#include <Components/MixedGradientComponent.h>
#include <GradientSignal/Components/MixedGradientComponent.h>
namespace GradientSignal
{
@@ -10,7 +10,7 @@
#include <AzCore/Module/Module.h>
#include <GradientSignal/Editor/EditorGradientComponentBase.h>
#include <Components/PerlinGradientComponent.h>
#include <GradientSignal/Components/PerlinGradientComponent.h>
namespace GradientSignal
{
@@ -9,7 +9,7 @@
#pragma once
#include <GradientSignal/Editor/EditorGradientComponentBase.h>
#include <Components/PosterizeGradientComponent.h>
#include <GradientSignal/Components/PosterizeGradientComponent.h>
namespace GradientSignal
{
@@ -12,7 +12,7 @@
#include <GradientSignal/Editor/EditorGradientComponentBase.h>
#include <GradientSignal/Editor/EditorGradientTypeIds.h>
#include <AzToolsFramework/ToolsComponents/EditorVisibilityBus.h>
#include <Components/RandomGradientComponent.h>
#include <GradientSignal/Components/RandomGradientComponent.h>
namespace GradientSignal
{
@@ -9,7 +9,7 @@
#pragma once
#include <GradientSignal/Editor/EditorGradientComponentBase.h>
#include <Components/ReferenceGradientComponent.h>
#include <GradientSignal/Components/ReferenceGradientComponent.h>
namespace GradientSignal
{
@@ -9,7 +9,7 @@
#pragma once
#include <GradientSignal/Editor/EditorGradientComponentBase.h>
#include <Components/ShapeAreaFalloffGradientComponent.h>
#include <GradientSignal/Components/ShapeAreaFalloffGradientComponent.h>
namespace GradientSignal
{
@@ -9,7 +9,7 @@
#pragma once
#include <GradientSignal/Editor/EditorGradientComponentBase.h>
#include <Components/SmoothStepGradientComponent.h>
#include <GradientSignal/Components/SmoothStepGradientComponent.h>
namespace GradientSignal
{
@@ -9,7 +9,7 @@
#pragma once
#include <GradientSignal/Editor/EditorGradientComponentBase.h>
#include <Components/SurfaceAltitudeGradientComponent.h>
#include <GradientSignal/Components/SurfaceAltitudeGradientComponent.h>
namespace GradientSignal
{
@@ -9,7 +9,7 @@
#pragma once
#include <GradientSignal/Editor/EditorGradientComponentBase.h>
#include <Components/SurfaceMaskGradientComponent.h>
#include <GradientSignal/Components/SurfaceMaskGradientComponent.h>
namespace GradientSignal
{
@@ -9,7 +9,7 @@
#pragma once
#include <GradientSignal/Editor/EditorGradientComponentBase.h>
#include <Components/SurfaceSlopeGradientComponent.h>
#include <GradientSignal/Components/SurfaceSlopeGradientComponent.h>
namespace GradientSignal
{
@@ -9,7 +9,7 @@
#pragma once
#include <GradientSignal/Editor/EditorGradientComponentBase.h>
#include <Components/ThresholdGradientComponent.h>
#include <GradientSignal/Components/ThresholdGradientComponent.h>
namespace GradientSignal
{
@@ -9,24 +9,24 @@
#include <GradientSignalModule.h>
#include <GradientSignalSystemComponent.h>
#include <Components/SmoothStepGradientComponent.h>
#include <Components/SurfaceAltitudeGradientComponent.h>
#include <Components/SurfaceSlopeGradientComponent.h>
#include <Components/MixedGradientComponent.h>
#include <Components/ImageGradientComponent.h>
#include <Components/ConstantGradientComponent.h>
#include <Components/ThresholdGradientComponent.h>
#include <Components/LevelsGradientComponent.h>
#include <Components/ReferenceGradientComponent.h>
#include <Components/InvertGradientComponent.h>
#include <Components/DitherGradientComponent.h>
#include <Components/PosterizeGradientComponent.h>
#include <Components/ShapeAreaFalloffGradientComponent.h>
#include <Components/PerlinGradientComponent.h>
#include <Components/RandomGradientComponent.h>
#include <Components/GradientTransformComponent.h>
#include <Components/SurfaceMaskGradientComponent.h>
#include <Components/GradientSurfaceDataComponent.h>
#include <GradientSignal/Components/SmoothStepGradientComponent.h>
#include <GradientSignal/Components/SurfaceAltitudeGradientComponent.h>
#include <GradientSignal/Components/SurfaceSlopeGradientComponent.h>
#include <GradientSignal/Components/MixedGradientComponent.h>
#include <GradientSignal/Components/ImageGradientComponent.h>
#include <GradientSignal/Components/ConstantGradientComponent.h>
#include <GradientSignal/Components/ThresholdGradientComponent.h>
#include <GradientSignal/Components/LevelsGradientComponent.h>
#include <GradientSignal/Components/ReferenceGradientComponent.h>
#include <GradientSignal/Components/InvertGradientComponent.h>
#include <GradientSignal/Components/DitherGradientComponent.h>
#include <GradientSignal/Components/PosterizeGradientComponent.h>
#include <GradientSignal/Components/ShapeAreaFalloffGradientComponent.h>
#include <GradientSignal/Components/PerlinGradientComponent.h>
#include <GradientSignal/Components/RandomGradientComponent.h>
#include <GradientSignal/Components/GradientTransformComponent.h>
#include <GradientSignal/Components/SurfaceMaskGradientComponent.h>
#include <GradientSignal/Components/GradientSurfaceDataComponent.h>
namespace GradientSignal
{
@@ -16,10 +16,10 @@
#include <AzCore/UnitTest/TestTypes.h>
#include <AzFramework/Asset/AssetCatalogBus.h>
#include <Source/Components/ImageGradientComponent.h>
#include <Source/Components/PerlinGradientComponent.h>
#include <Source/Components/RandomGradientComponent.h>
#include <Source/Components/GradientTransformComponent.h>
#include <GradientSignal/Components/ImageGradientComponent.h>
#include <GradientSignal/Components/PerlinGradientComponent.h>
#include <GradientSignal/Components/RandomGradientComponent.h>
#include <GradientSignal/Components/GradientTransformComponent.h>
namespace UnitTest
{
@@ -15,8 +15,8 @@
#include <AzCore/Math/Vector2.h>
#include <AzFramework/Asset/AssetCatalogBus.h>
#include <Source/Components/ImageGradientComponent.h>
#include <Source/Components/GradientTransformComponent.h>
#include <GradientSignal/Components/ImageGradientComponent.h>
#include <GradientSignal/Components/GradientTransformComponent.h>
namespace UnitTest
{
@@ -12,16 +12,16 @@
#include <AzCore/Math/MathUtils.h>
#include <Tests/GradientSignalTestFixtures.h>
#include <Source/Components/MixedGradientComponent.h>
#include <Source/Components/ReferenceGradientComponent.h>
#include <Source/Components/ShapeAreaFalloffGradientComponent.h>
#include <Source/Components/SurfaceAltitudeGradientComponent.h>
#include <Source/Components/SurfaceMaskGradientComponent.h>
#include <Source/Components/SurfaceSlopeGradientComponent.h>
#include <Source/Components/RandomGradientComponent.h>
#include <Source/Components/ConstantGradientComponent.h>
#include <Source/Components/DitherGradientComponent.h>
#include <Components/ImageGradientComponent.h>
#include <GradientSignal/Components/MixedGradientComponent.h>
#include <GradientSignal/Components/ReferenceGradientComponent.h>
#include <GradientSignal/Components/ShapeAreaFalloffGradientComponent.h>
#include <GradientSignal/Components/SurfaceAltitudeGradientComponent.h>
#include <GradientSignal/Components/SurfaceMaskGradientComponent.h>
#include <GradientSignal/Components/SurfaceSlopeGradientComponent.h>
#include <GradientSignal/Components/RandomGradientComponent.h>
#include <GradientSignal/Components/ConstantGradientComponent.h>
#include <GradientSignal/Components/DitherGradientComponent.h>
#include <GradientSignal/Components/ImageGradientComponent.h>
namespace UnitTest
{
@@ -10,9 +10,9 @@
#include <AzTest/AzTest.h>
#include <Source/Components/ConstantGradientComponent.h>
#include <Source/Components/DitherGradientComponent.h>
#include <Source/Components/InvertGradientComponent.h>
#include <GradientSignal/Components/ConstantGradientComponent.h>
#include <GradientSignal/Components/DitherGradientComponent.h>
#include <GradientSignal/Components/InvertGradientComponent.h>
namespace UnitTest
{
@@ -11,8 +11,8 @@
#include <AzCore/Math/MathUtils.h>
#include <Tests/GradientSignalTestFixtures.h>
#include <Source/Components/ConstantGradientComponent.h>
#include <Source/Components/GradientSurfaceDataComponent.h>
#include <GradientSignal/Components/ConstantGradientComponent.h>
#include <GradientSignal/Components/GradientSurfaceDataComponent.h>
namespace UnitTest
{
@@ -11,13 +11,13 @@
#include <GradientSignal/PerlinImprovedNoise.h>
#include <GradientSignal/Ebuses/GradientRequestBus.h>
#include <Source/Components/PerlinGradientComponent.h>
#include <Source/Components/RandomGradientComponent.h>
#include <Source/Components/LevelsGradientComponent.h>
#include <Source/Components/PosterizeGradientComponent.h>
#include <Source/Components/SmoothStepGradientComponent.h>
#include <Source/Components/ThresholdGradientComponent.h>
#include <Source/Components/GradientTransformComponent.h>
#include <GradientSignal/Components/PerlinGradientComponent.h>
#include <GradientSignal/Components/RandomGradientComponent.h>
#include <GradientSignal/Components/LevelsGradientComponent.h>
#include <GradientSignal/Components/PosterizeGradientComponent.h>
#include <GradientSignal/Components/SmoothStepGradientComponent.h>
#include <GradientSignal/Components/ThresholdGradientComponent.h>
#include <GradientSignal/Components/GradientTransformComponent.h>
namespace UnitTest
{
@@ -15,7 +15,7 @@
#include <AzCore/Math/Vector2.h>
#include <AZTestShared/Math/MathTestHelpers.h>
#include <Source/Components/GradientTransformComponent.h>
#include <GradientSignal/Components/GradientTransformComponent.h>
namespace UnitTest
{
@@ -15,6 +15,24 @@ set(FILES
Include/GradientSignal/PerlinImprovedNoise.h
Include/GradientSignal/Util.h
Include/GradientSignal/GradientImageConversion.h
Include/GradientSignal/Components/ConstantGradientComponent.h
Include/GradientSignal/Components/DitherGradientComponent.h
Include/GradientSignal/Components/GradientSurfaceDataComponent.h
Include/GradientSignal/Components/GradientTransformComponent.h
Include/GradientSignal/Components/ImageGradientComponent.h
Include/GradientSignal/Components/InvertGradientComponent.h
Include/GradientSignal/Components/LevelsGradientComponent.h
Include/GradientSignal/Components/MixedGradientComponent.h
Include/GradientSignal/Components/PerlinGradientComponent.h
Include/GradientSignal/Components/PosterizeGradientComponent.h
Include/GradientSignal/Components/RandomGradientComponent.h
Include/GradientSignal/Components/ReferenceGradientComponent.h
Include/GradientSignal/Components/ShapeAreaFalloffGradientComponent.h
Include/GradientSignal/Components/SmoothStepGradientComponent.h
Include/GradientSignal/Components/SurfaceAltitudeGradientComponent.h
Include/GradientSignal/Components/SurfaceMaskGradientComponent.h
Include/GradientSignal/Components/SurfaceSlopeGradientComponent.h
Include/GradientSignal/Components/ThresholdGradientComponent.h
Include/GradientSignal/Ebuses/GradientTransformRequestBus.h
Include/GradientSignal/Ebuses/GradientRequestBus.h
Include/GradientSignal/Ebuses/GradientPreviewRequestBus.h
@@ -40,41 +58,23 @@ set(FILES
Include/GradientSignal/Ebuses/GradientSurfaceDataRequestBus.h
Include/GradientSignal/Ebuses/SmoothStepRequestBus.h
Source/Components/ConstantGradientComponent.cpp
Source/Components/ConstantGradientComponent.h
Source/Components/DitherGradientComponent.cpp
Source/Components/DitherGradientComponent.h
Source/Components/GradientSurfaceDataComponent.cpp
Source/Components/GradientSurfaceDataComponent.h
Source/Components/GradientTransformComponent.cpp
Source/Components/GradientTransformComponent.h
Source/Components/ImageGradientComponent.cpp
Source/Components/ImageGradientComponent.h
Source/Components/InvertGradientComponent.cpp
Source/Components/InvertGradientComponent.h
Source/Components/LevelsGradientComponent.cpp
Source/Components/LevelsGradientComponent.h
Source/Components/MixedGradientComponent.cpp
Source/Components/MixedGradientComponent.h
Source/Components/PerlinGradientComponent.cpp
Source/Components/PerlinGradientComponent.h
Source/Components/PosterizeGradientComponent.cpp
Source/Components/PosterizeGradientComponent.h
Source/Components/RandomGradientComponent.cpp
Source/Components/RandomGradientComponent.h
Source/Components/ReferenceGradientComponent.cpp
Source/Components/ReferenceGradientComponent.h
Source/Components/ShapeAreaFalloffGradientComponent.cpp
Source/Components/ShapeAreaFalloffGradientComponent.h
Source/Components/SmoothStepGradientComponent.cpp
Source/Components/SmoothStepGradientComponent.h
Source/Components/SurfaceAltitudeGradientComponent.cpp
Source/Components/SurfaceAltitudeGradientComponent.h
Source/Components/SurfaceMaskGradientComponent.cpp
Source/Components/SurfaceMaskGradientComponent.h
Source/Components/SurfaceSlopeGradientComponent.cpp
Source/Components/SurfaceSlopeGradientComponent.h
Source/Components/ThresholdGradientComponent.cpp
Source/Components/ThresholdGradientComponent.h
Source/GradientSampler.cpp
Source/GradientSignalSystemComponent.cpp
Source/GradientSignalSystemComponent.h
+6
View File
@@ -159,6 +159,12 @@ namespace PhysX
AZStd::swap(m_entityTransformHandlers[index], m_entityTransformHandlers.back());
m_entityTransformHandlers.pop_back();
// When deleting entity from handler's m_entities, the AABB should be appended to m_pendingAabbUpdates
// for local wind handler to broadcast OnWindChanged to notify relative entities of wind changes in OnTick().
m_pendingAabbUpdates.push_back();
ColliderShapeRequestBus::EventResult(m_pendingAabbUpdates.back(),
entityId, &ColliderShapeRequestBus::Events::GetColliderShapeAabb);
m_changed = true;
}
}
+5
View File
@@ -119,6 +119,11 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
NAME Gem::Terrain.Tests
)
ly_add_googlebenchmark(
NAME Gem::Terrain.Benchmarks
TARGET Gem::Terrain.Tests
)
# If we are a host platform we want to add tools test like editor tests here
if(PAL_TRAIT_BUILD_HOST_TOOLS)
# We support Terrain.Editor.Tests on this platform, add Terrain.Editor.Tests target which depends on Terrain.Editor
@@ -32,6 +32,13 @@ namespace Terrain
AZ_RTTI(TerrainSurfaceGradientMapping, "{473AD2CE-F22A-45A9-803F-2192F3D9F2BF}");
static void Reflect(AZ::ReflectContext* context);
TerrainSurfaceGradientMapping() = default;
TerrainSurfaceGradientMapping(const AZ::EntityId& entityId, const SurfaceData::SurfaceTag& surfaceTag)
: m_gradientEntityId(entityId)
, m_surfaceTag(surfaceTag)
{
}
AZ::EntityId m_gradientEntityId;
SurfaceData::SurfaceTag m_surfaceTag;
};
@@ -0,0 +1,421 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#ifdef HAVE_BENCHMARK
#include <AzCore/Component/ComponentApplication.h>
#include <AzCore/Component/Entity.h>
#include <AzCore/Component/TransformBus.h>
#include <AzCore/Memory/PoolAllocator.h>
#include <AzCore/UnitTest/TestTypes.h>
#include <AzFramework/Components/TransformComponent.h>
#include <AzFramework/Terrain/TerrainDataRequestBus.h>
#include <AzTest/AzTest.h>
#include <GradientSignal/Components/RandomGradientComponent.h>
#include <GradientSignal/Components/GradientTransformComponent.h>
#include <GradientSignal/Ebuses/GradientRequestBus.h>
#include <SurfaceData/SurfaceDataTypes.h>
#include <LmbrCentral/Shape/ShapeComponentBus.h>
#include <MockAxisAlignedBoxShapeComponent.h>
#include <TerrainSystem/TerrainSystem.h>
#include <Components/TerrainLayerSpawnerComponent.h>
#include <Components/TerrainHeightGradientListComponent.h>
#include <Components/TerrainSurfaceGradientListComponent.h>
#include <benchmark/benchmark.h>
namespace UnitTest
{
using ::testing::NiceMock;
using ::testing::Return;
class TerrainSystemBenchmarkFixture
: public UnitTest::AllocatorsBenchmarkFixture
, public UnitTest::TraceBusRedirector
{
public:
void SetUp(const benchmark::State& state) override
{
InternalSetUp(state);
}
void SetUp(benchmark::State& state) override
{
InternalSetUp(state);
}
void TearDown(const benchmark::State& state) override
{
InternalTearDown(state);
}
void TearDown(benchmark::State& state) override
{
InternalTearDown(state);
}
void InternalSetUp(const benchmark::State& state)
{
AZ::Debug::TraceMessageBus::Handler::BusConnect();
UnitTest::AllocatorsBenchmarkFixture::SetUp(state);
m_app = AZStd::make_unique<AZ::ComponentApplication>();
ASSERT_TRUE(m_app != nullptr);
AZ::ComponentApplication::Descriptor componentAppDesc;
AZ::Entity* systemEntity = m_app->Create(componentAppDesc);
ASSERT_TRUE(systemEntity != nullptr);
m_app->AddEntity(systemEntity);
AZ::AllocatorInstance<AZ::ThreadPoolAllocator>::Create();
}
void InternalTearDown(const benchmark::State& state)
{
AZ::AllocatorInstance<AZ::ThreadPoolAllocator>::Destroy();
m_app->Destroy();
m_app.reset();
UnitTest::AllocatorsBenchmarkFixture::TearDown(state);
AZ::Debug::TraceMessageBus::Handler::BusDisconnect();
}
AZStd::unique_ptr<AZ::Entity> CreateEntity()
{
return AZStd::make_unique<AZ::Entity>();
}
void ActivateEntity(AZ::Entity* entity)
{
entity->Init();
entity->Activate();
}
template<typename Component, typename Configuration>
Component* CreateComponent(AZ::Entity* entity, const Configuration& config)
{
m_app->RegisterComponentDescriptor(Component::CreateDescriptor());
return entity->CreateComponent<Component>(config);
}
template<typename Component>
Component* CreateComponent(AZ::Entity* entity)
{
m_app->RegisterComponentDescriptor(Component::CreateDescriptor());
return entity->CreateComponent<Component>();
}
// Create a terrain system with reasonable defaults for testing, but with the ability to override the defaults
// on a test-by-test basis.
AZStd::unique_ptr<Terrain::TerrainSystem> CreateAndActivateTerrainSystem(
AZ::Vector2 queryResolution = AZ::Vector2(1.0f),
AZ::Aabb worldBounds = AZ::Aabb::CreateFromMinMax(AZ::Vector3(-128.0f), AZ::Vector3(128.0f)))
{
// Create the terrain system and give it one tick to fully initialize itself.
auto terrainSystem = AZStd::make_unique<Terrain::TerrainSystem>();
terrainSystem->SetTerrainAabb(worldBounds);
terrainSystem->SetTerrainHeightQueryResolution(queryResolution);
terrainSystem->Activate();
AZ::TickBus::Broadcast(&AZ::TickBus::Events::OnTick, 0.f, AZ::ScriptTimePoint{});
return terrainSystem;
}
// Create a mock shape bus listener that will listen to the given EntityId for shape requests and returns the following:
// - GetEncompassingAabb - returns the given Aabb
// - GetTransformAndLocalBounds - returns the center of the Aabb as the transform, and the size of the Aabb as the local bounds
// - IsPointInside - true if the point is in the Aabb, false if not
AZStd::unique_ptr<NiceMock<UnitTest::MockShapeComponentRequests>> CreateMockShape(
const AZ::Aabb& spawnerBox, const AZ::EntityId& shapeEntityId)
{
AZStd::unique_ptr<NiceMock<UnitTest::MockShapeComponentRequests>> mockShape =
AZStd::make_unique<NiceMock<UnitTest::MockShapeComponentRequests>>(shapeEntityId);
ON_CALL(*mockShape, GetEncompassingAabb).WillByDefault(Return(spawnerBox));
ON_CALL(*mockShape, GetTransformAndLocalBounds)
.WillByDefault(
[spawnerBox](AZ::Transform& transform, AZ::Aabb& bounds)
{
transform = AZ::Transform::CreateTranslation(spawnerBox.GetCenter());
bounds = spawnerBox.GetTranslated(-spawnerBox.GetCenter());
});
ON_CALL(*mockShape, IsPointInside)
.WillByDefault(
[spawnerBox](const AZ::Vector3& point) -> bool
{
return spawnerBox.Contains(point);
});
return mockShape;
}
// Create an entity with a Random Gradient on it that can be used for gradient queries.
AZStd::unique_ptr<AZ::Entity> CreateTestRandomGradientEntity(const AZ::Aabb& spawnerBox, uint32_t randomSeed)
{
// Create the base entity
AZStd::unique_ptr<AZ::Entity> testGradientEntity = CreateEntity();
// Add a mock AABB Shape so that the shape requirement is fulfilled.
CreateComponent<UnitTest::MockAxisAlignedBoxShapeComponent>(testGradientEntity.get());
// Create the Random Gradient Component with some default parameters.
GradientSignal::RandomGradientConfig config;
config.m_randomSeed = randomSeed;
CreateComponent<GradientSignal::RandomGradientComponent>(testGradientEntity.get(), config);
// Create the Gradient Transform Component with some default parameters.
GradientSignal::GradientTransformConfig gradientTransformConfig;
gradientTransformConfig.m_wrappingType = GradientSignal::WrappingType::None;
CreateComponent<GradientSignal::GradientTransformComponent>(testGradientEntity.get(), gradientTransformConfig);
// Set the transform to match the given spawnerBox
auto transform = CreateComponent<AzFramework::TransformComponent>(testGradientEntity.get());
transform->SetLocalTM(AZ::Transform::CreateTranslation(spawnerBox.GetCenter()));
transform->SetWorldTM(AZ::Transform::CreateTranslation(spawnerBox.GetCenter()));
return testGradientEntity;
}
AZStd::unique_ptr<AZ::Entity> CreateTestLayerSpawnerEntity(
const AZ::Aabb& spawnerBox, const AZ::EntityId& heightGradientEntityId,
const Terrain::TerrainSurfaceGradientListConfig& surfaceConfig)
{
// Create the base entity
AZStd::unique_ptr<AZ::Entity> testLayerSpawnerEntity = CreateEntity();
// Add a mock AABB Shape so that the shape requirement is fulfilled.
CreateComponent<UnitTest::MockAxisAlignedBoxShapeComponent>(testLayerSpawnerEntity.get());
// Add a Terrain Layer Spawner
CreateComponent<Terrain::TerrainLayerSpawnerComponent>(testLayerSpawnerEntity.get());
// Add a Terrain Height Gradient List with one entry pointing to the given gradient entity
Terrain::TerrainHeightGradientListConfig heightConfig;
heightConfig.m_gradientEntities.emplace_back(heightGradientEntityId);
CreateComponent<Terrain::TerrainHeightGradientListComponent>(testLayerSpawnerEntity.get(), heightConfig);
// Add a Terrain Surface Gradient List with however many entries we were given
CreateComponent<Terrain::TerrainSurfaceGradientListComponent>(testLayerSpawnerEntity.get(), surfaceConfig);
// Set the transform to match the given spawnerBox
auto transform = CreateComponent<AzFramework::TransformComponent>(testLayerSpawnerEntity.get());
transform->SetLocalTM(AZ::Transform::CreateTranslation(spawnerBox.GetCenter()));
transform->SetWorldTM(AZ::Transform::CreateTranslation(spawnerBox.GetCenter()));
return testLayerSpawnerEntity;
}
void RunTerrainApiBenchmark(
benchmark::State& state,
AZStd::function<void(
const AZ::Vector2& queryResolution,
const AZ::Aabb& worldBounds,
AzFramework::Terrain::TerrainDataRequests::Sampler sampler)> ApiCaller)
{
// Get the ranges for querying from our benchmark parameters
float boundsRange = aznumeric_cast<float>(state.range(0));
uint32_t numSurfaces = aznumeric_cast<uint32_t>(state.range(1));
AzFramework::Terrain::TerrainDataRequests::Sampler sampler =
static_cast<AzFramework::Terrain::TerrainDataRequests::Sampler>(state.range(2));
// Set up our world bounds and query resolution
AZ::Aabb worldBounds = AZ::Aabb::CreateFromMinMax(AZ::Vector3(-boundsRange / 2.0f), AZ::Vector3(boundsRange / 2.0f));
AZ::Vector2 queryResolution = AZ::Vector2(1.0f);
// Create a Random Gradient to use as our height provider
const uint32_t heightRandomSeed = 12345;
auto heightGradientEntity = CreateTestRandomGradientEntity(worldBounds, heightRandomSeed);
auto heightGradientShapeRequests = CreateMockShape(worldBounds, heightGradientEntity->GetId());
ActivateEntity(heightGradientEntity.get());
// Create a set of Random Gradients to use as our surface providers
Terrain::TerrainSurfaceGradientListConfig surfaceConfig;
AZStd::vector<AZStd::unique_ptr<AZ::Entity>> surfaceGradientEntities;
AZStd::vector<AZStd::unique_ptr<NiceMock<UnitTest::MockShapeComponentRequests>>> surfaceGradientShapeRequests;
for (uint32_t surfaces = 0; surfaces < numSurfaces; surfaces++)
{
const uint32_t surfaceRandomSeed = 23456 + surfaces;
auto surfaceGradientEntity = CreateTestRandomGradientEntity(worldBounds, surfaceRandomSeed);
auto shapeRequests = CreateMockShape(worldBounds, surfaceGradientEntity->GetId());
ActivateEntity(surfaceGradientEntity.get());
// Give each gradient a new surface tag
surfaceConfig.m_gradientSurfaceMappings.emplace_back(
surfaceGradientEntity->GetId(), SurfaceData::SurfaceTag(AZStd::string::format("test%u", surfaces)));
surfaceGradientEntities.emplace_back(AZStd::move(surfaceGradientEntity));
surfaceGradientShapeRequests.emplace_back(AZStd::move(shapeRequests));
}
// Create a single Terrain Layer Spawner that covers the entire terrain world bounds
// (Do this *after* creating and activating the height and surface gradients)
auto testLayerSpawnerEntity = CreateTestLayerSpawnerEntity(worldBounds, heightGradientEntity->GetId(), surfaceConfig);
auto spawnerShapeRequests = CreateMockShape(worldBounds, testLayerSpawnerEntity->GetId());
ActivateEntity(testLayerSpawnerEntity.get());
// Create the terrain system (do this after creating the terrain layer entity to ensure that we don't need any data refreshes)
auto terrainSystem = CreateAndActivateTerrainSystem(queryResolution, worldBounds);
// Call the terrain API we're testing for every height and width in our ranges.
for (auto stateIterator : state)
{
ApiCaller(queryResolution, worldBounds, sampler);
}
testLayerSpawnerEntity.reset();
spawnerShapeRequests.reset();
heightGradientEntity.reset();
heightGradientShapeRequests.reset();
surfaceGradientEntities.clear();
surfaceGradientShapeRequests.clear();
}
protected:
AZStd::unique_ptr<AZ::ComponentApplication> m_app;
};
BENCHMARK_DEFINE_F(TerrainSystemBenchmarkFixture, BM_GetHeight)(benchmark::State& state)
{
// Run the benchmark
RunTerrainApiBenchmark(
state,
[]([[maybe_unused]] const AZ::Vector2& queryResolution, const AZ::Aabb& worldBounds,
AzFramework::Terrain::TerrainDataRequests::Sampler sampler)
{
float worldMinZ = worldBounds.GetMin().GetZ();
for (float y = worldBounds.GetMin().GetY(); y < worldBounds.GetMax().GetY(); y += 1.0f)
{
for (float x = worldBounds.GetMin().GetX(); x < worldBounds.GetMax().GetX(); x += 1.0f)
{
float terrainHeight = worldMinZ;
bool terrainExists = false;
AzFramework::Terrain::TerrainDataRequestBus::BroadcastResult(
terrainHeight, &AzFramework::Terrain::TerrainDataRequests::GetHeightFromFloats, x, y, sampler, &terrainExists);
benchmark::DoNotOptimize(terrainHeight);
}
}
});
}
BENCHMARK_REGISTER_F(TerrainSystemBenchmarkFixture, BM_GetHeight)
->Args({ 1024, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::BILINEAR) })
->Args({ 2048, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::BILINEAR) })
->Args({ 4096, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::BILINEAR) })
->Args({ 1024, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::CLAMP) })
->Args({ 2048, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::CLAMP) })
->Args({ 4096, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::CLAMP) })
->Args({ 1024, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::EXACT) })
->Args({ 2048, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::EXACT) })
->Args({ 4096, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::EXACT) })
->Unit(::benchmark::kMillisecond);
BENCHMARK_DEFINE_F(TerrainSystemBenchmarkFixture, BM_GetNormal)(benchmark::State& state)
{
// Run the benchmark
RunTerrainApiBenchmark(
state,
[]([[maybe_unused]] const AZ::Vector2& queryResolution, const AZ::Aabb& worldBounds,
AzFramework::Terrain::TerrainDataRequests::Sampler sampler)
{
for (float y = worldBounds.GetMin().GetY(); y < worldBounds.GetMax().GetY(); y += 1.0f)
{
for (float x = worldBounds.GetMin().GetX(); x < worldBounds.GetMax().GetX(); x += 1.0f)
{
AZ::Vector3 terrainNormal;
bool terrainExists = false;
AzFramework::Terrain::TerrainDataRequestBus::BroadcastResult(
terrainNormal, &AzFramework::Terrain::TerrainDataRequests::GetNormalFromFloats, x, y, sampler, &terrainExists);
benchmark::DoNotOptimize(terrainNormal);
}
}
});
}
BENCHMARK_REGISTER_F(TerrainSystemBenchmarkFixture, BM_GetNormal)
->Args({ 1024, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::BILINEAR) })
->Args({ 2048, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::BILINEAR) })
->Args({ 1024, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::CLAMP) })
->Args({ 2048, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::CLAMP) })
->Args({ 1024, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::EXACT) })
->Args({ 2048, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::EXACT) })
->Unit(::benchmark::kMillisecond);
BENCHMARK_DEFINE_F(TerrainSystemBenchmarkFixture, BM_GetSurfaceWeights)(benchmark::State& state)
{
// Run the benchmark
RunTerrainApiBenchmark(
state,
[]([[maybe_unused]] const AZ::Vector2& queryResolution, const AZ::Aabb& worldBounds,
AzFramework::Terrain::TerrainDataRequests::Sampler sampler)
{
AzFramework::SurfaceData::SurfaceTagWeightList surfaceWeights;
for (float y = worldBounds.GetMin().GetY(); y < worldBounds.GetMax().GetY(); y += 1.0f)
{
for (float x = worldBounds.GetMin().GetX(); x < worldBounds.GetMax().GetX(); x += 1.0f)
{
bool terrainExists = false;
AzFramework::Terrain::TerrainDataRequestBus::Broadcast(
&AzFramework::Terrain::TerrainDataRequests::GetSurfaceWeightsFromFloats, x, y, surfaceWeights, sampler,
&terrainExists);
benchmark::DoNotOptimize(surfaceWeights);
}
}
});
}
BENCHMARK_REGISTER_F(TerrainSystemBenchmarkFixture, BM_GetSurfaceWeights)
->Args({ 1024, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::EXACT) })
->Args({ 2048, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::EXACT) })
->Args({ 1024, 2, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::EXACT) })
->Args({ 2048, 2, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::EXACT) })
->Args({ 1024, 4, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::EXACT) })
->Args({ 2048, 4, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::EXACT) })
->Unit(::benchmark::kMillisecond);
BENCHMARK_DEFINE_F(TerrainSystemBenchmarkFixture, BM_GetSurfacePoints)(benchmark::State& state)
{
// Run the benchmark
RunTerrainApiBenchmark(
state,
[]([[maybe_unused]] const AZ::Vector2& queryResolution, const AZ::Aabb& worldBounds,
AzFramework::Terrain::TerrainDataRequests::Sampler sampler)
{
AzFramework::SurfaceData::SurfacePoint surfacePoint;
for (float y = worldBounds.GetMin().GetY(); y < worldBounds.GetMax().GetY(); y += 1.0f)
{
for (float x = worldBounds.GetMin().GetX(); x < worldBounds.GetMax().GetX(); x += 1.0f)
{
bool terrainExists = false;
AzFramework::Terrain::TerrainDataRequestBus::Broadcast(
&AzFramework::Terrain::TerrainDataRequests::GetSurfacePointFromFloats, x, y, surfacePoint, sampler,
&terrainExists);
benchmark::DoNotOptimize(surfacePoint);
}
}
});
}
BENCHMARK_REGISTER_F(TerrainSystemBenchmarkFixture, BM_GetSurfacePoints)
->Args({ 1024, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::BILINEAR) })
->Args({ 2048, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::BILINEAR) })
->Args({ 1024, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::CLAMP) })
->Args({ 2048, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::CLAMP) })
->Args({ 1024, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::EXACT) })
->Args({ 2048, 1, static_cast<int>(AzFramework::Terrain::TerrainDataRequests::Sampler::EXACT) })
->Unit(::benchmark::kMillisecond);
#endif
}
@@ -16,4 +16,5 @@ set(FILES
Tests/TerrainHeightGradientListTests.cpp
Tests/TerrainMacroMaterialTests.cpp
Tests/TerrainSurfaceGradientListTests.cpp
Tests/TerrainSystemBenchmarks.cpp
)
+1 -1
View File
@@ -610,7 +610,7 @@ def CreateSingleNode(Map pipelineConfig, def platform, def build_job, Map envVar
CreateUploadAPLogsStage(platform.key, build_job_name, envVars['WORKSPACE'], platform.value.build_types[build_job_name].PARAMETERS).call()
}
// Upload test artifacts only on builds that failed and ran test suites
if (env.IS_UPLOAD_TEST_ARTIFACTS?.toBoolean() && params.containsKey('CMAKE_TARGET') && params.CMAKE_TARGET.contains("TEST_SUITE")) {
if (env.IS_UPLOAD_TEST_ARTIFACTS?.toBoolean() && params.containsKey('CTEST_OPTIONS')) {
CreateUploadTestArtifactStage(build_job_name, envVars['WORKSPACE'], params.OUTPUT_DIRECTORY).call()
}
// All other errors will be raised outside the retry block