Merge branch 'development' of https://github.com/o3de/o3de into cgalvan/DraftStreamingImageAssetPixelAPI
This commit is contained in:
+1
-1
@@ -127,7 +127,7 @@ def Collider_SameCollisionGroupSameCustomLayerCollide():
|
||||
# Main Script
|
||||
# 1) Load the level
|
||||
helper.init_idle()
|
||||
helper.open_level("physics", "Collider_SameCollisionGroupSameCustomLayerCollide")
|
||||
helper.open_level("Physics", "Collider_SameCollisionGroupSameCustomLayerCollide")
|
||||
|
||||
# 2) Enter Game Mode
|
||||
helper.enter_game_mode(Tests.enter_game_mode)
|
||||
|
||||
+1
-1
@@ -162,7 +162,7 @@ def ForceRegion_MultipleForcesInSameComponentCombineForces():
|
||||
helper.init_idle()
|
||||
|
||||
# 1) Load Level
|
||||
helper.open_level("physics", "ForceRegion_MultipleForcesInSameComponentCombineForces")
|
||||
helper.open_level("Physics", "ForceRegion_MultipleForcesInSameComponentCombineForces")
|
||||
|
||||
# 2) Enter Game Mode
|
||||
helper.enter_game_mode(Tests.enter_game_mode)
|
||||
|
||||
+2
-2
@@ -229,8 +229,8 @@ def Material_DefaultLibraryUpdatedAcrossLevels_after():
|
||||
for test in test_list:
|
||||
# 1) Open the correct level is open
|
||||
helper.open_level(
|
||||
"physics",
|
||||
f"Material_DefaultLibraryUpdatedAcrossLevels\\{test.level}"
|
||||
"Physics",
|
||||
os.path.join("Material_DefaultLibraryUpdatedAcrossLevels", str(test.level))
|
||||
)
|
||||
|
||||
# 2) Enter Game Mode
|
||||
|
||||
+1
-1
@@ -189,7 +189,7 @@ def Material_DefaultLibraryUpdatedAcrossLevels_before():
|
||||
# 1) Open the correct level is open
|
||||
helper.open_level(
|
||||
"Physics",
|
||||
f"Material_DefaultLibraryUpdatedAcrossLevels\\{test.level}"
|
||||
os.path.join("Material_DefaultLibraryUpdatedAcrossLevels", str(test.level))
|
||||
)
|
||||
|
||||
# 2) Enter Game Mode
|
||||
|
||||
+2
-4
@@ -252,10 +252,8 @@ def Material_LibraryUpdatedAcrossLevels():
|
||||
for test in test_list:
|
||||
# 1) Open the correct level for the test
|
||||
helper.open_level(
|
||||
"physics",
|
||||
"Material_LibraryUpdatedAcrossLevels\\Material_LibraryUpdatedAcrossLevels_{}".format(
|
||||
test.level_index
|
||||
),
|
||||
"Physics",
|
||||
os.path.join("Material_LibraryUpdatedAcrossLevels", str(test.level_index))
|
||||
)
|
||||
|
||||
# 2) Open Game Mode
|
||||
|
||||
+1
-1
@@ -106,7 +106,7 @@ def ScriptCanvas_SpawnEntityWithPhysComponents():
|
||||
# Main Script
|
||||
helper.init_idle()
|
||||
# 1) Open Level
|
||||
helper.open_level("physics", "ScriptCanvas_SpawnEntityWithPhysComponents")
|
||||
helper.open_level("Physics", "ScriptCanvas_SpawnEntityWithPhysComponents")
|
||||
|
||||
# 2) Enter Game Mode
|
||||
helper.enter_game_mode(Tests.enter_game_mode)
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:60276c07b45a734e4f71d695278167ea61e884f8b513906168c9642078ad5954
|
||||
size 6045
|
||||
oid sha256:0d004c329a7c5044a8fe05b6dbbf9b19de29c60acec75f13fdbc344a55aab8c7
|
||||
size 6404
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e89946c224d2e765931e8ba8e33133ac24651af321a404016d9a9ea8c323db6c
|
||||
size 8563
|
||||
@@ -0,0 +1,6 @@
|
||||
<download name="0" type="Map">
|
||||
<index src="filelist.xml" dest="filelist.xml"/>
|
||||
<files>
|
||||
<file src="level.pak" dest="level.pak" size="9D14"/>
|
||||
</files>
|
||||
</download>
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2a46437ba86135567d87d43af0c4d499bf3cfe321721dbaf6e3cda8e49427ee1
|
||||
size 40212
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:95996da3902d885060e700c573d13144bab246b930dfeedaed6066c13c879b11
|
||||
size 8737
|
||||
@@ -0,0 +1,6 @@
|
||||
<download name="1" type="Map">
|
||||
<index src="filelist.xml" dest="filelist.xml"/>
|
||||
<files>
|
||||
<file src="level.pak" dest="level.pak" size="9D12"/>
|
||||
</files>
|
||||
</download>
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:894dfd4ab92aa4d1d6003aebf82cf7ff854a8b3684e010234e073879f88b64e5
|
||||
size 40210
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:969b77ee335d2a04524a27c765dd2f2bdee048661f3ff7be0766ba69d18d5842
|
||||
size 10409
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
<download name="Material_LibraryUpdatedAcrossLevels_0" type="Map">
|
||||
<index src="filelist.xml" dest="filelist.xml"/>
|
||||
<files>
|
||||
<file src="level.pak" dest="level.pak" size="39337" md5="06897e9fe8d11880944a2a73aefcc9cc"/>
|
||||
</files>
|
||||
</download>
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:547d7fdfcd959569b69d78eb6f63c7c19fc90840d69ca2d46eca8a3e82b8db75
|
||||
size 39337
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
<Environment>
|
||||
<Fog ViewDistance="8000" ViewDistanceLowSpec="1000"/>
|
||||
<Terrain DetailLayersViewDistRatio="1.0" HeightMapAO="0"/>
|
||||
<EnvState WindVector="1,0,0" BreezeGeneration="0" BreezeStrength="1.f" BreezeMovementSpeed="8.f" BreezeVariation="1.f" BreezeLifeTime="15.f" BreezeCount="4" BreezeSpawnRadius="25.f" BreezeSpread="0.f" BreezeRadius="5.f" ConsoleMergedMeshesPool="2750" ShowTerrainSurface="1" SunShadowsMinSpec="1" SunShadowsAdditionalCascadeMinSpec="0" SunShadowsClipPlaneRange="256.0f" SunShadowsClipPlaneRangeShift="0.0f" UseLayersActivation="0" SunLinkedToTOD="1"/>
|
||||
<VolFogShadows Enable="0" EnableForClouds="0"/>
|
||||
<CloudShadows CloudShadowTexture="" CloudShadowSpeed="0,0,0" CloudShadowTiling="1.0" CloudShadowBrightness="1.0" CloudShadowInvert="0"/>
|
||||
<ParticleLighting AmbientMul="1.0" LightsMul="1.0"/>
|
||||
<SkyBox Material="EngineAssets/Materials/Sky/Sky" MaterialLowSpec="EngineAssets/Materials/Sky/Sky" Angle="0" Stretching="0.5"/>
|
||||
<Ocean Material="EngineAssets/Materials/Water/Ocean_default" CausticsDistanceAtten="100.0" CausticDepth="8.0" CausticIntensity="1.0" CausticsTilling="1.0"/>
|
||||
<OceanAnimation WindDirection="1.0" WindSpeed="4.0" WavesAmount="1.5" WavesSize="0.4" WavesSpeed="1.0"/>
|
||||
<Moon Latitude="240.0" Longitude="45.0" Size="0.5" Texture="Textures/Skys/Night/half_moon.dds"/>
|
||||
<DynTexSource Width="256" Height="256"/>
|
||||
<Total_Illumination_v2 Active="0" IntegrationMode="0" NumberOfBounces="1" DiffuseConeWidth="24" ConeMaxLength="12.0" UseLightProbes="0" InjectionMultiplier="1.0" AmbientOffsetRed="1.0" AmbientOffsetGreen="1.0" AmbientOffsetBlue="1.0" AmbientOffsetBias="0.1" Saturation="0.8" SSAOAmount="0.7"/>
|
||||
</Environment>
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
<GameTokens>
|
||||
<GameTokensLibrary>
|
||||
<LevelLibrary Name="Level"/>
|
||||
</GameTokensLibrary>
|
||||
</GameTokens>
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
<TerrainTexture TileCountX="1" TileCountY="1" TileResolution="512">
|
||||
<RGBLayer>
|
||||
<Tiles>
|
||||
<tile X="0" Y="0" Size="512"/>
|
||||
</Tiles>
|
||||
</RGBLayer>
|
||||
</TerrainTexture>
|
||||
-356
@@ -1,356 +0,0 @@
|
||||
<TimeOfDay Time="13.5" TimeStart="13.5" TimeEnd="13.5" TimeAnimSpeed="0">
|
||||
<Variable Name="Sun color" Color="0.99989021,0.99946922,0.9991194">
|
||||
<Spline Keys="-0.000628322:(0.783538:0.89627:0.930341):36,0:(0.783538:0.887923:0.921582):36,0.229167:(0.783538:0.879623:0.921582):36,0.25:(0.947307:0.745404:0.577581):36,0.458333:(1:1:1):36,0.5625:(1:1:1):36,0.75:(0.947307:0.745404:0.577581):36,0.770833:(0.783538:0.879623:0.921582):36,1:(0.783538:0.89627:0.930556):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sun intensity" Value="92366.68">
|
||||
<Spline Keys="0:1000:36,0.229167:1000:36,0.5:120000:36,0.770833:1000:65572,0.999306:1000:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sun specular multiplier" Value="1">
|
||||
<Spline Keys="0:1:36,0.25:1:36,0.5:1:36,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog color" Color="0.27049801,0.47353199,0.83076996">
|
||||
<Spline Keys="0:(0.00651209:0.00972122:0.0137021):36,0.229167:(0.00604883:0.00972122:0.0137021):36,0.25:(0.270498:0.473532:0.83077):36,0.5:(0.270498:0.473532:0.83077):458788,0.75:(0.270498:0.473532:0.83077):36,0.770833:(0.00604883:0.00972122:0.0137021):36,1:(0.00651209:0.00972122:0.0137021):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog color multiplier" Value="1">
|
||||
<Spline Keys="0:0.5:36,0.229167:0.5:36,0.25:1:36,0.5:1:36,0.75:1:36,0.770833:0.5:36,1:0.5:65572,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog height (bottom)" Value="0">
|
||||
<Spline Keys="0:0:36,0.25:0:36,0.5:0:36,0.75:0:36,1:0:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog layer density (bottom)" Value="1">
|
||||
<Spline Keys="0:1:36,0.25:1:36,0.5:1:36,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog color (top)" Color="0.597202,0.72305501,0.91309899">
|
||||
<Spline Keys="0:(0.00699541:0.00972122:0.0122865):36,0.229167:(0.00699541:0.00972122:0.0122865):36,0.25:(0.597202:0.723055:0.913099):36,0.5:(0.597202:0.723055:0.913099):458788,0.75:(0.597202:0.723055:0.913099):36,0.770833:(0.00699541:0.00972122:0.0122865):36,1:(0.00699541:0.00972122:0.0122865):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog color (top) multiplier" Value="0.88389361">
|
||||
<Spline Keys="-4.40702e-06:0.5:36,0.0297507:0.499195:36,0.229167:0.5:36,0.5:1:36,0.770833:0.5:36,1:0.5:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog height (top)" Value="100.00001">
|
||||
<Spline Keys="0:100:36,0.25:100:36,0.5:100:36,0.75:100:65572,1:100:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog layer density (top)" Value="9.9999997e-05">
|
||||
<Spline Keys="0:0.0001:36,0.25:0.0001:36,0.5:0.0001:65572,0.75:0.0001:36,1:0.0001:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog color height offset" Value="0">
|
||||
<Spline Keys="0:0:36,0.25:0:36,0.5:0:36,0.75:0:36,1:0:65572,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog color (radial)" Color="0.78592348,0.52744436,0.17234583">
|
||||
<Spline Keys="0:(0:0:0):36,0.229167:(0.00439144:0.00367651:0.00334654):36,0.25:(0.838799:0.564712:0.184475):36,0.5:(0.768151:0.514918:0.168269):458788,0.75:(0.838799:0.564712:0.184475):36,0.770833:(0.00402472:0.00334654:0.00303527):36,1:(0:0:0):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog color (radial) multiplier" Value="6">
|
||||
<Spline Keys="0:0:36,0.25:6:36,0.5:6:36,0.75:6:36,1:0:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog radial size" Value="0.85000002">
|
||||
<Spline Keys="0:0:36,0.25:0.85:65572,0.5:0.85:36,0.75:0.85:36,1:0:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog radial lobe" Value="0.75">
|
||||
<Spline Keys="0:0:36,0.25:0.75:36,0.5:0.75:36,0.75:0.75:65572,1:0:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog: Final density clamp" Value="1">
|
||||
<Spline Keys="0:1:36,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog: Global density" Value="1.5">
|
||||
<Spline Keys="0:1.5:36,0.25:1.5:36,0.5:1.5:65572,0.75:1.5:36,1:1.5:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog: Ramp start" Value="25.000002">
|
||||
<Spline Keys="0:25:36,0.25:25:36,0.5:25:65572,0.75:25:36,1:25:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog: Ramp end" Value="1000.0001">
|
||||
<Spline Keys="0:1000:36,0.25:1000:36,0.5:1000:65572,0.75:1000:36,1:1000:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog: Ramp influence" Value="0.69999993">
|
||||
<Spline Keys="0:0.7:36,0.25:0.7:36,0.5:0.7:65572,0.75:0.7:36,1:0.7:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog: Shadow darkening" Value="0.20000002">
|
||||
<Spline Keys="0:0.2:36,0.25:0.2:36,0.5:0.2:65572,0.75:0.2:36,1:0.2:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog: Shadow darkening sun" Value="0.5">
|
||||
<Spline Keys="0:0.5:36,0.25:0.5:36,0.5:0.5:65572,0.75:0.5:36,1:0.5:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog: Shadow darkening ambient" Value="1">
|
||||
<Spline Keys="0:1:36,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog: Shadow range" Value="0.10000001">
|
||||
<Spline Keys="0:0.1:36,0.25:0.1:36,0.5:0.1:65572,0.75:0.1:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Fog height (bottom)" Value="0">
|
||||
<Spline Keys="0:0:0,1:0:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Fog layer density (bottom)" Value="1">
|
||||
<Spline Keys="0:1:0,1:1:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Fog height (top)" Value="4000">
|
||||
<Spline Keys="0:4000:0,1:4000:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Fog layer density (top)" Value="9.9999997e-05">
|
||||
<Spline Keys="0:0.0001:0,1:0.0001:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Global fog density" Value="0.1">
|
||||
<Spline Keys="0:0.1:0,1:0.1:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Ramp start" Value="0">
|
||||
<Spline Keys="0:0:0,1:0:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Ramp end" Value="0">
|
||||
<Spline Keys="0:0:0,1:0:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Fog albedo color (atmosphere)" Color="1,1,1">
|
||||
<Spline Keys="0:(1:1:1):0,1:(1:1:1):0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Anisotropy factor (atmosphere)" Value="0.60000002">
|
||||
<Spline Keys="0:0.6:0,1:0.6:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Fog albedo color (sun radial)" Color="1,1,1">
|
||||
<Spline Keys="0:(1:1:1):0,1:(1:1:1):0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Anisotropy factor (sun radial)" Value="0.94999999">
|
||||
<Spline Keys="0:0.95:0,1:0.95:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Blend factor for sun scattering" Value="1">
|
||||
<Spline Keys="0:1:0,1:1:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Blend mode for sun scattering" Value="0">
|
||||
<Spline Keys="0:0:0,1:0:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Fog albedo color (entities)" Color="1,1,1">
|
||||
<Spline Keys="0:(1:1:1):0,1:(1:1:1):0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Anisotropy factor (entities)" Value="0.60000002">
|
||||
<Spline Keys="0:0.6:0,1:0.6:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Maximum range of ray-marching" Value="64">
|
||||
<Spline Keys="0:64:0,1:64:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: In-scattering factor" Value="1">
|
||||
<Spline Keys="0:1:0,1:1:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Extinction factor" Value="0.30000001">
|
||||
<Spline Keys="0:0.3:0,1:0.3:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Analytical volumetric fog visibility" Value="0.5">
|
||||
<Spline Keys="0:0.5:0,1:0.5:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Final density clamp" Value="1">
|
||||
<Spline Keys="0:1:0,0.5:1:36,1:1:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sky light: Sun intensity" Color="1,1,1">
|
||||
<Spline Keys="0:(1:1:1):36,0.25:(1:1:1):36,0.494381:(1:1:1):65572,0.5:(1:1:1):36,0.75:(1:1:1):36,1:(1:1:1):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sky light: Sun intensity multiplier" Value="200.00002">
|
||||
<Spline Keys="0:200:36,0.25:200:36,0.5:200:36,0.75:200:36,1:200:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sky light: Mie scattering" Value="6.779707">
|
||||
<Spline Keys="0:40:36,0.5:2:36,1:40:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sky light: Rayleigh scattering" Value="0.20000002">
|
||||
<Spline Keys="0:0.2:36,0.229167:0.2:36,0.25:1:36,0.291667:0.2:36,0.5:0.2:36,0.729167:0.2:36,0.75:1:36,0.770833:0.2:36,1:0.2:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sky light: Sun anisotropy factor" Value="-0.99989998">
|
||||
<Spline Keys="0:-0.9999:36,0.25:-0.9999:36,0.5:-0.9999:65572,0.75:-0.9999:36,1:-0.9999:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sky light: Wavelength (R)" Value="694">
|
||||
<Spline Keys="0:694:36,0.25:694:36,0.5:694:65572,0.75:694:36,1:694:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sky light: Wavelength (G)" Value="596.99994">
|
||||
<Spline Keys="0:597:36,0.25:597:36,0.5:597:36,0.75:597:36,1:597:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sky light: Wavelength (B)" Value="488">
|
||||
<Spline Keys="0:488:36,0.25:488:36,0.5:488:65572,0.75:488:36,1:488:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Horizon color" Color="0.27049801,0.39157301,0.52711499">
|
||||
<Spline Keys="0:(0.270498:0.391573:0.520996):36,0.25:(0.270498:0.391573:0.527115):36,0.5:(0.270498:0.391573:0.527115):262180,0.75:(0.270498:0.391573:0.527115):36,1:(0.270498:0.391573:0.520996):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Horizon color multiplier" Value="0">
|
||||
<Spline Keys="0:0.1:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Zenith color" Color="0.36130697,0.434154,0.46778399">
|
||||
<Spline Keys="0:(0.361307:0.434154:0.467784):36,0.25:(0.361307:0.434154:0.467784):36,0.5:(0.361307:0.434154:0.467784):262180,0.75:(0.361307:0.434154:0.467784):36,1:(0.361307:0.434154:0.467784):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Zenith color multiplier" Value="0">
|
||||
<Spline Keys="0:0.02:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0.02:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Zenith shift" Value="0.5">
|
||||
<Spline Keys="0:0.5:36,0.25:0.5:36,0.5:0.5:65572,0.75:0.5:36,1:0.5:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Star intensity" Value="0">
|
||||
<Spline Keys="0:3:36,0.25:0:36,0.5:0:65572,0.75:0:36,0.836647:1.03977:36,1:3:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Moon color" Color="1,1,1">
|
||||
<Spline Keys="0:(1:1:1):36,0.25:(1:1:1):36,0.5:(1:1:1):458788,0.75:(1:1:1):36,1:(1:1:1):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Moon color multiplier" Value="0">
|
||||
<Spline Keys="0:0.4:36,0.25:0:36,0.5:0:36,0.75:0:65572,1:0.4:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Moon inner corona color" Color="0.904661,1,1">
|
||||
<Spline Keys="0:(0.89627:1:1):36,0.25:(0.904661:1:1):36,0.5:(0.904661:1:1):393252,0.75:(0.904661:1:1):36,0.836647:(0.89627:1:1):36,1:(0.89627:1:1):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Moon inner corona color multiplier" Value="0">
|
||||
<Spline Keys="0:0.1:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Moon inner corona scale" Value="0">
|
||||
<Spline Keys="0:2:36,0.25:0:36,0.5:0:65572,0.75:0:36,0.836647:0.693178:36,1:2:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Moon outer corona color" Color="0.201556,0.22696599,0.25415203">
|
||||
<Spline Keys="0:(0.198069:0.226966:0.250158):36,0.25:(0.201556:0.226966:0.254152):36,0.5:(0.201556:0.226966:0.254152):36,0.75:(0.201556:0.226966:0.254152):36,1:(0.198069:0.226966:0.250158):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Moon outer corona color multiplier" Value="0">
|
||||
<Spline Keys="0:0.1:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Moon outer corona scale" Value="0">
|
||||
<Spline Keys="0:0.01:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0.01:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cloud shading: Sun light multiplier" Value="1">
|
||||
<Spline Keys="0:1:36,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cloud shading: Sun custom color" Color="0.83076996,0.76815104,0.65837508">
|
||||
<Spline Keys="0:(0.737911:0.737911:0.737911):36,0.25:(0.83077:0.768151:0.658375):36,0.5:(0.83077:0.768151:0.658375):458788,0.75:(0.83077:0.768151:0.658375):36,1:(0.737911:0.737911:0.737911):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cloud shading: Sun custom color multiplier" Value="1">
|
||||
<Spline Keys="0:0.1:36,0.25:1:36,0.5:1:65572,0.75:1:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cloud shading: Sun custom color influence" Value="0">
|
||||
<Spline Keys="0:0.5:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0.5:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sun shafts visibility" Value="0">
|
||||
<Spline Keys="0:0:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sun rays visibility" Value="1.5">
|
||||
<Spline Keys="0:1:36,0.25:1.5:36,0.5:1.5:65572,0.75:1.5:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sun rays attenuation" Value="1.5">
|
||||
<Spline Keys="0:0.1:36,0.25:1.5:36,0.5:1.5:65572,0.75:1.5:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sun rays suncolor influence" Value="0.5">
|
||||
<Spline Keys="0:0.5:36,0.25:0.5:36,0.5:0.5:65572,0.75:0.5:36,1:0.5:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sun rays custom color" Color="0.66538697,0.83879906,0.94730699">
|
||||
<Spline Keys="0:(0.665387:0.838799:0.947307):36,0.25:(0.665387:0.838799:0.947307):36,0.5:(0.665387:0.838799:0.947307):458788,0.75:(0.665387:0.838799:0.947307):36,1:(0.665387:0.838799:0.947307):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Ocean fog color" Color="0.0012141101,0.0091340598,0.017642001">
|
||||
<Spline Keys="0:(0.00121411:0.00913406:0.017642):36,0.25:(0.00121411:0.00913406:0.017642):36,0.5:(0.00121411:0.00913406:0.017642):458788,0.75:(0.00121411:0.00913406:0.017642):36,1:(0.00121411:0.00913406:0.017642):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Ocean fog color multiplier" Value="0.5">
|
||||
<Spline Keys="0:0.5:36,0.25:0.5:36,0.5:0.5:65572,0.75:0.5:36,1:0.5:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Ocean fog density" Value="0.5">
|
||||
<Spline Keys="0:0.5:36,0.25:0.5:36,0.5:0.5:65572,0.75:0.5:36,1:0.5:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Static skybox multiplier" Value="1">
|
||||
<Spline Keys="0:1:0,1:1:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Film curve shoulder scale" Value="2.232213">
|
||||
<Spline Keys="0:3:36,0.229167:3:36,0.5:2:36,0.770833:3:36,1:3:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Film curve midtones scale" Value="0.88389361">
|
||||
<Spline Keys="0:0.5:36,0.229167:0.5:36,0.5:1:36,0.770833:0.5:36,1:0.5:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Film curve toe scale" Value="1">
|
||||
<Spline Keys="0:1:36,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Film curve whitepoint" Value="4">
|
||||
<Spline Keys="0:4:36,0.25:4:36,0.5:4:65572,0.75:4:36,1:4:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Saturation" Value="1">
|
||||
<Spline Keys="0:0.8:36,0.229167:0.8:36,0.5:1:36,0.751391:1:65572,0.770833:0.8:36,1:0.8:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Color balance" Color="1,1,1">
|
||||
<Spline Keys="0:(1:1:1):36,0.25:(1:1:1):36,0.5:(1:1:1):36,0.75:(1:1:1):36,1:(1:1:1):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Scene key" Value="0.18000002">
|
||||
<Spline Keys="0:0.18:36,0.25:0.18:36,0.5:0.18:65572,0.75:0.18:36,1:0.18:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Min exposure" Value="1">
|
||||
<Spline Keys="0:1:36,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Max exposure" Value="2.6142297">
|
||||
<Spline Keys="0:2:36,0.229167:2:36,0.5:2.8:36,0.770833:2:36,1:2:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="EV Min" Value="4.5">
|
||||
<Spline Keys="0:4.5:0,1:4.5:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="EV Max" Value="17">
|
||||
<Spline Keys="0:17:0,1:17:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="EV Auto compensation" Value="1.5">
|
||||
<Spline Keys="0:1.5:0,1:1.5:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Bloom amount" Value="0.30899152">
|
||||
<Spline Keys="0:1:36,0.229167:1:36,0.5:0.1:36,0.770833:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Filters: grain" Value="0">
|
||||
<Spline Keys="0:0.3:65572,0.229167:0.3:36,0.25:0:36,0.5:0:36,0.75:0:36,1:0.3:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Filters: photofilter color" Color="0,0,0">
|
||||
<Spline Keys="0:(0:0:0):36,0.25:(0:0:0):36,0.5:(0:0:0):458788,0.75:(0:0:0):36,1:(0:0:0):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Filters: photofilter density" Value="0">
|
||||
<Spline Keys="0:0:36,0.25:0:36,0.5:0:36,0.75:0:36,1:0:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Dof: focus range" Value="500.00003">
|
||||
<Spline Keys="0:500:36,0.25:500:36,0.5:500:65572,0.75:500:36,1:500:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Dof: blur amount" Value="0.10000001">
|
||||
<Spline Keys="0:0.1:36,0.25:0.1:36,0.5:0.1:65572,0.75:0.1:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 0: Bias" Value="0.10000001">
|
||||
<Spline Keys="0:0.1:36,0.25:0.1:36,0.5:0.1:65572,0.75:0.1:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 0: Slope Bias" Value="64">
|
||||
<Spline Keys="0:64:36,0.25:64:36,0.5:64:65572,0.75:64:36,1:64:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 1: Bias" Value="0.10000001">
|
||||
<Spline Keys="0:0.1:36,0.25:0.1:36,0.5:0.1:65572,0.75:0.1:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 1: Slope Bias" Value="23">
|
||||
<Spline Keys="0:23:36,0.25:23:36,0.5:23:65572,0.75:23:36,1:23:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 2: Bias" Value="0.10000001">
|
||||
<Spline Keys="0:0.1:36,0.25:0.1:36,0.5:0.1:65572,0.75:0.1:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 2: Slope Bias" Value="4">
|
||||
<Spline Keys="0:4:36,0.25:4:36,0.5:4:65572,0.75:4:36,1:4:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 3: Bias" Value="0.10000001">
|
||||
<Spline Keys="0:0.1:36,0.25:0.1:36,0.5:0.1:36,0.75:0.1:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 3: Slope Bias" Value="1">
|
||||
<Spline Keys="0:1:36,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 4: Bias" Value="0.10000001">
|
||||
<Spline Keys="0:0.1:0,0.25:0.1:36,0.5:0.1:65572,0.75:0.1:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 4: Slope Bias" Value="1">
|
||||
<Spline Keys="0:1:0,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 5: Bias" Value="0.0099999998">
|
||||
<Spline Keys="0:0.01:0,0.25:0.01:36,0.5:0.01:65572,0.75:0.01:36,1:0.01:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 5: Slope Bias" Value="1">
|
||||
<Spline Keys="0:1:0,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 6: Bias" Value="0.10000001">
|
||||
<Spline Keys="0:0.1:0,0.25:0.1:36,0.5:0.1:36,0.75:0.1:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 6: Slope Bias" Value="1">
|
||||
<Spline Keys="0:1:0,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 7: Bias" Value="0.10000001">
|
||||
<Spline Keys="0:0.1:0,0.25:0.1:36,0.5:0.1:36,0.75:0.1:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 7: Slope Bias" Value="1">
|
||||
<Spline Keys="0:1:0,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Shadow jittering" Value="2.4999998">
|
||||
<Spline Keys="0:5:36,0.25:2.5:36,0.5:2.5:65572,0.75:2.5:36,1:5:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="HDR dynamic power factor" Value="0">
|
||||
<Spline Keys="0:0:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sky brightening (terrain occlusion)" Value="0">
|
||||
<Spline Keys="0:0:36,0.25:0:36,0.5:0:36,0.75:0:36,1:0:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sun color multiplier" Value="9.999999">
|
||||
<Spline Keys="0:0.1:36,0.25:10:36,0.5:10:36,0.75:10:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
</TimeOfDay>
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0e6a5435c928079b27796f6b202bbc2623e7e454244ddc099a3cadf33b7cb9e9
|
||||
size 63
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:19096597087688692a225c1955f73d22c46354995fca1df8dff107a90c2f17a2
|
||||
size 4202594
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:29f752c141514cb4b50aea07e6b63de5c8f43149ddac37722e9ddb8b5f4a667d
|
||||
size 9495
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
<download name="Material_LibraryUpdatedAcrossLevels_0" type="Map">
|
||||
<index src="filelist.xml" dest="filelist.xml"/>
|
||||
<files>
|
||||
<file src="level.pak" dest="level.pak" size="39337" md5="06897e9fe8d11880944a2a73aefcc9cc"/>
|
||||
</files>
|
||||
</download>
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:547d7fdfcd959569b69d78eb6f63c7c19fc90840d69ca2d46eca8a3e82b8db75
|
||||
size 39337
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
<Environment>
|
||||
<Fog ViewDistance="8000" ViewDistanceLowSpec="1000"/>
|
||||
<Terrain DetailLayersViewDistRatio="1.0" HeightMapAO="0"/>
|
||||
<EnvState WindVector="1,0,0" BreezeGeneration="0" BreezeStrength="1.f" BreezeMovementSpeed="8.f" BreezeVariation="1.f" BreezeLifeTime="15.f" BreezeCount="4" BreezeSpawnRadius="25.f" BreezeSpread="0.f" BreezeRadius="5.f" ConsoleMergedMeshesPool="2750" ShowTerrainSurface="1" SunShadowsMinSpec="1" SunShadowsAdditionalCascadeMinSpec="0" SunShadowsClipPlaneRange="256.0f" SunShadowsClipPlaneRangeShift="0.0f" UseLayersActivation="0" SunLinkedToTOD="1"/>
|
||||
<VolFogShadows Enable="0" EnableForClouds="0"/>
|
||||
<CloudShadows CloudShadowTexture="" CloudShadowSpeed="0,0,0" CloudShadowTiling="1.0" CloudShadowBrightness="1.0" CloudShadowInvert="0"/>
|
||||
<ParticleLighting AmbientMul="1.0" LightsMul="1.0"/>
|
||||
<SkyBox Material="EngineAssets/Materials/Sky/Sky" MaterialLowSpec="EngineAssets/Materials/Sky/Sky" Angle="0" Stretching="0.5"/>
|
||||
<Ocean Material="EngineAssets/Materials/Water/Ocean_default" CausticsDistanceAtten="100.0" CausticDepth="8.0" CausticIntensity="1.0" CausticsTilling="1.0"/>
|
||||
<OceanAnimation WindDirection="1.0" WindSpeed="4.0" WavesAmount="1.5" WavesSize="0.4" WavesSpeed="1.0"/>
|
||||
<Moon Latitude="240.0" Longitude="45.0" Size="0.5" Texture="Textures/Skys/Night/half_moon.dds"/>
|
||||
<DynTexSource Width="256" Height="256"/>
|
||||
<Total_Illumination_v2 Active="0" IntegrationMode="0" NumberOfBounces="1" DiffuseConeWidth="24" ConeMaxLength="12.0" UseLightProbes="0" InjectionMultiplier="1.0" AmbientOffsetRed="1.0" AmbientOffsetGreen="1.0" AmbientOffsetBlue="1.0" AmbientOffsetBias="0.1" Saturation="0.8" SSAOAmount="0.7"/>
|
||||
</Environment>
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
<GameTokens>
|
||||
<GameTokensLibrary>
|
||||
<LevelLibrary Name="Level"/>
|
||||
</GameTokensLibrary>
|
||||
</GameTokens>
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
<TerrainTexture TileCountX="1" TileCountY="1" TileResolution="512">
|
||||
<RGBLayer>
|
||||
<Tiles>
|
||||
<tile X="0" Y="0" Size="512"/>
|
||||
</Tiles>
|
||||
</RGBLayer>
|
||||
</TerrainTexture>
|
||||
-356
@@ -1,356 +0,0 @@
|
||||
<TimeOfDay Time="13.5" TimeStart="13.5" TimeEnd="13.5" TimeAnimSpeed="0">
|
||||
<Variable Name="Sun color" Color="0.99989021,0.99946922,0.9991194">
|
||||
<Spline Keys="-0.000628322:(0.783538:0.89627:0.930341):36,0:(0.783538:0.887923:0.921582):36,0.229167:(0.783538:0.879623:0.921582):36,0.25:(0.947307:0.745404:0.577581):36,0.458333:(1:1:1):36,0.5625:(1:1:1):36,0.75:(0.947307:0.745404:0.577581):36,0.770833:(0.783538:0.879623:0.921582):36,1:(0.783538:0.89627:0.930556):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sun intensity" Value="92366.68">
|
||||
<Spline Keys="0:1000:36,0.229167:1000:36,0.5:120000:36,0.770833:1000:65572,0.999306:1000:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sun specular multiplier" Value="1">
|
||||
<Spline Keys="0:1:36,0.25:1:36,0.5:1:36,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog color" Color="0.27049801,0.47353199,0.83076996">
|
||||
<Spline Keys="0:(0.00651209:0.00972122:0.0137021):36,0.229167:(0.00604883:0.00972122:0.0137021):36,0.25:(0.270498:0.473532:0.83077):36,0.5:(0.270498:0.473532:0.83077):458788,0.75:(0.270498:0.473532:0.83077):36,0.770833:(0.00604883:0.00972122:0.0137021):36,1:(0.00651209:0.00972122:0.0137021):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog color multiplier" Value="1">
|
||||
<Spline Keys="0:0.5:36,0.229167:0.5:36,0.25:1:36,0.5:1:36,0.75:1:36,0.770833:0.5:36,1:0.5:65572,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog height (bottom)" Value="0">
|
||||
<Spline Keys="0:0:36,0.25:0:36,0.5:0:36,0.75:0:36,1:0:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog layer density (bottom)" Value="1">
|
||||
<Spline Keys="0:1:36,0.25:1:36,0.5:1:36,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog color (top)" Color="0.597202,0.72305501,0.91309899">
|
||||
<Spline Keys="0:(0.00699541:0.00972122:0.0122865):36,0.229167:(0.00699541:0.00972122:0.0122865):36,0.25:(0.597202:0.723055:0.913099):36,0.5:(0.597202:0.723055:0.913099):458788,0.75:(0.597202:0.723055:0.913099):36,0.770833:(0.00699541:0.00972122:0.0122865):36,1:(0.00699541:0.00972122:0.0122865):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog color (top) multiplier" Value="0.88389361">
|
||||
<Spline Keys="-4.40702e-06:0.5:36,0.0297507:0.499195:36,0.229167:0.5:36,0.5:1:36,0.770833:0.5:36,1:0.5:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog height (top)" Value="100.00001">
|
||||
<Spline Keys="0:100:36,0.25:100:36,0.5:100:36,0.75:100:65572,1:100:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog layer density (top)" Value="9.9999997e-05">
|
||||
<Spline Keys="0:0.0001:36,0.25:0.0001:36,0.5:0.0001:65572,0.75:0.0001:36,1:0.0001:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog color height offset" Value="0">
|
||||
<Spline Keys="0:0:36,0.25:0:36,0.5:0:36,0.75:0:36,1:0:65572,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog color (radial)" Color="0.78592348,0.52744436,0.17234583">
|
||||
<Spline Keys="0:(0:0:0):36,0.229167:(0.00439144:0.00367651:0.00334654):36,0.25:(0.838799:0.564712:0.184475):36,0.5:(0.768151:0.514918:0.168269):458788,0.75:(0.838799:0.564712:0.184475):36,0.770833:(0.00402472:0.00334654:0.00303527):36,1:(0:0:0):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog color (radial) multiplier" Value="6">
|
||||
<Spline Keys="0:0:36,0.25:6:36,0.5:6:36,0.75:6:36,1:0:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog radial size" Value="0.85000002">
|
||||
<Spline Keys="0:0:36,0.25:0.85:65572,0.5:0.85:36,0.75:0.85:36,1:0:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Fog radial lobe" Value="0.75">
|
||||
<Spline Keys="0:0:36,0.25:0.75:36,0.5:0.75:36,0.75:0.75:65572,1:0:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog: Final density clamp" Value="1">
|
||||
<Spline Keys="0:1:36,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog: Global density" Value="1.5">
|
||||
<Spline Keys="0:1.5:36,0.25:1.5:36,0.5:1.5:65572,0.75:1.5:36,1:1.5:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog: Ramp start" Value="25.000002">
|
||||
<Spline Keys="0:25:36,0.25:25:36,0.5:25:65572,0.75:25:36,1:25:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog: Ramp end" Value="1000.0001">
|
||||
<Spline Keys="0:1000:36,0.25:1000:36,0.5:1000:65572,0.75:1000:36,1:1000:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog: Ramp influence" Value="0.69999993">
|
||||
<Spline Keys="0:0.7:36,0.25:0.7:36,0.5:0.7:65572,0.75:0.7:36,1:0.7:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog: Shadow darkening" Value="0.20000002">
|
||||
<Spline Keys="0:0.2:36,0.25:0.2:36,0.5:0.2:65572,0.75:0.2:36,1:0.2:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog: Shadow darkening sun" Value="0.5">
|
||||
<Spline Keys="0:0.5:36,0.25:0.5:36,0.5:0.5:65572,0.75:0.5:36,1:0.5:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog: Shadow darkening ambient" Value="1">
|
||||
<Spline Keys="0:1:36,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog: Shadow range" Value="0.10000001">
|
||||
<Spline Keys="0:0.1:36,0.25:0.1:36,0.5:0.1:65572,0.75:0.1:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Fog height (bottom)" Value="0">
|
||||
<Spline Keys="0:0:0,1:0:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Fog layer density (bottom)" Value="1">
|
||||
<Spline Keys="0:1:0,1:1:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Fog height (top)" Value="4000">
|
||||
<Spline Keys="0:4000:0,1:4000:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Fog layer density (top)" Value="9.9999997e-05">
|
||||
<Spline Keys="0:0.0001:0,1:0.0001:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Global fog density" Value="0.1">
|
||||
<Spline Keys="0:0.1:0,1:0.1:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Ramp start" Value="0">
|
||||
<Spline Keys="0:0:0,1:0:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Ramp end" Value="0">
|
||||
<Spline Keys="0:0:0,1:0:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Fog albedo color (atmosphere)" Color="1,1,1">
|
||||
<Spline Keys="0:(1:1:1):0,1:(1:1:1):0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Anisotropy factor (atmosphere)" Value="0.60000002">
|
||||
<Spline Keys="0:0.6:0,1:0.6:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Fog albedo color (sun radial)" Color="1,1,1">
|
||||
<Spline Keys="0:(1:1:1):0,1:(1:1:1):0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Anisotropy factor (sun radial)" Value="0.94999999">
|
||||
<Spline Keys="0:0.95:0,1:0.95:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Blend factor for sun scattering" Value="1">
|
||||
<Spline Keys="0:1:0,1:1:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Blend mode for sun scattering" Value="0">
|
||||
<Spline Keys="0:0:0,1:0:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Fog albedo color (entities)" Color="1,1,1">
|
||||
<Spline Keys="0:(1:1:1):0,1:(1:1:1):0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Anisotropy factor (entities)" Value="0.60000002">
|
||||
<Spline Keys="0:0.6:0,1:0.6:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Maximum range of ray-marching" Value="64">
|
||||
<Spline Keys="0:64:0,1:64:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: In-scattering factor" Value="1">
|
||||
<Spline Keys="0:1:0,1:1:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Extinction factor" Value="0.30000001">
|
||||
<Spline Keys="0:0.3:0,1:0.3:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Analytical volumetric fog visibility" Value="0.5">
|
||||
<Spline Keys="0:0.5:0,1:0.5:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Volumetric fog 2: Final density clamp" Value="1">
|
||||
<Spline Keys="0:1:0,0.5:1:36,1:1:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sky light: Sun intensity" Color="1,1,1">
|
||||
<Spline Keys="0:(1:1:1):36,0.25:(1:1:1):36,0.494381:(1:1:1):65572,0.5:(1:1:1):36,0.75:(1:1:1):36,1:(1:1:1):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sky light: Sun intensity multiplier" Value="200.00002">
|
||||
<Spline Keys="0:200:36,0.25:200:36,0.5:200:36,0.75:200:36,1:200:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sky light: Mie scattering" Value="6.779707">
|
||||
<Spline Keys="0:40:36,0.5:2:36,1:40:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sky light: Rayleigh scattering" Value="0.20000002">
|
||||
<Spline Keys="0:0.2:36,0.229167:0.2:36,0.25:1:36,0.291667:0.2:36,0.5:0.2:36,0.729167:0.2:36,0.75:1:36,0.770833:0.2:36,1:0.2:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sky light: Sun anisotropy factor" Value="-0.99989998">
|
||||
<Spline Keys="0:-0.9999:36,0.25:-0.9999:36,0.5:-0.9999:65572,0.75:-0.9999:36,1:-0.9999:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sky light: Wavelength (R)" Value="694">
|
||||
<Spline Keys="0:694:36,0.25:694:36,0.5:694:65572,0.75:694:36,1:694:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sky light: Wavelength (G)" Value="596.99994">
|
||||
<Spline Keys="0:597:36,0.25:597:36,0.5:597:36,0.75:597:36,1:597:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sky light: Wavelength (B)" Value="488">
|
||||
<Spline Keys="0:488:36,0.25:488:36,0.5:488:65572,0.75:488:36,1:488:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Horizon color" Color="0.27049801,0.39157301,0.52711499">
|
||||
<Spline Keys="0:(0.270498:0.391573:0.520996):36,0.25:(0.270498:0.391573:0.527115):36,0.5:(0.270498:0.391573:0.527115):262180,0.75:(0.270498:0.391573:0.527115):36,1:(0.270498:0.391573:0.520996):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Horizon color multiplier" Value="0">
|
||||
<Spline Keys="0:0.1:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Zenith color" Color="0.36130697,0.434154,0.46778399">
|
||||
<Spline Keys="0:(0.361307:0.434154:0.467784):36,0.25:(0.361307:0.434154:0.467784):36,0.5:(0.361307:0.434154:0.467784):262180,0.75:(0.361307:0.434154:0.467784):36,1:(0.361307:0.434154:0.467784):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Zenith color multiplier" Value="0">
|
||||
<Spline Keys="0:0.02:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0.02:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Zenith shift" Value="0.5">
|
||||
<Spline Keys="0:0.5:36,0.25:0.5:36,0.5:0.5:65572,0.75:0.5:36,1:0.5:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Star intensity" Value="0">
|
||||
<Spline Keys="0:3:36,0.25:0:36,0.5:0:65572,0.75:0:36,0.836647:1.03977:36,1:3:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Moon color" Color="1,1,1">
|
||||
<Spline Keys="0:(1:1:1):36,0.25:(1:1:1):36,0.5:(1:1:1):458788,0.75:(1:1:1):36,1:(1:1:1):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Moon color multiplier" Value="0">
|
||||
<Spline Keys="0:0.4:36,0.25:0:36,0.5:0:36,0.75:0:65572,1:0.4:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Moon inner corona color" Color="0.904661,1,1">
|
||||
<Spline Keys="0:(0.89627:1:1):36,0.25:(0.904661:1:1):36,0.5:(0.904661:1:1):393252,0.75:(0.904661:1:1):36,0.836647:(0.89627:1:1):36,1:(0.89627:1:1):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Moon inner corona color multiplier" Value="0">
|
||||
<Spline Keys="0:0.1:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Moon inner corona scale" Value="0">
|
||||
<Spline Keys="0:2:36,0.25:0:36,0.5:0:65572,0.75:0:36,0.836647:0.693178:36,1:2:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Moon outer corona color" Color="0.201556,0.22696599,0.25415203">
|
||||
<Spline Keys="0:(0.198069:0.226966:0.250158):36,0.25:(0.201556:0.226966:0.254152):36,0.5:(0.201556:0.226966:0.254152):36,0.75:(0.201556:0.226966:0.254152):36,1:(0.198069:0.226966:0.250158):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Moon outer corona color multiplier" Value="0">
|
||||
<Spline Keys="0:0.1:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Night sky: Moon outer corona scale" Value="0">
|
||||
<Spline Keys="0:0.01:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0.01:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cloud shading: Sun light multiplier" Value="1">
|
||||
<Spline Keys="0:1:36,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cloud shading: Sun custom color" Color="0.83076996,0.76815104,0.65837508">
|
||||
<Spline Keys="0:(0.737911:0.737911:0.737911):36,0.25:(0.83077:0.768151:0.658375):36,0.5:(0.83077:0.768151:0.658375):458788,0.75:(0.83077:0.768151:0.658375):36,1:(0.737911:0.737911:0.737911):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cloud shading: Sun custom color multiplier" Value="1">
|
||||
<Spline Keys="0:0.1:36,0.25:1:36,0.5:1:65572,0.75:1:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cloud shading: Sun custom color influence" Value="0">
|
||||
<Spline Keys="0:0.5:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0.5:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sun shafts visibility" Value="0">
|
||||
<Spline Keys="0:0:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sun rays visibility" Value="1.5">
|
||||
<Spline Keys="0:1:36,0.25:1.5:36,0.5:1.5:65572,0.75:1.5:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sun rays attenuation" Value="1.5">
|
||||
<Spline Keys="0:0.1:36,0.25:1.5:36,0.5:1.5:65572,0.75:1.5:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sun rays suncolor influence" Value="0.5">
|
||||
<Spline Keys="0:0.5:36,0.25:0.5:36,0.5:0.5:65572,0.75:0.5:36,1:0.5:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sun rays custom color" Color="0.66538697,0.83879906,0.94730699">
|
||||
<Spline Keys="0:(0.665387:0.838799:0.947307):36,0.25:(0.665387:0.838799:0.947307):36,0.5:(0.665387:0.838799:0.947307):458788,0.75:(0.665387:0.838799:0.947307):36,1:(0.665387:0.838799:0.947307):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Ocean fog color" Color="0.0012141101,0.0091340598,0.017642001">
|
||||
<Spline Keys="0:(0.00121411:0.00913406:0.017642):36,0.25:(0.00121411:0.00913406:0.017642):36,0.5:(0.00121411:0.00913406:0.017642):458788,0.75:(0.00121411:0.00913406:0.017642):36,1:(0.00121411:0.00913406:0.017642):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Ocean fog color multiplier" Value="0.5">
|
||||
<Spline Keys="0:0.5:36,0.25:0.5:36,0.5:0.5:65572,0.75:0.5:36,1:0.5:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Ocean fog density" Value="0.5">
|
||||
<Spline Keys="0:0.5:36,0.25:0.5:36,0.5:0.5:65572,0.75:0.5:36,1:0.5:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Static skybox multiplier" Value="1">
|
||||
<Spline Keys="0:1:0,1:1:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Film curve shoulder scale" Value="2.232213">
|
||||
<Spline Keys="0:3:36,0.229167:3:36,0.5:2:36,0.770833:3:36,1:3:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Film curve midtones scale" Value="0.88389361">
|
||||
<Spline Keys="0:0.5:36,0.229167:0.5:36,0.5:1:36,0.770833:0.5:36,1:0.5:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Film curve toe scale" Value="1">
|
||||
<Spline Keys="0:1:36,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Film curve whitepoint" Value="4">
|
||||
<Spline Keys="0:4:36,0.25:4:36,0.5:4:65572,0.75:4:36,1:4:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Saturation" Value="1">
|
||||
<Spline Keys="0:0.8:36,0.229167:0.8:36,0.5:1:36,0.751391:1:65572,0.770833:0.8:36,1:0.8:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Color balance" Color="1,1,1">
|
||||
<Spline Keys="0:(1:1:1):36,0.25:(1:1:1):36,0.5:(1:1:1):36,0.75:(1:1:1):36,1:(1:1:1):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Scene key" Value="0.18000002">
|
||||
<Spline Keys="0:0.18:36,0.25:0.18:36,0.5:0.18:65572,0.75:0.18:36,1:0.18:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Min exposure" Value="1">
|
||||
<Spline Keys="0:1:36,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Max exposure" Value="2.6142297">
|
||||
<Spline Keys="0:2:36,0.229167:2:36,0.5:2.8:36,0.770833:2:36,1:2:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="EV Min" Value="4.5">
|
||||
<Spline Keys="0:4.5:0,1:4.5:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="EV Max" Value="17">
|
||||
<Spline Keys="0:17:0,1:17:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="EV Auto compensation" Value="1.5">
|
||||
<Spline Keys="0:1.5:0,1:1.5:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="Bloom amount" Value="0.30899152">
|
||||
<Spline Keys="0:1:36,0.229167:1:36,0.5:0.1:36,0.770833:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Filters: grain" Value="0">
|
||||
<Spline Keys="0:0.3:65572,0.229167:0.3:36,0.25:0:36,0.5:0:36,0.75:0:36,1:0.3:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Filters: photofilter color" Color="0,0,0">
|
||||
<Spline Keys="0:(0:0:0):36,0.25:(0:0:0):36,0.5:(0:0:0):458788,0.75:(0:0:0):36,1:(0:0:0):36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Filters: photofilter density" Value="0">
|
||||
<Spline Keys="0:0:36,0.25:0:36,0.5:0:36,0.75:0:36,1:0:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Dof: focus range" Value="500.00003">
|
||||
<Spline Keys="0:500:36,0.25:500:36,0.5:500:65572,0.75:500:36,1:500:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Dof: blur amount" Value="0.10000001">
|
||||
<Spline Keys="0:0.1:36,0.25:0.1:36,0.5:0.1:65572,0.75:0.1:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 0: Bias" Value="0.10000001">
|
||||
<Spline Keys="0:0.1:36,0.25:0.1:36,0.5:0.1:65572,0.75:0.1:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 0: Slope Bias" Value="64">
|
||||
<Spline Keys="0:64:36,0.25:64:36,0.5:64:65572,0.75:64:36,1:64:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 1: Bias" Value="0.10000001">
|
||||
<Spline Keys="0:0.1:36,0.25:0.1:36,0.5:0.1:65572,0.75:0.1:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 1: Slope Bias" Value="23">
|
||||
<Spline Keys="0:23:36,0.25:23:36,0.5:23:65572,0.75:23:36,1:23:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 2: Bias" Value="0.10000001">
|
||||
<Spline Keys="0:0.1:36,0.25:0.1:36,0.5:0.1:65572,0.75:0.1:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 2: Slope Bias" Value="4">
|
||||
<Spline Keys="0:4:36,0.25:4:36,0.5:4:65572,0.75:4:36,1:4:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 3: Bias" Value="0.10000001">
|
||||
<Spline Keys="0:0.1:36,0.25:0.1:36,0.5:0.1:36,0.75:0.1:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 3: Slope Bias" Value="1">
|
||||
<Spline Keys="0:1:36,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 4: Bias" Value="0.10000001">
|
||||
<Spline Keys="0:0.1:0,0.25:0.1:36,0.5:0.1:65572,0.75:0.1:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 4: Slope Bias" Value="1">
|
||||
<Spline Keys="0:1:0,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 5: Bias" Value="0.0099999998">
|
||||
<Spline Keys="0:0.01:0,0.25:0.01:36,0.5:0.01:65572,0.75:0.01:36,1:0.01:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 5: Slope Bias" Value="1">
|
||||
<Spline Keys="0:1:0,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 6: Bias" Value="0.10000001">
|
||||
<Spline Keys="0:0.1:0,0.25:0.1:36,0.5:0.1:36,0.75:0.1:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 6: Slope Bias" Value="1">
|
||||
<Spline Keys="0:1:0,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 7: Bias" Value="0.10000001">
|
||||
<Spline Keys="0:0.1:0,0.25:0.1:36,0.5:0.1:36,0.75:0.1:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Cascade 7: Slope Bias" Value="1">
|
||||
<Spline Keys="0:1:0,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Shadow jittering" Value="2.4999998">
|
||||
<Spline Keys="0:5:36,0.25:2.5:36,0.5:2.5:65572,0.75:2.5:36,1:5:0,"/>
|
||||
</Variable>
|
||||
<Variable Name="HDR dynamic power factor" Value="0">
|
||||
<Spline Keys="0:0:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sky brightening (terrain occlusion)" Value="0">
|
||||
<Spline Keys="0:0:36,0.25:0:36,0.5:0:36,0.75:0:36,1:0:36,"/>
|
||||
</Variable>
|
||||
<Variable Name="Sun color multiplier" Value="9.999999">
|
||||
<Spline Keys="0:0.1:36,0.25:10:36,0.5:10:36,0.75:10:36,1:0.1:36,"/>
|
||||
</Variable>
|
||||
</TimeOfDay>
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0e6a5435c928079b27796f6b202bbc2623e7e454244ddc099a3cadf33b7cb9e9
|
||||
size 63
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:19096597087688692a225c1955f73d22c46354995fca1df8dff107a90c2f17a2
|
||||
size 4202594
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:cb97ada674d123c67d7a32eb65e81fa66472cf51f748054c4a4297649f2a0f40
|
||||
size 5568
|
||||
oid sha256:0f645243fb623258ed4b063c5a18ea414560496f97d7234782ca97884e0ed8f0
|
||||
size 5961
|
||||
|
||||
@@ -361,7 +361,7 @@ namespace AZ::Dom::Json
|
||||
|
||||
bool RapidJsonReadHandler::String(const char* str, rapidjson::SizeType length, bool copy)
|
||||
{
|
||||
const Lifetime lifetime = copy ? m_stringLifetime : Lifetime::Temporary;
|
||||
const Lifetime lifetime = !copy ? m_stringLifetime : Lifetime::Temporary;
|
||||
return CheckResult(m_visitor->String(AZStd::string_view(str, length), lifetime));
|
||||
}
|
||||
|
||||
@@ -373,11 +373,7 @@ namespace AZ::Dom::Json
|
||||
bool RapidJsonReadHandler::Key(const char* str, rapidjson::SizeType length, [[maybe_unused]] bool copy)
|
||||
{
|
||||
AZStd::string_view key = AZStd::string_view(str, length);
|
||||
if (!m_visitor->SupportsRawKeys())
|
||||
{
|
||||
m_visitor->Key(AZ::Name(key));
|
||||
}
|
||||
const Lifetime lifetime = copy ? m_stringLifetime : Lifetime::Temporary;
|
||||
const Lifetime lifetime = !copy ? m_stringLifetime : Lifetime::Temporary;
|
||||
return CheckResult(m_visitor->RawKey(key, lifetime));
|
||||
}
|
||||
|
||||
|
||||
@@ -21,4 +21,164 @@ namespace AZ::Dom::Utils
|
||||
{
|
||||
return backend.ReadFromBufferInPlace(string.data(), string.size(), visitor);
|
||||
}
|
||||
}
|
||||
|
||||
AZ::Outcome<Value, AZStd::string> WriteToValue(const Backend::WriteCallback& writeCallback)
|
||||
{
|
||||
Value value;
|
||||
AZStd::unique_ptr<Visitor> writer = value.GetWriteHandler();
|
||||
Visitor::Result result = writeCallback(*writer);
|
||||
if (!result.IsSuccess())
|
||||
{
|
||||
return AZ::Failure(result.GetError().FormatVisitorErrorMessage());
|
||||
}
|
||||
return AZ::Success(AZStd::move(value));
|
||||
}
|
||||
|
||||
bool DeepCompareIsEqual(const Value& lhs, const Value& rhs)
|
||||
{
|
||||
const Value::ValueType& lhsValue = lhs.GetInternalValue();
|
||||
const Value::ValueType& rhsValue = rhs.GetInternalValue();
|
||||
|
||||
if (lhs.IsString() && rhs.IsString())
|
||||
{
|
||||
// If we both hold the same ref counted string we don't need to do a full comparison
|
||||
if (AZStd::holds_alternative<Value::SharedStringType>(lhsValue) && lhsValue == rhsValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return lhs.GetString() == rhs.GetString();
|
||||
}
|
||||
|
||||
return AZStd::visit(
|
||||
[&](auto&& ourValue) -> bool
|
||||
{
|
||||
using Alternative = AZStd::decay_t<decltype(ourValue)>;
|
||||
|
||||
if constexpr (AZStd::is_same_v<Alternative, ObjectPtr>)
|
||||
{
|
||||
if (!rhs.IsObject())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
auto&& theirValue = AZStd::get<AZStd::remove_cvref_t<decltype(ourValue)>>(rhsValue);
|
||||
if (ourValue == theirValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const Object::ContainerType& ourValues = ourValue->GetValues();
|
||||
const Object::ContainerType& theirValues = theirValue->GetValues();
|
||||
|
||||
if (ourValues.size() != theirValues.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < ourValues.size(); ++i)
|
||||
{
|
||||
const Object::EntryType& lhsChild = ourValues[i];
|
||||
const Object::EntryType& rhsChild = theirValues[i];
|
||||
if (lhsChild.first != rhsChild.first || !DeepCompareIsEqual(lhsChild.second, rhsChild.second))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if constexpr (AZStd::is_same_v<Alternative, ArrayPtr>)
|
||||
{
|
||||
if (!rhs.IsArray())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
auto&& theirValue = AZStd::get<AZStd::remove_cvref_t<decltype(ourValue)>>(rhsValue);
|
||||
if (ourValue == theirValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const Array::ContainerType& ourValues = ourValue->GetValues();
|
||||
const Array::ContainerType& theirValues = theirValue->GetValues();
|
||||
|
||||
if (ourValues.size() != theirValues.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < ourValues.size(); ++i)
|
||||
{
|
||||
const Value& lhsChild = ourValues[i];
|
||||
const Value& rhsChild = theirValues[i];
|
||||
if (!DeepCompareIsEqual(lhsChild, rhsChild))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if constexpr (AZStd::is_same_v<Alternative, NodePtr>)
|
||||
{
|
||||
if (!rhs.IsNode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
auto&& theirValue = AZStd::get<AZStd::remove_cvref_t<decltype(ourValue)>>(rhsValue);
|
||||
if (ourValue == theirValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const Node& ourNode = *ourValue;
|
||||
const Node& theirNode = *theirValue;
|
||||
|
||||
const Object::ContainerType& ourProperties = ourNode.GetProperties();
|
||||
const Object::ContainerType& theirProperties = theirNode.GetProperties();
|
||||
|
||||
if (ourProperties.size() != theirProperties.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < ourProperties.size(); ++i)
|
||||
{
|
||||
const Object::EntryType& lhsChild = ourProperties[i];
|
||||
const Object::EntryType& rhsChild = theirProperties[i];
|
||||
if (lhsChild.first != rhsChild.first || !DeepCompareIsEqual(lhsChild.second, rhsChild.second))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const Array::ContainerType& ourChildren = ourNode.GetChildren();
|
||||
const Array::ContainerType& theirChildren = theirNode.GetChildren();
|
||||
|
||||
for (size_t i = 0; i < ourChildren.size(); ++i)
|
||||
{
|
||||
const Value& lhsChild = ourChildren[i];
|
||||
const Value& rhsChild = theirChildren[i];
|
||||
if (!DeepCompareIsEqual(lhsChild, rhsChild))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return lhs == rhs;
|
||||
}
|
||||
},
|
||||
lhsValue);
|
||||
}
|
||||
|
||||
Value DeepCopy(const Value& value, bool copyStrings)
|
||||
{
|
||||
Value copiedValue;
|
||||
AZStd::unique_ptr<Visitor> writer = copiedValue.GetWriteHandler();
|
||||
value.Accept(*writer, copyStrings);
|
||||
return copiedValue;
|
||||
}
|
||||
} // namespace AZ::Dom::Utils
|
||||
|
||||
@@ -9,9 +9,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/DOM/DomBackend.h>
|
||||
#include <AzCore/DOM/DomValue.h>
|
||||
|
||||
namespace AZ::Dom::Utils
|
||||
{
|
||||
Visitor::Result ReadFromString(Backend& backend, AZStd::string_view string, AZ::Dom::Lifetime lifetime, Visitor& visitor);
|
||||
Visitor::Result ReadFromStringInPlace(Backend& backend, AZStd::string& string, Visitor& visitor);
|
||||
|
||||
AZ::Outcome<Value, AZStd::string> WriteToValue(const Backend::WriteCallback& writeCallback);
|
||||
|
||||
bool DeepCompareIsEqual(const Value& lhs, const Value& rhs);
|
||||
Value DeepCopy(const Value& value, bool copyStrings = true);
|
||||
} // namespace AZ::Dom::Utils
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,402 @@
|
||||
/*
|
||||
* 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/DOM/DomBackend.h>
|
||||
#include <AzCore/DOM/DomVisitor.h>
|
||||
#include <AzCore/Memory/HphaSchema.h>
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
#include <AzCore/Memory/PoolAllocator.h>
|
||||
#include <AzCore/std/containers/array.h>
|
||||
#include <AzCore/std/containers/stack.h>
|
||||
#include <AzCore/std/containers/unordered_map.h>
|
||||
#include <AzCore/std/containers/variant.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/std/smart_ptr/shared_ptr.h>
|
||||
|
||||
namespace AZ::Dom
|
||||
{
|
||||
using KeyType = AZ::Name;
|
||||
|
||||
//! The type of underlying value stored in a value. \see Value
|
||||
enum class Type
|
||||
{
|
||||
Null,
|
||||
Bool,
|
||||
Object,
|
||||
Array,
|
||||
String,
|
||||
Int64,
|
||||
Uint64,
|
||||
Double,
|
||||
Node,
|
||||
Opaque,
|
||||
};
|
||||
|
||||
//! The allocator used by Value.
|
||||
//! Value heap allocates shared_ptrs for its container storage (Array / Object / Node) alongside
|
||||
class ValueAllocator final : public SimpleSchemaAllocator<AZ::HphaSchema, AZ::HphaSchema::Descriptor, false, false>
|
||||
{
|
||||
public:
|
||||
AZ_TYPE_INFO(ValueAllocator, "{5BC8B389-72C7-459E-B502-12E74D61869F}");
|
||||
|
||||
using Base = SimpleSchemaAllocator<AZ::HphaSchema, AZ::HphaSchema::Descriptor, false, false>;
|
||||
|
||||
ValueAllocator()
|
||||
: Base("DomValueAllocator", "Allocator for AZ::Dom::Value")
|
||||
{
|
||||
DisableOverriding();
|
||||
}
|
||||
};
|
||||
|
||||
using StdValueAllocator = AZStdAlloc<ValueAllocator>;
|
||||
|
||||
class Value;
|
||||
|
||||
//! Internal storage for a Value array: an ordered list of Values.
|
||||
class Array
|
||||
{
|
||||
public:
|
||||
using ContainerType = AZStd::vector<Value, StdValueAllocator>;
|
||||
using Iterator = ContainerType::iterator;
|
||||
using ConstIterator = ContainerType::const_iterator;
|
||||
static constexpr const size_t ReserveIncrement = 4;
|
||||
static_assert((ReserveIncrement & (ReserveIncrement - 1)) == 0, "ReserveIncremenet must be a power of 2");
|
||||
|
||||
const ContainerType& GetValues() const;
|
||||
|
||||
private:
|
||||
ContainerType m_values;
|
||||
|
||||
friend class Value;
|
||||
};
|
||||
|
||||
using ArrayPtr = AZStd::shared_ptr<Array>;
|
||||
using ConstArrayPtr = AZStd::shared_ptr<const Array>;
|
||||
|
||||
//! Internal storage for a Value object: an ordered list of Name / Value pairs.
|
||||
class Object
|
||||
{
|
||||
public:
|
||||
using EntryType = AZStd::pair<KeyType, Value>;
|
||||
using ContainerType = AZStd::vector<EntryType, StdValueAllocator>;
|
||||
using Iterator = ContainerType::iterator;
|
||||
using ConstIterator = ContainerType::const_iterator;
|
||||
static constexpr const size_t ReserveIncrement = 8;
|
||||
static_assert((ReserveIncrement & (ReserveIncrement - 1)) == 0, "ReserveIncremenet must be a power of 2");
|
||||
|
||||
const ContainerType& GetValues() const;
|
||||
|
||||
private:
|
||||
ContainerType m_values;
|
||||
|
||||
friend class Value;
|
||||
};
|
||||
|
||||
using ObjectPtr = AZStd::shared_ptr<Object>;
|
||||
using ConstObjectPtr = AZStd::shared_ptr<const Object>;
|
||||
|
||||
//! Storage for a Value node: a named Value with both properties and children.
|
||||
//! Properties are stored as an ordered list of Name / Value pairs.
|
||||
//! Children are stored as an oredered list of Values.
|
||||
class Node
|
||||
{
|
||||
public:
|
||||
Node() = default;
|
||||
Node(const Node&) = default;
|
||||
Node(Node&&) = default;
|
||||
explicit Node(AZ::Name name);
|
||||
|
||||
Node& operator=(const Node&) = default;
|
||||
Node& operator=(Node&&) = default;
|
||||
|
||||
AZ::Name GetName() const;
|
||||
void SetName(AZ::Name name);
|
||||
|
||||
Object::ContainerType& GetProperties();
|
||||
const Object::ContainerType& GetProperties() const;
|
||||
|
||||
Array::ContainerType& GetChildren();
|
||||
const Array::ContainerType& GetChildren() const;
|
||||
|
||||
private:
|
||||
AZ::Name m_name;
|
||||
Object::ContainerType m_properties;
|
||||
Array::ContainerType m_children;
|
||||
|
||||
friend class Value;
|
||||
};
|
||||
|
||||
using NodePtr = AZStd::shared_ptr<Node>;
|
||||
using ConstNodePtr = AZStd::shared_ptr<Node>;
|
||||
|
||||
//! Value is a typed union of Dom types that can represent the types provdied by AZ::Dom::Visitor.
|
||||
//! Value can be one of the following types:
|
||||
//! - Null: a type with no value, this is the default type for Value
|
||||
//! - Bool: a true or false boolean value
|
||||
//! - Object: a container with an ordered list of Name/Value pairs, analagous to a JSON object
|
||||
//! - Array: a container with an ordered list of Values, analagous to a JSON array
|
||||
//! - String: a UTF-8 string
|
||||
//! - Int64: a signed, 64-bit integer
|
||||
//! - Uint64: an unsigned, 64-bit integer
|
||||
//! - Double: a double precision floating point value
|
||||
//! - Node: a container with a Name, an ordered list of Name/Values pairs (attributes), and an ordered list of Values (children),
|
||||
//! analagous to an XML node
|
||||
//! - Opaque: an arbitrary value stored in an AZStd::any. This is a non-serializable representation of an entry used only for in-memory
|
||||
//! options. This is intended to be used as an intermediate value over the course of DOM transformation and as a proxy to pass through
|
||||
//! types of which the DOM has no knowledge to other systems.
|
||||
//! \note Value is a copy-on-write data structure and may be cheaply returned by value. Heap allocated data larger than the size of the
|
||||
//! value itself (objects, arrays, and nodes) are copied by new Values only when their contents change, so care should be taken in
|
||||
//! performance critical code to avoid mutation operations such as operator[] to avoid copies. It is recommended that an immutable Value
|
||||
//! be explicitly be stored as a `const Value` to avoid accidental detach and copy operations.
|
||||
class Value final
|
||||
{
|
||||
public:
|
||||
// Determine the short string buffer size based on the size of our largest internal type (string_view)
|
||||
// minus the size of the short string size field.
|
||||
static constexpr const size_t ShortStringSize = sizeof(AZStd::string_view) - 2;
|
||||
using ShortStringType = AZStd::fixed_string<ShortStringSize>;
|
||||
using SharedStringContainer = AZStd::vector<char>;
|
||||
using SharedStringType = AZStd::shared_ptr<const SharedStringContainer>;
|
||||
using OpaqueStorageType = AZStd::shared_ptr<AZStd::any>;
|
||||
|
||||
//! The internal storage type for Value.
|
||||
//! These types do not correspond one-to-one with the Value's external Type as there may be multiple storage classes
|
||||
//! for the same type in some instances, such as string storage.
|
||||
using ValueType = AZStd::variant<
|
||||
// Null
|
||||
AZStd::monostate,
|
||||
// Int64
|
||||
int64_t,
|
||||
// Uint64
|
||||
uint64_t,
|
||||
// Double
|
||||
double,
|
||||
// Bool
|
||||
bool,
|
||||
// String
|
||||
AZStd::string_view,
|
||||
SharedStringType,
|
||||
ShortStringType,
|
||||
// Object
|
||||
ObjectPtr,
|
||||
// Array
|
||||
ArrayPtr,
|
||||
// Node
|
||||
NodePtr,
|
||||
// Opaque
|
||||
OpaqueStorageType>;
|
||||
|
||||
// Constructors...
|
||||
Value() = default;
|
||||
Value(const Value&);
|
||||
Value(Value&&) noexcept;
|
||||
Value(AZStd::string_view stringView, bool copy);
|
||||
explicit Value(const ValueType&);
|
||||
explicit Value(ValueType&&);
|
||||
explicit Value(SharedStringType sharedString);
|
||||
|
||||
explicit Value(int8_t value);
|
||||
explicit Value(uint8_t value);
|
||||
explicit Value(int16_t value);
|
||||
explicit Value(uint16_t value);
|
||||
explicit Value(int32_t value);
|
||||
explicit Value(uint32_t value);
|
||||
explicit Value(int64_t value);
|
||||
explicit Value(uint64_t value);
|
||||
explicit Value(float value);
|
||||
explicit Value(double value);
|
||||
explicit Value(bool value);
|
||||
|
||||
explicit Value(Type type);
|
||||
|
||||
// Disable accidental calls to Value(bool) with pointer types
|
||||
template<class T>
|
||||
explicit Value(T*) = delete;
|
||||
|
||||
static Value FromOpaqueValue(const AZStd::any& value);
|
||||
|
||||
// Equality / comparison / swap...
|
||||
Value& operator=(const Value&);
|
||||
Value& operator=(Value&&) noexcept;
|
||||
|
||||
//! Assignment operator to allow forwarding types constructible via Value(T) to be assigned
|
||||
template<class T>
|
||||
auto operator=(T&& arg)
|
||||
-> AZStd::enable_if_t<!AZStd::is_same_v<AZStd::remove_cvref_t<T>, Value> && AZStd::is_constructible_v<Value, T>, Value&>
|
||||
{
|
||||
return operator=(Value(AZStd::forward<T>(arg)));
|
||||
}
|
||||
|
||||
bool operator==(const Value& rhs) const;
|
||||
bool operator!=(const Value& rhs) const;
|
||||
|
||||
void Swap(Value& other) noexcept;
|
||||
|
||||
// Type info...
|
||||
Type GetType() const;
|
||||
bool IsNull() const;
|
||||
bool IsFalse() const;
|
||||
bool IsTrue() const;
|
||||
bool IsBool() const;
|
||||
bool IsNode() const;
|
||||
bool IsObject() const;
|
||||
bool IsArray() const;
|
||||
bool IsOpaqueValue() const;
|
||||
bool IsNumber() const;
|
||||
bool IsInt() const;
|
||||
bool IsUint() const;
|
||||
bool IsDouble() const;
|
||||
bool IsString() const;
|
||||
|
||||
// Object API (also used by Node)...
|
||||
Value& SetObject();
|
||||
size_t MemberCount() const;
|
||||
size_t MemberCapacity() const;
|
||||
bool ObjectEmpty() const;
|
||||
|
||||
Value& operator[](KeyType name);
|
||||
const Value& operator[](KeyType name) const;
|
||||
Value& operator[](AZStd::string_view name);
|
||||
const Value& operator[](AZStd::string_view name) const;
|
||||
|
||||
Object::ConstIterator MemberBegin() const;
|
||||
Object::ConstIterator MemberEnd() const;
|
||||
Object::Iterator MemberBegin();
|
||||
Object::Iterator MemberEnd();
|
||||
|
||||
Object::Iterator FindMutableMember(KeyType name);
|
||||
Object::Iterator FindMutableMember(AZStd::string_view name);
|
||||
Object::ConstIterator FindMember(KeyType name) const;
|
||||
Object::ConstIterator FindMember(AZStd::string_view name) const;
|
||||
|
||||
Value& MemberReserve(size_t newCapacity);
|
||||
bool HasMember(KeyType name) const;
|
||||
bool HasMember(AZStd::string_view name) const;
|
||||
|
||||
Value& AddMember(KeyType name, const Value& value);
|
||||
Value& AddMember(AZStd::string_view name, const Value& value);
|
||||
Value& AddMember(KeyType name, Value&& value);
|
||||
Value& AddMember(AZStd::string_view name, Value&& value);
|
||||
|
||||
void RemoveAllMembers();
|
||||
void RemoveMember(KeyType name);
|
||||
void RemoveMember(AZStd::string_view name);
|
||||
Object::Iterator RemoveMember(Object::Iterator pos);
|
||||
Object::Iterator EraseMember(Object::ConstIterator pos);
|
||||
Object::Iterator EraseMember(Object::ConstIterator first, Object::ConstIterator last);
|
||||
Object::Iterator EraseMember(KeyType name);
|
||||
Object::Iterator EraseMember(AZStd::string_view name);
|
||||
|
||||
Object::ContainerType& GetMutableObject();
|
||||
const Object::ContainerType& GetObject() const;
|
||||
|
||||
// Array API (also used by Node)...
|
||||
Value& SetArray();
|
||||
|
||||
size_t ArraySize() const;
|
||||
size_t ArrayCapacity() const;
|
||||
bool IsArrayEmpty() const;
|
||||
void ClearArray();
|
||||
|
||||
Value& operator[](size_t index);
|
||||
const Value& operator[](size_t index) const;
|
||||
|
||||
Value& MutableArrayAt(size_t index);
|
||||
const Value& ArrayAt(size_t index) const;
|
||||
|
||||
Array::ConstIterator ArrayBegin() const;
|
||||
Array::ConstIterator ArrayEnd() const;
|
||||
Array::Iterator ArrayBegin();
|
||||
Array::Iterator ArrayEnd();
|
||||
|
||||
Value& ArrayReserve(size_t newCapacity);
|
||||
Value& ArrayPushBack(Value value);
|
||||
Value& ArrayPopBack();
|
||||
|
||||
Array::Iterator ArrayErase(Array::ConstIterator pos);
|
||||
Array::Iterator ArrayErase(Array::ConstIterator first, Array::ConstIterator last);
|
||||
|
||||
Array::ContainerType& GetMutableArray();
|
||||
const Array::ContainerType& GetArray() const;
|
||||
|
||||
// Node API (supports both object + array API, plus a dedicated NodeName)...
|
||||
void SetNode(AZ::Name name);
|
||||
void SetNode(AZStd::string_view name);
|
||||
|
||||
AZ::Name GetNodeName() const;
|
||||
void SetNodeName(AZ::Name name);
|
||||
void SetNodeName(AZStd::string_view name);
|
||||
//! Convenience method, sets the first non-node element of a Node.
|
||||
void SetNodeValue(Value value);
|
||||
//! Convenience method, gets the first non-node element of a Node.
|
||||
Value GetNodeValue() const;
|
||||
|
||||
Node& GetMutableNode();
|
||||
const Node& GetNode() const;
|
||||
|
||||
// int API...
|
||||
int64_t GetInt64() const;
|
||||
void SetInt64(int64_t);
|
||||
|
||||
// uint API...
|
||||
uint64_t GetUint64() const;
|
||||
void SetUint64(uint64_t);
|
||||
|
||||
// bool API...
|
||||
bool GetBool() const;
|
||||
void SetBool(bool);
|
||||
|
||||
// double API...
|
||||
double GetDouble() const;
|
||||
void SetDouble(double);
|
||||
|
||||
// String API...
|
||||
AZStd::string_view GetString() const;
|
||||
size_t GetStringLength() const;
|
||||
void SetString(AZStd::string_view);
|
||||
void SetString(SharedStringType sharedString);
|
||||
void CopyFromString(AZStd::string_view);
|
||||
|
||||
// Opaque type API...
|
||||
const AZStd::any& GetOpaqueValue() const;
|
||||
//! This sets this Value to represent a value of an type that the DOM has
|
||||
//! no formal knowledge of. Where possible, it should be preferred to
|
||||
//! serialize an opaque type into a DOM value instead, as serializers
|
||||
//! and other systems will have no means of dealing with fully arbitrary
|
||||
//! values.
|
||||
void SetOpaqueValue(AZStd::any);
|
||||
|
||||
// Null API...
|
||||
void SetNull();
|
||||
|
||||
// Visitor API...
|
||||
Visitor::Result Accept(Visitor& visitor, bool copyStrings) const;
|
||||
AZStd::unique_ptr<Visitor> GetWriteHandler();
|
||||
|
||||
//! Gets the internal value of this Value. Note that this value's types may not correspond one-to-one with the Type enumeration,
|
||||
//! as internally the same type might have different storage mechanisms. Where possible, prefer using the typed API.
|
||||
const ValueType& GetInternalValue() const;
|
||||
|
||||
private:
|
||||
const Node& GetNodeInternal() const;
|
||||
Node& GetNodeInternal();
|
||||
const Object::ContainerType& GetObjectInternal() const;
|
||||
Object::ContainerType& GetObjectInternal();
|
||||
const Array::ContainerType& GetArrayInternal() const;
|
||||
Array::ContainerType& GetArrayInternal();
|
||||
|
||||
explicit Value(AZStd::any opaqueValue);
|
||||
|
||||
static_assert(
|
||||
sizeof(ValueType) == sizeof(ShortStringType) + sizeof(size_t), "ValueType should have no members larger than ShortStringType");
|
||||
|
||||
ValueType m_value;
|
||||
};
|
||||
} // namespace AZ::Dom
|
||||
@@ -0,0 +1,262 @@
|
||||
/*
|
||||
* 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 <AzCore/DOM/DomValueWriter.h>
|
||||
|
||||
namespace AZ::Dom
|
||||
{
|
||||
ValueWriter::ValueWriter(Value& outputValue)
|
||||
: m_result(outputValue)
|
||||
{
|
||||
}
|
||||
|
||||
VisitorFlags ValueWriter::GetVisitorFlags() const
|
||||
{
|
||||
return VisitorFlags::SupportsRawKeys | VisitorFlags::SupportsArrays | VisitorFlags::SupportsObjects | VisitorFlags::SupportsNodes;
|
||||
}
|
||||
|
||||
ValueWriter::ValueInfo::ValueInfo(Value& container)
|
||||
: m_container(container)
|
||||
{
|
||||
}
|
||||
|
||||
Visitor::Result ValueWriter::Null()
|
||||
{
|
||||
CurrentValue().SetNull();
|
||||
return FinishWrite();
|
||||
}
|
||||
|
||||
Visitor::Result ValueWriter::Bool(bool value)
|
||||
{
|
||||
CurrentValue().SetBool(value);
|
||||
return FinishWrite();
|
||||
}
|
||||
|
||||
Visitor::Result ValueWriter::Int64(AZ::s64 value)
|
||||
{
|
||||
CurrentValue().SetInt64(value);
|
||||
return FinishWrite();
|
||||
}
|
||||
|
||||
Visitor::Result ValueWriter::Uint64(AZ::u64 value)
|
||||
{
|
||||
CurrentValue().SetUint64(value);
|
||||
return FinishWrite();
|
||||
}
|
||||
|
||||
Visitor::Result ValueWriter::Double(double value)
|
||||
{
|
||||
CurrentValue().SetDouble(value);
|
||||
return FinishWrite();
|
||||
}
|
||||
|
||||
Visitor::Result ValueWriter::String(AZStd::string_view value, Lifetime lifetime)
|
||||
{
|
||||
if (lifetime == Lifetime::Persistent)
|
||||
{
|
||||
CurrentValue().SetString(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentValue().CopyFromString(value);
|
||||
}
|
||||
return FinishWrite();
|
||||
}
|
||||
|
||||
Visitor::Result ValueWriter::RefCountedString(AZStd::shared_ptr<const AZStd::vector<char>> value, [[maybe_unused]] Lifetime lifetime)
|
||||
{
|
||||
CurrentValue().SetString(AZStd::move(value));
|
||||
return FinishWrite();
|
||||
}
|
||||
|
||||
Visitor::Result ValueWriter::StartObject()
|
||||
{
|
||||
CurrentValue().SetObject();
|
||||
|
||||
m_entryStack.emplace(CurrentValue());
|
||||
return VisitorSuccess();
|
||||
}
|
||||
|
||||
template <class T, class A>
|
||||
void MoveVectorMemory(AZStd::vector<T, A>& dest, AZStd::vector<T, A>& source)
|
||||
{
|
||||
dest.resize_no_construct(source.size());
|
||||
const size_t size = sizeof(T) * source.size();
|
||||
memcpy(dest.data(), source.data(), size);
|
||||
memset(source.data(), 0, size);
|
||||
source.resize(0);
|
||||
}
|
||||
|
||||
Visitor::Result ValueWriter::EndContainer(Type containerType, AZ::u64 attributeCount, AZ::u64 elementCount)
|
||||
{
|
||||
const char* endMethodName;
|
||||
switch (containerType)
|
||||
{
|
||||
case Type::Object:
|
||||
endMethodName = "EndObject";
|
||||
break;
|
||||
case Type::Array:
|
||||
endMethodName = "EndArray";
|
||||
break;
|
||||
case Type::Node:
|
||||
endMethodName = "EndNode";
|
||||
break;
|
||||
default:
|
||||
AZ_Assert(false, "Invalid container type specified");
|
||||
return VisitorFailure(VisitorErrorCode::InternalError, "AZ::Dom::ValueWriter: EndContainer called with invalid container type");
|
||||
}
|
||||
|
||||
if (m_entryStack.empty())
|
||||
{
|
||||
return VisitorFailure(
|
||||
VisitorErrorCode::InternalError,
|
||||
AZStd::string::format("AZ::Dom::ValueWriter: %s called without a matching call", endMethodName));
|
||||
}
|
||||
|
||||
const ValueInfo& topEntry = m_entryStack.top();
|
||||
Value& container = topEntry.m_container;
|
||||
ValueBuffer& buffer = GetValueBuffer();
|
||||
|
||||
if (container.GetType() != containerType)
|
||||
{
|
||||
return VisitorFailure(
|
||||
VisitorErrorCode::InternalError,
|
||||
AZStd::string::format("AZ::Dom::ValueWriter: %s called from within a different container type", endMethodName));
|
||||
}
|
||||
|
||||
if (aznumeric_cast<AZ::u64>(buffer.m_attributes.size()) != attributeCount)
|
||||
{
|
||||
return VisitorFailure(
|
||||
VisitorErrorCode::InternalError,
|
||||
AZStd::string::format(
|
||||
"AZ::Dom::ValueWriter: %s expected %llu attributes but received %zu attributes instead", endMethodName, attributeCount,
|
||||
buffer.m_attributes.size()));
|
||||
}
|
||||
|
||||
if (aznumeric_cast<AZ::u64>(buffer.m_elements.size()) != elementCount)
|
||||
{
|
||||
return VisitorFailure(
|
||||
VisitorErrorCode::InternalError,
|
||||
AZStd::string::format(
|
||||
"AZ::Dom::ValueWriter: %s expected %llu elements but received %zu elements instead", endMethodName, elementCount,
|
||||
buffer.m_elements.size()));
|
||||
}
|
||||
|
||||
if (buffer.m_attributes.size() > 0)
|
||||
{
|
||||
MoveVectorMemory(container.GetMutableObject(), buffer.m_attributes);
|
||||
}
|
||||
|
||||
if(buffer.m_elements.size() > 0)
|
||||
{
|
||||
MoveVectorMemory(container.GetMutableArray(), buffer.m_elements);
|
||||
}
|
||||
|
||||
m_entryStack.pop();
|
||||
return FinishWrite();
|
||||
}
|
||||
|
||||
ValueWriter::ValueBuffer& ValueWriter::GetValueBuffer()
|
||||
{
|
||||
if (m_entryStack.size() <= m_valueBuffers.size())
|
||||
{
|
||||
return m_valueBuffers[m_entryStack.size() - 1];
|
||||
}
|
||||
|
||||
m_valueBuffers.resize(m_entryStack.size());
|
||||
return m_valueBuffers[m_entryStack.size() - 1];
|
||||
}
|
||||
|
||||
Visitor::Result ValueWriter::EndObject(AZ::u64 attributeCount)
|
||||
{
|
||||
return EndContainer(Type::Object, attributeCount, 0);
|
||||
}
|
||||
|
||||
Visitor::Result ValueWriter::Key(AZ::Name key)
|
||||
{
|
||||
AZ_Assert(!m_entryStack.empty(), "Attempmted to push a key with no object");
|
||||
AZ_Assert(!m_entryStack.top().m_container.IsArray(), "Attempted to push a key to an array");
|
||||
m_entryStack.top().m_key = AZStd::move(key);
|
||||
return VisitorSuccess();
|
||||
}
|
||||
|
||||
Visitor::Result ValueWriter::RawKey(AZStd::string_view key, [[maybe_unused]] Lifetime lifetime)
|
||||
{
|
||||
return Key(AZ::Name(key));
|
||||
}
|
||||
|
||||
Visitor::Result ValueWriter::StartArray()
|
||||
{
|
||||
CurrentValue().SetArray();
|
||||
|
||||
m_entryStack.emplace(CurrentValue());
|
||||
return VisitorSuccess();
|
||||
}
|
||||
|
||||
Visitor::Result ValueWriter::EndArray(AZ::u64 elementCount)
|
||||
{
|
||||
return EndContainer(Type::Array, 0, elementCount);
|
||||
}
|
||||
|
||||
Visitor::Result ValueWriter::StartNode(AZ::Name name)
|
||||
{
|
||||
CurrentValue().SetNode(name);
|
||||
|
||||
m_entryStack.emplace(CurrentValue());
|
||||
return VisitorSuccess();
|
||||
}
|
||||
|
||||
Visitor::Result ValueWriter::RawStartNode(AZStd::string_view name, [[maybe_unused]] Lifetime lifetime)
|
||||
{
|
||||
return StartNode(AZ::Name(name));
|
||||
}
|
||||
|
||||
Visitor::Result ValueWriter::EndNode(AZ::u64 attributeCount, AZ::u64 elementCount)
|
||||
{
|
||||
return EndContainer(Type::Node, attributeCount, elementCount);
|
||||
}
|
||||
|
||||
Visitor::Result ValueWriter::OpaqueValue(OpaqueType& value)
|
||||
{
|
||||
CurrentValue().SetOpaqueValue(value);
|
||||
return FinishWrite();
|
||||
}
|
||||
|
||||
Visitor::Result ValueWriter::FinishWrite()
|
||||
{
|
||||
if (m_entryStack.empty())
|
||||
{
|
||||
return VisitorSuccess();
|
||||
}
|
||||
|
||||
Value value;
|
||||
m_entryStack.top().m_value.Swap(value);
|
||||
ValueInfo& newEntry = m_entryStack.top();
|
||||
|
||||
if (!newEntry.m_key.IsEmpty())
|
||||
{
|
||||
GetValueBuffer().m_attributes.emplace_back(AZStd::move(newEntry.m_key), AZStd::move(value));
|
||||
newEntry.m_key = AZ::Name();
|
||||
}
|
||||
else
|
||||
{
|
||||
GetValueBuffer().m_elements.emplace_back(AZStd::move(value));
|
||||
}
|
||||
|
||||
return VisitorSuccess();
|
||||
}
|
||||
|
||||
Value& ValueWriter::CurrentValue()
|
||||
{
|
||||
if (m_entryStack.empty())
|
||||
{
|
||||
return m_result;
|
||||
}
|
||||
return m_entryStack.top().m_value;
|
||||
}
|
||||
} // namespace AZ::Dom
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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/DOM/DomValue.h>
|
||||
#include <AzCore/std/containers/stack.h>
|
||||
|
||||
namespace AZ::Dom
|
||||
{
|
||||
//! Visitor that writes to a Value.
|
||||
//! Supports all Visitor operations.
|
||||
class ValueWriter : public Visitor
|
||||
{
|
||||
public:
|
||||
ValueWriter(Value& outputValue);
|
||||
|
||||
VisitorFlags GetVisitorFlags() const override;
|
||||
Result Null() override;
|
||||
Result Bool(bool value) override;
|
||||
Result Int64(AZ::s64 value) override;
|
||||
Result Uint64(AZ::u64 value) override;
|
||||
Result Double(double value) override;
|
||||
|
||||
Result String(AZStd::string_view value, Lifetime lifetime) override;
|
||||
Result RefCountedString(AZStd::shared_ptr<const AZStd::vector<char>> value, Lifetime lifetime) override;
|
||||
Result StartObject() override;
|
||||
Result EndObject(AZ::u64 attributeCount) override;
|
||||
Result Key(AZ::Name key) override;
|
||||
Result RawKey(AZStd::string_view key, Lifetime lifetime) override;
|
||||
Result StartArray() override;
|
||||
Result EndArray(AZ::u64 elementCount) override;
|
||||
Result StartNode(AZ::Name name) override;
|
||||
Result RawStartNode(AZStd::string_view name, Lifetime lifetime) override;
|
||||
Result EndNode(AZ::u64 attributeCount, AZ::u64 elementCount) override;
|
||||
Result OpaqueValue(OpaqueType& value) override;
|
||||
|
||||
private:
|
||||
Result FinishWrite();
|
||||
Value& CurrentValue();
|
||||
Visitor::Result EndContainer(Type containerType, AZ::u64 attributeCount, AZ::u64 elementCount);
|
||||
|
||||
struct ValueInfo
|
||||
{
|
||||
ValueInfo(Value& container);
|
||||
|
||||
KeyType m_key;
|
||||
Value m_value;
|
||||
Value& m_container;
|
||||
};
|
||||
|
||||
struct ValueBuffer
|
||||
{
|
||||
Array::ContainerType m_elements;
|
||||
Object::ContainerType m_attributes;
|
||||
};
|
||||
|
||||
ValueBuffer& GetValueBuffer();
|
||||
|
||||
Value& m_result;
|
||||
// Stores info about the current value being processed
|
||||
AZStd::stack<ValueInfo, AZStd::deque<ValueInfo, AZStdAlloc<ValueAllocator>>> m_entryStack;
|
||||
// Provides temporary storage for elements and attributes to prevent extra heap allocations
|
||||
// These buffers persist to be reused even as the entry stack changes
|
||||
AZStd::vector<ValueBuffer, AZStdAlloc<ValueAllocator>> m_valueBuffers;
|
||||
};
|
||||
} // namespace AZ::Dom
|
||||
@@ -105,7 +105,12 @@ namespace AZ::Dom
|
||||
return VisitorSuccess();
|
||||
}
|
||||
|
||||
Visitor::Result Visitor::OpaqueValue([[maybe_unused]] const OpaqueType& value, [[maybe_unused]] Lifetime lifetime)
|
||||
Visitor::Result Visitor::RefCountedString(AZStd::shared_ptr<const AZStd::vector<char>> value, Lifetime lifetime)
|
||||
{
|
||||
return String({ value->data(), value->size() }, lifetime);
|
||||
}
|
||||
|
||||
Visitor::Result Visitor::OpaqueValue([[maybe_unused]] OpaqueType& value)
|
||||
{
|
||||
if (!SupportsOpaqueValues())
|
||||
{
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <AzCore/Name/Name.h>
|
||||
#include <AzCore/Outcome/Outcome.h>
|
||||
#include <AzCore/std/any.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/std/smart_ptr/shared_ptr.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
namespace AZ::Dom
|
||||
@@ -167,15 +169,20 @@ namespace AZ::Dom
|
||||
virtual Result Uint64(AZ::u64 value);
|
||||
//! Operates on a double precision, 64 bit floating point value.
|
||||
virtual Result Double(double value);
|
||||
//! Operates on a string value. As strings are a reference type.
|
||||
//! Storage semantics are provided to indicate where the value may be stored persistently or requires a copy.
|
||||
//! Operates on a string value. As strings are a reference type,
|
||||
//! storage semantics are provided to indicate where the value may be stored persistently or requires a copy.
|
||||
//! \param lifetime Specifies the lifetime of this string - if the string has a temporary lifetime, it cannot
|
||||
//! safely be stored as a reference.
|
||||
virtual Result String(AZStd::string_view value, Lifetime lifetime);
|
||||
//! Operates on a ref-counted string value. S
|
||||
//! \param lifetime Specifies the lifetime of this string. If the string has a temporary lifetime, it may not
|
||||
//! be safely stored as a reference, but may still be safely stored as a ref-counted shared_ptr.
|
||||
virtual Result RefCountedString(AZStd::shared_ptr<const AZStd::vector<char>> value, Lifetime lifetime);
|
||||
//! Operates on an opaque value. As opaque values are a reference type, storage semantics are provided to
|
||||
//! indicate where the value may be stored persistently or requires a copy.
|
||||
//! The base implementation of OpaqueValue rejects the operation, as opaque values are meant for special
|
||||
//! cases with specific implementations, not generic usage.
|
||||
//! Storage semantics are provided to indicate where the value may be stored persistently or requires a copy.
|
||||
virtual Result OpaqueValue(const OpaqueType& value, Lifetime lifetime);
|
||||
virtual Result OpaqueValue(OpaqueType& value);
|
||||
//! Operates on a raw value encoded as a UTF-8 string that hasn't had its type deduced.
|
||||
//! Visitors that support raw values (\see VisitorFlags::SupportsRawValues) may parse the raw value and
|
||||
//! forward it to the corresponding value call or calls of their choice.
|
||||
|
||||
@@ -117,6 +117,10 @@ set(FILES
|
||||
DOM/DomBackend.h
|
||||
DOM/DomUtils.cpp
|
||||
DOM/DomUtils.h
|
||||
DOM/DomValue.cpp
|
||||
DOM/DomValue.h
|
||||
DOM/DomValueWriter.cpp
|
||||
DOM/DomValueWriter.h
|
||||
DOM/DomVisitor.cpp
|
||||
DOM/DomVisitor.h
|
||||
DOM/Backends/JSON/JsonBackend.h
|
||||
|
||||
@@ -8,9 +8,10 @@
|
||||
|
||||
#if defined(HAVE_BENCHMARK)
|
||||
|
||||
#include <AzCore/DOM/DomUtils.h>
|
||||
#include <AzCore/DOM/Backends/JSON/JsonBackend.h>
|
||||
#include <AzCore/DOM/Backends/JSON/JsonSerializationUtils.h>
|
||||
#include <AzCore/DOM/DomUtils.h>
|
||||
#include <AzCore/DOM/DomValue.h>
|
||||
#include <AzCore/JSON/document.h>
|
||||
#include <AzCore/Name/NameDictionary.h>
|
||||
#include <AzCore/Serialization/Json/JsonUtils.h>
|
||||
@@ -25,27 +26,31 @@ namespace Benchmark
|
||||
{
|
||||
UnitTest::AllocatorsBenchmarkFixture::SetUp(st);
|
||||
AZ::NameDictionary::Create();
|
||||
AZ::AllocatorInstance<AZ::Dom::ValueAllocator>::Create();
|
||||
}
|
||||
|
||||
void SetUp(::benchmark::State& st) override
|
||||
{
|
||||
UnitTest::AllocatorsBenchmarkFixture::SetUp(st);
|
||||
AZ::NameDictionary::Create();
|
||||
AZ::AllocatorInstance<AZ::Dom::ValueAllocator>::Create();
|
||||
}
|
||||
|
||||
void TearDown(::benchmark::State& st) override
|
||||
{
|
||||
AZ::AllocatorInstance<AZ::Dom::ValueAllocator>::Destroy();
|
||||
AZ::NameDictionary::Destroy();
|
||||
UnitTest::AllocatorsBenchmarkFixture::TearDown(st);
|
||||
}
|
||||
|
||||
void TearDown(const ::benchmark::State& st) override
|
||||
{
|
||||
AZ::AllocatorInstance<AZ::Dom::ValueAllocator>::Destroy();
|
||||
AZ::NameDictionary::Destroy();
|
||||
UnitTest::AllocatorsBenchmarkFixture::TearDown(st);
|
||||
}
|
||||
|
||||
AZStd::string GenerateDomJsonBenchmarkPayload(int64_t entryCount, int64_t stringTemplateLength)
|
||||
rapidjson::Document GenerateDomJsonBenchmarkDocument(int64_t entryCount, int64_t stringTemplateLength)
|
||||
{
|
||||
rapidjson::Document document;
|
||||
document.SetObject();
|
||||
@@ -103,11 +108,28 @@ namespace Benchmark
|
||||
document.SetObject();
|
||||
document.AddMember("entries", createObject(), document.GetAllocator());
|
||||
|
||||
return document;
|
||||
}
|
||||
|
||||
AZStd::string GenerateDomJsonBenchmarkPayload(int64_t entryCount, int64_t stringTemplateLength)
|
||||
{
|
||||
rapidjson::Document document = GenerateDomJsonBenchmarkDocument(entryCount, stringTemplateLength);
|
||||
|
||||
AZStd::string serializedJson;
|
||||
auto result = AZ::JsonSerializationUtils::WriteJsonString(document, serializedJson);
|
||||
AZ_Assert(result.IsSuccess(), "Failed to serialize generated JSON");
|
||||
return serializedJson;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void TakeAndDiscardWithoutTimingDtor(T&& value, benchmark::State& state)
|
||||
{
|
||||
{
|
||||
T instance = AZStd::move(value);
|
||||
state.PauseTiming();
|
||||
}
|
||||
state.ResumeTiming();
|
||||
}
|
||||
};
|
||||
|
||||
// Helper macro for registering JSON benchmarks
|
||||
@@ -119,7 +141,7 @@ namespace Benchmark
|
||||
->Args({ 100, 500 }) \
|
||||
->Unit(benchmark::kMillisecond);
|
||||
|
||||
BENCHMARK_DEFINE_F(DomJsonBenchmark, DomDeserializeToDocumentInPlace)(benchmark::State& state)
|
||||
BENCHMARK_DEFINE_F(DomJsonBenchmark, AzDomDeserializeToRapidjsonInPlace)(benchmark::State& state)
|
||||
{
|
||||
AZ::Dom::JsonBackend backend;
|
||||
AZStd::string serializedPayload = GenerateDomJsonBenchmarkPayload(state.range(0), state.range(1));
|
||||
@@ -136,14 +158,38 @@ namespace Benchmark
|
||||
return AZ::Dom::Utils::ReadFromStringInPlace(backend, payloadCopy, visitor);
|
||||
});
|
||||
|
||||
benchmark::DoNotOptimize(result.GetValue());
|
||||
TakeAndDiscardWithoutTimingDtor(result.TakeValue(), state);
|
||||
}
|
||||
|
||||
state.SetBytesProcessed(serializedPayload.size() * state.iterations());
|
||||
}
|
||||
BENCHMARK_REGISTER_JSON(DomJsonBenchmark, DomDeserializeToDocumentInPlace)
|
||||
BENCHMARK_REGISTER_JSON(DomJsonBenchmark, AzDomDeserializeToRapidjsonInPlace)
|
||||
|
||||
BENCHMARK_DEFINE_F(DomJsonBenchmark, DomDeserializeToDocument)(benchmark::State& state)
|
||||
BENCHMARK_DEFINE_F(DomJsonBenchmark, AzDomDeserializeToAzDomValueInPlace)(benchmark::State& state)
|
||||
{
|
||||
AZ::Dom::JsonBackend backend;
|
||||
AZStd::string serializedPayload = GenerateDomJsonBenchmarkPayload(state.range(0), state.range(1));
|
||||
|
||||
for (auto _ : state)
|
||||
{
|
||||
state.PauseTiming();
|
||||
AZStd::string payloadCopy = serializedPayload;
|
||||
state.ResumeTiming();
|
||||
|
||||
auto result = AZ::Dom::Utils::WriteToValue(
|
||||
[&](AZ::Dom::Visitor& visitor)
|
||||
{
|
||||
return AZ::Dom::Utils::ReadFromStringInPlace(backend, payloadCopy, visitor);
|
||||
});
|
||||
|
||||
TakeAndDiscardWithoutTimingDtor(result.TakeValue(), state);
|
||||
}
|
||||
|
||||
state.SetBytesProcessed(serializedPayload.size() * state.iterations());
|
||||
}
|
||||
BENCHMARK_REGISTER_JSON(DomJsonBenchmark, AzDomDeserializeToAzDomValueInPlace)
|
||||
|
||||
BENCHMARK_DEFINE_F(DomJsonBenchmark, AzDomDeserializeToRapidjson)(benchmark::State& state)
|
||||
{
|
||||
AZ::Dom::JsonBackend backend;
|
||||
AZStd::string serializedPayload = GenerateDomJsonBenchmarkPayload(state.range(0), state.range(1));
|
||||
@@ -156,14 +202,34 @@ namespace Benchmark
|
||||
return AZ::Dom::Utils::ReadFromString(backend, serializedPayload, AZ::Dom::Lifetime::Temporary, visitor);
|
||||
});
|
||||
|
||||
benchmark::DoNotOptimize(result.GetValue());
|
||||
TakeAndDiscardWithoutTimingDtor(result.TakeValue(), state);
|
||||
}
|
||||
|
||||
state.SetBytesProcessed(serializedPayload.size() * state.iterations());
|
||||
}
|
||||
BENCHMARK_REGISTER_JSON(DomJsonBenchmark, DomDeserializeToDocument)
|
||||
BENCHMARK_REGISTER_JSON(DomJsonBenchmark, AzDomDeserializeToRapidjson)
|
||||
|
||||
BENCHMARK_DEFINE_F(DomJsonBenchmark, JsonUtilsDeserializeToDocument)(benchmark::State& state)
|
||||
BENCHMARK_DEFINE_F(DomJsonBenchmark, AzDomDeserializeToAzDomValue)(benchmark::State& state)
|
||||
{
|
||||
AZ::Dom::JsonBackend backend;
|
||||
AZStd::string serializedPayload = GenerateDomJsonBenchmarkPayload(state.range(0), state.range(1));
|
||||
|
||||
for (auto _ : state)
|
||||
{
|
||||
auto result = AZ::Dom::Utils::WriteToValue(
|
||||
[&](AZ::Dom::Visitor& visitor)
|
||||
{
|
||||
return AZ::Dom::Utils::ReadFromString(backend, serializedPayload, AZ::Dom::Lifetime::Temporary, visitor);
|
||||
});
|
||||
|
||||
TakeAndDiscardWithoutTimingDtor(result.TakeValue(), state);
|
||||
}
|
||||
|
||||
state.SetBytesProcessed(serializedPayload.size() * state.iterations());
|
||||
}
|
||||
BENCHMARK_REGISTER_JSON(DomJsonBenchmark, AzDomDeserializeToAzDomValue)
|
||||
|
||||
BENCHMARK_DEFINE_F(DomJsonBenchmark, RapidjsonDeserializeToRapidjson)(benchmark::State& state)
|
||||
{
|
||||
AZ::Dom::JsonBackend backend;
|
||||
AZStd::string serializedPayload = GenerateDomJsonBenchmarkPayload(state.range(0), state.range(1));
|
||||
@@ -172,12 +238,78 @@ namespace Benchmark
|
||||
{
|
||||
auto result = AZ::JsonSerializationUtils::ReadJsonString(serializedPayload);
|
||||
|
||||
benchmark::DoNotOptimize(result.GetValue());
|
||||
TakeAndDiscardWithoutTimingDtor(result.TakeValue(), state);
|
||||
}
|
||||
|
||||
state.SetBytesProcessed(serializedPayload.size() * state.iterations());
|
||||
}
|
||||
BENCHMARK_REGISTER_JSON(DomJsonBenchmark, JsonUtilsDeserializeToDocument)
|
||||
BENCHMARK_REGISTER_JSON(DomJsonBenchmark, RapidjsonDeserializeToRapidjson)
|
||||
|
||||
BENCHMARK_DEFINE_F(DomJsonBenchmark, RapidjsonMakeComplexObject)(benchmark::State& state)
|
||||
{
|
||||
for (auto _ : state)
|
||||
{
|
||||
TakeAndDiscardWithoutTimingDtor(GenerateDomJsonBenchmarkPayload(state.range(0), state.range(1)), state);
|
||||
}
|
||||
|
||||
state.SetItemsProcessed(state.range(0) * state.range(0) * state.iterations());
|
||||
}
|
||||
BENCHMARK_REGISTER_JSON(DomJsonBenchmark, RapidjsonMakeComplexObject)
|
||||
|
||||
BENCHMARK_DEFINE_F(DomJsonBenchmark, RapidjsonLookupMemberByString)(benchmark::State& state)
|
||||
{
|
||||
rapidjson::Document document(rapidjson::kObjectType);
|
||||
AZStd::vector<AZStd::string> keys;
|
||||
for (int64_t i = 0; i < state.range(0); ++i)
|
||||
{
|
||||
AZStd::string key(AZStd::string::format("key%" PRId64, i));
|
||||
keys.push_back(key);
|
||||
document.AddMember(rapidjson::Value(key.data(), static_cast<rapidjson::SizeType>(key.size()), document.GetAllocator()), rapidjson::Value(i), document.GetAllocator());
|
||||
}
|
||||
|
||||
for (auto _ : state)
|
||||
{
|
||||
for (const AZStd::string& key : keys)
|
||||
{
|
||||
benchmark::DoNotOptimize(document.FindMember(key.data()));
|
||||
}
|
||||
}
|
||||
|
||||
state.SetItemsProcessed(state.iterations() * state.range(0));
|
||||
}
|
||||
BENCHMARK_REGISTER_F(DomJsonBenchmark, RapidjsonLookupMemberByString)->Arg(100)->Arg(1000)->Arg(10000)->Unit(benchmark::kMillisecond);
|
||||
|
||||
BENCHMARK_DEFINE_F(DomJsonBenchmark, RapidjsonDeepCopy)(benchmark::State& state)
|
||||
{
|
||||
rapidjson::Document original = GenerateDomJsonBenchmarkDocument(state.range(0), state.range(1));
|
||||
|
||||
for (auto _ : state)
|
||||
{
|
||||
rapidjson::Document copy;
|
||||
copy.CopyFrom(original, copy.GetAllocator(), true);
|
||||
TakeAndDiscardWithoutTimingDtor(AZStd::move(copy), state);
|
||||
}
|
||||
|
||||
state.SetItemsProcessed(state.iterations());
|
||||
}
|
||||
|
||||
BENCHMARK_REGISTER_JSON(DomJsonBenchmark, RapidjsonDeepCopy)
|
||||
|
||||
BENCHMARK_DEFINE_F(DomJsonBenchmark, RapidjsonCopyAndMutate)(benchmark::State& state)
|
||||
{
|
||||
rapidjson::Document original = GenerateDomJsonBenchmarkDocument(state.range(0), state.range(1));
|
||||
|
||||
for (auto _ : state)
|
||||
{
|
||||
rapidjson::Document copy;
|
||||
copy.CopyFrom(original, copy.GetAllocator(), true);
|
||||
copy["entries"]["Key0"].PushBack(42, copy.GetAllocator());
|
||||
TakeAndDiscardWithoutTimingDtor(AZStd::move(copy), state);
|
||||
}
|
||||
|
||||
state.SetItemsProcessed(state.iterations());
|
||||
}
|
||||
BENCHMARK_REGISTER_JSON(DomJsonBenchmark, RapidjsonCopyAndMutate)
|
||||
|
||||
#undef BENCHMARK_REGISTER_JSON
|
||||
} // namespace Benchmark
|
||||
|
||||
@@ -0,0 +1,263 @@
|
||||
/*
|
||||
* 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 <AzCore/DOM/DomValue.h>
|
||||
#include <AzCore/DOM/DomUtils.h>
|
||||
#include <AzCore/Name/NameDictionary.h>
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
#include <cinttypes>
|
||||
|
||||
namespace AZ::Dom::Benchmark
|
||||
{
|
||||
class DomValueBenchmark : public UnitTest::AllocatorsBenchmarkFixture
|
||||
{
|
||||
public:
|
||||
void SetUp(const ::benchmark::State& st) override
|
||||
{
|
||||
UnitTest::AllocatorsBenchmarkFixture::SetUp(st);
|
||||
AZ::NameDictionary::Create();
|
||||
AZ::AllocatorInstance<ValueAllocator>::Create();
|
||||
}
|
||||
|
||||
void SetUp(::benchmark::State& st) override
|
||||
{
|
||||
UnitTest::AllocatorsBenchmarkFixture::SetUp(st);
|
||||
AZ::NameDictionary::Create();
|
||||
AZ::AllocatorInstance<ValueAllocator>::Create();
|
||||
}
|
||||
|
||||
void TearDown(::benchmark::State& st) override
|
||||
{
|
||||
AZ::AllocatorInstance<ValueAllocator>::Destroy();
|
||||
AZ::NameDictionary::Destroy();
|
||||
UnitTest::AllocatorsBenchmarkFixture::TearDown(st);
|
||||
}
|
||||
|
||||
void TearDown(const ::benchmark::State& st) override
|
||||
{
|
||||
AZ::AllocatorInstance<ValueAllocator>::Destroy();
|
||||
AZ::NameDictionary::Destroy();
|
||||
UnitTest::AllocatorsBenchmarkFixture::TearDown(st);
|
||||
}
|
||||
|
||||
Value GenerateDomBenchmarkPayload(int64_t entryCount, int64_t stringTemplateLength)
|
||||
{
|
||||
Value root(Type::Object);
|
||||
|
||||
AZStd::string entryTemplate;
|
||||
while (entryTemplate.size() < static_cast<size_t>(stringTemplateLength))
|
||||
{
|
||||
entryTemplate += "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor ";
|
||||
}
|
||||
entryTemplate.resize(stringTemplateLength);
|
||||
AZStd::string buffer;
|
||||
|
||||
auto createString = [&](int n) -> Value
|
||||
{
|
||||
return Value(AZStd::string::format("#%i %s", n, entryTemplate.c_str()), true);
|
||||
};
|
||||
|
||||
auto createEntry = [&](int n) -> Value
|
||||
{
|
||||
Value entry(Type::Object);
|
||||
entry.AddMember("string", createString(n));
|
||||
entry.AddMember("int", Value(n));
|
||||
entry.AddMember("double", Value(static_cast<double>(n) * 0.5));
|
||||
entry.AddMember("bool", Value(n % 2 == 0));
|
||||
entry.AddMember("null", Value(Type::Null));
|
||||
return entry;
|
||||
};
|
||||
|
||||
auto createArray = [&]() -> Value
|
||||
{
|
||||
Value array(Type::Array);
|
||||
for (int i = 0; i < entryCount; ++i)
|
||||
{
|
||||
array.ArrayPushBack(createEntry(i));
|
||||
}
|
||||
return array;
|
||||
};
|
||||
|
||||
auto createObject = [&]() -> Value
|
||||
{
|
||||
Value object;
|
||||
object.SetObject();
|
||||
for (int i = 0; i < entryCount; ++i)
|
||||
{
|
||||
buffer = AZStd::string::format("Key%i", i);
|
||||
object.AddMember(AZ::Name(buffer), createArray());
|
||||
}
|
||||
return object;
|
||||
};
|
||||
|
||||
root["entries"] = createObject();
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void TakeAndDiscardWithoutTimingDtor(T&& value, benchmark::State& state)
|
||||
{
|
||||
{
|
||||
T instance = AZStd::move(value);
|
||||
state.PauseTiming();
|
||||
}
|
||||
state.ResumeTiming();
|
||||
}
|
||||
};
|
||||
|
||||
BENCHMARK_DEFINE_F(DomValueBenchmark, AzDomValueMakeComplexObject)(benchmark::State& state)
|
||||
{
|
||||
for (auto _ : state)
|
||||
{
|
||||
TakeAndDiscardWithoutTimingDtor(GenerateDomBenchmarkPayload(state.range(0), state.range(1)), state);
|
||||
}
|
||||
|
||||
state.SetItemsProcessed(state.range(0) * state.range(0) * state.iterations());
|
||||
}
|
||||
BENCHMARK_REGISTER_F(DomValueBenchmark, AzDomValueMakeComplexObject)
|
||||
->Args({ 10, 5 })
|
||||
->Args({ 10, 500 })
|
||||
->Args({ 100, 5 })
|
||||
->Args({ 100, 500 })
|
||||
->Unit(benchmark::kMillisecond);
|
||||
|
||||
BENCHMARK_DEFINE_F(DomValueBenchmark, AzDomValueShallowCopy)(benchmark::State& state)
|
||||
{
|
||||
Value original = GenerateDomBenchmarkPayload(state.range(0), state.range(1));
|
||||
|
||||
for (auto _ : state)
|
||||
{
|
||||
Value copy = original;
|
||||
benchmark::DoNotOptimize(copy);
|
||||
}
|
||||
|
||||
state.SetItemsProcessed(state.iterations());
|
||||
}
|
||||
BENCHMARK_REGISTER_F(DomValueBenchmark, AzDomValueShallowCopy)
|
||||
->Args({ 10, 5 })
|
||||
->Args({ 10, 500 })
|
||||
->Args({ 100, 5 })
|
||||
->Args({ 100, 500 })
|
||||
->Unit(benchmark::kNanosecond);
|
||||
|
||||
BENCHMARK_DEFINE_F(DomValueBenchmark, AzDomValueCopyAndMutate)(benchmark::State& state)
|
||||
{
|
||||
Value original = GenerateDomBenchmarkPayload(state.range(0), state.range(1));
|
||||
|
||||
for (auto _ : state)
|
||||
{
|
||||
Value copy = original;
|
||||
copy["entries"]["Key0"].ArrayPushBack(Value(42));
|
||||
TakeAndDiscardWithoutTimingDtor(AZStd::move(copy), state);
|
||||
}
|
||||
|
||||
state.SetItemsProcessed(state.iterations());
|
||||
}
|
||||
BENCHMARK_REGISTER_F(DomValueBenchmark, AzDomValueCopyAndMutate)
|
||||
->Args({ 10, 5 })
|
||||
->Args({ 10, 500 })
|
||||
->Args({ 100, 5 })
|
||||
->Args({ 100, 500 })
|
||||
->Unit(benchmark::kNanosecond);
|
||||
|
||||
BENCHMARK_DEFINE_F(DomValueBenchmark, AzDomValueDeepCopy)(benchmark::State& state)
|
||||
{
|
||||
Value original = GenerateDomBenchmarkPayload(state.range(0), state.range(1));
|
||||
|
||||
for (auto _ : state)
|
||||
{
|
||||
Value copy = Utils::DeepCopy(original);
|
||||
TakeAndDiscardWithoutTimingDtor(AZStd::move(copy), state);
|
||||
}
|
||||
|
||||
state.SetItemsProcessed(state.iterations());
|
||||
}
|
||||
BENCHMARK_REGISTER_F(DomValueBenchmark, AzDomValueDeepCopy)
|
||||
->Args({ 10, 5 })
|
||||
->Args({ 10, 500 })
|
||||
->Args({ 100, 5 })
|
||||
->Args({ 100, 500 })
|
||||
->Unit(benchmark::kMillisecond);
|
||||
|
||||
BENCHMARK_DEFINE_F(DomValueBenchmark, LookupMemberByName)(benchmark::State& state)
|
||||
{
|
||||
Value value(Type::Object);
|
||||
AZStd::vector<AZ::Name> keys;
|
||||
for (int64_t i = 0; i < state.range(0); ++i)
|
||||
{
|
||||
AZ::Name key(AZStd::string::format("key%" PRId64, i));
|
||||
keys.push_back(key);
|
||||
value[key] = i;
|
||||
}
|
||||
|
||||
for (auto _ : state)
|
||||
{
|
||||
for (const AZ::Name& key : keys)
|
||||
{
|
||||
benchmark::DoNotOptimize(value[key]);
|
||||
}
|
||||
}
|
||||
|
||||
state.SetItemsProcessed(state.iterations() * state.range(0));
|
||||
}
|
||||
BENCHMARK_REGISTER_F(DomValueBenchmark, LookupMemberByName)->Arg(100)->Arg(1000)->Arg(10000)->Unit(benchmark::kMillisecond);
|
||||
|
||||
BENCHMARK_DEFINE_F(DomValueBenchmark, LookupMemberByString)(benchmark::State& state)
|
||||
{
|
||||
Value value(Type::Object);
|
||||
AZStd::vector<AZStd::string> keys;
|
||||
for (int64_t i = 0; i < state.range(0); ++i)
|
||||
{
|
||||
AZStd::string key(AZStd::string::format("key%" PRId64, i));
|
||||
keys.push_back(key);
|
||||
value[key] = i;
|
||||
}
|
||||
|
||||
for (auto _ : state)
|
||||
{
|
||||
for (const AZStd::string& key : keys)
|
||||
{
|
||||
benchmark::DoNotOptimize(value[key]);
|
||||
}
|
||||
}
|
||||
|
||||
state.SetItemsProcessed(state.iterations() * state.range(0));
|
||||
}
|
||||
BENCHMARK_REGISTER_F(DomValueBenchmark, LookupMemberByString)->Arg(100)->Arg(1000)->Arg(10000)->Unit(benchmark::kMillisecond);
|
||||
|
||||
BENCHMARK_DEFINE_F(DomValueBenchmark, LookupMemberByStringComparison)(benchmark::State& state)
|
||||
{
|
||||
Value value(Type::Object);
|
||||
AZStd::vector<AZStd::string> keys;
|
||||
for (int64_t i = 0; i < state.range(0); ++i)
|
||||
{
|
||||
AZStd::string key(AZStd::string::format("key%" PRId64, i));
|
||||
keys.push_back(key);
|
||||
value[key] = i;
|
||||
}
|
||||
|
||||
for (auto _ : state)
|
||||
{
|
||||
for (const AZStd::string& key : keys)
|
||||
{
|
||||
const Object::ContainerType& object = value.GetObject();
|
||||
benchmark::DoNotOptimize(AZStd::find_if(
|
||||
object.cbegin(), object.cend(),
|
||||
[&key](const Object::EntryType& entry)
|
||||
{
|
||||
return key == entry.first.GetStringView();
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
state.SetItemsProcessed(state.iterations() * state.range(0));
|
||||
}
|
||||
BENCHMARK_REGISTER_F(DomValueBenchmark, LookupMemberByStringComparison)->Arg(100)->Arg(1000)->Arg(10000)->Unit(benchmark::kMillisecond);
|
||||
|
||||
} // namespace AZ::Dom::Benchmark
|
||||
@@ -0,0 +1,392 @@
|
||||
/*
|
||||
* 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 <AzCore/DOM/Backends/JSON/JsonBackend.h>
|
||||
#include <AzCore/DOM/Backends/JSON/JsonSerializationUtils.h>
|
||||
#include <AzCore/DOM/DomUtils.h>
|
||||
#include <AzCore/DOM/DomValue.h>
|
||||
#include <AzCore/Name/NameDictionary.h>
|
||||
#include <AzCore/Serialization/Json/JsonSerialization.h>
|
||||
#include <AzCore/Serialization/Json/JsonUtils.h>
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
#include <AzCore/std/numeric.h>
|
||||
|
||||
namespace AZ::Dom::Tests
|
||||
{
|
||||
class DomValueTests : public UnitTest::AllocatorsFixture
|
||||
{
|
||||
public:
|
||||
void SetUp() override
|
||||
{
|
||||
UnitTest::AllocatorsFixture::SetUp();
|
||||
NameDictionary::Create();
|
||||
AZ::AllocatorInstance<ValueAllocator>::Create();
|
||||
}
|
||||
|
||||
void TearDown() override
|
||||
{
|
||||
m_value = Value();
|
||||
|
||||
AZ::AllocatorInstance<ValueAllocator>::Destroy();
|
||||
NameDictionary::Destroy();
|
||||
UnitTest::AllocatorsFixture::TearDown();
|
||||
}
|
||||
|
||||
void PerformValueChecks()
|
||||
{
|
||||
Value shallowCopy = m_value;
|
||||
EXPECT_EQ(m_value, shallowCopy);
|
||||
EXPECT_TRUE(Utils::DeepCompareIsEqual(m_value, shallowCopy));
|
||||
|
||||
Value deepCopy = Utils::DeepCopy(m_value);
|
||||
EXPECT_TRUE(Utils::DeepCompareIsEqual(m_value, deepCopy));
|
||||
}
|
||||
|
||||
Value m_value;
|
||||
};
|
||||
|
||||
TEST_F(DomValueTests, EmptyArray)
|
||||
{
|
||||
m_value.SetArray();
|
||||
|
||||
EXPECT_TRUE(m_value.IsArray());
|
||||
EXPECT_EQ(m_value.ArraySize(), 0);
|
||||
|
||||
PerformValueChecks();
|
||||
}
|
||||
|
||||
TEST_F(DomValueTests, SimpleArray)
|
||||
{
|
||||
m_value.SetArray();
|
||||
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
m_value.ArrayPushBack(Value(i));
|
||||
EXPECT_EQ(m_value.ArraySize(), i + 1);
|
||||
EXPECT_EQ(m_value[i].GetInt64(), i);
|
||||
}
|
||||
|
||||
PerformValueChecks();
|
||||
}
|
||||
|
||||
TEST_F(DomValueTests, NestedArrays)
|
||||
{
|
||||
Value x(5);
|
||||
m_value.SetArray();
|
||||
for (int j = 0; j < 5; ++j)
|
||||
{
|
||||
Value nestedArray(Type::Array);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
nestedArray.ArrayPushBack(Value(i));
|
||||
}
|
||||
m_value.ArrayPushBack(AZStd::move(nestedArray));
|
||||
}
|
||||
|
||||
EXPECT_EQ(m_value.ArraySize(), 5);
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
EXPECT_EQ(m_value[i].ArraySize(), 5);
|
||||
for (int j = 0; j < 5; ++j)
|
||||
{
|
||||
EXPECT_EQ(m_value[i][j].GetInt64(), j);
|
||||
}
|
||||
}
|
||||
|
||||
PerformValueChecks();
|
||||
}
|
||||
|
||||
TEST_F(DomValueTests, EmptyObject)
|
||||
{
|
||||
m_value.SetObject();
|
||||
EXPECT_EQ(m_value.MemberCount(), 0);
|
||||
|
||||
PerformValueChecks();
|
||||
}
|
||||
|
||||
TEST_F(DomValueTests, SimpleObject)
|
||||
{
|
||||
m_value.SetObject();
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
AZStd::string key = AZStd::string::format("Key%i", i);
|
||||
m_value.AddMember(key, Value(i));
|
||||
EXPECT_EQ(m_value.MemberCount(), i + 1);
|
||||
EXPECT_EQ(m_value[key].GetInt64(), i);
|
||||
}
|
||||
|
||||
PerformValueChecks();
|
||||
}
|
||||
|
||||
TEST_F(DomValueTests, NestedObjects)
|
||||
{
|
||||
m_value.SetObject();
|
||||
for (int j = 0; j < 3; ++j)
|
||||
{
|
||||
Value nestedObject(Type::Object);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
nestedObject.AddMember(AZStd::string::format("Key%i", i), Value(i));
|
||||
}
|
||||
m_value.AddMember(AZStd::string::format("Obj%i", j), AZStd::move(nestedObject));
|
||||
}
|
||||
|
||||
EXPECT_EQ(m_value.MemberCount(), 3);
|
||||
for (int j = 0; j < 3; ++j)
|
||||
{
|
||||
const Value& nestedObject = m_value[AZStd::string::format("Obj%i", j)];
|
||||
EXPECT_EQ(nestedObject.MemberCount(), 5);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
EXPECT_EQ(nestedObject[AZStd::string::format("Key%i", i)].GetInt64(), i);
|
||||
}
|
||||
}
|
||||
|
||||
PerformValueChecks();
|
||||
}
|
||||
|
||||
TEST_F(DomValueTests, EmptyNode)
|
||||
{
|
||||
m_value.SetNode("Test");
|
||||
EXPECT_EQ(m_value.GetNodeName(), AZ::Name("Test"));
|
||||
EXPECT_EQ(m_value.MemberCount(), 0);
|
||||
EXPECT_EQ(m_value.ArraySize(), 0);
|
||||
|
||||
PerformValueChecks();
|
||||
}
|
||||
|
||||
TEST_F(DomValueTests, SimpleNode)
|
||||
{
|
||||
m_value.SetNode("Test");
|
||||
|
||||
for (int i = 0; i < 10; ++i)
|
||||
{
|
||||
m_value.ArrayPushBack(Value(i));
|
||||
EXPECT_EQ(m_value.ArraySize(), i + 1);
|
||||
EXPECT_EQ(m_value[i].GetInt64(), i);
|
||||
|
||||
if (i < 5)
|
||||
{
|
||||
AZ::Name key = AZ::Name(AZStd::string::format("TwoTimes%i", i));
|
||||
m_value.AddMember(key, Value(i * 2));
|
||||
EXPECT_EQ(m_value.MemberCount(), i + 1);
|
||||
EXPECT_EQ(m_value[key].GetInt64(), i * 2);
|
||||
}
|
||||
}
|
||||
|
||||
PerformValueChecks();
|
||||
}
|
||||
|
||||
TEST_F(DomValueTests, NestedNodes)
|
||||
{
|
||||
m_value.SetNode("TopLevel");
|
||||
|
||||
const AZ::Name childNodeName("ChildNode");
|
||||
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
Value childNode(Type::Node);
|
||||
childNode.SetNodeName(childNodeName);
|
||||
childNode.SetNodeValue(Value(i));
|
||||
|
||||
childNode.AddMember("foo", Value(i));
|
||||
childNode.AddMember("bar", Value("test", false));
|
||||
|
||||
m_value.ArrayPushBack(childNode);
|
||||
}
|
||||
|
||||
EXPECT_EQ(m_value.ArraySize(), 5);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
const Value& childNode = m_value[i];
|
||||
EXPECT_EQ(childNode.GetNodeName(), childNodeName);
|
||||
EXPECT_EQ(childNode.GetNodeValue().GetInt64(), i);
|
||||
EXPECT_EQ(childNode["foo"].GetInt64(), i);
|
||||
EXPECT_EQ(childNode["bar"].GetString(), "test");
|
||||
}
|
||||
|
||||
PerformValueChecks();
|
||||
}
|
||||
|
||||
TEST_F(DomValueTests, Int64)
|
||||
{
|
||||
m_value.SetObject();
|
||||
m_value["int64_min"] = AZStd::numeric_limits<int64_t>::min();
|
||||
m_value["int64_max"] = AZStd::numeric_limits<int64_t>::max();
|
||||
|
||||
EXPECT_EQ(m_value["int64_min"].GetType(), Type::Int64);
|
||||
EXPECT_EQ(m_value["int64_min"].GetInt64(), AZStd::numeric_limits<int64_t>::min());
|
||||
EXPECT_EQ(m_value["int64_max"].GetType(), Type::Int64);
|
||||
EXPECT_EQ(m_value["int64_max"].GetInt64(), AZStd::numeric_limits<int64_t>::max());
|
||||
|
||||
PerformValueChecks();
|
||||
}
|
||||
|
||||
TEST_F(DomValueTests, Uint64)
|
||||
{
|
||||
m_value.SetObject();
|
||||
m_value["uint64_min"] = AZStd::numeric_limits<uint64_t>::min();
|
||||
m_value["uint64_max"] = AZStd::numeric_limits<uint64_t>::max();
|
||||
|
||||
EXPECT_EQ(m_value["uint64_min"].GetType(), Type::Uint64);
|
||||
EXPECT_EQ(m_value["uint64_min"].GetInt64(), AZStd::numeric_limits<uint64_t>::min());
|
||||
EXPECT_EQ(m_value["uint64_max"].GetType(), Type::Uint64);
|
||||
EXPECT_EQ(m_value["uint64_max"].GetInt64(), AZStd::numeric_limits<uint64_t>::max());
|
||||
|
||||
PerformValueChecks();
|
||||
}
|
||||
|
||||
TEST_F(DomValueTests, Double)
|
||||
{
|
||||
m_value.SetObject();
|
||||
m_value["double_min"] = AZStd::numeric_limits<double>::min();
|
||||
m_value["double_max"] = AZStd::numeric_limits<double>::max();
|
||||
|
||||
EXPECT_EQ(m_value["double_min"].GetType(), Type::Double);
|
||||
EXPECT_EQ(m_value["double_min"].GetDouble(), AZStd::numeric_limits<double>::min());
|
||||
EXPECT_EQ(m_value["double_max"].GetType(), Type::Double);
|
||||
EXPECT_EQ(m_value["double_max"].GetDouble(), AZStd::numeric_limits<double>::max());
|
||||
|
||||
PerformValueChecks();
|
||||
}
|
||||
|
||||
TEST_F(DomValueTests, Null)
|
||||
{
|
||||
m_value.SetObject();
|
||||
m_value["null_value"] = Value(Type::Null);
|
||||
|
||||
EXPECT_EQ(m_value["null_value"].GetType(), Type::Null);
|
||||
EXPECT_EQ(m_value["null_type"], Value());
|
||||
|
||||
PerformValueChecks();
|
||||
}
|
||||
|
||||
TEST_F(DomValueTests, Bool)
|
||||
{
|
||||
m_value.SetObject();
|
||||
m_value["true_value"] = true;
|
||||
m_value["false_value"] = false;
|
||||
|
||||
EXPECT_EQ(m_value["true_value"].GetType(), Type::Bool);
|
||||
EXPECT_EQ(m_value["true_value"].GetBool(), true);
|
||||
EXPECT_EQ(m_value["false_value"].GetType(), Type::Bool);
|
||||
EXPECT_EQ(m_value["false_value"].GetBool(), false);
|
||||
|
||||
PerformValueChecks();
|
||||
}
|
||||
|
||||
TEST_F(DomValueTests, String)
|
||||
{
|
||||
const char* s1 = "reference string long enough to avoid SSO";
|
||||
const char* s2 = "copy string long enough to avoid SSO";
|
||||
|
||||
m_value.SetObject();
|
||||
AZStd::string stringToReference = s1;
|
||||
m_value["no_copy"] = Value(stringToReference, false);
|
||||
AZStd::string stringToCopy = s2;
|
||||
m_value["copy"] = Value(stringToCopy, true);
|
||||
|
||||
EXPECT_EQ(m_value["no_copy"].GetType(), Type::String);
|
||||
EXPECT_EQ(m_value["no_copy"].GetString(), s1);
|
||||
stringToReference.at(0) = 'F';
|
||||
EXPECT_NE(m_value["no_copy"].GetString(), s1);
|
||||
|
||||
EXPECT_EQ(m_value["copy"].GetType(), Type::String);
|
||||
EXPECT_EQ(m_value["copy"].GetString(), s2);
|
||||
stringToCopy.at(0) = 'F';
|
||||
EXPECT_EQ(m_value["copy"].GetString(), s2);
|
||||
|
||||
PerformValueChecks();
|
||||
}
|
||||
|
||||
TEST_F(DomValueTests, CopyOnWrite_Object)
|
||||
{
|
||||
Value v1(Type::Object);
|
||||
v1["foo"] = 5;
|
||||
|
||||
Value nestedObject(Type::Object);
|
||||
v1["obj"] = nestedObject;
|
||||
|
||||
Value v2 = v1;
|
||||
EXPECT_EQ(&v1.GetObject(), &v2.GetObject());
|
||||
EXPECT_EQ(&v1.FindMember("obj")->second.GetObject(), &v2.FindMember("obj")->second.GetObject());
|
||||
|
||||
v2["foo"] = 0;
|
||||
|
||||
EXPECT_NE(&v1.GetObject(), &v2.GetObject());
|
||||
EXPECT_EQ(&v1.FindMember("obj")->second.GetObject(), &v2.FindMember("obj")->second.GetObject());
|
||||
|
||||
v2["obj"]["key"] = true;
|
||||
|
||||
EXPECT_NE(&v1.GetObject(), &v2.GetObject());
|
||||
EXPECT_NE(&v1.FindMember("obj")->second.GetObject(), &v2.FindMember("obj")->second.GetObject());
|
||||
|
||||
v2 = v1;
|
||||
|
||||
EXPECT_EQ(&v1.GetObject(), &v2.GetObject());
|
||||
EXPECT_EQ(&v1.FindMember("obj")->second.GetObject(), &v2.FindMember("obj")->second.GetObject());
|
||||
}
|
||||
|
||||
TEST_F(DomValueTests, CopyOnWrite_Array)
|
||||
{
|
||||
Value v1(Type::Array);
|
||||
v1.ArrayPushBack(Value(1));
|
||||
v1.ArrayPushBack(Value(2));
|
||||
|
||||
Value nestedArray(Type::Array);
|
||||
v1.ArrayPushBack(nestedArray);
|
||||
Value v2 = v1;
|
||||
|
||||
EXPECT_EQ(&v1.GetArray(), &v2.GetArray());
|
||||
EXPECT_EQ(&v1.ArrayAt(2).GetArray(), &v2.ArrayAt(2).GetArray());
|
||||
|
||||
v2[0] = 0;
|
||||
|
||||
EXPECT_NE(&v1.GetArray(), &v2.GetArray());
|
||||
EXPECT_EQ(&v1.ArrayAt(2).GetArray(), &v2.ArrayAt(2).GetArray());
|
||||
|
||||
v2[2].ArrayPushBack(Value(42));
|
||||
|
||||
EXPECT_NE(&v1.GetArray(), &v2.GetArray());
|
||||
EXPECT_NE(&v1.ArrayAt(2).GetArray(), &v2.ArrayAt(2).GetArray());
|
||||
|
||||
v2 = v1;
|
||||
|
||||
EXPECT_EQ(&v1.GetArray(), &v2.GetArray());
|
||||
EXPECT_EQ(&v1.ArrayAt(2).GetArray(), &v2.ArrayAt(2).GetArray());
|
||||
}
|
||||
|
||||
TEST_F(DomValueTests, CopyOnWrite_Node)
|
||||
{
|
||||
Value v1;
|
||||
v1.SetNode("TopLevel");
|
||||
|
||||
v1.ArrayPushBack(Value(1));
|
||||
v1.ArrayPushBack(Value(2));
|
||||
v1["obj"].SetNode("Nested");
|
||||
Value v2 = v1;
|
||||
|
||||
EXPECT_EQ(&v1.GetNode(), &v2.GetNode());
|
||||
EXPECT_EQ(&v1["obj"].GetNode(), &v2["obj"].GetNode());
|
||||
|
||||
v2[0] = 0;
|
||||
|
||||
EXPECT_NE(&v1.GetNode(), &v2.GetNode());
|
||||
EXPECT_EQ(&v1["obj"].GetNode(), &v2["obj"].GetNode());
|
||||
|
||||
v2["obj"].ArrayPushBack(Value(42));
|
||||
|
||||
EXPECT_NE(&v1.GetNode(), &v2.GetNode());
|
||||
EXPECT_NE(&v1["obj"].GetNode(), &v2["obj"].GetNode());
|
||||
|
||||
v2 = v1;
|
||||
|
||||
EXPECT_EQ(&v1.GetNode(), &v2.GetNode());
|
||||
EXPECT_EQ(&v1["obj"].GetNode(), &v2["obj"].GetNode());
|
||||
}
|
||||
} // namespace AZ::Dom::Tests
|
||||
@@ -217,6 +217,8 @@ set(FILES
|
||||
AZStd/VectorAndArray.cpp
|
||||
DOM/DomJsonTests.cpp
|
||||
DOM/DomJsonBenchmarks.cpp
|
||||
DOM/DomValueTests.cpp
|
||||
DOM/DomValueBenchmarks.cpp
|
||||
)
|
||||
|
||||
# Prevent the following files from being grouped in UNITY builds
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
set(FILES
|
||||
../Common/UnixLike/AzTest/ColorizedOutput_UnixLike.cpp
|
||||
../Common/UnixLike/AzTest/Utils_UnixLike.cpp
|
||||
ScopedAutoTempDirectory_Android.cpp
|
||||
Platform_Android.cpp
|
||||
AzTest_Traits_Platform.h
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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 <AzTest/Utils.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Test
|
||||
{
|
||||
bool SetEnv([[maybe_unused]] const char* envname, [[maybe_unused]] const char* envvalue, [[maybe_unused]] bool overwrite)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UnsetEnv([[maybe_unused]] const char* envname)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} // namespace Test
|
||||
} // namespace AZ
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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 <AzTest/Utils.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Test
|
||||
{
|
||||
bool SetEnv(const char* envname, const char* envvalue, bool overwrite)
|
||||
{
|
||||
return setenv(envname, envvalue, overwrite) != -1;
|
||||
}
|
||||
|
||||
bool UnsetEnv(const char* envname)
|
||||
{
|
||||
return unsetenv(envname) != -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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 <AzTest/Utils.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Test
|
||||
{
|
||||
bool SetEnv(const char* envname, const char* envvalue, [[maybe_unused]] bool overwrite)
|
||||
{
|
||||
return _putenv_s(envname, envvalue);
|
||||
}
|
||||
|
||||
bool UnsetEnv(const char* envname)
|
||||
{
|
||||
return SetEnv(envname, "", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
set(FILES
|
||||
../Common/UnixLike/AzTest/ColorizedOutput_UnixLike.cpp
|
||||
../Common/UnixLike/AzTest/ScopedAutoTempDirectory_UnixLike.cpp
|
||||
../Common/UnixLike/AzTest/Utils_UnixLike.cpp
|
||||
Platform_Linux.cpp
|
||||
AzTest_Traits_Platform.h
|
||||
AzTest_Traits_Linux.h
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
set(FILES
|
||||
../Common/UnixLike/AzTest/ColorizedOutput_UnixLike.cpp
|
||||
../Common/UnixLike/AzTest/ScopedAutoTempDirectory_UnixLike.cpp
|
||||
../Common/UnixLike/AzTest/Utils_UnixLike.cpp
|
||||
Platform_Mac.cpp
|
||||
AzTest_Traits_Platform.h
|
||||
AzTest_Traits_Mac.h
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
set(FILES
|
||||
../Common/WinAPI/AzTest/ColorizedOutput_WinAPI.cpp
|
||||
../Common/WinAPI/AzTest/Utils_WinAPI.cpp
|
||||
Platform_Windows.cpp
|
||||
ScopedAutoTempDirectory_Windows.cpp
|
||||
AzTest_Traits_Platform.h
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
set(FILES
|
||||
../Common/UnixLike/AzTest/ColorizedOutput_UnixLike.cpp
|
||||
../Common/Unimplemented/AzTest/ScopedAutoTempDirectory_Unimplemented.cpp
|
||||
../Common/UnixLike/AzTest/Utils_UnixLike.cpp
|
||||
Platform_iOS.cpp
|
||||
AzTest_Traits_Platform.h
|
||||
AzTest_Traits_iOS.h
|
||||
|
||||
@@ -55,6 +55,19 @@ namespace AZ
|
||||
// Returns the path to the engine's root by cdup from the current execution path until engine.txt is found
|
||||
AZStd::string GetEngineRootPath();
|
||||
|
||||
//! Create or modify environment variable.
|
||||
//! @param envname The environment variable name
|
||||
//! @param envvalue The environment variable name
|
||||
//! @param overwrite If name does exist in the environment, then its value is changed to value if overwrite is nonzero;
|
||||
//! if overwrite is zero, then the value of name is not changed
|
||||
//! @returns Return true if successful, otherwise false
|
||||
bool SetEnv(const char* envname, const char* envvalue, bool overwrite);
|
||||
|
||||
//! Remove environment variable.
|
||||
//! @param envname The environment variable name
|
||||
//! @returns Return true if successful, otherwise false
|
||||
bool UnsetEnv(const char* envname);
|
||||
|
||||
//! Provides a scoped object that will create a temporary operating-system specific folder on creation, and delete it and
|
||||
//! its contents on destruction. This class is only available on host platforms (Windows, Mac, and Linux)
|
||||
class ScopedAutoTempDirectory
|
||||
|
||||
+12
-30
@@ -14,6 +14,7 @@
|
||||
#include <AzToolsFramework/UI/PropertyEditor/PropertyQTConstants.h>
|
||||
#include <AzToolsFramework/UI/PropertyEditor/QtWidgetLimits.h>
|
||||
#include <QtWidgets/QWidget>
|
||||
#include <QLocale>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
@@ -92,25 +93,11 @@ namespace AzToolsFramework
|
||||
{
|
||||
toolTipString += "\n";
|
||||
}
|
||||
toolTipString += "[";
|
||||
if (propertyControl->minimum() <= aznumeric_cast<AZ::s64>(QtWidgetLimits<T>::Min()))
|
||||
{
|
||||
toolTipString += "-" + QObject::tr(PropertyQTConstant_InfinityString);
|
||||
}
|
||||
else
|
||||
{
|
||||
toolTipString += QString::number(propertyControl->minimum());
|
||||
}
|
||||
toolTipString += ", ";
|
||||
if (propertyControl->maximum() >= aznumeric_cast<AZ::s64>(QtWidgetLimits<T>::Max()))
|
||||
{
|
||||
toolTipString += QObject::tr(PropertyQTConstant_InfinityString);
|
||||
}
|
||||
else
|
||||
{
|
||||
toolTipString += QString::number(propertyControl->maximum());
|
||||
}
|
||||
toolTipString += "]";
|
||||
|
||||
const QString minString = QLocale().toString(propertyControl->minimum());
|
||||
const QString maxString = QLocale().toString(propertyControl->maximum());
|
||||
toolTipString += QString("[%1, %2]").arg(minString).arg(maxString);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -128,16 +115,11 @@ namespace AzToolsFramework
|
||||
{
|
||||
toolTipString += "\n";
|
||||
}
|
||||
toolTipString += "[" + QString::number(propertyControl->minimum()) + ", ";
|
||||
if (propertyControl->maximum() >= aznumeric_cast<AZ::s64>(QtWidgetLimits<T>::Max()))
|
||||
{
|
||||
toolTipString += QObject::tr(PropertyQTConstant_InfinityString);
|
||||
}
|
||||
else
|
||||
{
|
||||
toolTipString += QString::number(propertyControl->maximum());
|
||||
}
|
||||
toolTipString += "]";
|
||||
|
||||
const QString minString = QLocale().toString(propertyControl->minimum());
|
||||
const QString maxString = QLocale().toString(propertyControl->maximum());
|
||||
toolTipString += QString("[%1, %2]").arg(minString).arg(maxString);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -196,7 +178,7 @@ namespace AzToolsFramework
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_WarningOnce("AzToolsFramework", false, "Property %s: 'Min' attribute from property '%s' into widget", debugName);
|
||||
AZ_WarningOnce("AzToolsFramework", false, "Failed to read 'Min' attribute from property '%s' into widget", debugName);
|
||||
}
|
||||
}
|
||||
else if (attrib == AZ::Edit::Attributes::Max)
|
||||
|
||||
@@ -83,18 +83,6 @@ namespace UnitTest
|
||||
widget->setMaximum(widget->maximum() - 1);
|
||||
}
|
||||
|
||||
static std::string GetToolTipStringAtLimits()
|
||||
{
|
||||
if constexpr (std::is_signed<ValueType>::value)
|
||||
{
|
||||
return "[-INF, INF]";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "[0, INF]";
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyCtrlHandlersCreated()
|
||||
{
|
||||
using ::testing::Ne;
|
||||
@@ -125,11 +113,13 @@ namespace UnitTest
|
||||
auto& widget = m_widget;
|
||||
auto& handler = m_handler;
|
||||
QString tooltip;
|
||||
std::string expected;
|
||||
|
||||
// Retrieve the tooltip string for this widget
|
||||
auto success = handler->ModifyTooltip(widget, tooltip);
|
||||
expected = GetToolTipStringAtLimits();
|
||||
|
||||
const QString minString = QLocale().toString(widget->minimum());
|
||||
const QString maxString = QLocale().toString(widget->maximum());
|
||||
const AZStd::string expected = AZStd::string::format("[%s, %s]", minString.toStdString().c_str(), maxString.toStdString().c_str());
|
||||
|
||||
// Expect the operation to be successful and a valid limit tooltip string generated
|
||||
EXPECT_TRUE(success);
|
||||
@@ -142,18 +132,21 @@ namespace UnitTest
|
||||
auto& widget = m_widget;
|
||||
auto& handler = m_handler;
|
||||
QString tooltip;
|
||||
std::stringstream expected;
|
||||
|
||||
// That is not at the extremeties of the type range limit
|
||||
SetWidgetRangeToNonExtremeties(widget);
|
||||
|
||||
// Retrieve the tooltip string for this widget
|
||||
auto success = handler->ModifyTooltip(widget, tooltip);
|
||||
expected << "[" << widget->minimum() << ", " << widget->maximum() << "]";
|
||||
|
||||
const QString minString = QLocale().toString(widget->minimum());
|
||||
const QString maxString = QLocale().toString(widget->maximum());
|
||||
|
||||
const AZStd::string expected = AZStd::string::format("[%s, %s]", minString.toStdString().c_str(), maxString.toStdString().c_str());
|
||||
|
||||
// Expect the operation to be successful and a valid less than limit tooltip string generated
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_STREQ(tooltip.toStdString().c_str(), expected.str().c_str());
|
||||
EXPECT_STREQ(tooltip.toStdString().c_str(), expected.c_str());
|
||||
}
|
||||
|
||||
void EmitWidgetValueChanged()
|
||||
|
||||
@@ -793,9 +793,9 @@ namespace UnitTests
|
||||
|
||||
TEST_F(SourceFileRelocatorTest, TestInterface)
|
||||
{
|
||||
auto* interface = AZ::Interface<ISourceFileRelocation>::Get();
|
||||
auto* sourceFileRelocator = AZ::Interface<ISourceFileRelocation>::Get();
|
||||
|
||||
ASSERT_NE(interface, nullptr);
|
||||
ASSERT_NE(sourceFileRelocator, nullptr);
|
||||
}
|
||||
|
||||
TEST_F(SourceFileRelocatorTest, Move_Real_Succeeds)
|
||||
|
||||
@@ -21,7 +21,7 @@ ly_add_target(
|
||||
INTERFACE
|
||||
Gem::GameState
|
||||
Gem::LocalUser
|
||||
Gem::LyShine.Static
|
||||
Gem::LyShine.Clients.API
|
||||
Gem::SaveData.Static
|
||||
Gem::MessagePopup.Static
|
||||
Legacy::CryCommon
|
||||
|
||||
@@ -62,6 +62,7 @@ namespace GradientSignal
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// GradientRequestBus
|
||||
float GetValue(const GradientSampleParams& sampleParams) const override;
|
||||
void GetValues(AZStd::array_view<AZ::Vector3> positions, AZStd::array_view<float> outValues) const override;
|
||||
|
||||
protected:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -69,6 +69,7 @@ namespace GradientSignal
|
||||
|
||||
// GradientRequestBus overrides...
|
||||
float GetValue(const GradientSampleParams& sampleParams) const override;
|
||||
void GetValues(AZStd::array_view<AZ::Vector3> positions, AZStd::array_view<float> outValues) const override;
|
||||
|
||||
// AZ::Data::AssetBus overrides...
|
||||
void OnAssetReady(AZ::Data::Asset<AZ::Data::AssetData> asset) override;
|
||||
|
||||
@@ -70,6 +70,7 @@ namespace GradientSignal
|
||||
|
||||
// GradientRequestBus overrides...
|
||||
float GetValue(const GradientSampleParams& sampleParams) const override;
|
||||
void GetValues(AZStd::array_view<AZ::Vector3> positions, AZStd::array_view<float> outValues) const override;
|
||||
|
||||
private:
|
||||
PerlinGradientConfig m_configuration;
|
||||
|
||||
@@ -61,6 +61,7 @@ namespace GradientSignal
|
||||
|
||||
// GradientRequestBus overrides...
|
||||
float GetValue(const GradientSampleParams& sampleParams) const override;
|
||||
void GetValues(AZStd::array_view<AZ::Vector3> positions, AZStd::array_view<float> outValues) const override;
|
||||
|
||||
private:
|
||||
RandomGradientConfig m_configuration;
|
||||
@@ -73,5 +74,7 @@ namespace GradientSignal
|
||||
// RandomGradientRequestBus overrides...
|
||||
int GetRandomSeed() const override;
|
||||
void SetRandomSeed(int seed) override;
|
||||
|
||||
float GetRandomValue(const AZ::Vector3& position, AZStd::size_t seed) const;
|
||||
};
|
||||
}
|
||||
|
||||
+1
@@ -69,6 +69,7 @@ namespace GradientSignal
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// GradientRequestBus
|
||||
float GetValue(const GradientSampleParams& sampleParams) const override;
|
||||
void GetValues(AZStd::array_view<AZ::Vector3> positions, AZStd::array_view<float> outValues) const override;
|
||||
|
||||
protected:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -134,6 +134,22 @@ namespace GradientSignal
|
||||
return m_configuration.m_value;
|
||||
}
|
||||
|
||||
void ConstantGradientComponent::GetValues(
|
||||
[[maybe_unused]] AZStd::array_view<AZ::Vector3> positions, AZStd::array_view<float> outValues) const
|
||||
{
|
||||
if (positions.size() != outValues.size())
|
||||
{
|
||||
AZ_Assert(false, "input and output lists are different sizes (%zu vs %zu).", positions.size(), outValues.size());
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto& outValue : outValues)
|
||||
{
|
||||
float& writableOutValue = const_cast<float&>(outValue);
|
||||
writableOutValue = m_configuration.m_value;
|
||||
}
|
||||
}
|
||||
|
||||
float ConstantGradientComponent::GetConstantValue() const
|
||||
{
|
||||
return m_configuration.m_value;
|
||||
|
||||
@@ -219,6 +219,39 @@ namespace GradientSignal
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
void ImageGradientComponent::GetValues(AZStd::array_view<AZ::Vector3> positions, AZStd::array_view<float> outValues) const
|
||||
{
|
||||
if (positions.size() != outValues.size())
|
||||
{
|
||||
AZ_Assert(false, "input and output lists are different sizes (%zu vs %zu).", positions.size(), outValues.size());
|
||||
return;
|
||||
}
|
||||
|
||||
AZ::Vector3 uvw;
|
||||
bool wasPointRejected = false;
|
||||
|
||||
AZStd::shared_lock<decltype(m_imageMutex)> imageLock(m_imageMutex);
|
||||
|
||||
for (size_t index = 0; index < positions.size(); index++)
|
||||
{
|
||||
// The const_cast is necessary for now since array_view currently only supports const entries.
|
||||
// If/when array_view is fixed to support non-const, or AZStd::span gets created, the const_cast can get removed.
|
||||
auto& outValue = const_cast<float&>(outValues[index]);
|
||||
|
||||
m_gradientTransform.TransformPositionToUVWNormalized(positions[index], uvw, wasPointRejected);
|
||||
|
||||
if (!wasPointRejected)
|
||||
{
|
||||
outValue = GetValueFromImageAsset(
|
||||
m_configuration.m_imageAsset, uvw, m_configuration.m_tilingX, m_configuration.m_tilingY, 0.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
outValue = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AZStd::string ImageGradientComponent::GetImageAssetPath() const
|
||||
{
|
||||
AZStd::string assetPathString;
|
||||
|
||||
@@ -203,6 +203,40 @@ namespace GradientSignal
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
void PerlinGradientComponent::GetValues(AZStd::array_view<AZ::Vector3> positions, AZStd::array_view<float> outValues) const
|
||||
{
|
||||
if (positions.size() != outValues.size())
|
||||
{
|
||||
AZ_Assert(false, "input and output lists are different sizes (%zu vs %zu).", positions.size(), outValues.size());
|
||||
return;
|
||||
}
|
||||
|
||||
AZ::Vector3 uvw;
|
||||
bool wasPointRejected = false;
|
||||
|
||||
AZStd::shared_lock<decltype(m_transformMutex)> lock(m_transformMutex);
|
||||
|
||||
for (size_t index = 0; index < positions.size(); index++)
|
||||
{
|
||||
// The const_cast is necessary for now since array_view currently only supports const entries.
|
||||
// If/when array_view is fixed to support non-const, or AZStd::span gets created, the const_cast can get removed.
|
||||
auto& outValue = const_cast<float&>(outValues[index]);
|
||||
|
||||
m_gradientTransform.TransformPositionToUVW(positions[index], uvw, wasPointRejected);
|
||||
|
||||
if (!wasPointRejected)
|
||||
{
|
||||
outValue = m_perlinImprovedNoise->GenerateOctaveNoise(
|
||||
uvw.GetX(), uvw.GetY(), uvw.GetZ(), m_configuration.m_octave, m_configuration.m_amplitude,
|
||||
m_configuration.m_frequency);
|
||||
}
|
||||
else
|
||||
{
|
||||
outValue = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int PerlinGradientComponent::GetRandomSeed() const
|
||||
{
|
||||
return m_configuration.m_randomSeed;
|
||||
|
||||
@@ -145,6 +145,22 @@ namespace GradientSignal
|
||||
m_gradientTransform = newTransform;
|
||||
}
|
||||
|
||||
float RandomGradientComponent::GetRandomValue(const AZ::Vector3& position, AZStd::size_t seed) const
|
||||
{
|
||||
// generating stable pseudo-random noise from a position based hash
|
||||
float x = position.GetX();
|
||||
float y = position.GetY();
|
||||
AZStd::size_t result = 0;
|
||||
|
||||
AZStd::hash_combine<float>(result, x * seed + y);
|
||||
AZStd::hash_combine<float>(result, y * seed + x);
|
||||
AZStd::hash_combine<float>(result, x * y * seed);
|
||||
|
||||
// always returns [0.0,1.0]
|
||||
return static_cast<float>(result % std::numeric_limits<AZ::u8>::max()) / static_cast<float>(std::numeric_limits<AZ::u8>::max());
|
||||
}
|
||||
|
||||
|
||||
float RandomGradientComponent::GetValue(const GradientSampleParams& sampleParams) const
|
||||
{
|
||||
|
||||
@@ -158,23 +174,50 @@ namespace GradientSignal
|
||||
|
||||
if (!wasPointRejected)
|
||||
{
|
||||
//generating stable pseudo-random noise from a position based hash
|
||||
float x = uvw.GetX();
|
||||
float y = uvw.GetY();
|
||||
AZStd::size_t result = 0;
|
||||
const AZStd::size_t seed = m_configuration.m_randomSeed + AZStd::size_t(2); // Add 2 to avoid seeds 0 and 1, which can create strange patterns with this particular algorithm
|
||||
const AZStd::size_t seed = m_configuration.m_randomSeed +
|
||||
AZStd::size_t(2); // Add 2 to avoid seeds 0 and 1, which can create strange patterns with this particular algorithm
|
||||
|
||||
AZStd::hash_combine<float>(result, x * seed + y);
|
||||
AZStd::hash_combine<float>(result, y * seed + x);
|
||||
AZStd::hash_combine<float>(result, x * y * seed);
|
||||
|
||||
//always returns [0.0,1.0]
|
||||
return static_cast<float>(result % std::numeric_limits<AZ::u8>::max()) / static_cast<float>(std::numeric_limits<AZ::u8>::max());
|
||||
return GetRandomValue(uvw, seed);
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
void RandomGradientComponent::GetValues(AZStd::array_view<AZ::Vector3> positions, AZStd::array_view<float> outValues) const
|
||||
{
|
||||
if (positions.size() != outValues.size())
|
||||
{
|
||||
AZ_Assert(false, "input and output lists are different sizes (%zu vs %zu).", positions.size(), outValues.size());
|
||||
return;
|
||||
}
|
||||
|
||||
AZ::Vector3 uvw;
|
||||
bool wasPointRejected = false;
|
||||
const AZStd::size_t seed = m_configuration.m_randomSeed +
|
||||
AZStd::size_t(2); // Add 2 to avoid seeds 0 and 1, which can create strange patterns with this particular algorithm
|
||||
|
||||
AZStd::shared_lock<decltype(m_transformMutex)> lock(m_transformMutex);
|
||||
|
||||
for (size_t index = 0; index < positions.size(); index++)
|
||||
{
|
||||
// The const_cast is necessary for now since array_view currently only supports const entries.
|
||||
// If/when array_view is fixed to support non-const, or AZStd::span gets created, the const_cast can get removed.
|
||||
auto& outValue = const_cast<float&>(outValues[index]);
|
||||
|
||||
m_gradientTransform.TransformPositionToUVW(positions[index], uvw, wasPointRejected);
|
||||
|
||||
if (!wasPointRejected)
|
||||
{
|
||||
outValue = GetRandomValue(uvw, seed);
|
||||
}
|
||||
else
|
||||
{
|
||||
outValue = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int RandomGradientComponent::GetRandomSeed() const
|
||||
{
|
||||
return m_configuration.m_randomSeed;
|
||||
|
||||
@@ -157,21 +157,62 @@ namespace GradientSignal
|
||||
|
||||
float ShapeAreaFalloffGradientComponent::GetValue(const GradientSampleParams& sampleParams) const
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(Entity);
|
||||
|
||||
float distance = 0.0f;
|
||||
LmbrCentral::ShapeComponentRequestsBus::EventResult(distance, m_configuration.m_shapeEntityId, &LmbrCentral::ShapeComponentRequestsBus::Events::DistanceFromPoint, sampleParams.m_position);
|
||||
|
||||
// In the special case of 0 falloff, make sure that all points inside the shape (0 distance) return
|
||||
// 1.0, and all points outside the shape return 0.
|
||||
if (m_configuration.m_falloffWidth == 0.0f)
|
||||
// Since this is outer falloff, distance should give us values from 1.0 at the minimum distance to 0.0 at the maximum distance.
|
||||
// The statement is written specifically to handle the 0 falloff case as well. For 0 falloff, all points inside the shape
|
||||
// (0 distance) return 1.0, and all points outside the shape return 0. This works because division by 0 gives infinity, which gets
|
||||
// clamped by the GetMax() to 0. However, if distance == 0, it would give us NaN, so we have the separate conditional check to
|
||||
// handle that case and clamp to 1.0.
|
||||
return (distance <= 0.0f) ? 1.0f : AZ::GetMax(1.0f - (distance / m_configuration.m_falloffWidth), 0.0f);
|
||||
}
|
||||
|
||||
void ShapeAreaFalloffGradientComponent::GetValues(AZStd::array_view<AZ::Vector3> positions, AZStd::array_view<float> outValues) const
|
||||
{
|
||||
if (positions.size() != outValues.size())
|
||||
{
|
||||
return (distance > 0.0f) ? 0.0f : 1.0f;
|
||||
AZ_Assert(false, "input and output lists are different sizes (%zu vs %zu).", positions.size(), outValues.size());
|
||||
return;
|
||||
}
|
||||
|
||||
// Since this is outer falloff, distance should give us values from 1.0 at the minimum distance
|
||||
// to 0.0 at the maximum distance.
|
||||
return GetRatio(m_configuration.m_falloffWidth, 0.0f, distance);
|
||||
bool shapeConnected = false;
|
||||
const float falloffWidth = m_configuration.m_falloffWidth;
|
||||
|
||||
LmbrCentral::ShapeComponentRequestsBus::Event(
|
||||
m_configuration.m_shapeEntityId,
|
||||
[falloffWidth, positions, &outValues, &shapeConnected](LmbrCentral::ShapeComponentRequestsBus::Events* shapeRequests)
|
||||
{
|
||||
shapeConnected = true;
|
||||
|
||||
for (size_t index = 0; index < positions.size(); index++)
|
||||
{
|
||||
// The const_cast is necessary for now since array_view currently only supports const entries.
|
||||
// If/when array_view is fixed to support non-const, or AZStd::span gets created, the const_cast can get removed.
|
||||
auto& outValue = const_cast<float&>(outValues[index]);
|
||||
|
||||
float distance = shapeRequests->DistanceFromPoint(positions[index]);
|
||||
|
||||
// Since this is outer falloff, distance should give us values from 1.0 at the minimum distance to 0.0 at the maximum
|
||||
// distance. The statement is written specifically to handle the 0 falloff case as well. For 0 falloff, all points
|
||||
// inside the shape (0 distance) return 1.0, and all points outside the shape return 0. This works because division by 0
|
||||
// gives infinity, which gets clamped by the GetMax() to 0. However, if distance == 0, it would give us NaN, so we have
|
||||
// the separate conditional check to handle that case and clamp to 1.0.
|
||||
outValue = (distance <= 0.0f) ? 1.0f : AZ::GetMax(1.0f - (distance / falloffWidth), 0.0f);
|
||||
}
|
||||
});
|
||||
|
||||
// If there's no shape, there's no falloff.
|
||||
if (!shapeConnected)
|
||||
{
|
||||
for (size_t index = 0; index < positions.size(); index++)
|
||||
{
|
||||
// The const_cast is necessary for now since array_view currently only supports const entries.
|
||||
// If/when array_view is fixed to support non-const, or AZStd::span gets created, the const_cast can get removed.
|
||||
auto& outValue = const_cast<float&>(outValues[index]);
|
||||
outValue = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AZ::EntityId ShapeAreaFalloffGradientComponent::GetShapeEntityId() const
|
||||
|
||||
@@ -29,21 +29,34 @@ namespace UnitTest
|
||||
{
|
||||
GradientSignalTest::SetUp();
|
||||
|
||||
// Set up job manager with two threads so that we can run and test the preview job logic.
|
||||
AZ::JobManagerDesc desc;
|
||||
AZ::JobManagerThreadDesc threadDesc;
|
||||
desc.m_workerThreads.push_back(threadDesc);
|
||||
desc.m_workerThreads.push_back(threadDesc);
|
||||
m_jobManager = aznew AZ::JobManager(desc);
|
||||
m_jobContext = aznew AZ::JobContext(*m_jobManager);
|
||||
AZ::JobContext::SetGlobalContext(m_jobContext);
|
||||
auto globalContext = AZ::JobContext::GetGlobalContext();
|
||||
if (globalContext)
|
||||
{
|
||||
AZ_Assert(
|
||||
globalContext->GetJobManager().GetNumWorkerThreads() >= 2,
|
||||
"Job Manager previously started by test environment with too few threads for this test.");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set up job manager with two threads so that we can run and test the preview job logic.
|
||||
AZ::JobManagerDesc desc;
|
||||
AZ::JobManagerThreadDesc threadDesc;
|
||||
desc.m_workerThreads.push_back(threadDesc);
|
||||
desc.m_workerThreads.push_back(threadDesc);
|
||||
m_jobManager = aznew AZ::JobManager(desc);
|
||||
m_jobContext = aznew AZ::JobContext(*m_jobManager);
|
||||
AZ::JobContext::SetGlobalContext(m_jobContext);
|
||||
}
|
||||
}
|
||||
|
||||
void TearDown() override
|
||||
{
|
||||
AZ::JobContext::SetGlobalContext(nullptr);
|
||||
delete m_jobContext;
|
||||
delete m_jobManager;
|
||||
if (m_jobContext)
|
||||
{
|
||||
AZ::JobContext::SetGlobalContext(nullptr);
|
||||
delete m_jobContext;
|
||||
delete m_jobManager;
|
||||
}
|
||||
|
||||
GradientSignalTest::TearDown();
|
||||
}
|
||||
@@ -180,4 +193,5 @@ namespace UnitTest
|
||||
}
|
||||
}
|
||||
|
||||
AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV);
|
||||
// This uses a custom test hook so that we can load LmbrCentral and use Shape components in our unit tests.
|
||||
AZ_UNIT_TEST_HOOK(new UnitTest::GradientSignalTestEnvironment);
|
||||
|
||||
@@ -14,10 +14,13 @@
|
||||
#include <AzCore/Memory/PoolAllocator.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzFramework/Asset/AssetCatalogBus.h>
|
||||
#include <AzFramework/Components/TransformComponent.h>
|
||||
|
||||
#include <GradientSignal/Components/ImageGradientComponent.h>
|
||||
#include <GradientSignal/Components/GradientTransformComponent.h>
|
||||
|
||||
#include <LmbrCentral/Shape/BoxShapeComponentBus.h>
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
struct GradientSignalImageTestsFixture
|
||||
@@ -89,23 +92,21 @@ namespace UnitTest
|
||||
test.m_imageSize, test.m_imageSize, static_cast<AZ::u32>(test.m_pixel.GetX()), static_cast<AZ::u32>(test.m_pixel.GetY()));
|
||||
config.m_tilingX = test.m_tiling;
|
||||
config.m_tilingY = test.m_tiling;
|
||||
CreateComponent<GradientSignal::ImageGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::ImageGradientComponent>(config);
|
||||
|
||||
// Create the Gradient Transform Component.
|
||||
GradientSignal::GradientTransformConfig gradientTransformConfig;
|
||||
gradientTransformConfig.m_wrappingType = test.m_wrappingType;
|
||||
CreateComponent<GradientSignal::GradientTransformComponent>(entity.get(), gradientTransformConfig);
|
||||
entity->CreateComponent<GradientSignal::GradientTransformComponent>(gradientTransformConfig);
|
||||
|
||||
// Create a mock Shape component that describes the bounds that we're using to map our ImageGradient into world space.
|
||||
CreateComponent<MockShapeComponent>(entity.get());
|
||||
MockShapeComponentHandler mockShapeHandler(entity->GetId());
|
||||
mockShapeHandler.m_GetLocalBounds = AZ::Aabb::CreateCenterRadius(AZ::Vector3(shapeHalfBounds), shapeHalfBounds);
|
||||
LmbrCentral::BoxShapeConfig boxConfig(AZ::Vector3(shapeHalfBounds * 2.0f));
|
||||
auto boxComponent = entity->CreateComponent(LmbrCentral::AxisAlignedBoxShapeComponentTypeId);
|
||||
boxComponent->SetConfiguration(boxConfig);
|
||||
|
||||
// Create a mock Transform component that locates our ImageGradient in the center of our desired mock Shape.
|
||||
MockTransformHandler mockTransformHandler;
|
||||
mockTransformHandler.m_GetLocalTMOutput = AZ::Transform::CreateTranslation(AZ::Vector3(shapeHalfBounds));
|
||||
mockTransformHandler.m_GetWorldTMOutput = AZ::Transform::CreateTranslation(AZ::Vector3(shapeHalfBounds));
|
||||
mockTransformHandler.BusConnect(entity->GetId());
|
||||
// Create a transform that locates our gradient in the center of our desired mock Shape.
|
||||
auto transform = entity->CreateComponent<AzFramework::TransformComponent>();
|
||||
transform->SetLocalTM(AZ::Transform::CreateTranslation(AZ::Vector3(shapeHalfBounds)));
|
||||
transform->SetWorldTM(AZ::Transform::CreateTranslation(AZ::Vector3(shapeHalfBounds)));
|
||||
|
||||
// All components are created, so activate the entity
|
||||
ActivateEntity(entity.get());
|
||||
@@ -365,7 +366,7 @@ namespace UnitTest
|
||||
mockShapeTransformHandler.BusConnect(mockShape->GetId());
|
||||
|
||||
// Create the mock shape that maps our 3x3 image to a 3x3 sample space in the world.
|
||||
CreateComponent<MockShapeComponent>(mockShape.get());
|
||||
mockShape->CreateComponent<MockShapeComponent>();
|
||||
MockShapeComponentHandler mockShapeComponentHandler(mockShape->GetId());
|
||||
// Create a 2x2 box shape (shapes are inclusive, so that's 3x3 sampling space), so that each pixel in the image directly maps to 1 meter in the box.
|
||||
mockShapeComponentHandler.m_GetEncompassingAabb = AZ::Aabb::CreateFromMinMax(AZ::Vector3(0.0f), AZ::Vector3(2.0f));
|
||||
@@ -379,7 +380,7 @@ namespace UnitTest
|
||||
// Create an ImageGradient with a 3x3 asset with the center pixel set.
|
||||
GradientSignal::ImageGradientConfig gradientConfig;
|
||||
gradientConfig.m_imageAsset = ImageAssetMockAssetHandler::CreateSpecificPixelImageAsset(3, 3, 1, 1);
|
||||
CreateComponent<GradientSignal::ImageGradientComponent>(entity.get(), gradientConfig);
|
||||
entity->CreateComponent<GradientSignal::ImageGradientComponent>(gradientConfig);
|
||||
|
||||
// Create the test GradientTransform
|
||||
GradientSignal::GradientTransformConfig config;
|
||||
@@ -400,7 +401,7 @@ namespace UnitTest
|
||||
config.m_overrideRotate = false;
|
||||
config.m_overrideScale = false;
|
||||
config.m_is3d = false;
|
||||
CreateComponent<GradientSignal::GradientTransformComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::GradientTransformComponent>(config);
|
||||
|
||||
// Set up the transform on the gradient entity.
|
||||
MockTransformHandler mockTransformHandler;
|
||||
@@ -409,7 +410,7 @@ namespace UnitTest
|
||||
mockTransformHandler.BusConnect(entity->GetId());
|
||||
|
||||
// Put a default shape on our gradient entity. This is only used for previews, so it doesn't matter what it gets set to.
|
||||
CreateComponent<MockShapeComponent>(entity.get());
|
||||
entity->CreateComponent<MockShapeComponent>();
|
||||
MockShapeComponentHandler mockShapeHandler(entity->GetId());
|
||||
|
||||
ActivateEntity(entity.get());
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace UnitTest
|
||||
config.m_layers.push_back(layer);
|
||||
|
||||
auto entity = CreateEntity();
|
||||
CreateComponent<GradientSignal::MixedGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::MixedGradientComponent>(config);
|
||||
ActivateEntity(entity.get());
|
||||
|
||||
TestFixedDataSampler(expectedOutput, dataSize, entity->GetId());
|
||||
@@ -88,7 +88,7 @@ namespace UnitTest
|
||||
config.m_smoothStep.m_falloffStrength = falloffStrength;
|
||||
|
||||
auto entity = CreateEntity();
|
||||
CreateComponent<GradientSignal::SurfaceSlopeGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::SurfaceSlopeGradientComponent>(config);
|
||||
ActivateEntity(entity.get());
|
||||
|
||||
TestFixedDataSampler(expectedOutput, dataSize, entity->GetId());
|
||||
@@ -391,7 +391,7 @@ namespace UnitTest
|
||||
GradientSignal::ReferenceGradientConfig referenceGradientConfig1;
|
||||
referenceGradientConfig1.m_gradientSampler.m_ownerEntityId = referenceGradientEntity1->GetId();
|
||||
referenceGradientConfig1.m_gradientSampler.m_gradientId = constantGradientEntity->GetId();
|
||||
CreateComponent<GradientSignal::ReferenceGradientComponent>(referenceGradientEntity1.get(), referenceGradientConfig1);
|
||||
referenceGradientEntity1->CreateComponent<GradientSignal::ReferenceGradientComponent>(referenceGradientConfig1);
|
||||
ActivateEntity(referenceGradientEntity1.get());
|
||||
EXPECT_TRUE(referenceGradientConfig1.m_gradientSampler.ValidateGradientEntityId());
|
||||
|
||||
@@ -400,7 +400,7 @@ namespace UnitTest
|
||||
GradientSignal::ReferenceGradientConfig referenceGradientConfig2;
|
||||
referenceGradientConfig2.m_gradientSampler.m_ownerEntityId = referenceGradientEntity2->GetId();
|
||||
referenceGradientConfig2.m_gradientSampler.m_gradientId = referenceGradientEntity1->GetId();
|
||||
CreateComponent<GradientSignal::ReferenceGradientComponent>(referenceGradientEntity2.get(), referenceGradientConfig2);
|
||||
referenceGradientEntity2->CreateComponent<GradientSignal::ReferenceGradientComponent>(referenceGradientConfig2);
|
||||
ActivateEntity(referenceGradientEntity2.get());
|
||||
EXPECT_TRUE(referenceGradientConfig2.m_gradientSampler.ValidateGradientEntityId());
|
||||
|
||||
@@ -409,7 +409,7 @@ namespace UnitTest
|
||||
GradientSignal::ReferenceGradientConfig referenceGradientConfig3;
|
||||
referenceGradientConfig3.m_gradientSampler.m_ownerEntityId = referenceGradientEntity3->GetId();
|
||||
referenceGradientConfig3.m_gradientSampler.m_gradientId = referenceGradientEntity3->GetId();
|
||||
CreateComponent<GradientSignal::ReferenceGradientComponent>(referenceGradientEntity3.get(), referenceGradientConfig3);
|
||||
referenceGradientEntity3->CreateComponent<GradientSignal::ReferenceGradientComponent>(referenceGradientConfig3);
|
||||
ActivateEntity(referenceGradientEntity3.get());
|
||||
EXPECT_FALSE(referenceGradientConfig3.m_gradientSampler.ValidateGradientEntityId());
|
||||
EXPECT_EQ(referenceGradientConfig3.m_gradientSampler.m_gradientId, AZ::EntityId());
|
||||
@@ -422,19 +422,19 @@ namespace UnitTest
|
||||
GradientSignal::ReferenceGradientConfig referenceGradientConfig4;
|
||||
referenceGradientConfig4.m_gradientSampler.m_ownerEntityId = referenceGradientEntity4->GetId();
|
||||
referenceGradientConfig4.m_gradientSampler.m_gradientId = referenceGradientEntity5->GetId();
|
||||
CreateComponent<GradientSignal::ReferenceGradientComponent>(referenceGradientEntity4.get(), referenceGradientConfig4);
|
||||
referenceGradientEntity4->CreateComponent<GradientSignal::ReferenceGradientComponent>(referenceGradientConfig4);
|
||||
ActivateEntity(referenceGradientEntity4.get());
|
||||
|
||||
GradientSignal::ReferenceGradientConfig referenceGradientConfig5;
|
||||
referenceGradientConfig5.m_gradientSampler.m_ownerEntityId = referenceGradientEntity5->GetId();
|
||||
referenceGradientConfig5.m_gradientSampler.m_gradientId = referenceGradientEntity6->GetId();
|
||||
CreateComponent<GradientSignal::ReferenceGradientComponent>(referenceGradientEntity5.get(), referenceGradientConfig5);
|
||||
referenceGradientEntity5->CreateComponent<GradientSignal::ReferenceGradientComponent>(referenceGradientConfig5);
|
||||
ActivateEntity(referenceGradientEntity5.get());
|
||||
|
||||
GradientSignal::ReferenceGradientConfig referenceGradientConfig6;
|
||||
referenceGradientConfig6.m_gradientSampler.m_ownerEntityId = referenceGradientEntity6->GetId();
|
||||
referenceGradientConfig6.m_gradientSampler.m_gradientId = referenceGradientEntity4->GetId();
|
||||
CreateComponent<GradientSignal::ReferenceGradientComponent>(referenceGradientEntity6.get(), referenceGradientConfig6);
|
||||
referenceGradientEntity6->CreateComponent<GradientSignal::ReferenceGradientComponent>(referenceGradientConfig6);
|
||||
ActivateEntity(referenceGradientEntity6.get());
|
||||
|
||||
EXPECT_FALSE(referenceGradientConfig6.m_gradientSampler.ValidateGradientEntityId());
|
||||
@@ -456,7 +456,7 @@ namespace UnitTest
|
||||
|
||||
// Create an AABB from -1 to 1, so points at coorindates 0 and 1 fall on it, but any points at coordinate 2 won't.
|
||||
auto entityShape = CreateEntity();
|
||||
CreateComponent<MockShapeComponent>(entityShape.get());
|
||||
entityShape->CreateComponent<MockShapeComponent>();
|
||||
MockShapeComponentHandler mockShapeComponentHandler(entityShape->GetId());
|
||||
mockShapeComponentHandler.m_GetEncompassingAabb = AZ::Aabb::CreateFromMinMax(AZ::Vector3(-1.0f), AZ::Vector3(1.0f));
|
||||
|
||||
@@ -466,7 +466,7 @@ namespace UnitTest
|
||||
config.m_falloffType = GradientSignal::FalloffType::Outer;
|
||||
|
||||
auto entity = CreateEntity();
|
||||
CreateComponent<GradientSignal::ShapeAreaFalloffGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::ShapeAreaFalloffGradientComponent>(config);
|
||||
ActivateEntity(entity.get());
|
||||
|
||||
TestFixedDataSampler(expectedOutput, dataSize, entity->GetId());
|
||||
@@ -481,7 +481,7 @@ namespace UnitTest
|
||||
|
||||
// Create our test shape from -1 to 0, so we have a corner directly on (0, 0).
|
||||
auto entityShape = CreateEntity();
|
||||
CreateComponent<MockShapeComponent>(entityShape.get());
|
||||
entityShape->CreateComponent<MockShapeComponent>();
|
||||
MockShapeComponentHandler mockShapeComponentHandler(entityShape->GetId());
|
||||
mockShapeComponentHandler.m_GetEncompassingAabb = AZ::Aabb::CreateFromMinMax(AZ::Vector3(-1.0f), AZ::Vector3(0.0f));
|
||||
|
||||
@@ -512,7 +512,7 @@ namespace UnitTest
|
||||
}
|
||||
|
||||
auto entity = CreateEntity();
|
||||
CreateComponent<GradientSignal::ShapeAreaFalloffGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::ShapeAreaFalloffGradientComponent>(config);
|
||||
ActivateEntity(entity.get());
|
||||
|
||||
TestFixedDataSampler(expectedOutput, dataSize, entity->GetId());
|
||||
@@ -533,7 +533,7 @@ namespace UnitTest
|
||||
|
||||
// We're pinning a shape, so the bounding box of (0, 0, 0) - (10, 10, 10) will be the one that applies.
|
||||
auto entityShape = CreateEntity();
|
||||
CreateComponent<MockShapeComponent>(entityShape.get());
|
||||
entityShape->CreateComponent<MockShapeComponent>();
|
||||
MockShapeComponentHandler mockShapeComponentHandler(entityShape->GetId());
|
||||
mockShapeComponentHandler.m_GetEncompassingAabb = AZ::Aabb::CreateFromMinMax(AZ::Vector3::CreateZero(), AZ::Vector3(10.0f));
|
||||
|
||||
@@ -551,7 +551,7 @@ namespace UnitTest
|
||||
config.m_altitudeMax = 24.0f;
|
||||
|
||||
auto entity = CreateEntity();
|
||||
CreateComponent<GradientSignal::SurfaceAltitudeGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::SurfaceAltitudeGradientComponent>(config);
|
||||
ActivateEntity(entity.get());
|
||||
|
||||
TestFixedDataSampler(expectedOutput, dataSize, entity->GetId());
|
||||
@@ -584,7 +584,7 @@ namespace UnitTest
|
||||
config.m_altitudeMax = 10.0f;
|
||||
|
||||
auto entity = CreateEntity();
|
||||
CreateComponent<GradientSignal::SurfaceAltitudeGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::SurfaceAltitudeGradientComponent>(config);
|
||||
ActivateEntity(entity.get());
|
||||
|
||||
TestFixedDataSampler(expectedOutput, dataSize, entity->GetId());
|
||||
@@ -612,7 +612,7 @@ namespace UnitTest
|
||||
config.m_altitudeMax = 15.0f;
|
||||
|
||||
auto entity = CreateEntity();
|
||||
CreateComponent<GradientSignal::SurfaceAltitudeGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::SurfaceAltitudeGradientComponent>(config);
|
||||
ActivateEntity(entity.get());
|
||||
|
||||
TestFixedDataSampler(expectedOutput, dataSize, entity->GetId());
|
||||
@@ -649,7 +649,7 @@ namespace UnitTest
|
||||
config.m_altitudeMax = 15.0f;
|
||||
|
||||
auto entity = CreateEntity();
|
||||
CreateComponent<GradientSignal::SurfaceAltitudeGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::SurfaceAltitudeGradientComponent>(config);
|
||||
ActivateEntity(entity.get());
|
||||
|
||||
TestFixedDataSampler(expectedOutput, dataSize, entity->GetId());
|
||||
@@ -684,7 +684,7 @@ namespace UnitTest
|
||||
config.m_surfaceTagList.push_back(AZ_CRC("test_mask", 0x7a16e9ff));
|
||||
|
||||
auto entity = CreateEntity();
|
||||
CreateComponent<GradientSignal::SurfaceMaskGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::SurfaceMaskGradientComponent>(config);
|
||||
ActivateEntity(entity.get());
|
||||
|
||||
TestFixedDataSampler(expectedOutput, dataSize, entity->GetId());
|
||||
@@ -711,7 +711,7 @@ namespace UnitTest
|
||||
config.m_surfaceTagList.push_back(AZ_CRC("test_mask", 0x7a16e9ff));
|
||||
|
||||
auto entity = CreateEntity();
|
||||
CreateComponent<GradientSignal::SurfaceMaskGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::SurfaceMaskGradientComponent>(config);
|
||||
ActivateEntity(entity.get());
|
||||
|
||||
TestFixedDataSampler(expectedOutput, dataSize, entity->GetId());
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace UnitTest
|
||||
config.m_value = expectedOutput;
|
||||
|
||||
auto entity = CreateEntity();
|
||||
CreateComponent<GradientSignal::ConstantGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::ConstantGradientComponent>(config);
|
||||
ActivateEntity(entity.get());
|
||||
|
||||
GradientSignal::GradientSampler gradientSampler;
|
||||
@@ -75,7 +75,7 @@ namespace UnitTest
|
||||
config.m_gradientSampler.m_gradientId = entityMock->GetId();
|
||||
|
||||
auto entity = CreateEntity();
|
||||
CreateComponent<GradientSignal::DitherGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::DitherGradientComponent>(config);
|
||||
ActivateEntity(entity.get());
|
||||
|
||||
TestFixedDataSampler(expectedOutput, dataSize, entity->GetId());
|
||||
@@ -109,7 +109,7 @@ namespace UnitTest
|
||||
config.m_gradientSampler.m_gradientId = entityMock->GetId();
|
||||
|
||||
auto entity = CreateEntity();
|
||||
CreateComponent<GradientSignal::DitherGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::DitherGradientComponent>(config);
|
||||
ActivateEntity(entity.get());
|
||||
|
||||
TestFixedDataSampler(expectedOutput, dataSize, entity->GetId());
|
||||
@@ -147,7 +147,7 @@ namespace UnitTest
|
||||
config.m_gradientSampler.m_gradientId = entityMock->GetId();
|
||||
|
||||
auto entity = CreateEntity();
|
||||
CreateComponent<GradientSignal::DitherGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::DitherGradientComponent>(config);
|
||||
ActivateEntity(entity.get());
|
||||
|
||||
TestFixedDataSampler(expectedOutput, dataSize, entity->GetId());
|
||||
@@ -185,7 +185,7 @@ namespace UnitTest
|
||||
config.m_gradientSampler.m_gradientId = entityMock->GetId();
|
||||
|
||||
auto entity = CreateEntity();
|
||||
CreateComponent<GradientSignal::DitherGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::DitherGradientComponent>(config);
|
||||
ActivateEntity(entity.get());
|
||||
|
||||
TestFixedDataSampler(expectedOutput, dataSize, entity->GetId());
|
||||
|
||||
@@ -44,11 +44,9 @@ namespace UnitTest
|
||||
// This lets our component register with surfaceData successfully.
|
||||
MockSurfaceDataSystem mockSurfaceDataSystem;
|
||||
|
||||
// Create a mock shape entity in case we want to use it.
|
||||
// Create a mock shape entity in case our gradient test uses shape constraints.
|
||||
// The mock shape is a cube that goes from -0.5 to 0.5 in space.
|
||||
auto mockShapeEntity = CreateEntity();
|
||||
CreateComponent<MockShapeComponent>(mockShapeEntity.get());
|
||||
MockShapeComponentHandler mockShapeHandler(mockShapeEntity->GetId());
|
||||
auto mockShapeEntity = CreateTestEntity(0.5f);
|
||||
ActivateEntity(mockShapeEntity.get());
|
||||
|
||||
// For ease of testing, use a constant gradient as our input gradient.
|
||||
@@ -76,8 +74,8 @@ namespace UnitTest
|
||||
|
||||
// Create the test entity with the GradientSurfaceData component and the required gradient dependency
|
||||
auto entity = CreateEntity();
|
||||
CreateComponent<GradientSignal::ConstantGradientComponent>(entity.get(), constantGradientConfig);
|
||||
CreateComponent<GradientSignal::GradientSurfaceDataComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::ConstantGradientComponent>(constantGradientConfig);
|
||||
entity->CreateComponent<GradientSignal::GradientSurfaceDataComponent>(config);
|
||||
ActivateEntity(entity.get());
|
||||
|
||||
// Get our registered modifier handle (and verify that it's valid)
|
||||
|
||||
@@ -27,14 +27,12 @@ namespace UnitTest
|
||||
void TestLevelsGradientComponent(int dataSize, const AZStd::vector<float>& inputData, const AZStd::vector<float>& expectedOutput,
|
||||
float inputMin, float inputMid, float inputMax, float outputMin, float outputMax)
|
||||
{
|
||||
auto entityMock = CreateEntity();
|
||||
auto entityMock = CreateTestEntity(1.0f);
|
||||
const AZ::EntityId id = entityMock->GetId();
|
||||
UnitTest::MockGradientArrayRequestsBus mockGradientRequestsBus(id, inputData, dataSize);
|
||||
|
||||
GradientSignal::GradientTransformConfig gradientTransformConfig;
|
||||
CreateComponent<GradientSignal::GradientTransformComponent>(entityMock.get(), gradientTransformConfig);
|
||||
CreateComponent<MockShapeComponent>(entityMock.get());
|
||||
MockShapeComponentHandler mockShapeHandler(entityMock->GetId());
|
||||
entityMock->CreateComponent<GradientSignal::GradientTransformComponent>(gradientTransformConfig);
|
||||
|
||||
ActivateEntity(entityMock.get());
|
||||
|
||||
@@ -47,7 +45,7 @@ namespace UnitTest
|
||||
config.m_outputMax = outputMax;
|
||||
|
||||
auto entity = CreateEntity();
|
||||
CreateComponent<GradientSignal::LevelsGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::LevelsGradientComponent>(config);
|
||||
ActivateEntity(entity.get());
|
||||
|
||||
TestFixedDataSampler(expectedOutput, dataSize, entity->GetId());
|
||||
@@ -56,14 +54,12 @@ namespace UnitTest
|
||||
void TestPosterizeGradientComponent(int dataSize, const AZStd::vector<float>& inputData, const AZStd::vector<float>& expectedOutput,
|
||||
GradientSignal::PosterizeGradientConfig::ModeType posterizeMode, int bands)
|
||||
{
|
||||
auto entityMock = CreateEntity();
|
||||
auto entityMock = CreateTestEntity(0.5f);
|
||||
const AZ::EntityId id = entityMock->GetId();
|
||||
UnitTest::MockGradientArrayRequestsBus mockGradientRequestsBus(id, inputData, dataSize);
|
||||
|
||||
GradientSignal::GradientTransformConfig gradientTransformConfig;
|
||||
CreateComponent<GradientSignal::GradientTransformComponent>(entityMock.get(), gradientTransformConfig);
|
||||
CreateComponent<MockShapeComponent>(entityMock.get());
|
||||
MockShapeComponentHandler mockShapeHandler(entityMock->GetId());
|
||||
entityMock->CreateComponent<GradientSignal::GradientTransformComponent>(gradientTransformConfig);
|
||||
|
||||
ActivateEntity(entityMock.get());
|
||||
|
||||
@@ -73,7 +69,7 @@ namespace UnitTest
|
||||
config.m_bands = bands;
|
||||
|
||||
auto entity = CreateEntity();
|
||||
CreateComponent<GradientSignal::PosterizeGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::PosterizeGradientComponent>(config);
|
||||
ActivateEntity(entity.get());
|
||||
|
||||
TestFixedDataSampler(expectedOutput, dataSize, entity->GetId());
|
||||
@@ -82,14 +78,12 @@ namespace UnitTest
|
||||
void TestSmoothStepGradientComponent(int dataSize, const AZStd::vector<float>& inputData, const AZStd::vector<float>& expectedOutput,
|
||||
float midpoint, float range, float softness)
|
||||
{
|
||||
auto entityMock = CreateEntity();
|
||||
auto entityMock = CreateTestEntity(0.5f);
|
||||
const AZ::EntityId id = entityMock->GetId();
|
||||
UnitTest::MockGradientArrayRequestsBus mockGradientRequestsBus(id, inputData, dataSize);
|
||||
|
||||
GradientSignal::GradientTransformConfig gradientTransformConfig;
|
||||
CreateComponent<GradientSignal::GradientTransformComponent>(entityMock.get(), gradientTransformConfig);
|
||||
CreateComponent<MockShapeComponent>(entityMock.get());
|
||||
MockShapeComponentHandler mockShapeHandler(entityMock->GetId());
|
||||
entityMock->CreateComponent<GradientSignal::GradientTransformComponent>(gradientTransformConfig);
|
||||
|
||||
ActivateEntity(entityMock.get());
|
||||
|
||||
@@ -100,7 +94,7 @@ namespace UnitTest
|
||||
config.m_smoothStep.m_falloffStrength = softness;
|
||||
|
||||
auto entity = CreateEntity();
|
||||
CreateComponent<GradientSignal::SmoothStepGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::SmoothStepGradientComponent>(config);
|
||||
ActivateEntity(entity.get());
|
||||
|
||||
TestFixedDataSampler(expectedOutput, dataSize, entity->GetId());
|
||||
@@ -108,14 +102,12 @@ namespace UnitTest
|
||||
|
||||
void TestThresholdGradientComponent(int dataSize, const AZStd::vector<float>& inputData, const AZStd::vector<float>& expectedOutput, float threshold)
|
||||
{
|
||||
auto entityMock = CreateEntity();
|
||||
auto entityMock = CreateTestEntity(0.5f);
|
||||
const AZ::EntityId id = entityMock->GetId();
|
||||
UnitTest::MockGradientArrayRequestsBus mockGradientRequestsBus(id, inputData, dataSize);
|
||||
|
||||
GradientSignal::GradientTransformConfig gradientTransformConfig;
|
||||
CreateComponent<GradientSignal::GradientTransformComponent>(entityMock.get(), gradientTransformConfig);
|
||||
CreateComponent<MockShapeComponent>(entityMock.get());
|
||||
MockShapeComponentHandler mockShapeHandler(entityMock->GetId());
|
||||
entityMock->CreateComponent<GradientSignal::GradientTransformComponent>(gradientTransformConfig);
|
||||
|
||||
ActivateEntity(entityMock.get());
|
||||
|
||||
@@ -124,7 +116,7 @@ namespace UnitTest
|
||||
config.m_threshold = threshold;
|
||||
|
||||
auto entity = CreateEntity();
|
||||
CreateComponent<GradientSignal::ThresholdGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::ThresholdGradientComponent>(config);
|
||||
ActivateEntity(entity.get());
|
||||
|
||||
TestFixedDataSampler(expectedOutput, dataSize, entity->GetId());
|
||||
@@ -167,11 +159,11 @@ namespace UnitTest
|
||||
AZStd::vector<float> expectedOutput = { AZ_TRAIT_UNIT_TEST_PERLINE_GRADIANT_GOLDEN_VALUES_7878 };
|
||||
|
||||
auto entity = CreateEntity();
|
||||
CreateComponent<GradientSignal::PerlinGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::PerlinGradientComponent>(config);
|
||||
|
||||
GradientSignal::GradientTransformConfig gradientTransformConfig;
|
||||
CreateComponent<GradientSignal::GradientTransformComponent>(entity.get(), gradientTransformConfig);
|
||||
CreateComponent<MockShapeComponent>(entity.get());
|
||||
entity->CreateComponent<GradientSignal::GradientTransformComponent>(gradientTransformConfig);
|
||||
entity->CreateComponent<MockShapeComponent>();
|
||||
MockShapeComponentHandler mockShapeHandler(entity->GetId());
|
||||
|
||||
ActivateEntity(entity.get());
|
||||
@@ -197,11 +189,11 @@ namespace UnitTest
|
||||
config.m_randomSeed = 5656;
|
||||
|
||||
auto entity = CreateEntity();
|
||||
CreateComponent<GradientSignal::RandomGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::RandomGradientComponent>(config);
|
||||
|
||||
GradientSignal::GradientTransformConfig gradientTransformConfig;
|
||||
CreateComponent<GradientSignal::GradientTransformComponent>(entity.get(), gradientTransformConfig);
|
||||
CreateComponent<MockShapeComponent>(entity.get());
|
||||
entity->CreateComponent<GradientSignal::GradientTransformComponent>(gradientTransformConfig);
|
||||
entity->CreateComponent<MockShapeComponent>();
|
||||
MockShapeComponentHandler mockShapeHandler(entity->GetId());
|
||||
|
||||
ActivateEntity(entity.get());
|
||||
@@ -546,4 +538,5 @@ namespace UnitTest
|
||||
}
|
||||
}
|
||||
|
||||
AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV);
|
||||
// This uses custom test / benchmark hooks so that we can load LmbrCentral and use Shape components in our unit tests and benchmarks.
|
||||
AZ_UNIT_TEST_HOOK(new UnitTest::GradientSignalTestEnvironment, UnitTest::GradientSignalBenchmarkEnvironment);
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
#include <Tests/GradientSignalTestFixtures.h>
|
||||
|
||||
#include <AzFramework/Components/TransformComponent.h>
|
||||
#include <GradientSignal/Components/GradientSurfaceDataComponent.h>
|
||||
#include <GradientSignal/Components/GradientTransformComponent.h>
|
||||
#include <LmbrCentral/Shape/BoxShapeComponentBus.h>
|
||||
|
||||
// Base gradient components
|
||||
#include <GradientSignal/Components/ConstantGradientComponent.h>
|
||||
@@ -36,65 +38,48 @@
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
void GradientSignalTestEnvironment::AddGemsAndComponents()
|
||||
{
|
||||
AddDynamicModulePaths({ "LmbrCentral" });
|
||||
|
||||
AddComponentDescriptors({
|
||||
AzFramework::TransformComponent::CreateDescriptor(),
|
||||
|
||||
GradientSignal::ConstantGradientComponent::CreateDescriptor(),
|
||||
GradientSignal::DitherGradientComponent::CreateDescriptor(),
|
||||
GradientSignal::GradientSurfaceDataComponent::CreateDescriptor(),
|
||||
GradientSignal::GradientTransformComponent::CreateDescriptor(),
|
||||
GradientSignal::ImageGradientComponent::CreateDescriptor(),
|
||||
GradientSignal::InvertGradientComponent::CreateDescriptor(),
|
||||
GradientSignal::LevelsGradientComponent::CreateDescriptor(),
|
||||
GradientSignal::MixedGradientComponent::CreateDescriptor(),
|
||||
GradientSignal::PerlinGradientComponent::CreateDescriptor(),
|
||||
GradientSignal::PosterizeGradientComponent::CreateDescriptor(),
|
||||
GradientSignal::RandomGradientComponent::CreateDescriptor(),
|
||||
GradientSignal::ReferenceGradientComponent::CreateDescriptor(),
|
||||
GradientSignal::ShapeAreaFalloffGradientComponent::CreateDescriptor(),
|
||||
GradientSignal::SmoothStepGradientComponent::CreateDescriptor(),
|
||||
GradientSignal::SurfaceAltitudeGradientComponent::CreateDescriptor(),
|
||||
GradientSignal::SurfaceMaskGradientComponent::CreateDescriptor(),
|
||||
GradientSignal::SurfaceSlopeGradientComponent::CreateDescriptor(),
|
||||
GradientSignal::ThresholdGradientComponent::CreateDescriptor(),
|
||||
|
||||
MockShapeComponent::CreateDescriptor(),
|
||||
});
|
||||
}
|
||||
|
||||
void GradientSignalBaseFixture::SetupCoreSystems()
|
||||
{
|
||||
m_app = AZStd::make_unique<AZ::ComponentApplication>();
|
||||
ASSERT_TRUE(m_app != nullptr);
|
||||
|
||||
AZ::ComponentApplication::Descriptor componentAppDesc;
|
||||
|
||||
m_systemEntity = m_app->Create(componentAppDesc);
|
||||
ASSERT_TRUE(m_systemEntity != nullptr);
|
||||
m_app->AddEntity(m_systemEntity);
|
||||
|
||||
AZ::AllocatorInstance<AZ::ThreadPoolAllocator>::Create();
|
||||
AZ::Data::AssetManager::Descriptor desc;
|
||||
AZ::Data::AssetManager::Create(desc);
|
||||
m_mockHandler = new ImageAssetMockAssetHandler();
|
||||
m_mockHandler = new UnitTest::ImageAssetMockAssetHandler();
|
||||
AZ::Data::AssetManager::Instance().RegisterHandler(m_mockHandler, azrtti_typeid<GradientSignal::ImageAsset>());
|
||||
|
||||
m_mockShapeHandlers = new AZStd::vector<AZStd::unique_ptr<testing::NiceMock<UnitTest::MockShapeComponentRequests>>>();
|
||||
}
|
||||
|
||||
void GradientSignalBaseFixture::TearDownCoreSystems()
|
||||
{
|
||||
// Clear any mock shape handlers that we've created for our test entities.
|
||||
delete m_mockShapeHandlers;
|
||||
|
||||
AZ::Data::AssetManager::Instance().UnregisterHandler(m_mockHandler);
|
||||
delete m_mockHandler; // delete after removing from the asset manager
|
||||
|
||||
AzFramework::LegacyAssetEventBus::ClearQueuedEvents();
|
||||
AZ::Data::AssetManager::Destroy();
|
||||
AZ::AllocatorInstance<AZ::ThreadPoolAllocator>::Destroy();
|
||||
|
||||
m_app->Destroy();
|
||||
m_app.reset();
|
||||
m_systemEntity = nullptr;
|
||||
}
|
||||
|
||||
AZStd::unique_ptr<testing::NiceMock<UnitTest::MockShapeComponentRequests>> GradientSignalBaseFixture::CreateMockShape(
|
||||
const AZ::Aabb& spawnerBox, const AZ::EntityId& shapeEntityId)
|
||||
{
|
||||
AZStd::unique_ptr<testing::NiceMock<UnitTest::MockShapeComponentRequests>> mockShape =
|
||||
AZStd::make_unique<testing::NiceMock<UnitTest::MockShapeComponentRequests>>(shapeEntityId);
|
||||
|
||||
ON_CALL(*mockShape, GetEncompassingAabb).WillByDefault(testing::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;
|
||||
}
|
||||
|
||||
AZStd::unique_ptr<MockSurfaceDataSystem> GradientSignalBaseFixture::CreateMockSurfaceDataSystem(const AZ::Aabb& spawnerBox)
|
||||
@@ -130,16 +115,12 @@ namespace UnitTest
|
||||
// Create the base entity
|
||||
AZStd::unique_ptr<AZ::Entity> testEntity = CreateEntity();
|
||||
|
||||
// Create a mock Shape component that describes the bounds that we're using to map our gradient into world space.
|
||||
CreateComponent<MockShapeComponent>(testEntity.get());
|
||||
|
||||
// Create and keep a reference to a mock shape handler that will respond to shape requests for the mock shape.
|
||||
auto mockShapeHandler =
|
||||
CreateMockShape(AZ::Aabb::CreateCenterRadius(AZ::Vector3(shapeHalfBounds), shapeHalfBounds), testEntity->GetId());
|
||||
m_mockShapeHandlers->push_back(AZStd::move(mockShapeHandler));
|
||||
LmbrCentral::BoxShapeConfig boxConfig(AZ::Vector3(shapeHalfBounds * 2.0f));
|
||||
auto boxComponent = testEntity->CreateComponent(LmbrCentral::AxisAlignedBoxShapeComponentTypeId);
|
||||
boxComponent->SetConfiguration(boxConfig);
|
||||
|
||||
// Create a transform that locates our gradient in the center of our desired mock Shape.
|
||||
auto transform = CreateComponent<AzFramework::TransformComponent>(testEntity.get());
|
||||
auto transform = testEntity->CreateComponent<AzFramework::TransformComponent>();
|
||||
transform->SetLocalTM(AZ::Transform::CreateTranslation(AZ::Vector3(shapeHalfBounds)));
|
||||
transform->SetWorldTM(AZ::Transform::CreateTranslation(AZ::Vector3(shapeHalfBounds)));
|
||||
|
||||
@@ -152,7 +133,7 @@ namespace UnitTest
|
||||
auto entity = CreateTestEntity(shapeHalfBounds);
|
||||
GradientSignal::ConstantGradientConfig config;
|
||||
config.m_value = 0.75f;
|
||||
CreateComponent<GradientSignal::ConstantGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::ConstantGradientComponent>(config);
|
||||
|
||||
ActivateEntity(entity.get());
|
||||
return entity;
|
||||
@@ -168,12 +149,12 @@ namespace UnitTest
|
||||
config.m_imageAsset = ImageAssetMockAssetHandler::CreateImageAsset(imageSize, imageSize, imageSeed);
|
||||
config.m_tilingX = 1.0f;
|
||||
config.m_tilingY = 1.0f;
|
||||
CreateComponent<GradientSignal::ImageGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::ImageGradientComponent>(config);
|
||||
|
||||
// Create a Gradient Transform Component with arbitrary parameters.
|
||||
GradientSignal::GradientTransformConfig gradientTransformConfig;
|
||||
gradientTransformConfig.m_wrappingType = GradientSignal::WrappingType::None;
|
||||
CreateComponent<GradientSignal::GradientTransformComponent>(entity.get(), gradientTransformConfig);
|
||||
entity->CreateComponent<GradientSignal::GradientTransformComponent>(gradientTransformConfig);
|
||||
|
||||
ActivateEntity(entity.get());
|
||||
return entity;
|
||||
@@ -188,12 +169,12 @@ namespace UnitTest
|
||||
config.m_frequency = 1.1f;
|
||||
config.m_octave = 4;
|
||||
config.m_randomSeed = 12345;
|
||||
CreateComponent<GradientSignal::PerlinGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::PerlinGradientComponent>(config);
|
||||
|
||||
// Create a Gradient Transform Component with arbitrary parameters.
|
||||
GradientSignal::GradientTransformConfig gradientTransformConfig;
|
||||
gradientTransformConfig.m_wrappingType = GradientSignal::WrappingType::None;
|
||||
CreateComponent<GradientSignal::GradientTransformComponent>(entity.get(), gradientTransformConfig);
|
||||
entity->CreateComponent<GradientSignal::GradientTransformComponent>(gradientTransformConfig);
|
||||
|
||||
ActivateEntity(entity.get());
|
||||
return entity;
|
||||
@@ -205,12 +186,12 @@ namespace UnitTest
|
||||
auto entity = CreateTestEntity(shapeHalfBounds);
|
||||
GradientSignal::RandomGradientConfig config;
|
||||
config.m_randomSeed = 12345;
|
||||
CreateComponent<GradientSignal::RandomGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::RandomGradientComponent>(config);
|
||||
|
||||
// Create a Gradient Transform Component with arbitrary parameters.
|
||||
GradientSignal::GradientTransformConfig gradientTransformConfig;
|
||||
gradientTransformConfig.m_wrappingType = GradientSignal::WrappingType::None;
|
||||
CreateComponent<GradientSignal::GradientTransformComponent>(entity.get(), gradientTransformConfig);
|
||||
entity->CreateComponent<GradientSignal::GradientTransformComponent>(gradientTransformConfig);
|
||||
|
||||
ActivateEntity(entity.get());
|
||||
return entity;
|
||||
@@ -224,7 +205,7 @@ namespace UnitTest
|
||||
config.m_shapeEntityId = entity->GetId();
|
||||
config.m_falloffWidth = 16.0f;
|
||||
config.m_falloffType = GradientSignal::FalloffType::InnerOuter;
|
||||
CreateComponent<GradientSignal::ShapeAreaFalloffGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::ShapeAreaFalloffGradientComponent>(config);
|
||||
|
||||
ActivateEntity(entity.get());
|
||||
return entity;
|
||||
@@ -238,10 +219,11 @@ namespace UnitTest
|
||||
GradientSignal::DitherGradientConfig config;
|
||||
config.m_gradientSampler.m_gradientId = inputGradientId;
|
||||
config.m_useSystemPointsPerUnit = false;
|
||||
config.m_pointsPerUnit = 1.0f;
|
||||
// Use a number other than 1.0f for pointsPerUnit to ensure the dither math is getting exercised properly.
|
||||
config.m_pointsPerUnit = 0.25f;
|
||||
config.m_patternOffset = AZ::Vector3::CreateZero();
|
||||
config.m_patternType = GradientSignal::DitherGradientConfig::BayerPatternType::PATTERN_SIZE_4x4;
|
||||
CreateComponent<GradientSignal::DitherGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::DitherGradientComponent>(config);
|
||||
|
||||
ActivateEntity(entity.get());
|
||||
return entity;
|
||||
@@ -254,7 +236,7 @@ namespace UnitTest
|
||||
auto entity = CreateTestEntity(shapeHalfBounds);
|
||||
GradientSignal::InvertGradientConfig config;
|
||||
config.m_gradientSampler.m_gradientId = inputGradientId;
|
||||
CreateComponent<GradientSignal::InvertGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::InvertGradientComponent>(config);
|
||||
|
||||
ActivateEntity(entity.get());
|
||||
return entity;
|
||||
@@ -272,7 +254,7 @@ namespace UnitTest
|
||||
config.m_inputMax = 0.9f;
|
||||
config.m_outputMin = 0.0f;
|
||||
config.m_outputMax = 1.0f;
|
||||
CreateComponent<GradientSignal::LevelsGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::LevelsGradientComponent>(config);
|
||||
|
||||
ActivateEntity(entity.get());
|
||||
return entity;
|
||||
@@ -298,7 +280,7 @@ namespace UnitTest
|
||||
layer.m_gradientSampler.m_opacity = 0.75f;
|
||||
config.m_layers.push_back(layer);
|
||||
|
||||
CreateComponent<GradientSignal::MixedGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::MixedGradientComponent>(config);
|
||||
|
||||
ActivateEntity(entity.get());
|
||||
return entity;
|
||||
@@ -313,7 +295,7 @@ namespace UnitTest
|
||||
config.m_gradientSampler.m_gradientId = inputGradientId;
|
||||
config.m_mode = GradientSignal::PosterizeGradientConfig::ModeType::Ps;
|
||||
config.m_bands = 5;
|
||||
CreateComponent<GradientSignal::PosterizeGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::PosterizeGradientComponent>(config);
|
||||
|
||||
ActivateEntity(entity.get());
|
||||
return entity;
|
||||
@@ -327,7 +309,7 @@ namespace UnitTest
|
||||
GradientSignal::ReferenceGradientConfig config;
|
||||
config.m_gradientSampler.m_gradientId = inputGradientId;
|
||||
config.m_gradientSampler.m_ownerEntityId = entity->GetId();
|
||||
CreateComponent<GradientSignal::ReferenceGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::ReferenceGradientComponent>(config);
|
||||
|
||||
ActivateEntity(entity.get());
|
||||
return entity;
|
||||
@@ -343,7 +325,7 @@ namespace UnitTest
|
||||
config.m_smoothStep.m_falloffMidpoint = 0.75f;
|
||||
config.m_smoothStep.m_falloffRange = 0.125f;
|
||||
config.m_smoothStep.m_falloffStrength = 0.25f;
|
||||
CreateComponent<GradientSignal::SmoothStepGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::SmoothStepGradientComponent>(config);
|
||||
|
||||
ActivateEntity(entity.get());
|
||||
return entity;
|
||||
@@ -357,7 +339,7 @@ namespace UnitTest
|
||||
GradientSignal::ThresholdGradientConfig config;
|
||||
config.m_gradientSampler.m_gradientId = inputGradientId;
|
||||
config.m_threshold = 0.75f;
|
||||
CreateComponent<GradientSignal::ThresholdGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::ThresholdGradientComponent>(config);
|
||||
|
||||
ActivateEntity(entity.get());
|
||||
return entity;
|
||||
@@ -370,7 +352,7 @@ namespace UnitTest
|
||||
GradientSignal::SurfaceAltitudeGradientConfig config;
|
||||
config.m_altitudeMin = -5.0f;
|
||||
config.m_altitudeMax = 15.0f;
|
||||
CreateComponent<GradientSignal::SurfaceAltitudeGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::SurfaceAltitudeGradientComponent>(config);
|
||||
|
||||
ActivateEntity(entity.get());
|
||||
return entity;
|
||||
@@ -382,7 +364,7 @@ namespace UnitTest
|
||||
auto entity = CreateTestEntity(shapeHalfBounds);
|
||||
GradientSignal::SurfaceMaskGradientConfig config;
|
||||
config.m_surfaceTagList.push_back(AZ_CRC_CE("test_mask"));
|
||||
CreateComponent<GradientSignal::SurfaceMaskGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::SurfaceMaskGradientComponent>(config);
|
||||
|
||||
ActivateEntity(entity.get());
|
||||
return entity;
|
||||
@@ -399,7 +381,7 @@ namespace UnitTest
|
||||
config.m_smoothStep.m_falloffMidpoint = 0.75f;
|
||||
config.m_smoothStep.m_falloffRange = 0.125f;
|
||||
config.m_smoothStep.m_falloffStrength = 0.25f;
|
||||
CreateComponent<GradientSignal::SurfaceSlopeGradientComponent>(entity.get(), config);
|
||||
entity->CreateComponent<GradientSignal::SurfaceSlopeGradientComponent>(config);
|
||||
|
||||
ActivateEntity(entity.get());
|
||||
return entity;
|
||||
|
||||
@@ -9,9 +9,39 @@
|
||||
|
||||
#include <Tests/GradientSignalTestMocks.h>
|
||||
#include <LmbrCentral/Shape/MockShapes.h>
|
||||
#include <AzTest/GemTestEnvironment.h>
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
// The GradientSignal unit tests need to use the GemTestEnvironment to load the LmbrCentral Gem so that Shape components can be used
|
||||
// in the unit tests and benchmarks.
|
||||
class GradientSignalTestEnvironment
|
||||
: public AZ::Test::GemTestEnvironment
|
||||
{
|
||||
public:
|
||||
void AddGemsAndComponents() override;
|
||||
};
|
||||
|
||||
#ifdef HAVE_BENCHMARK
|
||||
//! The Benchmark environment is used for one time setup and tear down of shared resources
|
||||
class GradientSignalBenchmarkEnvironment
|
||||
: public AZ::Test::BenchmarkEnvironmentBase
|
||||
, public GradientSignalTestEnvironment
|
||||
|
||||
{
|
||||
protected:
|
||||
void SetUpBenchmark() override
|
||||
{
|
||||
SetupEnvironment();
|
||||
}
|
||||
|
||||
void TearDownBenchmark() override
|
||||
{
|
||||
TeardownEnvironment();
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
// Base test fixture used for GradientSignal unit tests and benchmark tests
|
||||
class GradientSignalBaseFixture
|
||||
{
|
||||
@@ -30,24 +60,6 @@ namespace UnitTest
|
||||
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 mock shape that will respond to the shape bus with proper responses for the given input box.
|
||||
AZStd::unique_ptr<testing::NiceMock<UnitTest::MockShapeComponentRequests>> CreateMockShape(
|
||||
const AZ::Aabb& spawnerBox, const AZ::EntityId& shapeEntityId);
|
||||
|
||||
// Create a mock SurfaceDataSystem that will respond to requests for surface points with mock responses for points inside
|
||||
// the given input box.
|
||||
AZStd::unique_ptr<MockSurfaceDataSystem> CreateMockSurfaceDataSystem(const AZ::Aabb& spawnerBox);
|
||||
@@ -77,27 +89,22 @@ namespace UnitTest
|
||||
AZStd::unique_ptr<AZ::Entity> BuildTestSurfaceMaskGradient(float shapeHalfBounds);
|
||||
AZStd::unique_ptr<AZ::Entity> BuildTestSurfaceSlopeGradient(float shapeHalfBounds);
|
||||
|
||||
AZStd::unique_ptr<AZ::ComponentApplication> m_app;
|
||||
AZ::Entity* m_systemEntity = nullptr;
|
||||
ImageAssetMockAssetHandler* m_mockHandler = nullptr;
|
||||
AZStd::vector<AZStd::unique_ptr<testing::NiceMock<UnitTest::MockShapeComponentRequests>>>* m_mockShapeHandlers = nullptr;
|
||||
UnitTest::ImageAssetMockAssetHandler* m_mockHandler = nullptr;
|
||||
};
|
||||
|
||||
struct GradientSignalTest
|
||||
: public GradientSignalBaseFixture
|
||||
, public UnitTest::AllocatorsTestFixture
|
||||
, public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
void SetUp() override
|
||||
{
|
||||
UnitTest::AllocatorsTestFixture::SetUp();
|
||||
SetupCoreSystems();
|
||||
}
|
||||
|
||||
void TearDown() override
|
||||
{
|
||||
TearDownCoreSystems();
|
||||
UnitTest::AllocatorsTestFixture::TearDown();
|
||||
}
|
||||
|
||||
void TestFixedDataSampler(const AZStd::vector<float>& expectedOutput, int size, AZ::EntityId gradientEntityId);
|
||||
@@ -106,41 +113,36 @@ namespace UnitTest
|
||||
#ifdef HAVE_BENCHMARK
|
||||
class GradientSignalBenchmarkFixture
|
||||
: public GradientSignalBaseFixture
|
||||
, public UnitTest::AllocatorsBenchmarkFixture
|
||||
, public UnitTest::TraceBusRedirector
|
||||
, public ::benchmark::Fixture
|
||||
{
|
||||
public:
|
||||
void internalSetUp(const benchmark::State& state)
|
||||
void internalSetUp()
|
||||
{
|
||||
AZ::Debug::TraceMessageBus::Handler::BusConnect();
|
||||
UnitTest::AllocatorsBenchmarkFixture::SetUp(state);
|
||||
SetupCoreSystems();
|
||||
}
|
||||
|
||||
void internalTearDown(const benchmark::State& state)
|
||||
void internalTearDown()
|
||||
{
|
||||
TearDownCoreSystems();
|
||||
UnitTest::AllocatorsBenchmarkFixture::TearDown(state);
|
||||
AZ::Debug::TraceMessageBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
protected:
|
||||
void SetUp(const benchmark::State& state) override
|
||||
void SetUp([[maybe_unused]] const benchmark::State& state) override
|
||||
{
|
||||
internalSetUp(state);
|
||||
internalSetUp();
|
||||
}
|
||||
void SetUp(benchmark::State& state) override
|
||||
void SetUp([[maybe_unused]] benchmark::State& state) override
|
||||
{
|
||||
internalSetUp(state);
|
||||
internalSetUp();
|
||||
}
|
||||
|
||||
void TearDown(const benchmark::State& state) override
|
||||
void TearDown([[maybe_unused]] const benchmark::State& state) override
|
||||
{
|
||||
internalTearDown(state);
|
||||
internalTearDown();
|
||||
}
|
||||
void TearDown(benchmark::State& state) override
|
||||
void TearDown([[maybe_unused]] benchmark::State& state) override
|
||||
{
|
||||
internalTearDown(state);
|
||||
internalTearDown();
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <AzCore/Component/ComponentApplication.h>
|
||||
#include <GradientSignal/GradientImageConversion.h>
|
||||
#include <AzCore/UnitTest/UnitTest.h>
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
|
||||
#include <limits>
|
||||
|
||||
@@ -64,26 +65,8 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
class ImageAssetTest
|
||||
: public ::testing::Test
|
||||
class ImageAssetTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
AZ::ComponentApplication m_app;
|
||||
AZ::Entity* m_systemEntity = nullptr;
|
||||
|
||||
void SetUp() override
|
||||
{
|
||||
AZ::ComponentApplication::Descriptor appDesc;
|
||||
appDesc.m_memoryBlocksByteSize = 128 * 1024 * 1024;
|
||||
m_systemEntity = m_app.Create(appDesc);
|
||||
m_app.AddEntity(m_systemEntity);
|
||||
}
|
||||
|
||||
void TearDown() override
|
||||
{
|
||||
m_app.Destroy();
|
||||
m_systemEntity = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
#if AZ_TRAIT_DISABLE_FAILED_GRADIENT_SIGNAL_TESTS
|
||||
|
||||
@@ -58,10 +58,13 @@ ly_add_target(
|
||||
# by default, load the above "Gem::LyShine" module in Client and Server applications:
|
||||
ly_create_alias(NAME LyShine.Clients NAMESPACE Gem TARGETS Gem::LyShine)
|
||||
ly_create_alias(NAME LyShine.Servers NAMESPACE Gem TARGETS Gem::LyShine)
|
||||
# create an alias for other gems to depend on an LyShine public API (may be converted to a target in the future):
|
||||
ly_create_alias(NAME LyShine.Clients.API NAMESPACE Gem TARGETS Gem::LyShine.Clients)
|
||||
ly_create_alias(NAME LyShine.Servers.API NAMESPACE Gem TARGETS Gem::LyShine.Servers)
|
||||
|
||||
if (PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
ly_add_target(
|
||||
NAME LyShine.Editor.Static STATIC
|
||||
NAME LyShine.Tools.Static STATIC
|
||||
NAMESPACE Gem
|
||||
AUTOMOC
|
||||
AUTOUIC
|
||||
@@ -73,7 +76,6 @@ if (PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
.
|
||||
Source
|
||||
Editor
|
||||
PUBLIC
|
||||
Include
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
@@ -100,7 +102,7 @@ if (PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
)
|
||||
|
||||
ly_add_target(
|
||||
NAME LyShine.Editor GEM_MODULE
|
||||
NAME LyShine.Tools GEM_MODULE
|
||||
NAMESPACE Gem
|
||||
FILES_CMAKE
|
||||
lyshine_common_module_files.cmake
|
||||
@@ -112,18 +114,18 @@ if (PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
.
|
||||
Source
|
||||
Editor
|
||||
PUBLIC
|
||||
Include
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
Legacy::CryCommon
|
||||
AZ::AzToolsFramework
|
||||
Gem::LyShine.Editor.Static
|
||||
Gem::LyShine.Tools.Static
|
||||
Gem::LmbrCentral.Editor
|
||||
Gem::TextureAtlas.Editor
|
||||
RUNTIME_DEPENDENCIES
|
||||
Gem::LmbrCentral.Editor
|
||||
Gem::TextureAtlas.Editor
|
||||
Gem::UiBasics.Tools
|
||||
)
|
||||
|
||||
# by naming this target LyShine.Builders it ensures that it is loaded
|
||||
@@ -179,10 +181,9 @@ if (PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
Gem::LyShine.Builders.Static
|
||||
Gem::LmbrCentral.Editor
|
||||
Gem::TextureAtlas.Editor
|
||||
RUNTIME_DEPENDENCIES
|
||||
Gem::UiBasics.Builders
|
||||
)
|
||||
|
||||
# by default, load the above "Gem::LyShine.Editor" module in dev tools:
|
||||
ly_create_alias(NAME LyShine.Tools NAMESPACE Gem TARGETS Gem::LyShine.Editor)
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
@@ -241,7 +242,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
AZ::AzTest
|
||||
Legacy::CryCommon
|
||||
AZ::AssetBuilderSDK
|
||||
Gem::LyShine.Editor.Static
|
||||
Gem::LyShine.Tools.Static
|
||||
Gem::LyShine.Builders.Static
|
||||
Gem::LmbrCentral.Editor
|
||||
Gem::TextureAtlas
|
||||
|
||||
@@ -173,7 +173,7 @@ namespace GuideHelpers
|
||||
// the line is drawn as the inverse of the background color
|
||||
AZ::Color guideColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
CDraw2d::RenderState renderState;
|
||||
IDraw2d::RenderState renderState;
|
||||
renderState.m_blendState.m_blendSource = AZ::RHI::BlendFactor::ColorDestInverse;
|
||||
renderState.m_blendState.m_blendDest = AZ::RHI::BlendFactor::Zero;
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ void ViewportCanvasBackground::Draw(Draw2dHelper& draw2d, const AZ::Vector2& can
|
||||
// now draw the same as Stretched but with UV's adjusted
|
||||
const AZ::Vector2 uvs[4] = { AZ::Vector2(0, 0), AZ::Vector2(uvScale.GetX(), 0), AZ::Vector2(uvScale.GetX(), uvScale.GetY()), AZ::Vector2(0, uvScale.GetY()) };
|
||||
AZ::Color colorWhite(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
CDraw2d::VertexPosColUV verts[4];
|
||||
IDraw2d::VertexPosColUV verts[4];
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
verts[i].position = positions[i];
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <LyShine/Draw2d.h>
|
||||
#include <LyShine/IDraw2d.h>
|
||||
|
||||
//! Abstract base class for drag interactions in the UI Editor viewport window.
|
||||
class ViewportDragInteraction
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <LyShine/Draw2d.h>
|
||||
#include <LyShine/IDraw2d.h>
|
||||
|
||||
namespace ViewportHelpers
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
*/
|
||||
#include "EditorCommon.h"
|
||||
#include <LyShine/Draw2d.h>
|
||||
#include <LyShine/IDraw2d.h>
|
||||
|
||||
#include <Atom/RPI.Public/Image/StreamingImage.h>
|
||||
#include <Atom/RPI.Reflect/Image/StreamingImageAsset.h>
|
||||
@@ -15,7 +15,7 @@ float ViewportIcon::m_dpiScaleFactor = 1.0f;
|
||||
|
||||
ViewportIcon::ViewportIcon(const char* textureFilename)
|
||||
{
|
||||
m_image = CDraw2d::LoadTexture(textureFilename);
|
||||
m_image = Draw2dHelper::LoadTexture(textureFilename);
|
||||
}
|
||||
|
||||
ViewportIcon::~ViewportIcon()
|
||||
@@ -48,7 +48,7 @@ void ViewportIcon::DrawImageAligned(Draw2dHelper& draw2d, AZ::Vector2& pivot, fl
|
||||
opacity);
|
||||
}
|
||||
|
||||
void ViewportIcon::DrawImageTiled(Draw2dHelper& draw2d, CDraw2d::VertexPosColUV* verts)
|
||||
void ViewportIcon::DrawImageTiled(Draw2dHelper& draw2d, IDraw2d::VertexPosColUV* verts)
|
||||
{
|
||||
// Use default blending and rounding modes
|
||||
IDraw2d::Rounding rounding = IDraw2d::Rounding::Nearest;
|
||||
@@ -63,7 +63,7 @@ void ViewportIcon::DrawAxisAlignedBoundingBox(Draw2dHelper& draw2d, AZ::Vector2
|
||||
float endTexCoordU = fabsf((bound1.GetX() - bound0.GetX()) * pixelLengthForDottedLineTexture);
|
||||
float endTexCoordV = fabsf((bound1.GetY() - bound0.GetY()) * pixelLengthForDottedLineTexture);
|
||||
|
||||
CDraw2d::VertexPosColUV verts[2];
|
||||
IDraw2d::VertexPosColUV verts[2];
|
||||
{
|
||||
verts[0].color = dottedColor;
|
||||
verts[1].color = dottedColor;
|
||||
@@ -158,7 +158,7 @@ void ViewportIcon::Draw(Draw2dHelper& draw2d, AZ::Vector2 anchorPos, const AZ::M
|
||||
AZ::Matrix4x4 moveFromPivotSpaceMat = AZ::Matrix4x4::CreateTranslation(pivot3);
|
||||
AZ::Matrix4x4 newTransform = transform * moveFromPivotSpaceMat * rotMat * moveToPivotSpaceMat;
|
||||
|
||||
CDraw2d::VertexPosColUV verts[4];
|
||||
IDraw2d::VertexPosColUV verts[4];
|
||||
// points are a clockwise quad
|
||||
static const AZ::Vector2 uvs[4] = {
|
||||
AZ::Vector2(0.0f, 0.0f), AZ::Vector2(1.0f, 0.0f), AZ::Vector2(1.0f, 1.0f), AZ::Vector2(0.0f, 1.0f)
|
||||
@@ -251,7 +251,7 @@ void ViewportIcon::DrawDistanceLine(Draw2dHelper& draw2d, AZ::Vector2 start, AZ:
|
||||
const float pixelLengthForDottedLineTexture = 8.0f;
|
||||
float endTexCoordU = length / pixelLengthForDottedLineTexture;
|
||||
|
||||
CDraw2d::VertexPosColUV verts[2];
|
||||
IDraw2d::VertexPosColUV verts[2];
|
||||
|
||||
verts[0].position = start;
|
||||
verts[0].color = dottedColor;
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
|
||||
void DrawImageAligned(Draw2dHelper& draw2d, AZ::Vector2& pivot, float opacity);
|
||||
|
||||
void DrawImageTiled(Draw2dHelper& draw2d, CDraw2d::VertexPosColUV* verts);
|
||||
void DrawImageTiled(Draw2dHelper& draw2d, IDraw2d::VertexPosColUV* verts);
|
||||
|
||||
void Draw(Draw2dHelper& draw2d, AZ::Vector2 anchorPos, const AZ::Matrix4x4& transform, float iconRot = 0.0f, AZ::Color color = AZ::Color(1.0f, 1.0f, 1.0f, 1.0f)) const;
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include <AzFramework/Input/Devices/Keyboard/InputDeviceKeyboard.h>
|
||||
|
||||
#include <LyShine/Bus/UiEditorCanvasBus.h>
|
||||
#include <LyShine/Draw2d.h>
|
||||
|
||||
#include "LyShine.h"
|
||||
#include "UiRenderer.h"
|
||||
@@ -27,6 +26,7 @@
|
||||
#include "RulerWidget.h"
|
||||
#include "CanvasHelpers.h"
|
||||
#include "AssetDropHelpers.h"
|
||||
#include "Draw2d.h"
|
||||
#include "QtHelpers.h"
|
||||
#include <QtGui/private/qhighdpiscaling_p.h>
|
||||
|
||||
|
||||
@@ -482,6 +482,50 @@ public: // static member functions
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//! Helper to load a texture
|
||||
static AZ::Data::Instance<AZ::RPI::Image> LoadTexture(const AZStd::string& pathName)
|
||||
{
|
||||
if (gEnv && gEnv->pLyShine) // [LYSHINE_ATOM_TODO][GHI #3569] Remove LyShine global interface pointer from legacy global environment
|
||||
{
|
||||
return gEnv->pLyShine->LoadTexture(pathName);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//! Given a position and size and an alignment return the top left corner of the aligned quad
|
||||
static AZ::Vector2 Align(AZ::Vector2 position, AZ::Vector2 size, IDraw2d::HAlign horizontalAlignment, IDraw2d::VAlign verticalAlignment)
|
||||
{
|
||||
AZ::Vector2 result = AZ::Vector2::CreateZero();
|
||||
switch (horizontalAlignment)
|
||||
{
|
||||
case IDraw2d::HAlign::Left:
|
||||
result.SetX(position.GetX());
|
||||
break;
|
||||
case IDraw2d::HAlign::Center:
|
||||
result.SetX(position.GetX() - size.GetX() * 0.5f);
|
||||
break;
|
||||
case IDraw2d::HAlign::Right:
|
||||
result.SetX(position.GetX() - size.GetX());
|
||||
break;
|
||||
}
|
||||
|
||||
switch (verticalAlignment)
|
||||
{
|
||||
case IDraw2d::VAlign::Top:
|
||||
result.SetY(position.GetY());
|
||||
break;
|
||||
case IDraw2d::VAlign::Center:
|
||||
result.SetY(position.GetY() - size.GetY() * 0.5f);
|
||||
break;
|
||||
case IDraw2d::VAlign::Bottom:
|
||||
result.SetY(position.GetY() - size.GetY());
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//! Round the X and Y coordinates of a point using the given rounding policy
|
||||
template<typename T>
|
||||
static T RoundXY(T value, IDraw2d::Rounding roundingType)
|
||||
|
||||
@@ -9,12 +9,18 @@
|
||||
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
#include <AtomCore/Instance/Instance.h>
|
||||
|
||||
class IDraw2d;
|
||||
class ISprite;
|
||||
struct IUiAnimationSystem;
|
||||
class UiEntityContext;
|
||||
|
||||
namespace AZ::RPI
|
||||
{
|
||||
class Image;
|
||||
}
|
||||
|
||||
// The following ifdef block is the standard way of creating macros which make exporting
|
||||
// from a DLL simpler. All files within this DLL are compiled with the LYSHINE_EXPORTS
|
||||
// symbol defined in the StdAfx.h. this symbol should not be defined on any project
|
||||
@@ -82,6 +88,9 @@ public:
|
||||
//! Check if a sprite's texture asset exists. The .sprite sidecar file is optional and is not checked
|
||||
virtual bool DoesSpriteTextureAssetExist(const AZStd::string& pathname) = 0;
|
||||
|
||||
//! Load an image asset by texture pathname
|
||||
virtual AZ::Data::Instance<AZ::RPI::Image> LoadTexture(const AZStd::string& pathName) = 0;
|
||||
|
||||
//! Perform post-initialization (script system will be available)
|
||||
virtual void PostInit() = 0;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <LyShine/Draw2d.h>
|
||||
#include "Draw2d.h"
|
||||
#include <LyShine/UiRenderFormats.h>
|
||||
#include "LyShinePassDataBus.h"
|
||||
|
||||
@@ -215,7 +215,7 @@ void CDraw2d::DrawImageAligned(AZ::Data::Instance<AZ::RPI::Image> image, AZ::Vec
|
||||
HAlign horizontalAlignment, VAlign verticalAlignment,
|
||||
float opacity, float rotation, const AZ::Vector2* minMaxTexCoords, ImageOptions* imageOptions)
|
||||
{
|
||||
AZ::Vector2 alignedPosition = Align(position, size, horizontalAlignment, verticalAlignment);
|
||||
AZ::Vector2 alignedPosition = Draw2dHelper::Align(position, size, horizontalAlignment, verticalAlignment);
|
||||
|
||||
DrawImage(image, alignedPosition, size, opacity, rotation, &position, minMaxTexCoords, imageOptions);
|
||||
}
|
||||
@@ -524,40 +524,6 @@ void CDraw2d::SetSortKey(int64_t key)
|
||||
// PUBLIC STATIC FUNCTIONS
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AZ::Vector2 CDraw2d::Align(AZ::Vector2 position, AZ::Vector2 size,
|
||||
HAlign horizontalAlignment, VAlign verticalAlignment)
|
||||
{
|
||||
AZ::Vector2 result = AZ::Vector2::CreateZero();
|
||||
switch (horizontalAlignment)
|
||||
{
|
||||
case HAlign::Left:
|
||||
result.SetX(position.GetX());
|
||||
break;
|
||||
case HAlign::Center:
|
||||
result.SetX(position.GetX() - size.GetX() * 0.5f);
|
||||
break;
|
||||
case HAlign::Right:
|
||||
result.SetX(position.GetX() - size.GetX());
|
||||
break;
|
||||
}
|
||||
|
||||
switch (verticalAlignment)
|
||||
{
|
||||
case VAlign::Top:
|
||||
result.SetY(position.GetY());
|
||||
break;
|
||||
case VAlign::Center:
|
||||
result.SetY(position.GetY() - size.GetY() * 0.5f);
|
||||
break;
|
||||
case VAlign::Bottom:
|
||||
result.SetY(position.GetY() - size.GetY());
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AZ::Data::Instance<AZ::RPI::Image> CDraw2d::LoadTexture(const AZStd::string& pathName)
|
||||
{
|
||||
|
||||
@@ -180,9 +180,6 @@ private:
|
||||
|
||||
public: // static member functions
|
||||
|
||||
//! Given a position and size and an alignment return the top left corner of the aligned quad
|
||||
static AZ::Vector2 Align(AZ::Vector2 position, AZ::Vector2 size, HAlign horizontalAlignment, VAlign verticalAlignment);
|
||||
|
||||
//! Helper to load a texture
|
||||
static AZ::Data::Instance<AZ::RPI::Image> LoadTexture(const AZStd::string& pathName);
|
||||
|
||||
@@ -43,11 +43,11 @@
|
||||
#include "Sprite.h"
|
||||
#include "UiSerialize.h"
|
||||
#include "UiRenderer.h"
|
||||
#include "Draw2d.h"
|
||||
|
||||
#include <LyShine/Bus/UiCursorBus.h>
|
||||
#include <LyShine/Bus/UiDraggableBus.h>
|
||||
#include <LyShine/Bus/UiDropTargetBus.h>
|
||||
#include <LyShine/Draw2d.h>
|
||||
|
||||
#if defined(LYSHINE_INTERNAL_UNIT_TEST)
|
||||
#include "TextMarkup.h"
|
||||
@@ -355,6 +355,12 @@ bool CLyShine::DoesSpriteTextureAssetExist(const AZStd::string& pathname)
|
||||
return CSprite::DoesSpriteTextureAssetExist(pathname);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AZ::Data::Instance<AZ::RPI::Image> CLyShine::LoadTexture(const AZStd::string& pathname)
|
||||
{
|
||||
return CDraw2d::LoadTexture(pathname);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CLyShine::PostInit()
|
||||
{
|
||||
@@ -691,7 +697,7 @@ void CLyShine::RenderUiCursor()
|
||||
AZ::RHI::Size cursorSize = m_uiCursorTexture->GetDescriptor().m_size;
|
||||
const AZ::Vector2 dimensions(aznumeric_cast<float>(cursorSize.m_width), aznumeric_cast<float>(cursorSize.m_height));
|
||||
|
||||
CDraw2d::ImageOptions imageOptions;
|
||||
IDraw2d::ImageOptions imageOptions;
|
||||
imageOptions.m_clamp = true;
|
||||
const float opacity = 1.0f;
|
||||
const float rotation = 0.0f;
|
||||
|
||||
@@ -72,6 +72,7 @@ public:
|
||||
ISprite* LoadSprite(const AZStd::string& pathname) override;
|
||||
ISprite* CreateSprite(const AZStd::string& renderTargetName) override;
|
||||
bool DoesSpriteTextureAssetExist(const AZStd::string& pathname) override;
|
||||
AZ::Data::Instance<AZ::RPI::Image> LoadTexture(const AZStd::string& pathname) override;
|
||||
|
||||
void PostInit() override;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
#include "LyShineDebug.h"
|
||||
#include "IConsole.h"
|
||||
#include <LyShine/Draw2d.h>
|
||||
#include <LyShine/IDraw2d.h>
|
||||
|
||||
#include <Atom/RPI.Public/Image/ImageSystemInterface.h>
|
||||
|
||||
@@ -377,7 +377,7 @@ static void DebugDrawColoredBox(AZ::Vector2 pos, AZ::Vector2 size, AZ::Color col
|
||||
{
|
||||
IDraw2d* draw2d = Draw2dHelper::GetDefaultDraw2d();
|
||||
|
||||
CDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
|
||||
IDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
|
||||
imageOptions.color = color.GetAsVector3();
|
||||
auto whiteTexture = AZ::RPI::ImageSystemInterface::Get()->GetSystemImage(AZ::RPI::SystemImage::White);
|
||||
draw2d->DrawImageAligned(whiteTexture, pos, size, horizontalAlignment, verticalAlignment,
|
||||
@@ -392,7 +392,7 @@ static void DebugDrawStringWithSizeBox(AZStd::string_view font, unsigned int eff
|
||||
{
|
||||
IDraw2d* draw2d = Draw2dHelper::GetDefaultDraw2d();
|
||||
|
||||
CDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions();
|
||||
IDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions();
|
||||
if (!font.empty())
|
||||
{
|
||||
textOptions.fontName = font;
|
||||
@@ -618,7 +618,7 @@ static AZ::Vector2 DebugDrawFontColorTestBox(AZ::Vector2 pos, const char* string
|
||||
float pointSize = 32.0f;
|
||||
const float spacing = 6.0f;
|
||||
|
||||
CDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions();
|
||||
IDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions();
|
||||
textOptions.effectIndex = 1; // no drop shadow baked in
|
||||
textOptions.color = color;
|
||||
|
||||
@@ -742,7 +742,7 @@ static void DebugDraw2dImageColor()
|
||||
|
||||
AZ::Data::Instance<AZ::RPI::Image> texture = GetMonoAlphaTestTexture();
|
||||
|
||||
CDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
|
||||
IDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
|
||||
|
||||
draw2d->DrawText(
|
||||
"Testing image colors, image is black and white, top row is opacity=1, bottom row is opacity = 0.5",
|
||||
@@ -780,7 +780,7 @@ static void DebugDraw2dImageBlendMode()
|
||||
|
||||
AZ::Data::Instance<AZ::RPI::Image> texture = GetColorAlphaTestTexture();
|
||||
|
||||
CDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
|
||||
IDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
|
||||
|
||||
draw2d->DrawText("Testing blend modes, src blend changes across x-axis, dst blend changes across y axis",
|
||||
AZ::Vector2(20, 20), 16);
|
||||
@@ -801,7 +801,7 @@ static void DebugDraw2dImageBlendMode()
|
||||
AZ::Vector2 pos(xStart + xSpacing * srcIndex, yStart + ySpacing * dstIndex);
|
||||
|
||||
// first draw a background with varying color and alpha
|
||||
CDraw2d::VertexPosColUV verts[4] =
|
||||
IDraw2d::VertexPosColUV verts[4] =
|
||||
{
|
||||
{ // top left
|
||||
AZ::Vector2(pos.GetX(), pos.GetY()),
|
||||
@@ -828,7 +828,7 @@ static void DebugDraw2dImageBlendMode()
|
||||
|
||||
// Draw the image with this color
|
||||
|
||||
CDraw2d::RenderState renderState;
|
||||
IDraw2d::RenderState renderState;
|
||||
renderState.m_blendState.m_blendSource = g_srcBlendModes[srcIndex];
|
||||
renderState.m_blendState.m_blendDest = g_dstBlendModes[dstIndex];
|
||||
draw2d->DrawImage(texture, pos, size, 1.0f, 0.0f, 0, 0, &imageOptions);
|
||||
@@ -845,7 +845,7 @@ static void DebugDraw2dImageUVs()
|
||||
|
||||
AZ::Data::Instance<AZ::RPI::Image> texture = GetColorTestTexture();
|
||||
|
||||
CDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
|
||||
IDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
|
||||
|
||||
draw2d->DrawText(
|
||||
"Testing DrawImage with minMaxTexCoords. Full image, top left quadrant, middle section, full flipped",
|
||||
@@ -894,7 +894,7 @@ static void DebugDraw2dImagePixelRounding()
|
||||
|
||||
AZ::Data::Instance<AZ::RPI::Image> texture = GetColorTestTexture();
|
||||
|
||||
CDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
|
||||
IDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
|
||||
|
||||
draw2d->DrawText("Testing DrawImage pixel rounding options", AZ::Vector2(20, 20), 16);
|
||||
|
||||
@@ -933,7 +933,7 @@ static void DebugDraw2dLineBasic()
|
||||
{
|
||||
IDraw2d* draw2d = Draw2dHelper::GetDefaultDraw2d();
|
||||
|
||||
CDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
|
||||
IDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
|
||||
|
||||
draw2d->DrawText("Testing DrawLine", AZ::Vector2(20, 20), 16);
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <LyShine/Bus/UiEntityContextBus.h>
|
||||
#include <LyShine/Bus/UiCanvasUpdateNotificationBus.h>
|
||||
#include <LyShine/UiSerializeHelpers.h>
|
||||
#include <LyShine/Draw2d.h>
|
||||
#include <LyShine/IDraw2d.h>
|
||||
|
||||
#include <AzCore/Math/Crc.h>
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
*/
|
||||
#include "UiCanvasManager.h"
|
||||
#include <LyShine/Draw2d.h>
|
||||
#include <LyShine/IDraw2d.h>
|
||||
|
||||
#include "UiCanvasFileObject.h"
|
||||
#include "UiCanvasComponent.h"
|
||||
@@ -1020,7 +1020,7 @@ void UiCanvasManager::DebugDisplayCanvasData(int setting) const
|
||||
// local function to write a line of text (with a background rect) and increment Y offset
|
||||
AZStd::function<void(const char*, const AZ::Vector3&)> WriteLine = [&](const char* buffer, const AZ::Vector3& color)
|
||||
{
|
||||
CDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions();
|
||||
IDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions();
|
||||
textOptions.color = color;
|
||||
AZ::Vector2 textSize = draw2d->GetTextSize(buffer, fontSize, &textOptions);
|
||||
AZ::Vector2 rectTopLeft = AZ::Vector2(xOffset - 2, yOffset);
|
||||
@@ -1174,7 +1174,7 @@ void UiCanvasManager::DebugDisplayDrawCallData() const
|
||||
// local function to write a line of text (with a background rect) and increment Y offset
|
||||
AZStd::function<void(const char*, const AZ::Vector3&)> WriteLine = [&](const char* buffer, const AZ::Vector3& color)
|
||||
{
|
||||
CDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions();
|
||||
IDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions();
|
||||
textOptions.color = color;
|
||||
AZ::Vector2 textSize = draw2d->GetTextSize(buffer, fontSize, &textOptions);
|
||||
AZ::Vector2 rectTopLeft = AZ::Vector2(xOffset - 2, yOffset);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
#include "UiFaderComponent.h"
|
||||
#include "RenderGraph.h"
|
||||
#include <LyShine/Draw2d.h>
|
||||
#include <LyShine/IDraw2d.h>
|
||||
|
||||
#include <AzCore/Math/Crc.h>
|
||||
#include <AzCore/Math/MathUtils.h>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user