Merge branch 'main' into ly-as-sdk/LYN-2948

# Conflicts:
#	CMakeLists.txt
This commit is contained in:
pappeste
2021-05-05 12:33:47 -07:00
599 changed files with 4880 additions and 37122 deletions
-1
View File
@@ -1 +0,0 @@
<CacheBuildConfiguration Name="Game" UpAxis="Y" MeshPrediction="1" UseBFrames="1" IndexFrameDistance="10" BlockCompressionFormat="deflate" PlaybackFromMemory="0" PositionPrecision="1" UVmax="0"/>
@@ -1 +0,0 @@
<CacheBuildConfiguration Name="Game (fast decode)" UpAxis="Y" MeshPrediction="1" UseBFrames="1" IndexFrameDistance="10" BlockCompressionFormat="lz4hc" PlaybackFromMemory="0" PositionPrecision="1" UVmax="0"/>
@@ -1 +0,0 @@
<CacheBuildConfiguration Name="Game (Z-up)" UpAxis="Z" MeshPrediction="1" UseBFrames="1" IndexFrameDistance="10" BlockCompressionFormat="deflate" PlaybackFromMemory="0" PositionPrecision="1" UVmax="0"/>
@@ -1 +0,0 @@
<CacheBuildConfiguration Name="Game (fast decode, Z-up)" UpAxis="Z" MeshPrediction="1" UseBFrames="1" IndexFrameDistance="10" BlockCompressionFormat="lz4hc" PlaybackFromMemory="0" PositionPrecision="1" UVmax="0"/>
@@ -1 +0,0 @@
<CacheBuildConfiguration Name="Prerendered" UpAxis="Y" MeshPrediction="1" UseBFrames="1" IndexFrameDistance="10" BlockCompressionFormat="deflate" PlaybackFromMemory="0" PositionPrecision="0" UVmax="0"/>
@@ -1 +0,0 @@
<CacheBuildConfiguration Name="Prerendered (Z-up)" UpAxis="Z" MeshPrediction="1" UseBFrames="1" IndexFrameDistance="10" BlockCompressionFormat="deflate" PlaybackFromMemory="0" PositionPrecision="0" UVmax="0"/>
@@ -1 +0,0 @@
<CacheBuildConfiguration Name="Rigids Only" UpAxis="Y" MeshPrediction="0" UseBFrames="0" IndexFrameDistance="10" BlockCompressionFormat="deflate" PlaybackFromMemory="1" PositionPrecision="0" UVmax="0"/>
@@ -1 +0,0 @@
<CacheBuildConfiguration Name="Rigids Only (Z-up)" UpAxis="Z" MeshPrediction="0" UseBFrames="0" IndexFrameDistance="10" BlockCompressionFormat="deflate" PlaybackFromMemory="1" PositionPrecision="0" UVmax="0"/>
@@ -1 +0,0 @@
<CacheBuildConfiguration Name="Uncompressed (fastest compile)" UpAxis="Y" MeshPrediction="0" UseBFrames="0" IndexFrameDistance="10" BlockCompressionFormat="store" PlaybackFromMemory="0" PositionPrecision="0" UVmax="0"/>
@@ -1 +0,0 @@
<CacheBuildConfiguration Name="Uncompressed (fastest compile, Z-up)" UpAxis="Z" MeshPrediction="0" UseBFrames="0" IndexFrameDistance="10" BlockCompressionFormat="store" PlaybackFromMemory="0" PositionPrecision="0" UVmax="0"/>
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9c36d7bc993ddf616f478115a123efabda5b4b833a4e6524312f43c228ae0902
size 487003
@@ -1 +0,0 @@
<CacheBuildConfiguration UpAxis="Y" MeshPrediction="1" UseBFrames="1" IndexFrameDistance="15" BlockCompressionFormat="deflate" PlaybackFromMemory="1"/>
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:96a21446422b834ea90a5d38eaaca309fdee31dc3cc03c0e9c094b39ec3a459d
size 4715164
@@ -1,17 +0,0 @@
<Material MtlFlags="524544" vertModifType="0">
<SubMaterials>
<Material Name="mat01_white" MtlFlags="524416" Shader="Illum" GenMask="12000020040003" StringGenMask="%ALLOW_SILHOUETTE_POM%ALLOW_SPECULAR_ANTIALIASING%EMITTANCE_MAP%NORMAL_MAP%SPECULAR_MAP%SUBSURFACE_SCATTERING" SurfaceType="mat_default" Diffuse="1,1,1,1" Specular="0.5,0.5,0.5,1" Opacity="1" Shininess="174.72" vertModifType="0" LayerAct="1">
<Textures>
<Texture Map="Diffuse" File="engineassets/textures/white.dds"/>
</Textures>
<PublicParams EmittanceMapGamma="1" SSSIndex="0" IndirectColor="0.25,0.25,0.25"/>
</Material>
<Material Name="mat02_grey" MtlFlags="524416" Shader="Illum" GenMask="10000000000003" StringGenMask="%ALLOW_SILHOUETTE_POM%ALLOW_SPECULAR_ANTIALIASING%SUBSURFACE_SCATTERING" SurfaceType="mat_default" Diffuse="0.5,0.5,0.5,1" Specular="0.5,0.5,0.5,1" Opacity="1" Shininess="10" vertModifType="0" LayerAct="1">
<Textures>
<Texture Map="Diffuse" File="engineassets/textures/white.dds"/>
</Textures>
<PublicParams EmittanceMapGamma="1" SSSIndex="0" IndirectColor="0.25,0.25,0.25"/>
</Material>
</SubMaterials>
<PublicParams EmittanceMapGamma="1" SSSIndex="0" IndirectColor="0.25,0.25,0.25"/>
</Material>
+102 -25
View File
@@ -181,21 +181,23 @@ include(${pal_dir}/PAL_traits_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_LARGE_WORLDS_TEST_SUPPORTED)
## DynVeg ##
ly_add_pytest(
NAME AutomatedTesting::DynamicVegetationTests_Main
TEST_SERIAL
TEST_SUITE main
PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/dyn_veg
PYTEST_MARKS "not SUITE_sandbox and not SUITE_periodic and not SUITE_benchmark"
TIMEOUT 1500
RUNTIME_DEPENDENCIES
AZ::AssetProcessor
Legacy::Editor
AutomatedTesting.GameLauncher
AutomatedTesting.Assets
COMPONENT
LargeWorlds
)
# Temporarily moving all tests to periodic suite - SPEC-6553
#ly_add_pytest(
# NAME AutomatedTesting::DynamicVegetationTests_Main
# TEST_SERIAL
# TEST_SUITE main
# PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/dyn_veg
# PYTEST_MARKS "not SUITE_sandbox and not SUITE_periodic and not SUITE_benchmark"
# TIMEOUT 1500
# RUNTIME_DEPENDENCIES
# AZ::AssetProcessor
# Legacy::Editor
# AutomatedTesting.GameLauncher
# AutomatedTesting.Assets
# COMPONENT
# LargeWorlds
#)
ly_add_pytest(
NAME AutomatedTesting::DynamicVegetationTests_Sandbox
@@ -214,11 +216,11 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_
)
ly_add_pytest(
NAME AutomatedTesting::DynamicVegetationTests_Periodic
NAME AutomatedTesting::DynamicVegetationFilterTests_Periodic
TEST_SERIAL
TEST_SUITE periodic
PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/dyn_veg
PYTEST_MARKS "SUITE_periodic"
PYTEST_MARKS "SUITE_periodic and dynveg_filter"
TIMEOUT 1500
RUNTIME_DEPENDENCIES
AZ::AssetProcessor
@@ -228,22 +230,97 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_
LargeWorlds
)
## LandscapeCanvas ##
ly_add_pytest(
NAME AutomatedTesting::LandscapeCanvasTests_Main
NAME AutomatedTesting::DynamicVegetationModifierTests_Periodic
TEST_SERIAL
TEST_SUITE main
PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/landscape_canvas
PYTEST_MARKS "not SUITE_sandbox and not SUITE_periodic and not SUITE_benchmark"
TEST_SUITE periodic
PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/dyn_veg
PYTEST_MARKS "SUITE_periodic and dynveg_modifier"
TIMEOUT 1500
RUNTIME_DEPENDENCIES
AZ::AssetProcessor
Legacy::Editor
AutomatedTesting.Assets
AZ::AssetProcessor
Legacy::Editor
AutomatedTesting.Assets
COMPONENT
LargeWorlds
)
ly_add_pytest(
NAME AutomatedTesting::DynamicVegetationRegressionTests_Periodic
TEST_SERIAL
TEST_SUITE periodic
PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/dyn_veg
PYTEST_MARKS "SUITE_periodic and dynveg_regression"
TIMEOUT 1500
RUNTIME_DEPENDENCIES
AZ::AssetProcessor
Legacy::Editor
AutomatedTesting.Assets
COMPONENT
LargeWorlds
)
ly_add_pytest(
NAME AutomatedTesting::DynamicVegetationAreaTests_Periodic
TEST_SERIAL
TEST_SUITE periodic
PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/dyn_veg
PYTEST_MARKS "SUITE_periodic and dynveg_area"
TIMEOUT 1500
RUNTIME_DEPENDENCIES
AZ::AssetProcessor
Legacy::Editor
AutomatedTesting.Assets
COMPONENT
LargeWorlds
)
ly_add_pytest(
NAME AutomatedTesting::DynamicVegetationMiscTests_Periodic
TEST_SERIAL
TEST_SUITE periodic
PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/dyn_veg
PYTEST_MARKS "SUITE_periodic and dynveg_misc"
TIMEOUT 1500
RUNTIME_DEPENDENCIES
AZ::AssetProcessor
Legacy::Editor
AutomatedTesting.Assets
COMPONENT
LargeWorlds
)
ly_add_pytest(
NAME AutomatedTesting::DynamicVegetationSurfaceTagTests_Periodic
TEST_SERIAL
TEST_SUITE periodic
PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/dyn_veg
PYTEST_MARKS "SUITE_periodic and dynveg_surfacetagemitter"
TIMEOUT 1500
RUNTIME_DEPENDENCIES
AZ::AssetProcessor
Legacy::Editor
AutomatedTesting.Assets
COMPONENT
LargeWorlds
)
## LandscapeCanvas ##
# Temporarily moving all tests to periodic suite - SPEC-6553
#ly_add_pytest(
# NAME AutomatedTesting::LandscapeCanvasTests_Main
# TEST_SERIAL
# TEST_SUITE main
# PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/landscape_canvas
# PYTEST_MARKS "not SUITE_sandbox and not SUITE_periodic and not SUITE_benchmark"
# TIMEOUT 1500
# RUNTIME_DEPENDENCIES
# AZ::AssetProcessor
# Legacy::Editor
# AutomatedTesting.Assets
# COMPONENT
# LargeWorlds
#)
ly_add_pytest(
NAME AutomatedTesting::LandscapeCanvasTests_Periodic
TEST_SERIAL
@@ -114,11 +114,8 @@ class TestDynamicSliceInstanceSpawner(EditorTestHelper):
# This should result in 400 instances, since our box is 16 m x 16 m and by default the veg system plants
# 20 instances per 16 meters
spawner_entity.get_set_test(0, 'Configuration|Allow Empty Assets', True)
general.idle_wait(1.0)
num_expected_instances = 20 * 20
box = azlmbr.shape.ShapeComponentRequestsBus(bus.Event, 'GetEncompassingAabb', spawner_entity.id)
num_found = azlmbr.areasystem.AreaSystemRequestBus(bus.Broadcast, 'GetInstanceCountInAabb', box)
property_tree_success = property_tree_success and (num_found == num_expected_instances)
property_tree_success = property_tree_success and self.wait_for_condition(lambda: dynveg.validate_instance_count_in_entity_shape(spawner_entity.id, num_expected_instances), 5.0)
self.test_success = self.test_success and property_tree_success
self.log(f'Property Tree spawner type test: {property_tree_success}')
@@ -127,10 +124,8 @@ class TestDynamicSliceInstanceSpawner(EditorTestHelper):
# Since we have an empty slice path, we should have 0 instances once we disable 'Allow Empty Assets'
num_expected_instances = 0
allow_empty_assets_success = allow_empty_assets_success and spawner_entity.get_set_test(0, 'Configuration|Allow Empty Assets', False)
general.idle_wait(1.0)
num_found = azlmbr.areasystem.AreaSystemRequestBus(bus.Broadcast, 'GetInstanceCountInAabb', box)
self.log(f'Allow Empty Assets test: Found {num_found} instances -- Expected {num_expected_instances} instances')
allow_empty_assets_success = allow_empty_assets_success and (num_found == num_expected_instances)
self.log('Allow Empty Assets test:')
allow_empty_assets_success = allow_empty_assets_success and self.wait_for_condition(lambda: dynveg.validate_instance_count_in_entity_shape(spawner_entity.id, num_expected_instances), 5.0)
self.test_success = self.test_success and allow_empty_assets_success
self.log(f'Allow Empty Assets test: {allow_empty_assets_success}')
@@ -143,10 +138,8 @@ class TestDynamicSliceInstanceSpawner(EditorTestHelper):
descriptor = hydra.get_component_property_value(spawner_entity.components[2], 'Configuration|Embedded Assets|[0]')
descriptor.spawner = dynamic_slice_spawner
spawns_slices_success = spawns_slices_success and spawner_entity.get_set_test(2, "Configuration|Embedded Assets|[0]", descriptor)
general.idle_wait(1.0)
num_found = azlmbr.areasystem.AreaSystemRequestBus(bus.Broadcast, 'GetInstanceCountInAabb', box)
self.log(f'Spawn dynamic slices test: Found {num_found} instances -- Expected {num_expected_instances} instances')
spawns_slices_success = spawns_slices_success and (num_found == num_expected_instances)
self.log('Spawn dynamic slices test:')
spawns_slices_success = spawns_slices_success and self.wait_for_condition(lambda: dynveg.validate_instance_count_in_entity_shape(spawner_entity.id, num_expected_instances), 5.0)
self.test_success = self.test_success and spawns_slices_success
self.log(f'Spawn dynamic slices test: {spawns_slices_success}')
@@ -100,21 +100,15 @@ class TestEmptyInstanceSpawner(EditorTestHelper):
# This should result in 400 instances, since our box is 16 m x 16 m and by default the veg system plants
# 20 instances per 16 meters
general.idle_wait(2.0)
num_expected_instances = 20 * 20
box = azlmbr.shape.ShapeComponentRequestsBus(bus.Event, 'GetEncompassingAabb', spawner_entity.id)
num_found = azlmbr.areasystem.AreaSystemRequestBus(bus.Broadcast, 'GetInstanceCountInAabb', box)
property_tree_success = property_tree_success and (num_found == num_expected_instances)
property_tree_success = property_tree_success and self.wait_for_condition(lambda: dynveg.validate_instance_count_in_entity_shape(spawner_entity.id, num_expected_instances), 5.0)
self.test_success = self.test_success and property_tree_success
self.log(f'Found {num_found} instances -- Expected {num_expected_instances} instances')
self.log(f'Property Tree spawner type test: {property_tree_success}')
# 6) Validate that the "Allow Empty Assets" setting doesn't affect the EmptyInstanceSpawner
allow_empty_assets_success = True
spawner_entity.get_set_test(0, 'Configuration|Allow Empty Assets', False)
general.idle_wait(2.0)
num_found = azlmbr.areasystem.AreaSystemRequestBus(bus.Broadcast, 'GetInstanceCountInAabb', box)
allow_empty_assets_success = allow_empty_assets_success and (num_found == num_expected_instances)
allow_empty_assets_success = allow_empty_assets_success and self.wait_for_condition(lambda: dynveg.validate_instance_count_in_entity_shape(spawner_entity.id, num_expected_instances), 5.0)
self.test_success = self.test_success and allow_empty_assets_success
self.log(f'Allow Empty Assets test: {allow_empty_assets_success}')
@@ -37,6 +37,7 @@ class TestAltitudeFilter(object):
@pytest.mark.test_case_id('C4814463', 'C4847477')
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_filter
def test_AltitudeFilter_ComponentAndOverrides_InstancesPlantAtSpecifiedAltitude(self, request, editor, level,
launcher_platform):
@@ -61,6 +62,7 @@ class TestAltitudeFilter(object):
@pytest.mark.test_case_id("C4847476")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_filter
def test_AltitudeFilter_ShapeSample_InstancesPlantAtSpecifiedAltitude(self, request, editor, level,
launcher_platform):
@@ -85,6 +87,7 @@ class TestAltitudeFilter(object):
@pytest.mark.test_case_id("C4847478")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_filter
@pytest.mark.xfail # LYN-3275
def test_AltitudeFilter_FilterStageToggle(self, request, editor, level, workspace, launcher_platform):
cfg_args = [level]
@@ -52,6 +52,7 @@ class TestAreaComponents(object):
@pytest.mark.test_case_id("C2627900", "C2627905", "C2627904")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_misc
def test_AreaComponents_SliceCreationVisibilityToggleWorks(self, request, editor, level, workspace,
launcher_platform):
cfg_args = [level]
@@ -38,6 +38,7 @@ class TestAssetListCombiner(object):
@pytest.mark.test_case_id("C4762374", "C4762373")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_misc
def test_AssetListCombiner_CombinedDescriptorsExpressInConfiguredArea(self, request, editor, level,
launcher_platform):
@@ -42,6 +42,7 @@ class TestAssetWeightSelector(object):
@pytest.mark.test_case_id("C6269654", "C4762368")
@pytest.mark.SUITE_sandbox
@pytest.mark.dynveg_filter
def test_AssetWeightSelector_InstancesExpressBasedOnWeight(self, request, editor, level, launcher_platform):
expected_lines = [
@@ -40,6 +40,7 @@ class TestDebugger(object):
@pytest.mark.test_case_id("C2789148")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_misc
def test_Debugger_DebugCVarsWork(self, request, editor, level, workspace, launcher_platform):
cfg_args = [level]
@@ -38,6 +38,7 @@ class TestDistanceBetweenFilter(object):
@pytest.mark.test_case_id("C4851066")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_filter
def test_DistanceBetweenFilter_InstancesPlantAtSpecifiedRadius(self, request, editor, level, launcher_platform):
expected_lines = [
@@ -58,6 +59,7 @@ class TestDistanceBetweenFilter(object):
@pytest.mark.test_case_id("C4814458")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_filter
def test_DistanceBetweenFilterOverrides_InstancesPlantAtSpecifiedRadius(self, request, editor, level,
launcher_platform):
@@ -40,6 +40,7 @@ class Test_DynVeg_Regressions(object):
@pytest.mark.test_case_id("C29470845")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_regression
def test_SurfaceDataRefreshes_RemainsStable(self, request, editor, level, launcher_platform):
expected_lines = [
@@ -41,7 +41,8 @@ class TestDynamicSliceInstanceSpawner(object):
return console
@pytest.mark.test_case_id("C28851763")
@pytest.mark.SUITE_sandbox
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_area
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
def test_DynamicSliceInstanceSpawner_DynamicSliceSpawnerWorks(self, request, editor, level, workspace, project,
launcher_platform):
@@ -66,6 +67,7 @@ class TestDynamicSliceInstanceSpawner(object):
@pytest.mark.test_case_id('C2574330')
@pytest.mark.BAT
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_area
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
def test_DynamicSliceInstanceSpawner_Embedded_E2E_Editor(self, workspace, request, editor, level, project,
launcher_platform):
@@ -85,6 +87,7 @@ class TestDynamicSliceInstanceSpawner(object):
@pytest.mark.test_case_id('C2574330')
@pytest.mark.BAT
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_area
@pytest.mark.parametrize("launcher_platform", ['windows'])
@pytest.mark.skip # ATOM-14703
def test_DynamicSliceInstanceSpawner_Embedded_E2E_Launcher(self, workspace, launcher, level,
@@ -101,6 +104,7 @@ class TestDynamicSliceInstanceSpawner(object):
@pytest.mark.test_case_id('C4762367')
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_area
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
def test_DynamicSliceInstanceSpawner_External_E2E_Editor(self, workspace, request, editor, level, project,
launcher_platform):
@@ -119,6 +123,7 @@ class TestDynamicSliceInstanceSpawner(object):
@pytest.mark.test_case_id('C4762367')
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_area
@pytest.mark.parametrize("launcher_platform", ['windows'])
@pytest.mark.skip # ATOM-14703
def test_DynamicSliceInstanceSpawner_External_E2E_Launcher(self, workspace, launcher, level,
@@ -36,13 +36,9 @@ class TestEmptyInstanceSpawner(object):
file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
# Main suite needs at least one test
@pytest.mark.SUITE_main
def test_EmptyInstanceSpawner_Dummy(self, request, editor, level, workspace, project, launcher_platform):
pass
@pytest.mark.test_case_id("C28851762")
@pytest.mark.SUITE_sandbox
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_area
def test_EmptyInstanceSpawner_EmptySpawnerWorks(self, request, editor, level, launcher_platform):
cfg_args = [level]
@@ -43,6 +43,7 @@ class TestInstanceSpawnerPriority(object):
@pytest.mark.test_case_id("C5747383", "C4762382")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_misc
def test_InstanceSpawnerPriority_LayerAndSubPriority_HigherValuesPlantOverLower(self, request, editor, level,
launcher_platform):
@@ -20,17 +20,10 @@ import pytest
pytest.importorskip("ly_test_tools")
import time as time
import editor_python_test_tools.hydra_test_utils as hydra
import ly_test_tools.launchers.launcher_helper as launcher_helper
import ly_remote_console.remote_console_commands as remote_console_commands
import ly_test_tools.environment.waiter as waiter
import ly_test_tools.environment.file_system as file_system
import ly_remote_console.remote_console_commands as remote_console_commands
from ly_remote_console.remote_console_commands import send_command_and_expect_response as send_command_and_expect_response
import automatedtesting_shared.screenshot_utils as screenshot_utils
from automatedtesting_shared.network_utils import check_for_listening_port
import editor_python_test_tools.hydra_test_utils as hydra
test_directory = os.path.join(os.path.dirname(__file__), "EditorScripts")
@@ -58,6 +51,7 @@ class TestLayerBlender(object):
@pytest.mark.test_case_id("C2627906")
@pytest.mark.BAT
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_area
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
def test_LayerBlender_E2E_Editor(self, workspace, request, editor, project, level, launcher_platform):
# Make sure temp level doesn't already exist
@@ -95,6 +89,7 @@ class TestLayerBlender(object):
@pytest.mark.test_case_id("C2627906")
@pytest.mark.BAT
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_area
@pytest.mark.xfail
@pytest.mark.parametrize("launcher_platform", ['windows'])
def test_LayerBlender_E2E_Launcher(self, workspace, project, launcher, level, remote_console_instance,
@@ -38,6 +38,7 @@ class TestLayerBlocker(object):
@pytest.mark.test_case_id("C2793772")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_area
def test_LayerBlocker_InstancesBlockedInConfiguredArea(self, request, editor, level, launcher_platform):
expected_lines = [
@@ -40,6 +40,7 @@ class TestLayerSpawner(object):
@pytest.mark.test_case_id("C4762381")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_misc
def test_LayerSpawner_InheritBehaviorFlag(self, request, editor, level, workspace, launcher_platform):
expected_lines = [
@@ -60,6 +61,7 @@ class TestLayerSpawner(object):
@pytest.mark.test_case_id("C2802020")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_misc
def test_LayerSpawner_InstancesPlantInAllSupportedShapes(self, request, editor, level, launcher_platform):
expected_lines = [
@@ -101,6 +103,7 @@ class TestLayerSpawner(object):
@pytest.mark.test_case_id("C4765973")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_misc
@pytest.mark.xfail # LYN-3275
def test_LayerSpawner_FilterStageToggle(self, request, editor, level, workspace, launcher_platform):
@@ -122,6 +125,7 @@ class TestLayerSpawner(object):
@pytest.mark.test_case_id("C30000751")
@pytest.mark.SUITE_sandbox
@pytest.mark.dynveg_misc
@pytest.mark.skip # ATOM-14828
def test_LayerSpawner_InstancesRefreshUsingCorrectViewportCamera(self, request, editor, level, launcher_platform):
@@ -46,6 +46,7 @@ class TestMeshBlocker(object):
"""
@pytest.mark.test_case_id("C3980834")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_area
@pytest.mark.xfail # LYN-3273
def test_MeshBlocker_InstancesBlockedByMesh(self, request, editor, level, launcher_platform):
expected_lines = [
@@ -70,6 +71,7 @@ class TestMeshBlocker(object):
"""
@pytest.mark.test_case_id("C4766030")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_area
@pytest.mark.xfail # LYN-3273
def test_MeshBlocker_InstancesBlockedByMeshHeightTuning(self, request, editor, level, launcher_platform):
expected_lines = [
@@ -38,6 +38,7 @@ class TestMeshSurfaceTagEmitter(object):
@pytest.mark.test_case_id("C2908172")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_surfacetagemitter
def test_MeshSurfaceTagEmitter_DependentOnMeshComponent(self, request, editor, level, launcher_platform):
expected_lines = [
@@ -66,6 +67,7 @@ class TestMeshSurfaceTagEmitter(object):
@pytest.mark.test_case_id("C2908174")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_surfacetagemitter
def test_MeshSurfaceTagEmitter_SurfaceTagsAddRemoveSuccessfully(self, request, editor, level, launcher_platform):
expected_lines = [
@@ -38,6 +38,7 @@ class TestPhysXColliderSurfaceTagEmitter(object):
@pytest.mark.test_case_id("C29053640")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_surfacetagemitter
def test_PhysXColliderSurfaceTagEmitter_E2E_Editor(self, request, editor, level, launcher_platform):
expected_lines = [
@@ -38,6 +38,7 @@ class TestPositionModifier(object):
@pytest.mark.test_case_id("C4874099", "C4814461")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_modifier
def test_PositionModifier_ComponentAndOverrides_InstancesPlantAtSpecifiedOffsets(self, request, editor, level,
launcher_platform):
@@ -60,6 +61,7 @@ class TestPositionModifier(object):
@pytest.mark.test_case_id("C4874100")
@pytest.mark.SUITE_sandbox
@pytest.mark.dynveg_modifier
@pytest.mark.xfail # LYN-3275
def test_PositionModifier_AutoSnapToSurfaceWorks(self, request, editor, level, launcher_platform):
@@ -42,6 +42,7 @@ class TestRotationModifier(object):
@pytest.mark.test_case_id("C4896922")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_modifier
def test_RotationModifier_InstancesRotateWithinRange(self, request, editor, level, launcher_platform) -> None:
"""
Launches editor and run test script to test that rotation modifier works for all axis.
@@ -71,6 +72,7 @@ class TestRotationModifier(object):
@pytest.mark.test_case_id("C4814460")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_modifier
def test_RotationModifierOverrides_InstancesRotateWithinRange(self, request, editor, level, launcher_platform) -> None:
expected_lines = [
@@ -41,6 +41,7 @@ class TestScaleOverrideWorksSuccessfully(object):
@pytest.mark.test_case_id("C4814462")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_modifier
def test_ScaleModifierOverrides_InstancesProperlyScale(self, request, editor, level, launcher_platform):
expected_lines = [
@@ -70,6 +71,7 @@ class TestScaleOverrideWorksSuccessfully(object):
@pytest.mark.test_case_id("C4896937")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_modifier
def test_ScaleModifier_InstancesProperlyScale(self, request, editor, level, launcher_platform):
expected_lines = [
@@ -38,6 +38,7 @@ class TestShapeIntersectionFilter(object):
@pytest.mark.test_case_id("C4874094")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_filter
def test_ShapeIntersectionFilter_InstancesPlantInAssignedShape(self, request, editor, level, launcher_platform):
expected_lines = [
@@ -41,6 +41,7 @@ class TestSlopeAlignmentModifier(object):
@pytest.mark.test_case_id("C4896941")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_modifier
@pytest.mark.skip # ATOM-14299
def test_SlopeAlignmentModifier_InstanceSurfaceAlignment(self, request, editor, level, launcher_platform):
@@ -63,6 +64,7 @@ class TestSlopeAlignmentModifier(object):
@pytest.mark.test_case_id("C4814459")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_modifier
@pytest.mark.skip # ATOM-14299
def test_SlopeAlignmentModifierOverrides_InstanceSurfaceAlignment(self, request, editor, level, launcher_platform):
@@ -39,6 +39,7 @@ class TestSlopeFilter(object):
@pytest.mark.test_case_id("C4874097")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_filter
def test_SlopeFilter_FilterStageToggle(self, request, editor, level, workspace, launcher_platform):
cfg_args = [level]
@@ -70,6 +71,7 @@ class TestSlopeFilter(object):
@pytest.mark.test_case_id("C4814464", "C4874096")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_filter
@pytest.mark.skip # LYN-2211
def test_SlopeFilter_ComponentAndOverrides_InstancesPlantOnValidSlopes(self, request, editor, level,
launcher_platform):
@@ -40,6 +40,7 @@ class TestSurfaceMaskFilter(object):
# Simple validation test to ensure that SurfaceTag can be created, set to a value, and compared to another SurfaceTag.
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_filter
def test_SurfaceMaskFilter_BasicSurfaceTagCreation(self, request, level, editor, launcher_platform):
expected_lines = [
@@ -61,6 +62,7 @@ class TestSurfaceMaskFilter(object):
@pytest.mark.test_case_id("C2561342")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_filter
def test_SurfaceMaskFilter_ExclusiveSurfaceTags_Function(self, request, editor, level, launcher_platform):
expected_lines = [
@@ -93,6 +95,7 @@ class TestSurfaceMaskFilter(object):
@pytest.mark.test_case_id("C2561341")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_filter
def test_SurfaceMaskFilter_InclusiveSurfaceTags_Function(self, request, editor, level, launcher_platform):
expected_lines = [
@@ -125,6 +128,7 @@ class TestSurfaceMaskFilter(object):
@pytest.mark.test_case_id("C3711666")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_filter
def test_SurfaceMaskFilterOverrides_MultipleDescriptorOverridesPlantAsExpected(self, request, editor, level,
launcher_platform):
@@ -38,6 +38,7 @@ class TestSystemSettings(object):
@pytest.mark.test_case_id("C2646869")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_misc
def test_SystemSettings_SectorPointDensity(self, request, editor, level, launcher_platform):
expected_lines = [
@@ -64,6 +65,7 @@ class TestSystemSettings(object):
@pytest.mark.test_case_id("C2646870")
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_misc
def test_SystemSettings_SectorSize(self, request, editor, level, launcher_platform):
expected_lines = [
@@ -57,6 +57,7 @@ def C18243589_Joints_BallSoftLimitsConstrained():
"""
import os
import sys
import math
import ImportPathHelper as imports
@@ -95,13 +96,33 @@ def C18243589_Joints_BallSoftLimitsConstrained():
Report.info_vector3(follower.position, "follower initial position:")
leadInitialPosition = lead.position
followerInitialPosition = follower.position
followerMovedAboveJoint = False
#calculate the start vector from follower and lead positions
normalizedStartPos = JointsHelper.getRelativeVector(lead.position, follower.position)
normalizedStartPos = normalizedStartPos.GetNormalizedSafe()
#the targeted angle to reach between the initial vector and the current follower-lead vector
TARGET_ANGLE_DEG = 45
targetAngle = math.radians(TARGET_ANGLE_DEG)
angleAchieved = 0.0
# 4) Wait for several seconds
general.idle_wait(1.0) # wait for lead and follower to move
def checkAngleMet():
#calculate the current follower-lead vector
normalVec = JointsHelper.getRelativeVector(lead.position, follower.position)
normalVec = normalVec.GetNormalizedSafe()
#dot product + acos to get the angle
angleAchieved = math.acos(normalizedStartPos.Dot(normalVec))
#is it above target?
return angleAchieved > targetAngle
MAX_WAIT_TIME = 2.0 #seconds
followerMovedAboveJoint = helper.wait_for_condition(checkAngleMet, MAX_WAIT_TIME)
# 5) Check to see if lead and follower behaved as expected
Report.info_vector3(lead.position, "lead position after 1 second:")
Report.info_vector3(follower.position, "follower position after 1 second:")
Report.info_vector3(lead.position, "lead position:")
Report.info_vector3(follower.position, "follower position:")
angleAchievedDeg = math.degrees(angleAchieved)
Report.info(f"Angle achieved {angleAchievedDeg:.2f} Target {TARGET_ANGLE_DEG:.2f}")
leadPositionDelta = lead.position.Subtract(leadInitialPosition)
leadRemainedStill = JointsHelper.vector3SmallerThanScalar(leadPositionDelta, FLOAT_EPSILON)
@@ -111,7 +132,6 @@ def C18243589_Joints_BallSoftLimitsConstrained():
followerMovedinXYZ = JointsHelper.vector3LargerThanScalar(followerPositionDelta, FLOAT_EPSILON)
Report.critical_result(Tests.check_follower_position, followerMovedinXYZ)
followerMovedAboveJoint = follower.position.z > (followerInitialPosition.z + 2.5) # (followerInitialPosition.z + 2.5) is the z position past the 45 degree limit. This is to show that the follower swinged past the 45 degree cone limit, above the joint position.
Report.critical_result(Tests.check_follower_above_joint, followerMovedAboveJoint)
# 6) Exit Game Mode
@@ -20,7 +20,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
class Tests():
enter_game_mode = ("Entered game mode", "Failed to enter game mode")
find_cylinder = ("Cylinder entity found", "Cylinder entity not found")
find_terrain = ("Terrain found", "Terrain not found")
create_terrain = ("Terrain entity created successfully", "Failed to create Terrain Entity")
find_terrain = ("Terrain entity found", "Terrain entity not found")
add_physx_shape_collider = ("Added PhysX Shape Collider", "Failed to add PhysX Shape Collider")
add_box_shape = ("Added Box Shape", "Failed to add Box Shape")
cylinder_above_terrain = ("Cylinder position above ground", "Cylinder is not above the ground")
time_out = ("No time out occurred", "A time out occurred, please validate level setup")
touched_ground = ("Touched ground before time out", "Did not touch ground before time out")
@@ -40,11 +43,12 @@ def C24308873_CylinderShapeCollider_CollidesWithPhysXTerrain():
Once game mode is entered, the cylinder should fall toward and collide with the terrain.
Steps:
1) Open level and enter game mode
2) Retrieve entities and positions
3) Wait for cylinder to collide with terrain OR time out
4) Exit game mode
5) Close the editor
1) Open level and create terrain Entity.
2) Enter Game Mode.
3) Retrieve entities and positions
4) Wait for cylinder to collide with terrain OR time out
5) Exit game mode
6) Close the editor
:return:
"""
@@ -54,29 +58,48 @@ def C24308873_CylinderShapeCollider_CollidesWithPhysXTerrain():
import ImportPathHelper as imports
imports.init()
from editor_python_test_tools.editor_entity_utils import EditorEntity
import azlmbr.legacy.general as general
import azlmbr.bus
import azlmbr.math as math
from editor_python_test_tools.utils import Report
from editor_python_test_tools.utils import TestHelper as helper
# Global time out
TIME_OUT = 1.0
# 1) Open level / Enter game mode
# 1) Open level
helper.init_idle()
helper.open_level("Physics", "C24308873_CylinderShapeCollider_CollidesWithPhysXTerrain")
# Create terrain entity
terrain = EditorEntity.create_editor_entity_at([30.0, 30.0, 33.96], "Terrain")
Report.result(Tests.create_terrain, terrain.id.IsValid())
terrain.add_component("PhysX Shape Collider")
Report.result(Tests.add_physx_shape_collider, terrain.has_component("PhysX Shape Collider"))
box_shape_component = terrain.add_component("Box Shape")
Report.result(Tests.add_box_shape, terrain.has_component("Box Shape"))
box_shape_component.set_component_property_value("Box Shape|Box Configuration|Dimensions",
math.Vector3(1024.0, 1024.0, 0.01))
# 2)Enter game mode
helper.enter_game_mode(Tests.enter_game_mode)
# 2) Retrieve entities and positions
# 3) Retrieve entities and positions
cylinder_id = general.find_game_entity("PhysX_Cylinder")
Report.critical_result(Tests.find_cylinder, cylinder_id.IsValid())
terrain_id = general.find_game_entity("Terrain")
Report.critical_result(Tests.find_terrain, terrain_id.IsValid())
terrain_id = general.find_game_entity("PhysX_Terrain")
Report.critical_result(Tests.find_terrain, terrain_id.IsValid())
cylinder_pos = azlmbr.components.TransformBus(azlmbr.bus.Event, "GetWorldTM", cylinder_id).GetPosition()
terrain_pos = azlmbr.components.TransformBus(azlmbr.bus.Event, "GetWorldTM", terrain_id).GetPosition()
cylinder_pos = azlmbr.components.TransformBus(azlmbr.bus.Event, "GetWorldTranslation", cylinder_id)
#Cylinder position is 64,84,35
terrain_pos = azlmbr.components.TransformBus(azlmbr.bus.Event, "GetWorldTranslation", terrain_id)
Report.info_vector3(cylinder_pos, "Cylinder:")
Report.info_vector3(terrain_pos, "Terrain:")
Report.critical_result(
@@ -104,13 +127,13 @@ def C24308873_CylinderShapeCollider_CollidesWithPhysXTerrain():
handler.connect(cylinder_id)
handler.add_callback("OnCollisionBegin", on_collision_begin)
# 3) Wait for the cylinder to hit the ground OR time out
# 4) Wait for the cylinder to hit the ground OR time out
test_completed = helper.wait_for_condition((lambda: TouchGround.value), TIME_OUT)
Report.critical_result(Tests.time_out, test_completed)
Report.result(Tests.touched_ground, TouchGround.value)
# 4) Exit game mode
# 5) Exit game mode
helper.exit_game_mode(Tests.exit_game_mode)
@@ -135,7 +135,7 @@ def C5932042_PhysXForceRegion_LinearDamping():
# Constants
CLOSE_ENOUGH = 0.001
TIME_OUT = 2.0
TIME_OUT = 3.0
INITIAL_VELOCITY = azmath.Vector3(0.0, 0.0, -10.0)
# 1) Open level / Enter game mode
@@ -27,6 +27,13 @@ def vector3LargerThanScalar(vec3Value, scalarValue):
vec3Value.y > scalarValue and
vec3Value.z > scalarValue)
def getRelativeVector(vecA, vecB):
relativeVec = vecA
relativeVec.x = relativeVec.x - vecB.x
relativeVec.y = relativeVec.y - vecB.y
relativeVec.z = relativeVec.z - vecB.z
return relativeVec
# Entity class for joints tests
class JointEntity:
@@ -34,4 +34,61 @@ class TestAutomation(TestAutomationBase):
def test_C111111_RigidBody_EnablingGravityWorksUsingNotificationsPoC(self, request, workspace, editor, launcher_platform):
from . import C111111_RigidBody_EnablingGravityWorksUsingNotificationsPoC as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C5932041_PhysXForceRegion_LocalSpaceForceOnRigidBodies(self, request, workspace, editor, launcher_platform):
from . import C5932041_PhysXForceRegion_LocalSpaceForceOnRigidBodies as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C4044459_Material_DynamicFriction(self, request, workspace, editor, launcher_platform):
from . import C4044459_Material_DynamicFriction as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C15425929_Undo_Redo(self, request, workspace, editor, launcher_platform):
from . import C15425929_Undo_Redo as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C4976243_Collision_SameCollisionGroupDiffCollisionLayers(self, request, workspace, editor,
launcher_platform):
from . import C4976243_Collision_SameCollisionGroupDiffCollisionLayers as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C14654881_CharacterController_SwitchLevels(self, request, workspace, editor, launcher_platform):
from . import C14654881_CharacterController_SwitchLevels as test_module
self._run_test(request, workspace, editor, test_module)
def test_C17411467_AddPhysxRagdollComponent(self, request, workspace, editor, launcher_platform):
from . import C17411467_AddPhysxRagdollComponent as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C12712453_ScriptCanvas_MultipleRaycastNode(self, request, workspace, editor, launcher_platform):
from . import C12712453_ScriptCanvas_MultipleRaycastNode as test_module
# Fixme: unexpected_lines = ["Assert"] + test_module.Lines.unexpected
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
@fm.file_override('physxsystemconfiguration.setreg','C4982593_PhysXCollider_CollisionLayer.setreg', 'AutomatedTesting/Registry')
def test_C4982593_PhysXCollider_CollisionLayerTest(self, request, workspace, editor, launcher_platform):
from . import C4982593_PhysXCollider_CollisionLayerTest as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C18243586_Joints_HingeLeadFollowerCollide(self, request, workspace, editor, launcher_platform):
from . import C18243586_Joints_HingeLeadFollowerCollide as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C4982803_Enable_PxMesh_Option(self, request, workspace, editor, launcher_platform):
from . import C4982803_Enable_PxMesh_Option as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C24308873_CylinderShapeCollider_CollidesWithPhysXTerrain(self, request, workspace, editor, launcher_platform):
from . import C24308873_CylinderShapeCollider_CollidesWithPhysXTerrain as test_module
self._run_test(request, workspace, editor, test_module)
@@ -52,11 +52,6 @@ class TestAutomation(TestAutomationBase):
from . import C4976207_PhysXRigidBodies_KinematicBehavior as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C5932041_PhysXForceRegion_LocalSpaceForceOnRigidBodies(self, request, workspace, editor, launcher_platform):
from . import C5932041_PhysXForceRegion_LocalSpaceForceOnRigidBodies as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C5932042_PhysXForceRegion_LinearDamping(self, request, workspace, editor, launcher_platform):
from . import C5932042_PhysXForceRegion_LinearDamping as test_module
@@ -92,11 +87,6 @@ class TestAutomation(TestAutomationBase):
from . import C4976194_RigidBody_PhysXComponentIsValid as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C4044459_Material_DynamicFriction(self, request, workspace, editor, launcher_platform):
from . import C4044459_Material_DynamicFriction as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C5932045_ForceRegion_Spline(self, request, workspace, editor, launcher_platform):
from . import C5932045_ForceRegion_Spline as test_module
@@ -208,26 +198,11 @@ class TestAutomation(TestAutomationBase):
from . import C18981526_Material_RestitutionCombinePriority as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C15425929_Undo_Redo(self, request, workspace, editor, launcher_platform):
from . import C15425929_Undo_Redo as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C15308217_NoCrash_LevelSwitch(self, request, workspace, editor, launcher_platform):
from . import C15308217_NoCrash_LevelSwitch as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C12868580_ForceRegion_SplineModifiedTransform(self, request, workspace, editor, launcher_platform):
from . import C12868580_ForceRegion_SplineModifiedTransform as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C4976243_Collision_SameCollisionGroupDiffCollisionLayers(self, request, workspace, editor, launcher_platform):
from . import C4976243_Collision_SameCollisionGroupDiffCollisionLayers as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C12712455_ScriptCanvas_ShapeCastVerification(self, request, workspace, editor, launcher_platform):
from . import C12712455_ScriptCanvas_ShapeCastVerification as test_module
@@ -248,17 +223,6 @@ class TestAutomation(TestAutomationBase):
from . import C6131473_StaticSlice_OnDynamicSliceSpawn as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C4982798_Collider_ColliderRotationOffset(self, request, workspace, editor, launcher_platform):
from . import C4982798_Collider_ColliderRotationOffset as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C12712453_ScriptCanvas_MultipleRaycastNode(self, request, workspace, editor, launcher_platform):
from . import C12712453_ScriptCanvas_MultipleRaycastNode as test_module
# Fixme: unexpected_lines = ["Assert"] + test_module.Lines.unexpected
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C5959808_ForceRegion_PositionOffset(self, request, workspace, editor, launcher_platform):
from . import C5959808_ForceRegion_PositionOffset as test_module
@@ -275,7 +239,7 @@ class TestAutomation(TestAutomationBase):
def test_C13895144_Ragdoll_ChangeLevel(self, request, workspace, editor, launcher_platform):
from . import C13895144_Ragdoll_ChangeLevel as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C5968759_ForceRegion_ExertsSeveralForcesOnRigidBody(self, request, workspace, editor, launcher_platform):
from . import C5968759_ForceRegion_ExertsSeveralForcesOnRigidBody as test_module
@@ -290,6 +254,8 @@ class TestAutomation(TestAutomationBase):
from . import C4044697_Material_PerfaceMaterialValidation as test_module
self._run_test(request, workspace, editor, test_module)
@pytest.mark.xfail(
reason="This test will sometimes fail as the ball will continue to roll before the timeout is reached.")
@revert_physics_config
def test_C4976202_RigidBody_StopsWhenBelowKineticThreshold(self, request, workspace, editor, launcher_platform):
from . import C4976202_RigidBody_StopsWhenBelowKineticThreshold as test_module
@@ -305,11 +271,6 @@ class TestAutomation(TestAutomationBase):
from . import C5296614_PhysXMaterial_ColliderShape as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C6090547_ForceRegion_ParentChildForceRegions(self, request, workspace, editor, launcher_platform):
from . import C6090547_ForceRegion_ParentChildForceRegions as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C4982595_Collider_TriggerDisablesCollision(self, request, workspace, editor, launcher_platform):
from . import C4982595_Collider_TriggerDisablesCollision as test_module
@@ -320,11 +281,6 @@ class TestAutomation(TestAutomationBase):
from . import C14976307_Gravity_SetGravityWorks as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C14654881_CharacterController_SwitchLevels(self, request, workspace, editor, launcher_platform):
from . import C14654881_CharacterController_SwitchLevels as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C15556261_PhysXMaterials_CharacterControllerMaterialAssignment(self, request, workspace, editor, launcher_platform):
from . import C15556261_PhysXMaterials_CharacterControllerMaterialAssignment as test_module
@@ -374,18 +330,6 @@ class TestAutomation(TestAutomationBase):
from . import C4044461_Material_Restitution as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
@fm.file_override('physxsystemconfiguration.setreg','C4982593_PhysXCollider_CollisionLayer.setreg', 'AutomatedTesting/Registry')
def test_C4982593_PhysXCollider_CollisionLayerTest(self, request, workspace, editor, launcher_platform):
from . import C4982593_PhysXCollider_CollisionLayerTest as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
@fm.file_override('physxsystemconfiguration.setreg','C3510644_Collider_CollisionGroups.setreg', 'AutomatedTesting/Registry')
def test_C3510644_Collider_CollisionGroups(self, request, workspace, editor, launcher_platform):
from . import C3510644_Collider_CollisionGroups as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
@fm.file_override('physxdefaultsceneconfiguration.setreg','C14902097_ScriptCanvas_PreUpdateEvent.setreg', 'AutomatedTesting/Registry')
def test_C14902097_ScriptCanvas_PreUpdateEvent(self, request, workspace, editor, launcher_platform):
@@ -415,11 +359,6 @@ class TestAutomation(TestAutomationBase):
from . import C18243589_Joints_BallSoftLimitsConstrained as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C18243586_Joints_HingeLeadFollowerCollide(self, request, workspace, editor, launcher_platform):
from . import C18243586_Joints_HingeLeadFollowerCollide as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C18243591_Joints_BallLeadFollowerCollide(self, request, workspace, editor, launcher_platform):
from . import C18243591_Joints_BallLeadFollowerCollide as test_module
@@ -441,21 +380,11 @@ class TestAutomation(TestAutomationBase):
from . import C14861500_DefaultSetting_ColliderShape as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C19578021_ShapeCollider_CanBeAdded(self, request, workspace, editor, launcher_platform):
from . import C19578021_ShapeCollider_CanBeAdded as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C19723164_ShapeCollider_WontCrashEditor(self, request, workspace, editor, launcher_platform):
from . import C19723164_ShapeColliders_WontCrashEditor as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C4982803_Enable_PxMesh_Option(self, request, workspace, editor, launcher_platform):
from . import C4982803_Enable_PxMesh_Option as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C4982800_PhysXColliderShape_CanBeSelected(self, request, workspace, editor, launcher_platform):
from . import C4982800_PhysXColliderShape_CanBeSelected as test_module
@@ -471,10 +400,6 @@ class TestAutomation(TestAutomationBase):
from . import C4982802_PhysXColliderShape_CanBeSelected as test_module
self._run_test(request, workspace, editor, test_module)
def test_C17411467_AddPhysxRagdollComponent(self, request, workspace, editor, launcher_platform):
from . import C17411467_AddPhysxRagdollComponent as test_module
self._run_test(request, workspace, editor, test_module)
def test_C12905528_ForceRegion_WithNonTriggerCollider(self, request, workspace, editor, launcher_platform):
from . import C12905528_ForceRegion_WithNonTriggerCollider as test_module
# Fixme: expected_lines = ["[Warning] (PhysX Force Region) - Please ensure collider component marked as trigger exists in entity"]
@@ -522,4 +447,35 @@ class TestAutomation(TestAutomationBase):
def test_C100000_RigidBody_EnablingGravityWorksPoC(self, request, workspace, editor, launcher_platform):
from . import C100000_RigidBody_EnablingGravityWorksPoC as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
@fm.file_override('physxsystemconfiguration.setreg','C3510644_Collider_CollisionGroups.setreg', 'AutomatedTesting/Registry')
def test_C3510644_Collider_CollisionGroups(self, request, workspace, editor, launcher_platform):
from . import C3510644_Collider_CollisionGroups as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C4982798_Collider_ColliderRotationOffset(self, request, workspace, editor, launcher_platform):
from . import C4982798_Collider_ColliderRotationOffset as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C15308217_NoCrash_LevelSwitch(self, request, workspace, editor, launcher_platform):
from . import C15308217_NoCrash_LevelSwitch as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C6090547_ForceRegion_ParentChildForceRegions(self, request, workspace, editor, launcher_platform):
from . import C6090547_ForceRegion_ParentChildForceRegions as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C19578021_ShapeCollider_CanBeAdded(self, request, workspace, editor, launcher_platform):
from . import C19578021_ShapeCollider_CanBeAdded as test_module
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_C15425929_Undo_Redo(self, request, workspace, editor, launcher_platform):
from . import C15425929_Undo_Redo as test_module
self._run_test(request, workspace, editor, test_module)
@@ -1,49 +1,49 @@
"""
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
its licensors.
For complete copyright and license terms please see the LICENSE at the root of this
distribution (the "License"). All use of this software is governed by the License,
or, if provided, by the license below or the license accompanying this file. Do not
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
# This suite consists of all test cases that are passing and have been verified.
import pytest
import os
import sys
from .FileManagement import FileManagement as fm
from ly_test_tools import LAUNCHERS
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../automatedtesting_shared')
from base import TestAutomationBase
revert_physics_config = fm.file_revert_list(['physxdebugconfiguration.setreg', 'physxdefaultsceneconfiguration.setreg', 'physxsystemconfiguration.setreg'], 'AutomatedTesting/Registry')
@pytest.mark.SUITE_sandbox
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
@pytest.mark.parametrize("project", ["AutomatedTesting"])
class TestAutomation(TestAutomationBase):
## Seems to be flaky, need to investigate
def test_C19536274_GetCollisionName_PrintsName(self, request, workspace, editor, launcher_platform):
from . import C19536274_GetCollisionName_PrintsName as test_module
# Fixme: expected_lines=["Layer Name: Right"]
self._run_test(request, workspace, editor, test_module)
## Seems to be flaky, need to investigate
def test_C19536277_GetCollisionName_PrintsNothing(self, request, workspace, editor, launcher_platform):
from . import C19536277_GetCollisionName_PrintsNothing as test_module
# All groups present in the PhysX Collider that could show up in test
# Fixme: collision_groups = ["All", "None", "All_NoTouchBend", "All_3", "None_1", "All_NoTouchBend_1", "All_2", "None_1_1", "All_NoTouchBend_1_1", "All_1", "None_1_1_1", "All_NoTouchBend_1_1_1", "All_4", "None_1_1_1_1", "All_NoTouchBend_1_1_1_1", "GroupLeft", "GroupRight"]
# Fixme: for group in collision_groups:
# Fixme: unexpected_lines.append(f"GroupName: {group}")
# Fixme: expected_lines=["GroupName: "]
self._run_test(request, workspace, editor, test_module)
"""
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
its licensors.
For complete copyright and license terms please see the LICENSE at the root of this
distribution (the "License"). All use of this software is governed by the License,
or, if provided, by the license below or the license accompanying this file. Do not
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
# This suite consists of all test cases that are passing and have been verified.
import pytest
import os
import sys
from .FileManagement import FileManagement as fm
from ly_test_tools import LAUNCHERS
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../automatedtesting_shared')
from base import TestAutomationBase
revert_physics_config = fm.file_revert_list(['physxdebugconfiguration.setreg', 'physxdefaultsceneconfiguration.setreg', 'physxsystemconfiguration.setreg'], 'AutomatedTesting/Registry')
@pytest.mark.SUITE_sandbox
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
@pytest.mark.parametrize("project", ["AutomatedTesting"])
class TestAutomation(TestAutomationBase):
## Seems to be flaky, need to investigate
def test_C19536274_GetCollisionName_PrintsName(self, request, workspace, editor, launcher_platform):
from . import C19536274_GetCollisionName_PrintsName as test_module
# Fixme: expected_lines=["Layer Name: Right"]
self._run_test(request, workspace, editor, test_module)
## Seems to be flaky, need to investigate
def test_C19536277_GetCollisionName_PrintsNothing(self, request, workspace, editor, launcher_platform):
from . import C19536277_GetCollisionName_PrintsNothing as test_module
# All groups present in the PhysX Collider that could show up in test
# Fixme: collision_groups = ["All", "None", "All_NoTouchBend", "All_3", "None_1", "All_NoTouchBend_1", "All_2", "None_1_1", "All_NoTouchBend_1_1", "All_1", "None_1_1_1", "All_NoTouchBend_1_1_1", "All_4", "None_1_1_1_1", "All_NoTouchBend_1_1_1_1", "GroupLeft", "GroupRight"]
# Fixme: for group in collision_groups:
# Fixme: unexpected_lines.append(f"GroupName: {group}")
# Fixme: expected_lines=["GroupName: "]
self._run_test(request, workspace, editor, test_module)
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:231d5ac32c95334eeb1cbf77ea0bceae1d8010de3290dfdbd991abb46d18bae6
size 6844
oid sha256:83af66a6db4ff2b4df7212099b661a96668cfb326d8984e41b16506ec0062141
size 5844
@@ -1,28 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
// Please read README.md for an explanation on why scenesrg.srgi and viewsrg.srgi are
// located in this folder (And how you can optionally customize your own scenesrg.srgi
// and viewsrg.srgi in your game project).
#include <Atom/Features/SrgSemantics.azsli>
partial ShaderResourceGroup RayTracingSceneSrg : SRG_RayTracingScene
{
/* Intentionally Empty. Helps define the SrgSemantic for RayTracingSceneSrg once.*/
};
#define AZ_COLLECTING_PARTIAL_SRGS
#include <Atom/Feature/Common/Assets/ShaderResourceGroups/RayTracingSceneSrgAll.azsli>
#undef AZ_COLLECTING_PARTIAL_SRGS
+1 -1
View File
@@ -126,5 +126,5 @@ if(NOT INSTALLED_ENGINE)
ly_setup_o3de_install()
# 7. CPack information (to be included after install)
include(cmake/CPack.cmake)
include(cmake/Packaging.cmake)
endif()
@@ -1,77 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : declaration of struct CryEngineDecalInfo.
// Note:
// 3D Engine and Character Animation subsystems (as well as perhaps
// some others) transfer data about the decals that need to be spawned
// via this structure. This is to avoid passing many parameters through
// each function call, and to save on copying these parameters when just
// simply passing the structure from one function to another.
#ifndef CRYINCLUDE_CRYCOMMON_CRYENGINEDECALINFO_H
#define CRYINCLUDE_CRYCOMMON_CRYENGINEDECALINFO_H
#pragma once
#include "Cry_Math.h"
// Summary:
// Structure containing common parameters that describe a decal
struct SDecalOwnerInfo
{
SDecalOwnerInfo() { memset(this, 0, sizeof(*this)); nRenderNodeSlotId = nRenderNodeSlotSubObjectId = -1; }
struct IStatObj* GetOwner(Matrix34A& objMat);
struct IRenderNode* pRenderNode; // Owner (decal will be attached to or wrapped around of this object)
PodArray<struct SRNInfo>* pDecalReceivers;
int nRenderNodeSlotId; // is set internally by 3dengine
int nRenderNodeSlotSubObjectId; // is set internally by 3dengine
int nMatID;
};
struct CryEngineDecalInfo
{
SDecalOwnerInfo ownerInfo;
Vec3 vPos; // Decal position (world coordinates)
Vec3 vNormal; // Decal/face normal
float fSize; // Decal size
float fLifeTime; // Decal life time (in seconds)
float fAngle; // Angle of rotation
struct IStatObj* pIStatObj; // Decal geometry
Vec3 vHitDirection; // Direction from weapon/player position to decal position (bullet direction)
float fGrowTime, fGrowTimeAlpha;// Used for blood pools
unsigned int nGroupId; // Used for multi-component decals
bool bSkipOverlappingTest; // Always spawn decals even if there are a lot of other decals in same place
bool bAssemble; // Assemble to bigger decals if more than 1 decal is on the same place
bool bForceEdge; // force the decal to the nearest edge of the owner mesh and project it accordingly
bool bForceSingleOwner; // Do not attempt to cast the decal into the environment even if it's large enough
bool bDeferred;
uint8 sortPrio;
char szMaterialName[_MAX_PATH]; // name of material used for rendering the decal (in favor of szTextureName/nTid and the default decal shader)
bool preventDecalOnGround; // mainly for decal placement support
const Matrix33* pExplicitRightUpFront; // mainly for decal placement support
void GetMemoryUsage([[maybe_unused]] ICrySizer* pSizer) const{}
// the constructor fills in some non-obligatory fields; the other fields must be filled in by the client
CryEngineDecalInfo ()
{
memset(this, 0, sizeof(*this));
ownerInfo.nRenderNodeSlotId = ownerInfo.nRenderNodeSlotSubObjectId = -1;
sortPrio = 255;
}
};
#endif // CRYINCLUDE_CRYCOMMON_CRYENGINEDECALINFO_H
-98
View File
@@ -1,98 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <platform.h>
#if defined(AZ_RESTRICTED_PLATFORM)
#include AZ_RESTRICTED_FILE(Gem_h)
#endif
#if defined(LINUX) || defined(APPLE) || defined(ANDROID)
#define OPENGL 1
#endif
#include <Common/RendererDefs.h>
#include <Cry_Math.h>
#include <Cry_XOptimise.h>
#include <Cry_Math.h>
#include <Cry_Geo.h>
#include <CryArray.h>
#include <CryHeaders.h>
#include <CrySizer.h>
#include <CryArray.h>
#include <IProcess.h>
#include <ITimer.h>
#include <ISystem.h>
#include <ILog.h>
#include <IConsole.h>
#include <IRenderer.h>
#include <IRenderAuxGeom.h>
#include <IEntityRenderState.h>
#include <I3DEngine.h>
#include <IStreamEngine.h>
#include <CryArray2d.h>
#include <PoolAllocator.h>
#include <Cry3DEngineBase.h>
#include <cvars.h>
#include <Material.h>
#include <3dEngine.h>
#include <ObjMan.h>
#include <StlUtils.h>
#include <Common/CommonRender.h>
#include <Common/Shaders/ShaderComponents.h>
#include <Common/Shaders/Shader.h>
#include <Common/Shaders/CShader.h>
#include <Common/RenderMesh.h>
#include <Common/RenderPipeline.h>
#include <Common/RenderThread.h>
#include <Common/Renderer.h>
#include <Common/Textures/Texture.h>
#include <Common/Shaders/Parser.h>
#include <RenderDll/Common/OcclQuery.h>
#include <RenderDll/Common/DeferredRenderUtils.h>
#include <RenderDll/Common/Textures/TextureManager.h>
#include <RenderDll/Common/FrameProfiler.h>
#include <RenderDll/XRenderD3D9/DeviceManager/DeviceManagerInline.h>
#include <RenderDll/XRenderD3D9/DriverD3D.h>
#include <RenderDll/XRenderD3D9/DeviceManager/TempDynBuffer.h>
#include <AzCore/PlatformDef.h>
#include <AzCore/Asset/AssetCommon.h>
#include <AzCore/Asset/AssetManager.h>
#include <AzCore/Asset/AssetManagerBus.h>
#include <AzCore/Asset/AssetTypeInfoBus.h>
#include <AzCore/Component/Component.h>
#include <AzCore/Component/ComponentBus.h>
#include <AzCore/Component/ComponentApplicationBus.h>
#include <AzCore/Component/Entity.h>
#include <AzCore/Component/TickBus.h>
#include <AzCore/Component/TransformBus.h>
#include <AzCore/IO/GenericStreams.h>
#include <AzCore/IO/FileIO.h>
#include <AzCore/Math/Quaternion.h>
#include <AzCore/Math/Vector3.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/XML/rapidxml.h>
#include <AzFramework/Asset/SimpleAsset.h>
#include <AzFramework/Asset/AssetCatalogBus.h>
#include <AzFramework/Entity/EntityDebugDisplayBus.h>
#include <LmbrCentral/Rendering/RenderNodeBus.h>
File diff suppressed because it is too large Load Diff
-53
View File
@@ -1,53 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#ifndef CRYINCLUDE_CRYCOMMON_I3DENGINE_INFO_H
#define CRYINCLUDE_CRYCOMMON_I3DENGINE_INFO_H
#pragma once
#include "TypeInfo_impl.h"
#include "IShader_info.h"
#include <I3DEngine.h> // <> required for Interfuscator
STRUCT_INFO_BEGIN(SVisAreaManChunkHeader)
STRUCT_VAR_INFO(nVersion, TYPE_INFO(int8))
STRUCT_VAR_INFO(nDummy, TYPE_INFO(int8))
STRUCT_VAR_INFO(nFlags, TYPE_INFO(int8))
STRUCT_VAR_INFO(nFlags2, TYPE_INFO(int8))
STRUCT_VAR_INFO(nChunkSize, TYPE_INFO(int))
STRUCT_VAR_INFO(nVisAreasNum, TYPE_INFO(int))
STRUCT_VAR_INFO(nPortalsNum, TYPE_INFO(int))
STRUCT_VAR_INFO(nOcclAreasNum, TYPE_INFO(int))
STRUCT_INFO_END(SVisAreaManChunkHeader)
STRUCT_INFO_BEGIN(SOcTreeNodeChunk)
STRUCT_VAR_INFO(nChunkVersion, TYPE_INFO(int16))
STRUCT_VAR_INFO(ucChildsMask, TYPE_INFO(int16))
STRUCT_VAR_INFO(nodeBox, TYPE_INFO(AABB))
STRUCT_VAR_INFO(nObjectsBlockSize, TYPE_INFO(int32))
STRUCT_INFO_END(SOcTreeNodeChunk)
STRUCT_INFO_BEGIN(SHotUpdateInfo)
STRUCT_VAR_INFO(nHeigtmap, TYPE_INFO(uint32))
STRUCT_VAR_INFO(nObjTypeMask, TYPE_INFO(uint32))
STRUCT_VAR_INFO(areaBox, TYPE_INFO(AABB))
STRUCT_INFO_END(SHotUpdateInfo)
STRUCT_INFO_BEGIN(SCommonFileHeader)
STRUCT_VAR_INFO(signature, TYPE_ARRAY(4, TYPE_INFO(char)))
STRUCT_VAR_INFO(file_type, TYPE_INFO(uint8))
STRUCT_VAR_INFO(flags, TYPE_INFO(uint8))
STRUCT_VAR_INFO(version, TYPE_INFO(uint16))
STRUCT_INFO_END(SCommonFileHeader)
#endif // CRYINCLUDE_CRYCOMMON_I3DENGINE_INFO_H
@@ -286,7 +286,6 @@ struct IRenderNode
// Physicalizes node.
virtual void Physicalize([[maybe_unused]] bool bInstant = false) {}
// Make sure I3DEngine::FreeRenderNodeState(this) is called in destructor of derived class.
virtual ~IRenderNode() { assert(!m_pRNTmpData); };
// Summary:
@@ -1,33 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Interface for LocalMemoryUsage
#ifndef CRYINCLUDE_CRYCOMMON_ILOCALMEMORYUSAGE_H
#define CRYINCLUDE_CRYCOMMON_ILOCALMEMORYUSAGE_H
#pragma once
class CCamera;
struct IRenderer;
struct ILocalMemoryUsage
{
virtual ~ILocalMemoryUsage(){}
virtual void OnRender(IRenderer* pRenderer, const CCamera* camera) = 0;
virtual void OnUpdate() = 0;
virtual void DeleteGlobalData() = 0;
};
#endif // CRYINCLUDE_CRYCOMMON_ILOCALMEMORYUSAGE_H
+1 -2
View File
@@ -273,7 +273,7 @@ struct IMaterial
//////////////////////////////////////////////////////////////////////////
// material name
//////////////////////////////////////////////////////////////////////////
//! Set material name, (Do not use this directly, to change material name use I3DEngine::RenameMatInfo method).
//! Set material name, (Do not use this directly
virtual void SetName(const char* pName) = 0;
//! Returns material name.
virtual const char* GetName() const = 0;
@@ -404,7 +404,6 @@ struct IMaterial
//////////////////////////////////////////////////////////////////////////
// Makes this specific material enter sketch mode.
// Se also: I3DEngine::LoadCGF, in I3DEngine.h.
// Current supported sketch modes:
// - 0, no sketch.
// - 1, normal sketch mode.
-1
View File
@@ -26,7 +26,6 @@
#include <ISplines.h>
#include <IRenderer.h>
#include <IRenderAuxGeom.h>
#include <I3DEngine.h>
#include <VectorSet.h>
#include <CryName.h>
-1
View File
@@ -202,7 +202,6 @@ struct IObjManager
// time counters
virtual bool IsAfterWater(const Vec3& vPos, const SRenderingPassInfo& passInfo) = 0;
virtual void GetObjectsStreamingStatus(I3DEngine::SObjectsStreamingStatus& outStatus) = 0;
virtual void FreeNotUsedCGFs() = 0;
virtual void MakeUnitCube() = 0;
-22
View File
@@ -66,7 +66,6 @@ struct IConsole;
struct IRemoteConsole;
struct IRenderer;
struct IProcess;
struct I3DEngine;
struct ITimer;
struct ICryFont;
struct IMovieSystem;
@@ -123,8 +122,6 @@ namespace Serialization {
struct IArchiveHost;
}
struct ILocalMemoryUsage;
typedef void* WIN_HWND;
class CCamera;
@@ -793,7 +790,6 @@ struct SSystemUpdateStats
// ISystem
struct SSystemGlobalEnvironment
{
I3DEngine* p3DEngine;
AZ::IO::IArchive* pCryPak;
AZ::IO::FileIOBase* pFileIO;
IFileChangeMonitor* pFileChangeMonitor;
@@ -801,7 +797,6 @@ struct SSystemGlobalEnvironment
IOpticsManager* pOpticsManager;
ITimer* pTimer;
ICryFont* pCryFont;
ILocalMemoryUsage* pLocalMemoryUsage;
::IConsole* pConsole;
ISystem* pSystem = nullptr;
ILog* pLog;
@@ -1113,25 +1108,9 @@ struct ISystem
virtual void DoWorkDuringOcclusionChecks() = 0;
virtual bool NeedDoWorkDuringOcclusionChecks() = 0;
// Summary:
// Renders subsystems.
virtual void Render() = 0;
// Summary:
// Begins rendering frame.
virtual void RenderBegin() = 0;
// Summary:
// Ends rendering frame and swap back buffer.
virtual void RenderEnd(bool bRenderStats = true, bool bMainWindow = true) = 0;
//! Update screen and call some important tick functions during loading.
virtual void SynchronousLoadingTick(const char* pFunc, int line) = 0;
// Description:
// Renders the statistics; this is called from RenderEnd, but if the
// Host application (Editor) doesn't employ the Render cycle in ISystem,
// it may call this method to render the essential statistics.
virtual void RenderStatistics() = 0;
// Summary:
// Returns the current used memory.
virtual uint32 GetUsedMemory() = 0;
@@ -1229,7 +1208,6 @@ struct ISystem
virtual ICryFont* GetICryFont() = 0;
virtual IMemoryManager* GetIMemoryManager() = 0;
virtual IMovieSystem* GetIMovieSystem() = 0;
virtual I3DEngine* GetI3DEngine() = 0;
virtual ::IConsole* GetIConsole() = 0;
virtual IRemoteConsole* GetIRemoteConsole() = 0;
// Returns:
-286
View File
@@ -1,286 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#pragma once
struct SBezierKey;
struct ITimeOfDayUpdateCallback;
struct ISplineInterpolator;
//! Interface to the Time Of Day functionality.
struct ITimeOfDay
{
enum ETimeOfDayParamID
{
PARAM_SUN_COLOR,
PARAM_SUN_INTENSITY,
PARAM_SUN_SPECULAR_MULTIPLIER,
PARAM_FOG_COLOR,
PARAM_FOG_COLOR_MULTIPLIER,
PARAM_VOLFOG_HEIGHT,
PARAM_VOLFOG_DENSITY,
PARAM_FOG_COLOR2,
PARAM_FOG_COLOR2_MULTIPLIER,
PARAM_VOLFOG_HEIGHT2,
PARAM_VOLFOG_DENSITY2,
PARAM_VOLFOG_HEIGHT_OFFSET,
PARAM_FOG_RADIAL_COLOR,
PARAM_FOG_RADIAL_COLOR_MULTIPLIER,
PARAM_VOLFOG_RADIAL_SIZE,
PARAM_VOLFOG_RADIAL_LOBE,
PARAM_VOLFOG_FINAL_DENSITY_CLAMP,
PARAM_VOLFOG_GLOBAL_DENSITY,
PARAM_VOLFOG_RAMP_START,
PARAM_VOLFOG_RAMP_END,
PARAM_VOLFOG_RAMP_INFLUENCE,
PARAM_VOLFOG_SHADOW_DARKENING,
PARAM_VOLFOG_SHADOW_DARKENING_SUN,
PARAM_VOLFOG_SHADOW_DARKENING_AMBIENT,
PARAM_VOLFOG_SHADOW_RANGE,
PARAM_VOLFOG2_HEIGHT,
PARAM_VOLFOG2_DENSITY,
PARAM_VOLFOG2_HEIGHT2,
PARAM_VOLFOG2_DENSITY2,
PARAM_VOLFOG2_GLOBAL_DENSITY,
PARAM_VOLFOG2_RAMP_START,
PARAM_VOLFOG2_RAMP_END,
PARAM_VOLFOG2_COLOR1,
PARAM_VOLFOG2_ANISOTROPIC1,
PARAM_VOLFOG2_COLOR2,
PARAM_VOLFOG2_ANISOTROPIC2,
PARAM_VOLFOG2_BLEND_FACTOR,
PARAM_VOLFOG2_BLEND_MODE,
PARAM_VOLFOG2_COLOR,
PARAM_VOLFOG2_ANISOTROPIC,
PARAM_VOLFOG2_RANGE,
PARAM_VOLFOG2_INSCATTER,
PARAM_VOLFOG2_EXTINCTION,
PARAM_VOLFOG2_GLOBAL_FOG_VISIBILITY,
PARAM_VOLFOG2_FINAL_DENSITY_CLAMP,
PARAM_SKYLIGHT_SUN_INTENSITY,
PARAM_SKYLIGHT_SUN_INTENSITY_MULTIPLIER,
PARAM_SKYLIGHT_KM,
PARAM_SKYLIGHT_KR,
PARAM_SKYLIGHT_G,
PARAM_SKYLIGHT_WAVELENGTH_R,
PARAM_SKYLIGHT_WAVELENGTH_G,
PARAM_SKYLIGHT_WAVELENGTH_B,
PARAM_NIGHSKY_HORIZON_COLOR,
PARAM_NIGHSKY_HORIZON_COLOR_MULTIPLIER,
PARAM_NIGHSKY_ZENITH_COLOR,
PARAM_NIGHSKY_ZENITH_COLOR_MULTIPLIER,
PARAM_NIGHSKY_ZENITH_SHIFT,
PARAM_NIGHSKY_START_INTENSITY,
PARAM_NIGHSKY_MOON_COLOR,
PARAM_NIGHSKY_MOON_COLOR_MULTIPLIER,
PARAM_NIGHSKY_MOON_INNERCORONA_COLOR,
PARAM_NIGHSKY_MOON_INNERCORONA_COLOR_MULTIPLIER,
PARAM_NIGHSKY_MOON_INNERCORONA_SCALE,
PARAM_NIGHSKY_MOON_OUTERCORONA_COLOR,
PARAM_NIGHSKY_MOON_OUTERCORONA_COLOR_MULTIPLIER,
PARAM_NIGHSKY_MOON_OUTERCORONA_SCALE,
PARAM_CLOUDSHADING_SUNLIGHT_MULTIPLIER,
PARAM_CLOUDSHADING_SUNLIGHT_CUSTOM_COLOR,
PARAM_CLOUDSHADING_SUNLIGHT_CUSTOM_COLOR_MULTIPLIER,
PARAM_CLOUDSHADING_SUNLIGHT_CUSTOM_COLOR_INFLUENCE,
PARAM_SUN_SHAFTS_VISIBILITY,
PARAM_SUN_RAYS_VISIBILITY,
PARAM_SUN_RAYS_ATTENUATION,
PARAM_SUN_RAYS_SUNCOLORINFLUENCE,
PARAM_SUN_RAYS_CUSTOMCOLOR,
PARAM_OCEANFOG_COLOR, // Remove when ocean related feature toggle is removed.
PARAM_OCEANFOG_COLOR_MULTIPLIER, // Remove when ocean related feature toggle is removed.
PARAM_OCEANFOG_DENSITY, // Remove when ocean related feature toggle is removed.
PARAM_SKYBOX_MULTIPLIER,
PARAM_HDR_FILMCURVE_SHOULDER_SCALE,
PARAM_HDR_FILMCURVE_LINEAR_SCALE,
PARAM_HDR_FILMCURVE_TOE_SCALE,
PARAM_HDR_FILMCURVE_WHITEPOINT,
PARAM_HDR_COLORGRADING_COLOR_SATURATION,
PARAM_HDR_COLORGRADING_COLOR_BALANCE,
PARAM_HDR_EYEADAPTATION_SCENEKEY,
PARAM_HDR_EYEADAPTATION_MIN_EXPOSURE,
PARAM_HDR_EYEADAPTATION_MAX_EXPOSURE,
PARAM_HDR_EYEADAPTATION_EV_MIN,
PARAM_HDR_EYEADAPTATION_EV_MAX,
PARAM_HDR_EYEADAPTATION_EV_AUTO_COMPENSATION,
PARAM_HDR_BLOOM_AMOUNT,
PARAM_COLORGRADING_FILTERS_GRAIN,
PARAM_COLORGRADING_FILTERS_PHOTOFILTER_COLOR,
PARAM_COLORGRADING_FILTERS_PHOTOFILTER_DENSITY,
PARAM_COLORGRADING_DOF_FOCUSRANGE,
PARAM_COLORGRADING_DOF_BLURAMOUNT,
PARAM_SHADOWSC0_BIAS,
PARAM_SHADOWSC0_SLOPE_BIAS,
PARAM_SHADOWSC1_BIAS,
PARAM_SHADOWSC1_SLOPE_BIAS,
PARAM_SHADOWSC2_BIAS,
PARAM_SHADOWSC2_SLOPE_BIAS,
PARAM_SHADOWSC3_BIAS,
PARAM_SHADOWSC3_SLOPE_BIAS,
PARAM_SHADOWSC4_BIAS,
PARAM_SHADOWSC4_SLOPE_BIAS,
PARAM_SHADOWSC5_BIAS,
PARAM_SHADOWSC5_SLOPE_BIAS,
PARAM_SHADOWSC6_BIAS,
PARAM_SHADOWSC6_SLOPE_BIAS,
PARAM_SHADOWSC7_BIAS,
PARAM_SHADOWSC7_SLOPE_BIAS,
PARAM_SHADOW_JITTERING,
PARAM_HDR_DYNAMIC_POWER_FACTOR,
PARAM_TERRAIN_OCCL_MULTIPLIER,
PARAM_SUN_COLOR_MULTIPLIER,
PARAM_TOTAL
};
struct SPresetInfo
{
const char* m_pName;
bool m_bCurrent;
};
enum EVariableType
{
TYPE_FLOAT,
TYPE_COLOR
};
struct SVariableInfo
{
const char* name; //!< Variable name.
const char* displayName; //!< Variable user readable name.
const char* group; //!< Group name.
int nParamId;
EVariableType type;
float fValue[3]; //!< Value of the variable (3 needed for color type).
ISplineInterpolator* pInterpolator; //!< Splines that control variable value.
};
struct SAdvancedInfo
{
float fStartTime;
float fEndTime;
float fAnimSpeed;
};
struct SEnvironmentInfo
{
SEnvironmentInfo()
: bSunLinkedToTOD(true)
, sunRotationLatitude(0)
, sunRotationLongitude(0){}
bool bSunLinkedToTOD;
float sunRotationLatitude;
float sunRotationLongitude;
};
// <interfuscator:shuffle>
virtual ~ITimeOfDay(){}
virtual int GetPresetCount() const = 0;
virtual bool GetPresetsInfos(SPresetInfo* resultArray, unsigned int arraySize) const = 0;
virtual bool SetCurrentPreset(const char* szPresetName) = 0;
virtual bool AddNewPreset(const char* szPresetName) = 0;
virtual bool RemovePreset(const char* szPresetName) = 0;
virtual bool SavePreset(const char* szPresetName) const = 0;
virtual bool LoadPreset(const char* szFilePath) = 0;
virtual void ResetPreset(const char* szPresetName) = 0;
virtual bool ImportPreset(const char* szPresetName, const char* szFilePath) = 0;
virtual bool ExportPreset(const char* szPresetName, const char* szFilePath) const = 0;
//! Access to variables that control time of the day appearance.
virtual int GetVariableCount() const = 0;
virtual bool GetVariableInfo(int nIndex, SVariableInfo& varInfo) const = 0;
virtual void SetVariableValue(int nIndex, float fValue[3]) = 0;
//! Editor interface.
virtual bool InterpolateVarInRange(int nIndex, float fMin, float fMax, unsigned int nCount, Vec3* resultArray) const = 0;
virtual uint GetSplineKeysCount(int nIndex, int nSpline) const = 0;
virtual bool GetSplineKeysForVar(int nIndex, int nSpline, SBezierKey* keysArray, unsigned int keysArraySize) const = 0;
virtual bool SetSplineKeysForVar(int nIndex, int nSpline, const SBezierKey* keysArray, unsigned int keysArraySize) = 0;
virtual bool UpdateSplineKeyForVar(int nIndex, int nSpline, float fTime, float newValue) = 0;
virtual void ResetVariables() = 0;
//! Sets the time of the day specified in hours.
virtual void SetTime(float fHour, bool bForceUpdate = false, bool bForceEnvUpdate = true) = 0;
virtual float GetTime() = 0;
//! Sun position.
virtual void SetSunPos(float longitude, float latitude) = 0;
virtual float GetSunLatitude() = 0;
virtual float GetSunLongitude() = 0;
//! Updates the current ToD.
virtual void Tick() = 0;
virtual void SetPaused(bool paused) = 0;
virtual void SetAdvancedInfo(const SAdvancedInfo& advInfo) = 0;
virtual void GetAdvancedInfo(SAdvancedInfo& advInfo) = 0;
//! Updates engine parameters after variable values have been changed.
virtual void Update(bool bInterpolate = true, bool bForceUpdate = false, bool bForceEnvUpdate = true) = 0;
virtual void SetUpdateCallback(ITimeOfDayUpdateCallback* pCallback) = 0;
virtual void BeginEditMode() = 0;
virtual void EndEditMode() = 0;
virtual void Serialize(XmlNodeRef& node, bool bLoading) = 0;
virtual void Serialize(TSerialize ser) = 0;
virtual void SetTimer(ITimer* pTimer) = 0;
virtual void SetEnvironmentSettings(const SEnvironmentInfo& envInfo) = 0;
virtual void LerpWith(const ITimeOfDay& other, float lerpValue, ITimeOfDay& output) const = 0;
//! Multiplayer serialization.
static const int NETSER_FORCESET = BIT(0);
static const int NETSER_COMPENSATELAG = BIT(1);
static const int NETSER_STATICPROPS = BIT(2);
virtual void NetSerialize(TSerialize ser, float lag, uint32 flags) = 0;
};
struct ITimeOfDayUpdateCallback
{
// <interfuscator:shuffle>
virtual ~ITimeOfDayUpdateCallback(){}
virtual void BeginUpdate() = 0;
virtual bool GetCustomValue(ITimeOfDay::ETimeOfDayParamID paramID, int dim, float* pValues, float& blendWeight) = 0;
virtual void EndUpdate() = 0;
// </interfuscator:shuffle>
};
@@ -1,528 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/Math/Aabb.h>
#include <I3DEngine.h>
#include <ISerialize.h>
#include <gmock/gmock.h>
// the following was generated using google's python script to autogenerate mocks.
// however, it needed some hand-editing to make it work, so if you add functions to I3DEngine,
// it will probably be better to just manually add them here than try to run the script again.
class I3DEngineMock
: public I3DEngine
{
public:
// From IProcess
MOCK_METHOD1(SetFlags,
void(int));
MOCK_METHOD0(GetFlags,
int(void));
// From I3DEngine
MOCK_METHOD0(Init,
bool());
MOCK_METHOD1(SetLevelPath,
void(const char* szFolderName));
MOCK_METHOD1(CheckMinSpec,
bool(uint32 nMinSpec));
MOCK_METHOD1(PrepareOcclusion,
void(const CCamera& rCamera));
MOCK_METHOD0(EndOcclusion,
void());
MOCK_METHOD2(LoadLevel,
bool(const char* szFolderName, const char* szMissionName));
MOCK_METHOD2(InitLevelForEditor,
bool(const char* szFolderName, const char* szMissionName));
MOCK_METHOD0(LevelLoadingInProgress,
bool());
MOCK_METHOD0(OnFrameStart,
void());
MOCK_METHOD0(PostLoadLevel,
void());
MOCK_METHOD0(LoadEmptyLevel,
void());
MOCK_METHOD0(UnloadLevel,
void());
MOCK_METHOD0(Update,
void());
MOCK_CONST_METHOD0(GetRenderingCamera,
const CCamera&());
MOCK_CONST_METHOD0(GetZoomFactor,
float());
MOCK_METHOD0(Tick,
void());
MOCK_METHOD0(UpdateShaderItems,
void());
MOCK_METHOD0(Release,
void());
MOCK_METHOD3(RenderWorld,
void(int nRenderFlags, const SRenderingPassInfo& passInfo, const char* szDebugName));
MOCK_METHOD2(RenderSceneReflection,
void(int nRenderFlags, const SRenderingPassInfo& passInfo));
MOCK_METHOD1(PreWorldStreamUpdate,
void(const CCamera& cam));
MOCK_METHOD0(WorldStreamUpdate,
void());
MOCK_METHOD0(ShutDown,
void());
MOCK_METHOD7(LoadStatObjUnsafeManualRef,
IStatObj*(const char* fileName, const char* geomName, IStatObj::SSubObject** subObject,
bool useStreaming, unsigned long loadingFlags, const void* data, int dataSize));
MOCK_METHOD7(LoadStatObjAutoRef,
_smart_ptr<IStatObj>(const char* fileName, const char* geomName, IStatObj::SSubObject** subObject,
bool useStreaming, unsigned long loadingFlags, const void* data, int dataSize));
MOCK_METHOD0(ProcessAsyncStaticObjectLoadRequests,
void());
MOCK_METHOD5(LoadStatObjAsync,
void(LoadStaticObjectAsyncResult resultCallback, const char* szFileName, const char* szGeomName, bool bUseStreaming, unsigned long nLoadingFlags));
MOCK_METHOD1(FindStatObjectByFilename,
IStatObj*(const char* filename));
MOCK_METHOD0(GetGSMRange,
const float());
MOCK_METHOD0(GetGSMRangeStep,
const float());
MOCK_METHOD0(GetLoadedObjectCount,
int());
MOCK_METHOD2(GetLoadedStatObjArray,
void(IStatObj** pObjectsArray, int& nCount));
MOCK_METHOD1(GetObjectsStreamingStatus,
void(SObjectsStreamingStatus& outStatus));
MOCK_METHOD2(GetStreamingSubsystemData,
void(int subsystem, SStremaingBandwidthData& outData));
MOCK_METHOD3(RegisterEntity,
void(IRenderNode* pEntity, int nSID, int nSIDConsideredSafe));
MOCK_METHOD1(SelectEntity,
void(IRenderNode* pEntity));
MOCK_METHOD0(IsSunShadows,
bool());
MOCK_METHOD2(MakeSystemMaterialFromShaderHelper
, _smart_ptr<IMaterial>(const char* sShaderName, SInputShaderResources* Res));
MOCK_METHOD1(CheckMinSpecHelper
, bool(uint32 nMinSpec));
MOCK_METHOD1(OnCasterDeleted
, void(IShadowCaster* pCaster));
MOCK_METHOD4(GetStatObjAndMatTables,
void(DynArray<IStatObj*>* pStatObjTable, DynArray<_smart_ptr<IMaterial>>* pMatTable, DynArray<IStatInstGroup*>* pStatInstGroupTable, uint32 nObjTypeMask));
#ifndef _RELEASE
MOCK_METHOD1(AddObjToDebugDrawList,
void(SObjectInfoToAddToDebugDrawList& objInfo));
MOCK_CONST_METHOD0(IsDebugDrawListEnabled,
bool());
#endif
MOCK_METHOD1(UnRegisterEntityDirect,
void(IRenderNode* pEntity));
MOCK_METHOD1(UnRegisterEntityAsJob,
void(IRenderNode* pEnt));
MOCK_CONST_METHOD1(IsUnderWater,
bool(const Vec3& vPos));
MOCK_METHOD1(SetOceanRenderFlags,
void(uint8 nFlags));
MOCK_CONST_METHOD0(GetOceanRenderFlags,
uint8());
MOCK_CONST_METHOD0(GetOceanVisiblePixelsCount,
uint32());
MOCK_METHOD3(GetBottomLevel,
float(const Vec3& referencePos, float maxRelevantDepth, int objtypes));
MOCK_METHOD2(GetBottomLevel,
float(const Vec3& referencePos, float maxRelevantDepth));
MOCK_METHOD2(GetBottomLevel,
float(const Vec3& referencePos, int objflags));
MOCK_METHOD0(GetWaterLevel,
float());
MOCK_METHOD3(GetWaterLevel,
float(const Vec3* pvPos, IPhysicalEntity* pent, bool bAccurate));
MOCK_CONST_METHOD1(GetAccurateOceanHeight,
float(const Vec3& pCurrPos));
MOCK_CONST_METHOD0(GetCausticsParams,
CausticsParams());
MOCK_CONST_METHOD0(GetOceanAnimationParams,
OceanAnimationData());
MOCK_CONST_METHOD1(GetHDRSetupParams,
void(Vec4 pParams[5]));
MOCK_METHOD0(ResetParticlesAndDecals,
void());
MOCK_METHOD1(CreateDecal,
void(const CryEngineDecalInfo& Decal));
MOCK_METHOD2(DeleteDecalsInRange,
void(AABB* pAreaBox, IRenderNode* pEntity));
MOCK_METHOD1(SetSunColor,
void(Vec3 vColor));
MOCK_METHOD0(GetSunAnimColor,
Vec3());
MOCK_METHOD1(SetSunAnimColor,
void(const Vec3& color));
MOCK_METHOD0(GetSunAnimSpeed,
float());
MOCK_METHOD1(SetSunAnimSpeed,
void(float sunAnimSpeed));
MOCK_METHOD0(GetSunAnimPhase,
AZ::u8());
MOCK_METHOD1(SetSunAnimPhase,
void(AZ::u8 sunAnimPhase));
MOCK_METHOD0(GetSunAnimIndex,
AZ::u8());
MOCK_METHOD1(SetSunAnimIndex,
void(AZ::u8 sunAnimIndex));
MOCK_METHOD1(SetRainParams,
void(const SRainParams& rainParams));
MOCK_METHOD1(GetRainParams,
bool(SRainParams& rainParams));
MOCK_METHOD5(SetSnowSurfaceParams,
void(const Vec3& vCenter, float fRadius, float fSnowAmount, float fFrostAmount, float fSurfaceFreezing));
MOCK_METHOD5(GetSnowSurfaceParams,
bool(Vec3& vCenter, float& fRadius, float& fSnowAmount, float& fFrostAmount, float& fSurfaceFreezing));
MOCK_METHOD7(SetSnowFallParams,
void(int nSnowFlakeCount, float fSnowFlakeSize, float fSnowFallBrightness, float fSnowFallGravityScale, float fSnowFallWindScale, float fSnowFallTurbulence, float fSnowFallTurbulenceFreq));
MOCK_METHOD7(GetSnowFallParams,
bool(int& nSnowFlakeCount, float& fSnowFlakeSize, float& fSnowFallBrightness, float& fSnowFallGravityScale, float& fSnowFallWindScale, float& fSnowFallTurbulence, float& fSnowFallTurbulenceFreq));
MOCK_METHOD1(SetMaxViewDistanceScale,
void(float fScale));
MOCK_METHOD1(GetMaxViewDistance,
float(bool));
MOCK_CONST_METHOD0(GetFrameLodInfo,
const SFrameLodInfo&());
MOCK_METHOD1(SetFrameLodInfo,
void(const SFrameLodInfo& frameLodInfo));
MOCK_METHOD1(SetFogColor,
void(const Vec3& vFogColor));
MOCK_METHOD0(GetFogColor,
Vec3());
MOCK_METHOD6(GetSkyLightParameters,
void(Vec3& sunDir, Vec3& sunIntensity, float& Km, float& Kr, float& g, Vec3& rgbWaveLengths));
MOCK_METHOD7(SetSkyLightParameters,
void(const Vec3& sunDir, const Vec3& sunIntensity, float Km, float Kr, float g, const Vec3& rgbWaveLengths, bool forceImmediateUpdate));
MOCK_CONST_METHOD0(GetLightsHDRDynamicPowerFactor,
float());
MOCK_CONST_METHOD3(IsTessellationAllowed,
bool(const CRenderObject* pObj, const SRenderingPassInfo& passInfo, bool bIgnoreShadowPass));
MOCK_METHOD3(SetRenderNodeMaterialAtPosition,
void(EERType eNodeType, const Vec3& vPos, _smart_ptr<IMaterial> pMat));
MOCK_METHOD1(OverrideCameraPrecachePoint,
void(const Vec3& vPos));
MOCK_METHOD4(AddPrecachePoint,
int(const Vec3& vPos, const Vec3& vDir, float fTimeOut, float fImportanceFactor));
MOCK_METHOD1(ClearPrecachePoint,
void(int id));
MOCK_METHOD0(ClearAllPrecachePoints,
void());
MOCK_METHOD1(GetPrecacheRoundIds,
void(int pRoundIds[MAX_STREAM_PREDICTION_ZONES]));
MOCK_METHOD5(TraceFogVolumes,
void(const Vec3& vPos, const AABB& objBBox, SFogVolumeData& fogVolData, const SRenderingPassInfo& passInfo, bool fogVolumeShadingQuality));
MOCK_METHOD1(RemoveAllStaticObjects,
void(int));
MOCK_METHOD3(SetStatInstGroup,
bool(int nGroupId, const IStatInstGroup& siGroup, int nSID));
MOCK_METHOD3(GetStatInstGroup,
bool(int, IStatInstGroup&, int));
MOCK_METHOD3(OnExplosion,
void(Vec3, float, bool));
MOCK_METHOD1(SetPhysMaterialEnumerator,
void(IPhysMaterialEnumerator* pPhysMaterialEnumerator));
MOCK_METHOD0(GetPhysMaterialEnumerator,
IPhysMaterialEnumerator*());
MOCK_METHOD0(SetupDistanceFog,
void());
MOCK_METHOD1(LoadMissionDataFromXMLNode,
void(const char* szMissionName));
MOCK_METHOD2(LoadEnvironmentSettingsFromXML,
void(XmlNodeRef, int));
MOCK_METHOD0(LoadCompiledOctreeForEditor,
bool());
MOCK_CONST_METHOD0(GetSunDir,
Vec3());
MOCK_CONST_METHOD0(GetSunDirNormalized,
Vec3());
MOCK_CONST_METHOD0(GetRealtimeSunDirNormalized,
Vec3());
MOCK_METHOD0(GetDistanceToSectorWithWater,
float());
MOCK_CONST_METHOD0(GetSunColor,
Vec3());
MOCK_CONST_METHOD0(GetSSAOAmount,
float());
MOCK_CONST_METHOD0(GetSSAOContrast,
float());
MOCK_METHOD1(FreeRenderNodeState,
void(IRenderNode* pEntity));
MOCK_METHOD1(GetLevelFilePath,
const char*(const char* szFileName));
MOCK_METHOD4(DisplayInfo,
void(float& fTextPosX, float& fTextPosY, float& fTextStepY, bool bEnhanced));
MOCK_METHOD0(DisplayMemoryStatistics,
void());
// Can't mock methods with variable parameters so just create empty bodies for them.
void DrawTextRightAligned([[maybe_unused]] const float x, [[maybe_unused]] const float y, [[maybe_unused]] const char* format, ...) override {}
void DrawTextRightAligned([[maybe_unused]] const float x, [[maybe_unused]] const float y, [[maybe_unused]] const float scale, [[maybe_unused]] const ColorF& color, [[maybe_unused]] const char* format, ...) override {}
MOCK_METHOD3(DrawBBoxHelper
, void (const Vec3& vMin, const Vec3& vMax, ColorB col));
MOCK_METHOD2(DrawBBoxHelper
, void (const AABB& box, ColorB col));
MOCK_METHOD3(ActivatePortal,
void(const Vec3& vPos, bool bActivate, const char* szEntityName));
MOCK_CONST_METHOD1(GetMemoryUsage,
void(ICrySizer* pSizer));
MOCK_METHOD2(GetResourceMemoryUsage,
void(ICrySizer* pSizer, const AABB& cstAABB));
MOCK_METHOD1(CreateVisArea,
IVisArea*(uint64 visGUID));
MOCK_METHOD1(DeleteVisArea,
void(IVisArea* pVisArea));
MOCK_METHOD6(UpdateVisArea,
void(IVisArea* pArea, const Vec3* pPoints, int nCount, const char* szName, const SVisAreaInfo& info, bool bReregisterObjects));
MOCK_METHOD4(IsVisAreasConnected,
bool(IVisArea* pArea1, IVisArea* pArea2, int nMaxRecursion, bool bSkipDisabledPortals));
MOCK_METHOD0(CreateClipVolume,
IClipVolume*());
MOCK_METHOD1(DeleteClipVolume,
void(IClipVolume* pClipVolume));
MOCK_METHOD7(UpdateClipVolume,
void(IClipVolume* pClipVolume, _smart_ptr<IRenderMesh> pRenderMesh, IBSPTree3D* pBspTree, const Matrix34& worldTM, bool bActive, uint32 flags, const char* szName));
MOCK_METHOD1(CreateRenderNode,
IRenderNode*(EERType type));
MOCK_METHOD1(DeleteRenderNode,
void(IRenderNode* pRenderNode));
MOCK_METHOD1(SetWind,
void(const Vec3& vWind));
MOCK_CONST_METHOD2(GetWind,
Vec3(const AABB& box, bool bIndoors));
MOCK_CONST_METHOD1(GetGlobalWind,
Vec3(bool bIndoors));
MOCK_CONST_METHOD4(SampleWind,
bool(Vec3* pSamples, int nSamples, const AABB& volume, bool bIndoors));
MOCK_METHOD1(GetVisAreaFromPos,
IVisArea*(const Vec3& vPos));
MOCK_METHOD2(IntersectsVisAreas,
bool(const AABB& box, void** pNodeCache));
MOCK_METHOD4(ClipToVisAreas,
bool(IVisArea* pInside, Sphere& sphere, Vec3 const& vNormal, void* pNodeCache));
MOCK_METHOD1(EnableOceanRendering,
void(bool bOcean));
MOCK_METHOD1(AddTextureLoadHandler,
void(ITextureLoadHandler* pHandler));
MOCK_METHOD1(RemoveTextureLoadHandler,
void(ITextureLoadHandler* pHandler));
MOCK_METHOD1(GetTextureLoadHandlerForImage,
ITextureLoadHandler*(const char* ext));
MOCK_METHOD0(CreateLightSource,
struct ILightSource*());
MOCK_METHOD1(DeleteLightSource,
void(ILightSource* pLightSource));
MOCK_METHOD0(GetLightEntities,
const PodArray<ILightSource*>* ());
MOCK_METHOD3(GetLightVolumes,
void(threadID nThreadID, SLightVolume*& pLightVols, uint32& nNumVols));
MOCK_METHOD4(RegisterVolumeForLighting,
uint16(const Vec3& vPos, f32 fRadius, uint8 nClipVolumeRef, const SRenderingPassInfo& passInfo));
MOCK_METHOD1(RestoreTerrainFromDisk,
bool(int));
MOCK_METHOD1(GetFilePath,
const char*(const char* szFileName));
MOCK_CONST_METHOD0(GetPostEffectGroups,
class IPostEffectGroupManager*());
MOCK_CONST_METHOD0(GetPostEffectBaseGroup,
class IPostEffectGroup*());
MOCK_CONST_METHOD3(SetPostEffectParam,
void(const char* pParam, float fValue, bool bForceValue));
MOCK_CONST_METHOD3(SetPostEffectParamVec4,
void(const char* pParam, const Vec4& pValue, bool bForceValue));
MOCK_CONST_METHOD2(SetPostEffectParamString,
void(const char* pParam, const char* pszArg));
MOCK_CONST_METHOD2(GetPostEffectParam,
void(const char* pParam, float& fValue));
MOCK_CONST_METHOD2(GetPostEffectParamVec4,
void(const char* pParam, Vec4& pValue));
MOCK_CONST_METHOD2(GetPostEffectParamString,
void(const char* pParam, const char*& pszArg));
MOCK_METHOD1(GetPostEffectID,
int32(const char* pPostEffectName));
MOCK_METHOD1(ResetPostEffects,
void(bool));
MOCK_METHOD0(DisablePostEffects,
void());
MOCK_METHOD1(SetShadowsGSMCache,
void(bool bCache));
MOCK_METHOD2(SetCachedShadowBounds,
void(const AABB& shadowBounds, float fAdditionalCascadesScale));
MOCK_METHOD1(SetRecomputeCachedShadows,
void(uint));
MOCK_METHOD0(CheckMemoryHeap,
void());
MOCK_METHOD1(DeleteEntityDecals,
void(IRenderNode* pEntity));
MOCK_METHOD0(LockCGFResources,
void());
MOCK_METHOD0(UnlockCGFResources,
void());
MOCK_METHOD0(FreeUnusedCGFResources,
void());
MOCK_METHOD0(CreateStatObj,
IStatObj*());
MOCK_METHOD1(CreateStatObjOptionalIndexedMesh,
IStatObj*(bool createIndexedMesh));
MOCK_METHOD0(CreateIndexedMesh,
IIndexedMesh*());
MOCK_METHOD1(SerializeState,
void(TSerialize ser));
MOCK_METHOD1(PostSerialize,
void(bool bReading));
MOCK_METHOD0(GetMaterialHelpers,
IMaterialHelpers&());
MOCK_METHOD0(GetMaterialManager,
IMaterialManager*());
MOCK_METHOD0(GetObjManager,
IObjManager*());
MOCK_METHOD1(CreateChunkfileContent,
CContentCGF*(const char* filename));
MOCK_METHOD1(ReleaseChunkfileContent,
void(CContentCGF*));
MOCK_METHOD4(LoadChunkFileContent,
bool(CContentCGF* pCGF, const char* filename, bool bNoWarningMode, bool bCopyChunkFile));
MOCK_METHOD6(LoadChunkFileContentFromMem,
bool(CContentCGF* pCGF, const void* pData, size_t nDataLen, uint32 nLoadingFlags, bool bNoWarningMode, bool bCopyChunkFile));
MOCK_METHOD1(CreateChunkFile,
IChunkFile*(bool));
MOCK_CONST_METHOD3(CreateChunkFileWriter,
ChunkFile::IChunkFileWriter*(EChunkFileFormat eFormat, AZ::IO::IArchive* pPak, const char* filename));
MOCK_CONST_METHOD1(ReleaseChunkFileWriter,
void(ChunkFile::IChunkFileWriter* p));
MOCK_METHOD2(CreateOcean,
bool(_smart_ptr<IMaterial> pTerrainWaterMat, float waterLevel));
MOCK_METHOD0(DeleteOcean,
void());
MOCK_METHOD1(ChangeOceanMaterial,
void(_smart_ptr<IMaterial> pMat));
MOCK_METHOD1(ChangeOceanWaterLevel,
void(float fWaterLevel));
MOCK_METHOD1(InitMaterialDefautMappingAxis
, void(_smart_ptr<IMaterial> pMat));
MOCK_METHOD0(GetIVisAreaManager,
IVisAreaManager*());
MOCK_METHOD3(PrecacheLevel,
void(bool bPrecacheAllVisAreas, Vec3* pPrecachePoints, int nPrecachePointsNum));
MOCK_METHOD0(ProposeContentPrecache,
void());
MOCK_METHOD0(GetTimeOfDay,
ITimeOfDay*());
MOCK_METHOD1(SetSkyMaterialPath,
void(const string& skyMaterialPath));
MOCK_METHOD1(SetSkyLowSpecMaterialPath,
void(const string& skyMaterialPath));
MOCK_METHOD0(LoadSkyMaterial,
void());
MOCK_METHOD0(GetSkyMaterial,
_smart_ptr<IMaterial>());
MOCK_METHOD1(SetSkyMaterial,
void(_smart_ptr<IMaterial> pSkyMat));
MOCK_METHOD2(SetGlobalParameter,
void(E3DEngineParameter param, const Vec3& v));
MOCK_METHOD2(GetGlobalParameter,
void(E3DEngineParameter param, Vec3& v));
MOCK_METHOD1(SetShadowMode,
void(EShadowMode shadowMode));
MOCK_CONST_METHOD0(GetShadowMode,
EShadowMode());
MOCK_METHOD6(AddPerObjectShadow,
void(IShadowCaster* pCaster, float fConstBias, float fSlopeBias, float fJitter, const Vec3& vBBoxScale, uint nTexSize));
MOCK_METHOD1(RemovePerObjectShadow,
void(IShadowCaster* pCaster));
MOCK_METHOD1(GetPerObjectShadow,
struct SPerObjectShadow*(IShadowCaster* pCaster));
MOCK_METHOD2(GetCustomShadowMapFrustums,
void(struct ShadowMapFrustum*& arrFrustums, int& nFrustumCount));
MOCK_METHOD2(SaveStatObj,
int(IStatObj* pStatObj, TSerialize ser));
MOCK_METHOD1(LoadStatObj,
IStatObj*(TSerialize ser));
MOCK_METHOD2(CheckIntersectClouds,
bool(const Vec3& p1, const Vec3& p2));
MOCK_METHOD1(OnRenderMeshDeleted,
void(IRenderMesh* pRenderMesh));
MOCK_METHOD0(DebugDraw_UpdateDebugNode,
void());
MOCK_METHOD4(RayObjectsIntersection2D,
bool(Vec3 vStart, Vec3 vEnd, Vec3& vHitPoint, EERType eERType));
MOCK_METHOD3(RenderMeshRayIntersection,
bool(IRenderMesh* pRenderMesh, SRayHitInfo& hitInfo, _smart_ptr<IMaterial> pCustomMtl));
MOCK_METHOD3(CheckCreateRNTmpData
, void(CRNTmpData** ppInfo, IRenderNode* pRNode, const SRenderingPassInfo& passInfo));
MOCK_METHOD1(FreeRNTmpData,
void(CRNTmpData** ppInfo));
MOCK_METHOD0(IsObjectTreeReady
, bool());
MOCK_METHOD0(GetIObjectTree
, IOctreeNode*());
MOCK_METHOD2(GetObjectsByType,
uint32(EERType, IRenderNode**));
MOCK_METHOD4(GetObjectsByTypeInBox,
uint32(EERType objType, const AABB& bbox, IRenderNode** pObjects, ObjectTreeQueryFilterCallback filterCallback));
MOCK_METHOD2(GetObjectsInBox,
uint32(const AABB& bbox, IRenderNode** pObjects));
MOCK_METHOD2(GetObjectsByFlags,
uint32(uint, IRenderNode**));
MOCK_METHOD4(GetObjectsByTypeInBox,
void(EERType objType, const AABB& bbox, PodArray<IRenderNode*>* pLstObjects, ObjectTreeQueryFilterCallback filterCallback));
MOCK_METHOD2(OnObjectModified,
void(IRenderNode* pRenderNode, uint dwFlags));
MOCK_METHOD1(FillDebugFPSInfo,
void(SDebugFPSInfo&));
MOCK_METHOD0(GetLevelFolder,
const char*());
MOCK_METHOD0(IsAreaActivationInUse,
bool());
MOCK_METHOD3(RenderRenderNode_ShadowPass,
void(IShadowCaster* pRNode, const SRenderingPassInfo& passInfo, AZ::LegacyJobExecutor* pJobExecutor));
MOCK_METHOD0(GetOpticsManager,
IOpticsManager*());
MOCK_METHOD0(SyncProcessStreamingUpdate,
void());
MOCK_METHOD1(SetScreenshotCallback,
void(IScreenshotCallback* pCallback));
MOCK_METHOD8(ActivateObjectsLayer,
void(uint16 nLayerId, bool bActivate, bool bPhys, bool bObjects, bool bStaticLights, const char* pLayerName, IGeneralMemoryHeap* pHeap, bool bCheckLayerActivation));
MOCK_CONST_METHOD4(GetLayerMemoryUsage,
void(uint16 nLayerId, ICrySizer* pSizer, int* pNumBrushes, int* pNumDecals));
MOCK_METHOD2(SkipLayerLoading,
void(uint16 nLayerId, bool bClearList));
MOCK_METHOD2(PrecacheRenderNode,
void(IRenderNode* pObj, float fEntDistanceReal));
MOCK_METHOD0(GetDeferredPhysicsEventManager,
IDeferredPhysicsEventManager*());
MOCK_METHOD1(SetStreamableListener,
void(IStreamedObjectListener* pListener));
MOCK_METHOD1(GetRenderingPassCamera,
CCamera*(const CCamera& rCamera));
MOCK_METHOD3(GetSvoStaticTextures,
void(I3DEngine::SSvoStaticTexInfo& svoInfo, PodArray<I3DEngine::SLightTI>* pLightsTI_S, PodArray<I3DEngine::SLightTI>* pLightsTI_D));
MOCK_METHOD2(GetSvoBricksForUpdate,
void(PodArray<SSvoNodeInfo>& arrNodeInfo, bool getDynamic));
#if defined(USE_GEOM_CACHES)
MOCK_METHOD1(LoadGeomCache,
IGeomCache*(const char* szFileName));
MOCK_METHOD1(FindGeomCacheByFilename,
IGeomCache*(const char* szFileName));
#endif
MOCK_METHOD3(LoadDesignerObject,
IStatObj*(int nVersion, const char* szBinaryStream, int size));
MOCK_METHOD0(WaitForCullingJobsCompletion,
void());
};
@@ -12,11 +12,15 @@
#pragma once
#include <IRenderer.h>
#include <I3DEngine.h> // needed for SRenderingPassInfo definition
#include <IVideoRenderer.h>
#include <IImage.h>
#include <gmock/gmock.h>
struct SRendItemSorter {};
struct SRenderingPassInfo {};
struct SClipVolumeBlendInfo {};
struct SFogVolumeData {};
// the following was generated using google's python script to autogenerate mocks.
// however, it needed some hand-editing to make it work, so if you add functions to IRenderer,
// it will probably be better to just manually add them here than try to run the script again
@@ -37,12 +37,6 @@ public:
void());
MOCK_METHOD0(NeedDoWorkDuringOcclusionChecks,
bool());
MOCK_METHOD0(Render,
void());
MOCK_METHOD0(RenderBegin,
void());
MOCK_METHOD2(RenderEnd,
void(bool, bool));
MOCK_METHOD2(SynchronousLoadingTick,
void(const char* pFunc, int line));
MOCK_METHOD0(RenderStatistics,
@@ -124,8 +118,6 @@ public:
IMovieSystem * ());
MOCK_METHOD0(GetIAudioSystem,
Audio::IAudioSystem * ());
MOCK_METHOD0(GetI3DEngine,
I3DEngine * ());
MOCK_METHOD0(GetIConsole,
::IConsole * ());
MOCK_METHOD0(GetIRemoteConsole,
@@ -11,6 +11,8 @@
*/
#pragma once
#include <ITimer.h>
//! Simple stub timer that exposes a single simple interface for setting the current time.
class StubTimer
: public ITimer
-215
View File
@@ -1,215 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#pragma once
#if defined(WIN32)
#include "CryWindows.h"
#include "IRenderer.h"
#include "IImage.h"
#include "smartptr.h"
#include "ImageExtensionHelper.h"
// Types supported by CreateResourceFromTexture
enum EResourceType
{
eResourceType_IconBig,
eResourceType_IconSmall,
eResourceType_Cursor,
};
// Loads a (DDS) texture resource from the renderer into a Win32 GDI resource.
// Returns a HICON that must be closed with DestroyIcon(), or NULL on failure.
static HICON CreateResourceFromTexture(IRenderer* pRenderer, const char* path, EResourceType type)
{
if (!pRenderer || !path || !*path)
{
// Invalid parameter passed
return NULL;
}
// Find the target dimensions of the GDI resource
const int nRequestedWidth = GetSystemMetrics(type == eResourceType_IconBig ? SM_CXICON : type == eResourceType_IconSmall ? SM_CXSMICON : SM_CXCURSOR);
const int nRequestedHeight = GetSystemMetrics(type == eResourceType_IconBig ? SM_CYICON : type == eResourceType_IconSmall ? SM_CYSMICON : SM_CYCURSOR);
if (nRequestedWidth != nRequestedHeight || nRequestedHeight <= 0 || nRequestedWidth <= 0)
{
// Don't support non-squares icons or cursors
return NULL;
}
// Load texture.
// in this case, we want to fall back on a null, not substiture the missing texture.
_smart_ptr<IImageFile> pImage = pRenderer->EF_LoadImage(path, FIM_NOFALLBACKS);
if (!pImage || pImage->mfGet_depth() != 1 || pImage->mfGet_NumSides() != 1 || pImage->mfGetTileMode() != eTM_None)
{
// Can't load texture, or texture is a cube-map or volume texture, or uses tiling of some kind
return NULL;
}
byte* pImgRaw = pImage->mfGet_image(0);
const ETEX_Format texFormat = pImage->mfGetFormat();
// Pick first mip level smaller than the GDI resource
int nMip = 0;
size_t offset = 0;
int nMipWidth = pImage->mfGet_width();
int nMipHeight = pImage->mfGet_height();
while (nMipWidth > nRequestedWidth)
{
++nMip;
offset += pRenderer->GetTextureFormatDataSize(nMipWidth, nMipHeight, 1, 1, texFormat);
nMipWidth = max(nMipWidth / 2, 1);
nMipHeight = max(nMipHeight / 2, 1);
}
pImgRaw += offset;
if (nMip >= pImage->mfGet_numMips())
{
// No appropriate mip in the texture
// Note: Consider creating a full mip-chain on the texture so this can't happen
return NULL;
}
const size_t nRawSize = pRenderer->GetTextureFormatDataSize(nMipWidth, nMipHeight, 1, 1, texFormat);
#if 0
// Check that DDS indexing is correct here
offset += nRawSize;
for (int nIdx = nMip + 1; nIdx < pImage->mfGet_numMips(); ++nIdx)
{
const int w = max(nMipWidth >> (nIdx - nMip), 1);
const int h = max(nMipHeight >> (nIdx - nMip), 1);
offset += pRenderer->GetTextureFormatDataSize(w, h, 1, 1, texFormat);
}
assert(offset == pImage->mfGet_ImageSize());
#endif
// Type of bitmap to create
BITMAPV5HEADER bi = { 0 };
bi.bV5Size = sizeof(BITMAPV5HEADER);
bi.bV5Width = nRequestedWidth;
bi.bV5Height = -nRequestedHeight;
bi.bV5Planes = 1;
bi.bV5BitCount = 32;
bi.bV5Compression = BI_BITFIELDS;
// The following mask specification specifies a supported 32 BPP alpha format for Windows XP+
bi.bV5AlphaMask = 0xFF000000;
bi.bV5RedMask = 0x00FF0000;
bi.bV5GreenMask = 0x0000FF00;
bi.bV5BlueMask = 0x000000FF;
// Create the DIB section with an alpha channel
const HDC hdc = GetDC(NULL);
void* lpBits;
const HBITMAP hBitmap = CreateDIBSection(hdc, (BITMAPINFO*)&bi, DIB_RGB_COLORS, &lpBits, NULL, 0);
ReleaseDC(NULL, hdc);
if (!hBitmap || !lpBits)
{
// Can't allocate OS bitmap
return NULL;
}
GdiFlush();
// Decompress texture
const bool bTryDecompress = texFormat != eTF_R8G8B8A8 && texFormat != eTF_B8G8R8A8 && texFormat != eTF_B8G8R8X8;
byte* const pImgDecomp = bTryDecompress ? new byte[nMipWidth * nMipHeight * sizeof(int32)] : pImgRaw;
const bool bImgDecompressed = bTryDecompress && pRenderer->DXTDecompress(pImgRaw, nRawSize, pImgDecomp, nMipWidth, nMipHeight, 1, texFormat, false, sizeof(int32));
// Check which conversions need to be performed
const bool bSRGB = (pImage->mfGet_Flags() & CImageExtensionHelper::EIF_SRGBRead) != 0;
const bool bSwap = (texFormat == eTF_R8G8B8A8) || bTryDecompress;
HICON result = NULL;
if (!bTryDecompress || bImgDecompressed)
{
// Assign texture data with mismatching sizes
// Note: Any pixels not in the selected mip will become 100% transparent black, no resizing is performed
const size_t sourceRowStride = nMipWidth;
const size_t targetRowStride = nRequestedWidth;
const uint32* pSourceRow = (uint32*)pImgDecomp;
uint32* pTargetRow = (uint32*)lpBits;
assert(sourceRowStride <= targetRowStride);
assert(nMipHeight <= nRequestedHeight);
assert(pSourceRow != pTargetRow);
assert(pSourceRow && pTargetRow);
uint8 gammaTable[256];
if (!bSRGB)
{
// Linear to sRGB table
const float gamma = 1.0f / 2.2f;
const float gammaMultiplier = 255.0f / powf(255.0f, gamma);
for (int i = 0; i < 256; ++i)
{
gammaTable[i] = uint8(powf(float(i), gamma) * gammaMultiplier);
}
}
else if (bSwap)
{
// sRGB to sRGB table (no change)
for (int i = 0; i < 256; ++i)
{
gammaTable[i] = uint8(i);
}
}
for (int y = 0; y < nMipHeight; ++y, pSourceRow += sourceRowStride, pTargetRow += targetRowStride)
{
if (!bSwap && bSRGB)
{
memcpy(pTargetRow, pSourceRow, sourceRowStride * sizeof(uint32));
}
else
{
const uint32* pSourceTexel = pSourceRow;
uint32* pTargetTexel = pTargetRow;
for (int x = 0; x < nMipWidth; ++x, ++pSourceTexel, ++pTargetTexel)
{
const uint8 red = gammaTable[uint8(*pSourceTexel >> 0)];
const uint8 green = gammaTable[uint8(*pSourceTexel >> 8)];
const uint8 blue = gammaTable[uint8(*pSourceTexel >> 16)];
const uint32 alpha = *pSourceTexel & 0xFF000000;
*pTargetTexel = (red << (bSwap ? 16 : 0)) | (green << 8) | (blue << (bSwap ? 0 : 16)) | alpha;
}
}
// Fill remaining columns with zeros
memset(pTargetRow + sourceRowStride, 0, (targetRowStride - sourceRowStride) * sizeof(uint32));
}
// Fill remaining rows with zeros
for (int y = nMipHeight; y < nRequestedHeight; ++y)
{
memset(pTargetRow, 0, targetRowStride * sizeof(uint32));
pTargetRow += targetRowStride;
}
// Convert to GDI icon
ICONINFO iconinfo = {0};
iconinfo.fIcon = type == eResourceType_Cursor ? FALSE : TRUE;
iconinfo.hbmMask = ::CreateBitmap(nRequestedWidth, nRequestedHeight, 1, 1, NULL);
iconinfo.hbmColor = hBitmap;
result = ::CreateIconIndirect(&iconinfo);
DeleteObject(iconinfo.hbmMask);
}
// Clean up
DeleteObject(hBitmap);
if (bTryDecompress)
{
delete[] pImgDecomp;
}
pImage.reset();
return result;
}
#endif
@@ -14,9 +14,6 @@ set(FILES
CryCommon.cpp
Allocator.h
FinalizingSpline.h
Gem.h
I3DEngine.h
I3DEngine_info.h
IAudioInterfacesCommonData.h
IAudioSystem.h
IChunkFile.h
@@ -86,7 +83,6 @@ set(FILES
ITexture.h
IThreadManager.h
IThreadTask.h
ITimeOfDay.h
ITimer.h
IValidator.h
IVideoRenderer.h
@@ -143,7 +139,6 @@ set(FILES
CryAssert.h
CryCrc32.h
CryCustomTypes.h
CryEngineDecalInfo.h
CryFile.h
CryFixedArray.h
CryFixedString.h
@@ -292,7 +287,6 @@ set(FILES
platform_impl.cpp
Win32specific.h
Win64specific.h
WindowsUtils.h
CryExtension/CryCreateClassInstance.h
CryExtension/CryGUID.h
CryExtension/CryTypeID.h
@@ -317,7 +311,6 @@ set(FILES
CryPool/STLWrapper.h
CryPool/ThreadSafe.h
stl/STLAlignedAlloc.h
ILocalMemoryUsage.h
Serialization/Assert.h
Serialization/BitVector.h
Serialization/BitVectorImpl.h
@@ -10,7 +10,6 @@
#
set(FILES
Mocks/I3DEngineMock.h
Mocks/IAudioSystemMock.h
Mocks/IConsoleMock.h
Mocks/ICryPakMock.h
@@ -102,7 +102,6 @@ inline int RoundToClosestMB(size_t memSize)
#include <IRenderer.h>
#include <CryFile.h>
#include <ISystem.h>
#include <I3DEngine.h>
#include <ITimer.h>
#include <IPhysics.h>
#include <IXml.h>
@@ -127,7 +126,6 @@ namespace AZ::IO
struct IArchive;
}
struct ICryFont;
struct I3DEngine;
struct IMovieSystem;
struct IAudioSystem;
struct IPhysicalWorld;
@@ -193,10 +193,6 @@ static void UnloadMap([[maybe_unused]] IConsoleCmdArgs* args)
if (gEnv->pSystem && gEnv->pSystem->GetILevelSystem() && !gEnv->IsEditor())
{
gEnv->pSystem->GetILevelSystem()->UnloadLevel();
if (gEnv->p3DEngine)
{
gEnv->p3DEngine->LoadEmptyLevel();
}
}
}
@@ -674,18 +670,6 @@ ILevel* CLevelSystem::LoadLevelInternal(const char* _levelName)
pSpamDelay->Set(0.0f);
}
if (gEnv->p3DEngine)
{
bool is3DEngineLoaded = gEnv->IsEditor() ? gEnv->p3DEngine->InitLevelForEditor(pLevelInfo->GetPath(), pLevelInfo->m_defaultGameTypeName.c_str())
: gEnv->p3DEngine->LoadLevel(pLevelInfo->GetPath(), pLevelInfo->m_defaultGameTypeName.c_str());
if (!is3DEngineLoaded)
{
OnLoadingError(levelName, "3DEngine failed to handle loading the level");
return 0;
}
}
// Parse level specific config data.
AZStd::string const sLevelNameOnly(PathUtil::GetFileName(levelName));
@@ -760,14 +744,6 @@ ILevel* CLevelSystem::LoadLevelInternal(const char* _levelName)
gEnv->pSystem->SetSystemGlobalState(ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_START_PRECACHE);
//////////////////////////////////////////////////////////////////////////
// Notify 3D engine that loading finished
//////////////////////////////////////////////////////////////////////////
if (gEnv->p3DEngine)
{
gEnv->p3DEngine->PostLoadLevel();
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
gEnv->pConsole->SetScrollMax(600 / 2);
@@ -991,18 +967,6 @@ void CLevelSystem::UnloadLevel()
CTimeValue tBegin = gEnv->pTimer->GetAsyncTime();
I3DEngine* p3DEngine = gEnv->p3DEngine;
if (p3DEngine)
{
IDeferredPhysicsEventManager* pPhysEventManager = p3DEngine->GetDeferredPhysicsEventManager();
if (pPhysEventManager)
{
// clear deferred physics queues before renderer, since we could have jobs running
// which access a rendermesh
pPhysEventManager->ClearDeferredEvents();
}
}
//AM: Flush render thread (Flush is not exposed - using EndFrame())
//We are about to delete resources that could be in use
if (gEnv->pRenderer)
@@ -1076,25 +1040,10 @@ void CLevelSystem::UnloadLevel()
SAFE_RELEASE(m_pCurrentLevel);
/*
Force Lua garbage collection before p3DEngine->UnloadLevel() and pRenderer->FreeResources(flags) are called.
p3DEngine->UnloadLevel() will destroy particle emitters even if they're still referenced by Lua objects that are yet to be collected.
(as per comment in 3dEngineLoad.cpp (line 501) - "Force to clean all particles that are left, even if still referenced.").
Then, during the next GC cycle, Lua finally cleans up, the particle emitter smart pointers will be pointing to invalid memory).
Normally the GC step is triggered at the end of this method (by the ESYSTEM_EVENT_LEVEL_POST_UNLOAD event), which is too late
(after the render resources have been purged).
This extra GC step takes a few ms more level unload time, which is a small price for fixing nasty crashes.
If, however, we wanted to claim it back, we could potentially get rid of the GC step that is triggered by ESYSTEM_EVENT_LEVEL_POST_UNLOAD to break even.
*/
// Force Lua garbage collection (may no longer be needed now the legacy renderer has been removed).
// Normally the GC step is triggered at the end of this method (by the ESYSTEM_EVENT_LEVEL_POST_UNLOAD event).
EBUS_EVENT(AZ::ScriptSystemRequestBus, GarbageCollect);
// Delete engine resources
if (p3DEngine)
{
p3DEngine->UnloadLevel();
}
// Force to clean render resources left after deleting all objects and materials.
IRenderer* pRenderer = gEnv->pRenderer;
if (pRenderer)
@@ -55,10 +55,6 @@ namespace LegacyLevelSystem
if (gEnv->pSystem && gEnv->pSystem->GetILevelSystem() && !gEnv->IsEditor())
{
gEnv->pSystem->GetILevelSystem()->UnloadLevel();
if (gEnv->p3DEngine)
{
gEnv->p3DEngine->LoadEmptyLevel();
}
}
}
@@ -262,22 +258,6 @@ namespace LegacyLevelSystem
pSpamDelay->Set(0.0f);
}
if (gEnv->p3DEngine)
{
AZ::IO::PathView levelPath(levelName);
AZStd::string parentPath(levelPath.ParentPath().Native());
static constexpr const char* defaultGameTypeName = "Mission0";
bool is3DEngineLoaded = gEnv->IsEditor() ? gEnv->p3DEngine->InitLevelForEditor(parentPath.c_str(), defaultGameTypeName)
: gEnv->p3DEngine->LoadLevel(parentPath.c_str(), defaultGameTypeName);
if (!is3DEngineLoaded)
{
OnLoadingError(levelName, "3DEngine failed to handle loading the level");
return 0;
}
}
// Parse level specific config data.
AZStd::string const sLevelNameOnly(PathUtil::GetFileName(levelName));
@@ -340,14 +320,6 @@ namespace LegacyLevelSystem
gEnv->pSystem->SetSystemGlobalState(ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_START_PRECACHE);
//////////////////////////////////////////////////////////////////////////
// Notify 3D engine that loading finished
//////////////////////////////////////////////////////////////////////////
if (gEnv->p3DEngine)
{
gEnv->p3DEngine->PostLoadLevel();
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
gEnv->pConsole->SetScrollMax(600 / 2);
@@ -569,18 +541,6 @@ namespace LegacyLevelSystem
CTimeValue tBegin = gEnv->pTimer->GetAsyncTime();
I3DEngine* p3DEngine = gEnv->p3DEngine;
if (p3DEngine)
{
IDeferredPhysicsEventManager* pPhysEventManager = p3DEngine->GetDeferredPhysicsEventManager();
if (pPhysEventManager)
{
// clear deferred physics queues before renderer, since we could have jobs running
// which access a rendermesh
pPhysEventManager->ClearDeferredEvents();
}
}
// AM: Flush render thread (Flush is not exposed - using EndFrame())
// We are about to delete resources that could be in use
if (gEnv->pRenderer)
@@ -644,25 +604,10 @@ namespace LegacyLevelSystem
GetISystem()->GetIResourceManager()->UnloadLevel();
/*
Force Lua garbage collection before p3DEngine->UnloadLevel() and pRenderer->FreeResources(flags) are called.
p3DEngine->UnloadLevel() will destroy particle emitters even if they're still referenced by Lua objects that are yet to be
collected. (as per comment in 3dEngineLoad.cpp (line 501) - "Force to clean all particles that are left, even if still referenced.").
Then, during the next GC cycle, Lua finally cleans up, the particle emitter smart pointers will be pointing to invalid memory).
Normally the GC step is triggered at the end of this method (by the ESYSTEM_EVENT_LEVEL_POST_UNLOAD event), which is too late
(after the render resources have been purged).
This extra GC step takes a few ms more level unload time, which is a small price for fixing nasty crashes.
If, however, we wanted to claim it back, we could potentially get rid of the GC step that is triggered by
ESYSTEM_EVENT_LEVEL_POST_UNLOAD to break even.
*/
// Force Lua garbage collection (may no longer be needed now the legacy renderer has been removed).
// Normally the GC step is triggered at the end of this method (by the ESYSTEM_EVENT_LEVEL_POST_UNLOAD event).
EBUS_EVENT(AZ::ScriptSystemRequestBus, GarbageCollect);
// Delete engine resources
if (p3DEngine)
{
p3DEngine->UnloadLevel();
}
// Force to clean render resources left after deleting all objects and materials.
IRenderer* pRenderer = gEnv->pRenderer;
if (pRenderer)
-55
View File
@@ -22,7 +22,6 @@
#include "MiniGUI/MiniMenu.h"
#include "MiniGUI/MiniTable.h"
#include <IConsole.h>
#include <I3DEngine.h>
#include <ITimer.h>
#include "System.h"
@@ -853,21 +852,6 @@ void CPerfHUD::SaveStatsCallback([[maybe_unused]] void* data, [[maybe_unused]] b
// RENDER CALLBACKS
//////////////////////////////////////////////////////////////////////////
/*
void CPerfHUD::DisplayRenderInfoCallback(const Rect& rect)
{
IMiniGUIPtr pGUI;
if (CryCreateClassInstanceForInterface( cryiidof<IMiniGUI>(),pGUI ))
{
//right aligned display
float x = rect.right;
float y = rect.top;
float step = 13.f;
gEnv->p3DEngine->DisplayInfo(x, y, step, true);
}
}*/
void CPerfHUD::EnableWidget(ICryPerfHUDWidget::EWidgetID id, int mode)
{
const int nWidgets = m_widgets.size();
@@ -1530,26 +1514,6 @@ void CRenderStatsWidget::Update()
m_runtimeData.nFwdLights = 0;
m_runtimeData.nFwdShadowLights = 0;
//////////////////////////////////////////////////////////////////////////
if (gEnv->p3DEngine)
{
I3DEngine::SObjectsStreamingStatus objStats;
gEnv->p3DEngine->GetObjectsStreamingStatus(objStats);
float fMeshRequiredMB = (float)(objStats.nMemRequired) / (1024 * 1024);
sprintf_s(entryBuffer, "Mesh Required: %.2f (%dMB)", fMeshRequiredMB, azlossy_cast<int>(objStats.nMeshPoolSize));
if (fMeshRequiredMB < objStats.nMeshPoolSize)
{
m_pInfoBox->AddEntry(entryBuffer, CPerfHUD::COL_NORM, CPerfHUD::TEXT_SIZE_NORM);
}
else
{
m_pInfoBox->AddEntry(entryBuffer, CPerfHUD::COL_ERROR, CPerfHUD::TEXT_SIZE_NORM);
CryPerfHUDWarning(1.f, "Too Many Geometry: %.2fMB", fMeshRequiredMB);
}
}
//////////////////////////////////////////////////////////////////////////
if (gEnv->pRenderer)
{
@@ -1727,25 +1691,6 @@ CStreamingStatsWidget::CStreamingStatsWidget(IMiniCtrl* pParentMenu, ICryPerfHUD
//////////////////////////////////////////////////////////////////////////
void CStreamingStatsWidget::Update()
{
char entryBuffer[CMiniInfoBox::MAX_TEXT_LENGTH] = {0};
//Clear old entries
m_pInfoBox->ClearEntries();
I3DEngine::SObjectsStreamingStatus objStats;
gEnv->p3DEngine->GetObjectsStreamingStatus(objStats);
float fMeshRequiredMB = (float)(objStats.nMemRequired) / (1024 * 1024);
sprintf_s(entryBuffer, "Mesh Required: %.2f (%dMB)", fMeshRequiredMB, objStats.nMeshPoolSize);
if (fMeshRequiredMB < objStats.nMeshPoolSize)
{
m_pInfoBox->AddEntry(entryBuffer, CPerfHUD::COL_NORM, CPerfHUD::TEXT_SIZE_NORM);
}
else
{
m_pInfoBox->AddEntry(entryBuffer, CPerfHUD::COL_ERROR, CPerfHUD::TEXT_SIZE_NORM);
CryPerfHUDWarning(1.f, "Too Many Geometry: %.2fMB", fMeshRequiredMB);
}
}
//////////////////////////////////////////////////////////////////////////
File diff suppressed because it is too large Load Diff
@@ -1,245 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Visual helper for checking a local memory usage on maps
#ifndef CRYINCLUDE_CRYSYSTEM_STATISTICS_LOCALMEMORYUSAGE_H
#define CRYINCLUDE_CRYSYSTEM_STATISTICS_LOCALMEMORYUSAGE_H
#pragma once
#include "../CryCommon/Cry_Geo.h"
#include "ILocalMemoryUsage.h"
#include "TimeValue.h"
#define LOCALMEMORY_SECTOR_SIZE 32.f //Size of one sector
#define LOCALMEMORY_SECTOR_NR_X 128 //4096 / LOCALMEMORY_SECTOR_SIZE Sector number of the world (x)
#define LOCALMEMORY_SECTOR_NR_Y 128 //4096 / LOCALMEMORY_SECTOR_SIZE Sector number of the world (y)
#define LOCALMEMORY_SECTOR_PER_PASS 128 //4096 / 32 Sector nr for one calculation pass. Now it is the whole world;
//Sector number must be = LOCALMEMORY_SECTOR_PER_PASS * n
#define LOCALMEMORY_COLOR_OK 0, 255, 0
#define LOCALMEMORY_COLOR_WARNING 255, 255, 0
#define LOCALMEMORY_COLOR_ERROR 255, 0, 0
#define LOCALMEMORY_COLOR_TEXTURE 0, 0, 255
#define LOCALMEMORY_COLOR_GEOMETRY 0, 0, 0
#define LOCALMEMORY_COLOR_BLACK 0, 0, 0, 192
#define LOCALMEMORY_FCOLOR_OK 0, 1, 0
#define LOCALMEMORY_FCOLOR_WARNING 1, 1, 0
#define LOCALMEMORY_FCOLOR_ERROR 1, 0, 0
#define LOCALMEMORY_FCOLOR_OTHER 0, 0, 1
struct IMaterial;
struct IStatObj;
struct IRenderMesh;
struct IRenderNode;
struct CRenderChunk;
class CCamera;
#include <VectorMap.h>
struct CLocalMemoryUsage
: public ILocalMemoryUsage
{
private:
struct STextureInfo;
struct SMaterialInfo;
struct SStatObjInfo;
typedef std__hash_map<INT_PTR, STextureInfo > TTextureMap; // Type: hash map of textures
typedef std__hash_map<INT_PTR, SMaterialInfo> TMaterialMap; // Type: hash map of materials
typedef std__hash_map<INT_PTR, SStatObjInfo > TStatObjMap; // Type: hash map of stat objects
//*******************
struct SResource
{
CLocalMemoryUsage* m_pLocalMemoryUsage; // Inner pointer to the singleton (we can use gEnv->pLocalMemoryUsage with type cast instead this)
float m_arrMipFactor[LOCALMEMORY_SECTOR_PER_PASS * LOCALMEMORY_SECTOR_PER_PASS]; // Mipmap factor based on minimum distance of the resource from the sector (bounding box distance)
bool m_arrRowDirty[LOCALMEMORY_SECTOR_PER_PASS]; // Dirty flag for m_arrMipFactor rows
bool m_used;
static int m_arrMemoryUsage[LOCALMEMORY_SECTOR_PER_PASS]; // Memory usage of the resource in sectors (last row)
static int m_arrPieces[LOCALMEMORY_SECTOR_PER_PASS]; // Pieces nr of the resource in sectors (last row)
virtual void StartChecking(); // Called every frame first
void CheckOnAllSectorsP1(const AABB& bounding, float maxViewDist, float viewDistMultiplierForLOD, float mipFactor); // Calculates the minimum of sector bounding vs renderobject bounding distances
SResource();
virtual void Init(CLocalMemoryUsage* pLocalMemoryUsage);
//If we will needed a destructor, it must be virtual!
};
//*******************
struct STextureInfo
: public SResource
{
ITexture* m_pTexture; // Texture pointer
//int m_size; // For later use - Used memory
//int m_xSize; // For later use - Texture x size
//int m_ySize; // For later use - Texture y size
//int m_numMips; // For later use - Number of mip maps
void CheckOnAllSectorsP2(); // Calculate memory usage using distances
STextureInfo();
~STextureInfo();
};
//*******************
struct STextureInfoAndTilingFactor
{
STextureInfo* m_pTextureInfo;
float m_tilingFactor;
};
typedef std::vector<STextureInfoAndTilingFactor> TTextureVector; // Type: vector of textures
struct SMaterialInfo
: public SResource
{
//_smart_ptr<IMaterial> m_pMaterial; // For later use
TTextureVector m_textures; // Used textures
SMaterialInfo();
void AddTextureInfo(STextureInfoAndTilingFactor texture);// Add a new texture (unique)
void CheckOnAllSectorsP2(); // Forward distance informations to textures
};
//*******************
struct SStatObjInfo
: public SResource
{
int m_streamableContentMemoryUsage; // Total streamable memory usage
//IStatObj *m_pStatObj; //TODO kiszedni
string m_filePath; // The original file name and path of the StatObj
bool m_bSubObject; // Is the original StatObj a subobject?
/*
int m_lodNr; // For later use
int m_vertices;
int m_meshSize;
int m_physProxySize;
int m_physPrimitives;
int m_indices;
int m_indicesPerLod[MAX_LODS];
*/
SStatObjInfo();
void CheckOnAllSectorsP2(); // Calculate memory usage using distances
};
//*******************
struct SSector
{
SSector();
void StartChecking(); // Called every frame first
int m_memoryUsage_Textures; // Sum of texture memory usage
int m_memoryUsage_Geometry; // Sum of geometry memory usage
};
//*******************
PREFAST_SUPPRESS_WARNING(6262);
TTextureMap m_globalTextures; // Hash map of resources: textures
PREFAST_SUPPRESS_WARNING(6262);
TMaterialMap m_globalMaterials; // Hash map of resources: materials
PREFAST_SUPPRESS_WARNING(6262);
TStatObjMap m_globalStatObjs; // Hash map of resources: stat objects
ICVar* m_pStreamCgfPredicitionDistance; // Config: additional object distance for streaming
ICVar* m_pDebugDraw; // Config: debug draw mode
int sys_LocalMemoryTextureLimit; // Config: texture limit for streaming
int sys_LocalMemoryGeometryLimit; // Config: stat object geometry limit for streaming
int sys_LocalMemoryTextureStreamingSpeedLimit; // Config: texture streaming speed limit (approx)
int sys_LocalMemoryGeometryStreamingSpeedLimit; // Config: stat object geometry streaming speed limit (approx)
float sys_LocalMemoryWarningRatio; // Config: Warning ratio for streaming
float sys_LocalMemoryOuterViewDistance; // Config: View distance for debug draw
float sys_LocalMemoryInnerViewDistance; // Config: View distance for detailed debug draw
float sys_LocalMemoryObjectWidth; // Config: Width of the debug object
float sys_LocalMemoryObjectHeight; // Config: Height of the debug object
int sys_LocalMemoryObjectAlpha; // Config: Color alpha of the debug object
float sys_LocalMemoryStreamingSpeedObjectLength; // Config: Length of the streaming speed debug object
float sys_LocalMemoryStreamingSpeedObjectWidth; // Config: Width of the streaming speed debug object
float sys_LocalMemoryDiagramWidth; // Config: Width of the diagram
float sys_LocalMemoryDiagramRadius; // Config: Radius of the diagram
float sys_LocalMemoryDiagramDistance; // Config: Distance of the diagram from the main debug object
float sys_LocalMemoryDiagramStreamingSpeedRadius; // Config: Radius of the streaming speed diagram
float sys_LocalMemoryDiagramStreamingSpeedDistance; // Config: Distance of the streaming speed diagram from the streaming speed debug line
int sys_LocalMemoryDiagramAlpha; // Config: Color alpha of the diagram
int sys_LocalMemoryDrawText; // Config: If != 0, it will draw the numeric values
int sys_LocalMemoryLogText; // Config: If != 0, it will log the numeric values
int sys_LocalMemoryOptimalMSecPerSec; // Config: Optimal calculation time (MSec) per secundum
int sys_LocalMemoryMaxMSecBetweenCalls; // Config: Maximal time difference (MSec) between calls
RectI m_actProcessedSectors; // Processed sectors (now it is the whole world)
RectI m_actDrawedSectors; // Processed sectors (now it is the whole world)
Vec2i m_sectorNr; // Sector x and y number
float m_AverageUpdateTime; // Avarage Update() time (MSec)
CTimeValue m_LastCallTime; // Last call time of Update()
SSector m_arrSectors[LOCALMEMORY_SECTOR_NR_X * LOCALMEMORY_SECTOR_NR_Y]; // Sectors
public:
CLocalMemoryUsage();
~CLocalMemoryUsage();
virtual void OnRender(IRenderer* pRenderer, const CCamera* camera);
virtual void OnUpdate();
virtual void DeleteGlobalData(); // Deletes the m_globalXXX hash maps
private:
void DeleteUnusedResources(); // Delete the non-used resources (especially StatObjs)
void StartChecking(const RectI& actProcessedSectors); // Called every frame first
void CollectGeometryP1(); // Calculates the minimum of sector bounding vs renderobject bounding distances
// Get / create StatObjInfo then run Pass1
SStatObjInfo* CheckStatObjP1(IStatObj* pStatObj, IRenderNode* pRenderNode, AABB bounding, float maxViewDist, float scale);
//void CollectStatObjInfo_Recursive( SStatObjInfo* statObjInfo, IStatObj *pStatObj );
//void CollectGeometryInfo( SStatObjInfo* statObjInfo, IStatObj *pStatObj );
// Get / create MaterialInfo then run Pass1
void CheckMaterialP1(_smart_ptr<IMaterial> pMaterial, AABB bounding, float maxViewDist, float scale, float mipFactor);
void CheckChunkMaterialP1(_smart_ptr<IMaterial> pMaterial, AABB bounding, float maxViewDist, float scale, CRenderChunk* pRenderChunk);
void CheckMeshMaterialP1(IRenderMesh* pRenderMesh, _smart_ptr<IMaterial> pMaterial, AABB bounding, float maxViewDist, float scale);
void CheckStatObjMaterialP1(IStatObj* pStatObj, _smart_ptr<IMaterial> pMaterial, AABB bounding, float maxViewDist, float scale);
// Collects textures used by the material
void CollectMaterialInfo_Recursive(SMaterialInfo* materialInfo, _smart_ptr<IMaterial> pMaterial);
// Get / create TextureInfo
STextureInfo* GetTextureInfo(ITexture* pTexture);
};
#undef MAX_LODS
#endif // CRYINCLUDE_CRYSYSTEM_STATISTICS_LOCALMEMORYUSAGE_H
+3 -126
View File
@@ -31,7 +31,6 @@
#include <AzCore/Interface/Interface.h>
#include <AzFramework/Logging/MissingAssetLogger.h>
#include <AzFramework/Entity/EntityDebugDisplayBus.h>
#include <AzFramework/API/AtomActiveInterface.h>
#include <AzCore/Interface/Interface.h>
@@ -120,8 +119,6 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
#include AZ_RESTRICTED_FILE(System_cpp)
#endif
#include <I3DEngine.h>
#include <IRenderer.h>
#include <IMovieSystem.h>
#include <ServiceNetwork.h>
@@ -132,7 +129,6 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
#include <ISoftCodeMgr.h>
#include "VisRegTest.h"
#include <LyShine/ILyShine.h>
#include <ITimeOfDay.h>
#include <LoadScreenBus.h>
@@ -155,7 +151,6 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
#include "Serialization/ArchiveHost.h"
#include "SystemEventDispatcher.h"
#include "ServerThrottle.h"
#include "ILocalMemoryUsage.h"
#include "ResourceManager.h"
#include "HMDBus.h"
#include "OverloadSceneManager/OverloadSceneManager.h"
@@ -683,15 +678,6 @@ void CSystem::ShutDown()
// Shutdown any running VR devices.
EBUS_EVENT(AZ::VR::HMDInitRequestBus, Shutdown);
//////////////////////////////////////////////////////////////////////////
// Clear 3D Engine resources.
if (m_env.p3DEngine)
{
m_env.p3DEngine->UnloadLevel();
}
//////////////////////////////////////////////////////////////////////////
// Shutdown resource manager.
m_pResourceManager->Shutdown();
@@ -707,7 +693,6 @@ void CSystem::ShutDown()
SAFE_DELETE(m_env.pServiceNetwork);
SAFE_RELEASE(m_env.pLyShine);
SAFE_RELEASE(m_env.pCryFont);
SAFE_RELEASE(m_env.p3DEngine); // depends on EntitySystem
if (m_env.pConsole)
{
((CXConsole*)m_env.pConsole)->FreeRenderResources();
@@ -1162,31 +1147,6 @@ void CSystem::SleepIfInactive()
{
return;
}
#if defined(WIN32)
if (!AZ::Interface<AzFramework::AtomActiveInterface>::Get())
{
WIN_HWND hRendWnd = GetIRenderer()->GetHWND();
if (!hRendWnd)
{
return;
}
AZ_TRACE_METHOD();
// Loop here waiting for window to be activated.
for (int nLoops = 0; nLoops < 5; nLoops++)
{
WIN_HWND hActiveWnd = ::GetActiveWindow();
if (hActiveWnd == hRendWnd)
{
break;
}
AzFramework::ApplicationRequests::Bus::Broadcast(&AzFramework::ApplicationRequests::PumpSystemEventLoopUntilEmpty);
Sleep(5);
}
}
#endif
}
//////////////////////////////////////////////////////////////////////////
@@ -1257,8 +1217,6 @@ bool CSystem::UpdatePreTickBus(int updateFlags, int nPauseMode)
return false;
}
RenderBegin();
#ifndef EXCLUDE_UPDATE_ON_CONSOLE
// do the dedicated sleep earlier than the frame profiler to avoid having it counted
if (gEnv->IsDedicated())
@@ -1321,11 +1279,6 @@ bool CSystem::UpdatePreTickBus(int updateFlags, int nPauseMode)
GetIRemoteConsole()->Update();
#endif
if (gEnv->pLocalMemoryUsage != NULL)
{
gEnv->pLocalMemoryUsage->OnUpdate();
}
if (!gEnv->IsEditor() && gEnv->pRenderer)
{
// If the dimensions of the render target change,
@@ -1516,11 +1469,6 @@ bool CSystem::UpdatePreTickBus(int updateFlags, int nPauseMode)
//update time subsystem
m_Time.UpdateOnFrameStart();
if (m_env.p3DEngine)
{
m_env.p3DEngine->OnFrameStart();
}
//////////////////////////////////////////////////////////////////////
// update rate limiter for dedicated server
if (m_pServerThrottle.get())
@@ -1677,7 +1625,7 @@ bool CSystem::UpdatePreTickBus(int updateFlags, int nPauseMode)
}
//////////////////////////////////////////////////////////////////////
bool CSystem::UpdatePostTickBus(int updateFlags, int nPauseMode)
bool CSystem::UpdatePostTickBus(int updateFlags, int /*nPauseMode*/)
{
CTimeValue updateStart = gEnv->pTimer->GetAsyncTime();
@@ -1689,44 +1637,6 @@ bool CSystem::UpdatePostTickBus(int updateFlags, int nPauseMode)
UpdateMovieSystem(updateFlags, fMovieFrameTime, false);
}
//////////////////////////////////////////////////////////////////////
//update process (3D engine)
if (!(updateFlags & ESYSUPDATE_EDITOR) && !m_bNoUpdate && m_env.p3DEngine)
{
FRAME_PROFILER("SysUpdate:Update3DEngine", this, PROFILE_SYSTEM);
if (ITimeOfDay* pTOD = m_env.p3DEngine->GetTimeOfDay())
{
pTOD->Tick();
}
if (m_env.p3DEngine)
{
m_env.p3DEngine->Tick(); // clear per frame temp data
}
if (m_pProcess && (m_pProcess->GetFlags() & PROC_3DENGINE))
{
if ((nPauseMode != 1))
{
if (!IsEquivalent(m_ViewCamera.GetPosition(), Vec3(0, 0, 0), VEC_EPSILON))
{
if (m_env.p3DEngine)
{
// m_env.p3DEngine->SetCamera(m_ViewCamera);
m_pProcess->Update();
}
}
}
}
else
{
if (m_pProcess)
{
m_pProcess->Update();
}
}
}
//////////////////////////////////////////////////////////////////////
//update sound system part 2
if (!g_cvars.sys_deferAudioUpdateOptim && !m_bNoUpdate)
@@ -1774,41 +1684,8 @@ bool CSystem::UpdatePostTickBus(int updateFlags, int nPauseMode)
gEnv->pCryPak->DisableRuntimeFileAccess(true);
}
// If it's in editing mode (in editor) the render is done in RenderViewport so we skip rendering here.
if (!gEnv->IsEditing() && gEnv->pRenderer && gEnv->p3DEngine)
{
if (GetIViewSystem())
{
GetIViewSystem()->Update(min(gEnv->pTimer->GetFrameTime(), 0.1f));
}
// Begin occlusion job after setting the correct camera.
gEnv->p3DEngine->PrepareOcclusion(GetViewCamera());
CrySystemNotificationBus::Broadcast(&CrySystemNotifications::OnPreRender);
// Also broadcast for anyone else that needs to draw global debug to do so now
AzFramework::DebugDisplayEventBus::Broadcast(&AzFramework::DebugDisplayEvents::DrawGlobalDebugInfo);
Render();
gEnv->p3DEngine->EndOcclusion();
CrySystemNotificationBus::Broadcast(&CrySystemNotifications::OnPostRender);
RenderEnd();
gEnv->p3DEngine->SyncProcessStreamingUpdate();
if (NeedDoWorkDuringOcclusionChecks())
{
DoWorkDuringOcclusionChecks();
}
// Sync the work that must be done in the main thread by the end of frame.
gEnv->pRenderer->GetGenerateShadowRendItemJobExecutor()->WaitForCompletion();
gEnv->pRenderer->GetGenerateRendItemJobExecutor()->WaitForCompletion();
}
// Also broadcast for anyone else that needs to draw global debug to do so now
AzFramework::DebugDisplayEventBus::Broadcast(&AzFramework::DebugDisplayEvents::DrawGlobalDebugInfo);
return !IsQuitting();
}
-16
View File
@@ -408,13 +408,6 @@ public:
virtual void DoWorkDuringOcclusionChecks();
virtual bool NeedDoWorkDuringOcclusionChecks() { return m_bNeedDoWorkDuringOcclusionChecks; }
//! Begin rendering frame.
void RenderBegin();
//! Render subsystems.
void Render();
//! End rendering frame and swap back buffer.
void RenderEnd(bool bRenderStats = true, bool bMainWindow = true);
//Called when the renderer finishes rendering the scene
void OnScene3DEnd() override;
@@ -429,11 +422,6 @@ public:
//! Update screen and call some important tick functions during loading.
void SynchronousLoadingTick(const char* pFunc, int line);
//! Renders the statistics; this is called from RenderEnd, but if the
//! Host application (Editor) doesn't employ the Render cycle in ISystem,
//! it may call this method to render the essential statistics
void RenderStatistics() override;
uint32 GetUsedMemory();
virtual void DumpMemoryUsageStatistics(bool bUseKB);
@@ -469,7 +457,6 @@ public:
AZ::IO::IArchive* GetIPak() { return m_env.pCryPak; };
IConsole* GetIConsole() { return m_env.pConsole; };
IRemoteConsole* GetIRemoteConsole();
I3DEngine* GetI3DEngine(){ return m_env.p3DEngine; }
IMovieSystem* GetIMovieSystem() { return m_env.pMovieSystem; };
IMemoryManager* GetIMemoryManager(){ return m_pMemoryManager; }
IThreadManager* GetIThreadManager() override {return m_env.pThreadManager; }
@@ -696,9 +683,6 @@ private:
void CreateRendererVars(const SSystemInitParams& startupParams);
void CreateSystemVars();
void CreateAudioVars();
void RenderStats();
void RenderOverscanBorders();
void RenderMemStats();
AZStd::unique_ptr<AZ::DynamicModuleHandle> LoadDLL(const char* dllName);
-29
View File
@@ -68,7 +68,6 @@
#include <LyShine/Bus/UiSystemBus.h>
#include <AzFramework/Logging/MissingAssetLogger.h>
#include <AzFramework/Platform/PlatformDefaults.h>
#include <AzFramework/API/AtomActiveInterface.h>
#include <AzCore/Interface/Interface.h>
#include <AzCore/Utils/Utils.h>
@@ -87,7 +86,6 @@
#endif //WIN32
#include <I3DEngine.h>
#include <IRenderer.h>
#include <AzCore/IO/FileIO.h>
#include <IMovieSystem.h>
@@ -108,7 +106,6 @@
#include "PhysRenderer.h"
#include "LocalizedStringManager.h"
#include "SystemEventDispatcher.h"
#include "Statistics/LocalMemoryUsage.h"
#include "ThreadConfigManager.h"
#include "Validator.h"
#include "ServerThrottle.h"
@@ -769,11 +766,6 @@ static void LoadDetectedSpec(ICVar* pVar)
GetISystem()->SetConfigSpec(static_cast<ESystemConfigSpec>(spec), platform, false);
if (gEnv->p3DEngine)
{
gEnv->p3DEngine->GetMaterialManager()->RefreshMaterialRuntime();
}
no_recursive = false;
}
@@ -2462,21 +2454,6 @@ AZ_POP_DISABLE_WARNING
m_env.pRenderer->SetViewport(0, 0, screenWidth, screenHeight);
// Skip splash screen rendering
if (!AZ::Interface<AzFramework::AtomActiveInterface>::Get())
{
// make sure it's rendered in full screen mode when triple buffering is enabled as well
for (size_t n = 0; n < 3; n++)
{
m_env.pRenderer->BeginFrame();
m_env.pRenderer->SetCullMode(R_CULL_NONE);
m_env.pRenderer->SetState(GS_BLSRC_SRCALPHA | GS_BLDST_ONEMINUSSRCALPHA | GS_NODEPTHTEST);
m_env.pRenderer->Draw2dImageStretchMode(true);
m_env.pRenderer->Draw2dImage(x * vx, y * vy, w * vx, h * vy, pTex->GetTextureID(), 0.0f, 1.0f, 1.0f, 0.0f);
m_env.pRenderer->Draw2dImageStretchMode(false);
m_env.pRenderer->EndFrame();
}
}
#if defined(AZ_PLATFORM_IOS) || defined(AZ_PLATFORM_MAC)
// Pump system events in order to update the screen
AzFramework::ApplicationRequests::Bus::Broadcast(&AzFramework::ApplicationRequests::PumpSystemEventLoopUntilEmpty);
@@ -2804,12 +2781,6 @@ AZ_POP_DISABLE_WARNING
m_env.pRenderer->TryFlush();
}
#if !defined(RELEASE)
m_env.pLocalMemoryUsage = new CLocalMemoryUsage();
#else
m_env.pLocalMemoryUsage = nullptr;
#endif
if (g_cvars.sys_float_exceptions > 0)
{
if (g_cvars.sys_float_exceptions == 3 && gEnv->IsEditor()) // Turn off float exceptions in editor if sys_float_exceptions = 3
-315
View File
@@ -31,7 +31,6 @@
#include <IProcess.h>
#include "Log.h"
#include "XConsole.h"
#include <I3DEngine.h>
#include <CryLibrary.h>
#include "PhysRenderer.h"
#include <IMovieSystem.h>
@@ -222,92 +221,6 @@ void CSystem::CreateRendererVars(const SSystemInitParams& startupParams)
"Usage: r_OverscanBordersDrawDebugView [0=off/1=show]");
}
//////////////////////////////////////////////////////////////////////////
void CSystem::RenderBegin()
{
FUNCTION_PROFILER_FAST(GetISystem(), PROFILE_SYSTEM, g_bProfilerEnabled);
if (m_bIgnoreUpdates)
{
return;
}
bool rndAvail = m_env.pRenderer != 0;
//////////////////////////////////////////////////////////////////////
//start the rendering pipeline
if (rndAvail)
{
m_env.pRenderer->BeginFrame();
}
gEnv->nMainFrameID = (rndAvail) ? m_env.pRenderer->GetFrameID(false) : 0;
}
//////////////////////////////////////////////////////////////////////////
void CSystem::RenderEnd([[maybe_unused]] bool bRenderStats, bool bMainWindow)
{
{
FUNCTION_PROFILER_FAST(GetISystem(), PROFILE_SYSTEM, g_bProfilerEnabled);
if (m_bIgnoreUpdates)
{
return;
}
if (!m_env.pRenderer)
{
return;
}
if (bMainWindow) // we don't do this in UI Editor window for example
{
#if !defined (_RELEASE)
// Flush render data and swap buffers.
m_env.pRenderer->RenderDebug(bRenderStats);
#endif
#if defined(USE_PERFHUD)
if (m_pPerfHUD)
{
m_pPerfHUD->Draw();
}
if (m_pMiniGUI)
{
m_pMiniGUI->Draw();
}
#endif
if (!gEnv->pSystem->GetILevelSystem() || !gEnv->pSystem->GetILevelSystem()->IsLevelLoaded())
{
IConsole* console = GetIConsole();
//Same goes for the console. When no level is loaded, it's okay to render it outside of the renderer
//so that users can load maps or change settings.
if (console != nullptr)
{
console->Draw();
}
}
}
m_env.pRenderer->ForceGC(); // XXX Rename this
m_env.pRenderer->EndFrame();
if (IConsole* pConsole = GetIConsole())
{
// if we have pending cvar calculation, execute it here
// since we know cvars will be correct here after ->EndFrame().
if (!pConsole->IsHashCalculated())
{
pConsole->CalcCheatVarHash();
}
}
}
}
void CSystem::OnScene3DEnd()
{
//Render Console
@@ -391,231 +304,3 @@ void CSystem::DisplayErrorMessage(const char* acMessage,
#endif
m_ErrorMessages.push_back(message);
}
//! Renders the statistics; this is called from RenderEnd, but if the
//! Host application (Editor) doesn't employ the Render cycle in ISystem,
//! it may call this method to render the essential statistics
//////////////////////////////////////////////////////////////////////////
void CSystem::RenderStatistics()
{
RenderStats();
}
//////////////////////////////////////////////////////////////////////
void CSystem::Render()
{
if (m_bIgnoreUpdates)
{
return;
}
//check what is the current process
if (!m_pProcess)
{
return; //should never happen
}
//check if the game is in pause or
//in menu mode
//bool bPause=false;
//if (m_pProcess->GetFlags() & PROC_MENU)
// bPause=true;
FUNCTION_PROFILER_FAST(GetISystem(), PROFILE_SYSTEM, g_bProfilerEnabled);
//////////////////////////////////////////////////////////////////////
//draw
m_env.p3DEngine->PreWorldStreamUpdate(m_ViewCamera);
if (m_pProcess)
{
if (m_pProcess->GetFlags() & PROC_3DENGINE)
{
if (!gEnv->IsEditing()) // Editor calls it's own rendering update
{
if (m_env.p3DEngine && !m_env.IsFMVPlaying())
{
if (!IsEquivalent(m_ViewCamera.GetPosition(), Vec3(0, 0, 0), VEC_EPSILON) || // never pass undefined camera to p3DEngine->RenderWorld()
gEnv->IsDedicated() || (gEnv->pRenderer && gEnv->pRenderer->IsPost3DRendererEnabled()))
{
GetIRenderer()->SetViewport(0, 0, GetIRenderer()->GetWidth(), GetIRenderer()->GetHeight());
m_env.p3DEngine->RenderWorld(SHDF_ALLOW_WATER | SHDF_ALLOWPOSTPROCESS | SHDF_ALLOWHDR | SHDF_ZPASS | SHDF_ALLOW_AO, SRenderingPassInfo::CreateGeneralPassRenderingInfo(m_ViewCamera), __FUNCTION__);
}
else
{
if (gEnv->pRenderer)
{
// force rendering of black screen to be sure we don't only render the clear color (which is the fog color by default)
gEnv->pRenderer->SetState(GS_BLSRC_SRCALPHA | GS_BLDST_ONEMINUSSRCALPHA | GS_NODEPTHTEST);
gEnv->pRenderer->Draw2dImage(0, 0, 800, 600, -1, 0.0f, 0.0f, 1.0f, 1.0f, 0.f,
0.0f, 0.0f, 0.0f, 1.0f, 0.f);
}
}
}
#if !defined(_RELEASE)
if (m_pVisRegTest)
{
m_pVisRegTest->AfterRender();
}
#endif
if (m_env.pMovieSystem)
{
m_env.pMovieSystem->Render();
}
}
}
else
{
GetIRenderer()->SetViewport(0, 0, GetIRenderer()->GetWidth(), GetIRenderer()->GetHeight());
m_pProcess->RenderWorld(SHDF_ALLOW_WATER | SHDF_ALLOWPOSTPROCESS | SHDF_ALLOWHDR | SHDF_ZPASS | SHDF_ALLOW_AO, SRenderingPassInfo::CreateGeneralPassRenderingInfo(m_ViewCamera), __FUNCTION__);
}
}
m_env.p3DEngine->WorldStreamUpdate();
gEnv->pRenderer->SwitchToNativeResolutionBackbuffer();
}
//////////////////////////////////////////////////////////////////////////
void CSystem::RenderStats()
{
#if defined(ENABLE_PROFILING_CODE)
#ifndef _RELEASE
// if we rendered an error message on screen during the last frame, then sleep now
// to force hard stall for 3sec
if (m_bHasRenderedErrorMessage && !gEnv->IsEditor() && !IsLoading())
{
// DO NOT REMOVE OR COMMENT THIS OUT!
// If you hit this, then you most likely have invalid (synchronous) file accesses
// which must be fixed in order to not stall the entire game.
Sleep(3000);
m_bHasRenderedErrorMessage = false;
}
#endif
// render info messages on screen
float fTextPosX = 5.0f;
float fTextPosY = -10;
float fTextStepY = 13;
float fFrameTime = gEnv->pTimer->GetRealFrameTime();
TErrorMessages::iterator itnext;
for (TErrorMessages::iterator it = m_ErrorMessages.begin(); it != m_ErrorMessages.end(); it = itnext)
{
itnext = it;
++itnext;
SErrorMessage& message = *it;
SDrawTextInfo ti;
ti.flags = eDrawText_FixedSize | eDrawText_2D | eDrawText_Monospace;
memcpy(ti.color, message.m_Color, 4 * sizeof(float));
ti.xscale = ti.yscale = 1.4f;
m_env.pRenderer->DrawTextQueued(Vec3(fTextPosX, fTextPosY += fTextStepY, 1.0f), ti, message.m_Message.c_str());
if (!IsLoading())
{
message.m_fTimeToShow -= fFrameTime;
}
if (message.m_HardFailure)
{
m_bHasRenderedErrorMessage = true;
}
if (message.m_fTimeToShow < 0.0f)
{
m_ErrorMessages.erase(it);
}
}
#endif
if (!m_env.pConsole)
{
return;
}
#ifndef _RELEASE
if (m_rOverscanBordersDrawDebugView)
{
RenderOverscanBorders();
}
#endif
int iDisplayInfo = m_rDisplayInfo->GetIVal();
if (iDisplayInfo == 0)
{
return;
}
// Draw engine stats
if (m_env.p3DEngine)
{
// Draw 3dengine stats and get last text cursor position
float nTextPosX = 101 - 20, nTextPosY = -2, nTextStepY = 3;
m_env.p3DEngine->DisplayInfo(nTextPosX, nTextPosY, nTextStepY, iDisplayInfo != 1);
// Dump Open 3D Engine CPU and GPU memory statistics to screen
m_env.p3DEngine->DisplayMemoryStatistics();
#if defined(ENABLE_LW_PROFILERS)
if (m_rDisplayInfo->GetIVal() == 2)
{
m_env.pRenderer->TextToScreen(nTextPosX, nTextPosY += nTextStepY, "SysMem %.1f mb",
float(DumpMMStats(false)) / 1024.f);
}
#endif
#if 0
for (int i = 0; i < NUM_POOLS; ++i)
{
int used = (g_pPakHeap->m_iBigPoolUsed[i] ? (int)g_pPakHeap->m_iBigPoolSize[i] : 0);
int size = (int)g_pPakHeap->m_iBigPoolSize[i];
float fC1[4] = {1, 1, 0, 1};
m_env.pRenderer->Draw2dLabel(10, 100.0f + i * 16, 2.1f, fC1, false, "BigPool %d: %d bytes of %d bytes used", i, used, size);
}
#endif
}
}
void CSystem::RenderOverscanBorders()
{
#ifndef _RELEASE
if (m_env.pRenderer && m_rOverscanBordersDrawDebugView)
{
int iOverscanBordersDrawDebugView = m_rOverscanBordersDrawDebugView->GetIVal();
if (iOverscanBordersDrawDebugView)
{
const int texId = -1;
const float uv = 0.0f;
const float rot = 0.0f;
const int whiteTextureId = m_env.pRenderer->GetWhiteTextureId();
const float r = 1.0f;
const float g = 1.0f;
const float b = 1.0f;
const float a = 0.2f;
Vec2 overscanBorders = Vec2(0.0f, 0.0f);
m_env.pRenderer->EF_Query(EFQ_OverscanBorders, overscanBorders);
const float overscanBorderWidth = overscanBorders.x * VIRTUAL_SCREEN_WIDTH;
const float overscanBorderHeight = overscanBorders.y * VIRTUAL_SCREEN_HEIGHT;
const float xPos = overscanBorderWidth;
const float yPos = overscanBorderHeight;
const float width = VIRTUAL_SCREEN_WIDTH - (2.0f * overscanBorderWidth);
const float height = VIRTUAL_SCREEN_HEIGHT - (2.0f * overscanBorderHeight);
m_env.pRenderer->SetState(GS_BLSRC_SRCALPHA | GS_BLDST_ONEMINUSSRCALPHA | GS_NODEPTHTEST);
m_env.pRenderer->Draw2dImage(xPos, yPos,
width, height,
whiteTextureId,
uv, uv, uv, uv,
rot,
r, g, b, a);
}
}
#endif
}
-18
View File
@@ -15,7 +15,6 @@
#include "System.h"
#include <time.h>
#include <I3DEngine.h>
#include <IRenderer.h>
#include <IMovieSystem.h>
#include <ILog.h>
@@ -302,23 +301,6 @@ void CSystem::CollectMemStats (ICrySizer* pSizer, MemStatsPurposeEnum nPurpose,
}
}
if (m_env.p3DEngine)
{
SIZER_COMPONENT_NAME(pSizer, "Cry3DEngine");
{
m_env.p3DEngine->GetMemoryUsage (pSizer);
{
SIZER_COMPONENT_NAME (pSizer, "$Allocations waste");
const SmallModuleInfo* info = FindModuleInfo(stats, "Cry3DEngine.dll");
if (info)
{
pSizer->AddObject(info, info->memInfo.allocated - info->memInfo.requested);
}
}
}
}
if (m_env.pRenderer)
{
SIZER_COMPONENT_NAME(pSizer, "CryRenderer");
+1 -1
View File
@@ -98,7 +98,7 @@ void CView::Update(float frameTime, bool isActive)
//see if the view have to use a custom near clipping plane
const float nearPlane = (m_viewParams.nearplane >= CAMERA_MIN_NEAR) ? (m_viewParams.nearplane) : fNearZ;
const float farPlane = (m_viewParams.farplane > 0.f) ? m_viewParams.farplane : gEnv->p3DEngine->GetMaxViewDistance();
const float farPlane = (m_viewParams.farplane > 0.f) ? m_viewParams.farplane : DEFAULT_FAR;
float fov = (m_viewParams.fov < 0.001f) ? DEFAULT_FOV : m_viewParams.fov;
// [VR] specific
@@ -533,11 +533,6 @@ void CViewSystem::BeginCutScene(IAnimSequence* pSeq, [[maybe_unused]] unsigned l
{
m_cutsceneCount++;
if (m_cutsceneCount == 1)
{
gEnv->p3DEngine->ResetPostEffects();
}
VS_CALL_LISTENERS(OnBeginCutScene(pSeq, bResetFX));
}
@@ -546,11 +541,6 @@ void CViewSystem::EndCutScene(IAnimSequence* pSeq, [[maybe_unused]] unsigned lon
{
m_cutsceneCount -= (m_cutsceneCount > 0);
if (m_cutsceneCount == 0)
{
gEnv->p3DEngine->ResetPostEffects();
}
ClearCutsceneViews();
VS_CALL_LISTENERS(OnEndCutScene(pSeq));
-1
View File
@@ -18,7 +18,6 @@
#include "VisRegTest.h"
#include "ISystem.h"
#include "I3DEngine.h"
#include "IRenderer.h"
#include "IConsole.h"
#include "ITimer.h"
@@ -57,7 +57,6 @@ set(FILES
UnixConsole.h
SystemInit.h
Serialization/MemoryReader.h
Statistics/LocalMemoryUsage.h
MemoryFragmentationProfiler.h
XML/ReadWriteXMLSink.h
Serialization/ArchiveHost.h
@@ -151,7 +150,6 @@ set(FILES
MiniGUI/MiniInfoBox.h
MiniGUI/MiniMenu.h
MiniGUI/MiniTable.h
Statistics/LocalMemoryUsage.cpp
ZLibCompressor.cpp
ZLibCompressor.h
SoftCode/SoftCodeMgr.cpp
@@ -239,8 +239,13 @@ namespace AZ
return;
}
CheckReady();
m_initComplete = true;
// *After* setting initComplete to true, check to see if the assets are already ready.
// This check needs to wait until after setting initComplete because if they *are* ready, we want the final call to
// RemoveWaitingAsset to trigger the OnAssetContainerReady/Canceled event. If we call CheckReady() *before* setting
// initComplete, if all the assets are ready, the event will never get triggered.
CheckReady();
}
bool AssetContainer::IsReady() const
+38 -13
View File
@@ -142,27 +142,44 @@ namespace AZ
void SetBasis(const Vector3& basisX, const Vector3& basisY, const Vector3& basisZ);
//! @}
Matrix3x3 operator*(const Matrix3x3& rhs) const;
//! Calculates (this->GetTranspose() * rhs).
Matrix3x3 TransposedMultiply(const Matrix3x3& rhs) const;
//! Post-multiplies the matrix by a vector.
Vector3 operator*(const Vector3& rhs) const;
Matrix3x3 operator+(const Matrix3x3& rhs) const;
Matrix3x3 operator-(const Matrix3x3& rhs) const;
Matrix3x3 operator*(float multiplier) const;
Matrix3x3 operator/(float divisor) const;
Matrix3x3 operator-() const;
Matrix3x3& operator*=(const Matrix3x3& rhs);
//! Operator for matrix-matrix addition.
//! @{
[[nodiscard]] Matrix3x3 operator+(const Matrix3x3& rhs) const;
Matrix3x3& operator+=(const Matrix3x3& rhs);
//! @}
//! Operator for matrix-matrix substraction.
//! @{
[[nodiscard]] Matrix3x3 operator-(const Matrix3x3& rhs) const;
Matrix3x3& operator-=(const Matrix3x3& rhs);
//! @}
//! Operator for matrix-matrix multiplication.
//! @{
[[nodiscard]] Matrix3x3 operator*(const Matrix3x3& rhs) const;
Matrix3x3& operator*=(const Matrix3x3& rhs);
//! @}
//! Operator for multiplying all matrix's elements with a scalar
//! @{
[[nodiscard]] Matrix3x3 operator*(float multiplier) const;
Matrix3x3& operator*=(float multiplier);
//! @}
//! Operator for dividing all matrix's elements with a scalar
//! @{
[[nodiscard]] Matrix3x3 operator/(float divisor) const;
Matrix3x3& operator/=(float divisor);
//! @}
//! Operator for negating all matrix's elements
[[nodiscard]] Matrix3x3 operator-() const;
bool operator==(const Matrix3x3& rhs) const;
bool operator!=(const Matrix3x3& rhs) const;
@@ -187,7 +204,10 @@ namespace AZ
//! @}
//! Gets the scale part of the transformation, i.e. the length of the scale components.
Vector3 RetrieveScale() const;
[[nodiscard]] Vector3 RetrieveScale() const;
//! Gets the squared scale part of the transformation (the squared length of the basis vectors).
[[nodiscard]] Vector3 RetrieveScaleSq() const;
//! Gets the scale part of the transformation as in RetrieveScale, and also removes this scaling from the matrix.
Vector3 ExtractScale();
@@ -195,6 +215,9 @@ namespace AZ
//! Quick multiplication by a scale matrix, equivalent to m*=Matrix3x3::CreateScale(scale).
void MultiplyByScale(const Vector3& scale);
//! Returns a matrix with the reciprocal scale, keeping the same rotation and translation.
[[nodiscard]] Matrix3x3 GetReciprocalScaled() const;
//! Polar decomposition, M=U*H, U is orthogonal (unitary) and H is symmetric (hermitian).
//! This function returns the orthogonal part only
Matrix3x3 GetPolarDecomposition() const;
@@ -241,7 +264,9 @@ namespace AZ
//! Note that this is not the usual multiplication order for transformations.
Vector3& operator*=(Vector3& lhs, const Matrix3x3& rhs);
//! Pre-multiplies the matrix by a scalar.
Matrix3x3 operator*(float lhs, const Matrix3x3& rhs);
}
} // namespace AZ
#include <AzCore/Math/Matrix3x3.inl>
+84 -57
View File
@@ -392,14 +392,6 @@ namespace AZ
}
AZ_MATH_INLINE Matrix3x3 Matrix3x3::operator*(const Matrix3x3& rhs) const
{
Matrix3x3 result;
Simd::Vec3::Mat3x3Multiply(GetSimdValues(), rhs.GetSimdValues(), result.GetSimdValues());
return result;
}
AZ_MATH_INLINE Matrix3x3 Matrix3x3::TransposedMultiply(const Matrix3x3& rhs) const
{
Matrix3x3 result;
@@ -416,51 +408,12 @@ namespace AZ
AZ_MATH_INLINE Matrix3x3 Matrix3x3::operator+(const Matrix3x3& rhs) const
{
return Matrix3x3(Simd::Vec3::Add(m_rows[0].GetSimdValue(), rhs.m_rows[0].GetSimdValue())
, Simd::Vec3::Add(m_rows[1].GetSimdValue(), rhs.m_rows[1].GetSimdValue())
, Simd::Vec3::Add(m_rows[2].GetSimdValue(), rhs.m_rows[2].GetSimdValue()));
}
AZ_MATH_INLINE Matrix3x3 Matrix3x3::operator-(const Matrix3x3& rhs) const
{
return Matrix3x3(Simd::Vec3::Sub(m_rows[0].GetSimdValue(), rhs.m_rows[0].GetSimdValue())
, Simd::Vec3::Sub(m_rows[1].GetSimdValue(), rhs.m_rows[1].GetSimdValue())
, Simd::Vec3::Sub(m_rows[2].GetSimdValue(), rhs.m_rows[2].GetSimdValue()));
}
AZ_MATH_INLINE Matrix3x3 Matrix3x3::operator*(float multiplier) const
{
const Simd::Vec3::FloatType mulVec = Simd::Vec3::Splat(multiplier);
return Matrix3x3(Simd::Vec3::Mul(m_rows[0].GetSimdValue(), mulVec)
, Simd::Vec3::Mul(m_rows[1].GetSimdValue(), mulVec)
, Simd::Vec3::Mul(m_rows[2].GetSimdValue(), mulVec));
}
AZ_MATH_INLINE Matrix3x3 Matrix3x3::operator/(float divisor) const
{
const Simd::Vec3::FloatType divVec = Simd::Vec3::Splat(divisor);
return Matrix3x3(Simd::Vec3::Div(m_rows[0].GetSimdValue(), divVec)
, Simd::Vec3::Div(m_rows[1].GetSimdValue(), divVec)
, Simd::Vec3::Div(m_rows[2].GetSimdValue(), divVec));
}
AZ_MATH_INLINE Matrix3x3 Matrix3x3::operator-() const
{
const Simd::Vec3::FloatType zeroVec = Simd::Vec3::ZeroFloat();
return Matrix3x3(Simd::Vec3::Sub(zeroVec, m_rows[0].GetSimdValue())
, Simd::Vec3::Sub(zeroVec, m_rows[1].GetSimdValue())
, Simd::Vec3::Sub(zeroVec, m_rows[2].GetSimdValue()));
}
AZ_MATH_INLINE Matrix3x3& Matrix3x3::operator*=(const Matrix3x3& rhs)
{
*this = *this * rhs;
return *this;
return Matrix3x3
(
Simd::Vec3::Add(m_rows[0].GetSimdValue(), rhs.m_rows[0].GetSimdValue()),
Simd::Vec3::Add(m_rows[1].GetSimdValue(), rhs.m_rows[1].GetSimdValue()),
Simd::Vec3::Add(m_rows[2].GetSimdValue(), rhs.m_rows[2].GetSimdValue())
);
}
@@ -471,6 +424,17 @@ namespace AZ
}
AZ_MATH_INLINE Matrix3x3 Matrix3x3::operator-(const Matrix3x3& rhs) const
{
return Matrix3x3
(
Simd::Vec3::Sub(m_rows[0].GetSimdValue(), rhs.m_rows[0].GetSimdValue()),
Simd::Vec3::Sub(m_rows[1].GetSimdValue(), rhs.m_rows[1].GetSimdValue()),
Simd::Vec3::Sub(m_rows[2].GetSimdValue(), rhs.m_rows[2].GetSimdValue())
);
}
AZ_MATH_INLINE Matrix3x3& Matrix3x3::operator-=(const Matrix3x3& rhs)
{
*this = *this - rhs;
@@ -478,6 +442,33 @@ namespace AZ
}
AZ_MATH_INLINE Matrix3x3 Matrix3x3::operator*(const Matrix3x3& rhs) const
{
Matrix3x3 result;
Simd::Vec3::Mat3x3Multiply(GetSimdValues(), rhs.GetSimdValues(), result.GetSimdValues());
return result;
}
AZ_MATH_INLINE Matrix3x3& Matrix3x3::operator*=(const Matrix3x3& rhs)
{
*this = *this * rhs;
return *this;
}
AZ_MATH_INLINE Matrix3x3 Matrix3x3::operator*(float multiplier) const
{
const Simd::Vec3::FloatType mulVec = Simd::Vec3::Splat(multiplier);
return Matrix3x3
(
Simd::Vec3::Mul(m_rows[0].GetSimdValue(), mulVec),
Simd::Vec3::Mul(m_rows[1].GetSimdValue(), mulVec),
Simd::Vec3::Mul(m_rows[2].GetSimdValue(), mulVec)
);
}
AZ_MATH_INLINE Matrix3x3& Matrix3x3::operator*=(float multiplier)
{
*this = *this * multiplier;
@@ -485,6 +476,18 @@ namespace AZ
}
AZ_MATH_INLINE Matrix3x3 Matrix3x3::operator/(float divisor) const
{
const Simd::Vec3::FloatType divVec = Simd::Vec3::Splat(divisor);
return Matrix3x3
(
Simd::Vec3::Div(m_rows[0].GetSimdValue(), divVec),
Simd::Vec3::Div(m_rows[1].GetSimdValue(), divVec),
Simd::Vec3::Div(m_rows[2].GetSimdValue(), divVec)
);
}
AZ_MATH_INLINE Matrix3x3& Matrix3x3::operator/=(float divisor)
{
*this = *this / divisor;
@@ -492,6 +495,18 @@ namespace AZ
}
AZ_MATH_INLINE Matrix3x3 Matrix3x3::operator-() const
{
const Simd::Vec3::FloatType zeroVec = Simd::Vec3::ZeroFloat();
return Matrix3x3
(
Simd::Vec3::Sub(zeroVec, m_rows[0].GetSimdValue()),
Simd::Vec3::Sub(zeroVec, m_rows[1].GetSimdValue()),
Simd::Vec3::Sub(zeroVec, m_rows[2].GetSimdValue())
);
}
AZ_MATH_INLINE bool Matrix3x3::operator==(const Matrix3x3& rhs) const
{
return (Simd::Vec3::CmpAllEq(m_rows[0].GetSimdValue(), rhs.m_rows[0].GetSimdValue())
@@ -552,6 +567,12 @@ namespace AZ
}
AZ_MATH_INLINE Vector3 Matrix3x3::RetrieveScaleSq() const
{
return Vector3(GetBasisX().GetLengthSq(), GetBasisY().GetLengthSq(), GetBasisZ().GetLengthSq());
}
AZ_MATH_INLINE Vector3 Matrix3x3::ExtractScale()
{
const Vector3 x = GetBasisX();
@@ -584,6 +605,14 @@ namespace AZ
}
AZ_MATH_INLINE Matrix3x3 Matrix3x3::GetReciprocalScaled() const
{
Matrix3x3 result = *this;
result.MultiplyByScale(RetrieveScaleSq().GetReciprocal());
return result;
}
AZ_MATH_INLINE void Matrix3x3::GetPolarDecomposition(Matrix3x3* orthogonalOut, Matrix3x3* symmetricOut) const
{
*orthogonalOut = GetPolarDecomposition();
@@ -679,8 +708,6 @@ namespace AZ
AZ_MATH_INLINE Matrix3x3 operator*(float lhs, const Matrix3x3& rhs)
{
const Simd::Vec3::FloatType lhsVec = Simd::Vec3::Splat(lhs);
const Simd::Vec3::FloatType* rows = rhs.GetSimdValues();
return Matrix3x3(Simd::Vec3::Mul(lhsVec, rows[0]), Simd::Vec3::Mul(lhsVec, rows[1]), Simd::Vec3::Mul(lhsVec, rows[2]));
return rhs * lhs;
}
}
} // namespace AZ
+40 -3
View File
@@ -225,11 +225,38 @@ namespace AZ
//! Sets the three basis vectors and the translation.
void SetBasisAndTranslation(const Vector3& basisX, const Vector3& basisY, const Vector3& basisZ, const Vector3& translation);
//! Operator for matrix-matrix multiplication.
[[nodiscard]] Matrix3x4 operator*(const Matrix3x4& rhs) const;
//! Operator for matrix-matrix addition.
//! @{
[[nodiscard]] Matrix3x4 operator+(const Matrix3x4& rhs) const;
Matrix3x4& operator+=(const Matrix3x4& rhs);
//! @}
//! Compound assignment operator for matrix-matrix multiplication.
//! Operator for matrix-matrix substraction.
//! @{
[[nodiscard]] Matrix3x4 operator-(const Matrix3x4& rhs) const;
Matrix3x4& operator-=(const Matrix3x4& rhs);
//! @}
//! Operator for matrix-matrix multiplication.
//! @{
[[nodiscard]] Matrix3x4 operator*(const Matrix3x4& rhs) const;
Matrix3x4& operator*=(const Matrix3x4& rhs);
//! @}
//! Operator for multiplying all matrix's elements with a scalar
//! @{
[[nodiscard]] Matrix3x4 operator*(float multiplier) const;
Matrix3x4& operator*=(float multiplier);
//! @}
//! Operator for dividing all matrix's elements with a scalar
//! @{
[[nodiscard]] Matrix3x4 operator/(float divisor) const;
Matrix3x4& operator/=(float divisor);
//! @}
//! Operator for negating all matrix's elements
[[nodiscard]] Matrix3x4 operator-() const;
//! Operator for transforming a Vector3.
[[nodiscard]] Vector3 operator*(const Vector3& rhs) const;
@@ -274,12 +301,18 @@ namespace AZ
//! Gets the scale part of the transformation (the length of the basis vectors).
[[nodiscard]] Vector3 RetrieveScale() const;
//! Gets the squared scale part of the transformation (the squared length of the basis vectors).
[[nodiscard]] Vector3 RetrieveScaleSq() const;
//! Gets the scale part of the transformation as in RetrieveScale, and also removes this scaling from the matrix.
Vector3 ExtractScale();
//! Multiplies the basis vectors of the matrix by the elements of the scale specified.
void MultiplyByScale(const Vector3& scale);
//! Returns a matrix with the reciprocal scale, keeping the same rotation and translation.
[[nodiscard]] Matrix3x4 GetReciprocalScaled() const;
//! Tests if the 3x3 part of the matrix is orthogonal.
bool IsOrthogonal(float tolerance = Constants::Tolerance) const;
@@ -335,6 +368,10 @@ namespace AZ
Vector4 m_rows[RowCount];
};
//! Pre-multiplies the matrix by a scalar.
Matrix3x4 operator*(float lhs, const Matrix3x4& rhs);
} // namespace AZ
#include <AzCore/Math/Matrix3x4.inl>
@@ -472,6 +472,42 @@ namespace AZ
}
AZ_MATH_INLINE Matrix3x4 Matrix3x4::operator+(const Matrix3x4& rhs) const
{
return Matrix3x4
(
Simd::Vec4::Add(m_rows[0].GetSimdValue(), rhs.m_rows[0].GetSimdValue()),
Simd::Vec4::Add(m_rows[1].GetSimdValue(), rhs.m_rows[1].GetSimdValue()),
Simd::Vec4::Add(m_rows[2].GetSimdValue(), rhs.m_rows[2].GetSimdValue())
);
}
AZ_MATH_INLINE Matrix3x4& Matrix3x4::operator+=(const Matrix3x4& rhs)
{
*this = *this + rhs;
return *this;
}
AZ_MATH_INLINE Matrix3x4 Matrix3x4::operator-(const Matrix3x4& rhs) const
{
return Matrix3x4
(
Simd::Vec4::Sub(m_rows[0].GetSimdValue(), rhs.m_rows[0].GetSimdValue()),
Simd::Vec4::Sub(m_rows[1].GetSimdValue(), rhs.m_rows[1].GetSimdValue()),
Simd::Vec4::Sub(m_rows[2].GetSimdValue(), rhs.m_rows[2].GetSimdValue())
);
}
AZ_MATH_INLINE Matrix3x4& Matrix3x4::operator-=(const Matrix3x4& rhs)
{
*this = *this - rhs;
return *this;
}
AZ_MATH_INLINE Matrix3x4 Matrix3x4::operator*(const Matrix3x4& rhs) const
{
Matrix3x4 result;
@@ -487,6 +523,56 @@ namespace AZ
}
AZ_MATH_INLINE Matrix3x4 Matrix3x4::operator*(float multiplier) const
{
const Simd::Vec4::FloatType mulVec = Simd::Vec4::Splat(multiplier);
return Matrix3x4
(
Simd::Vec4::Mul(m_rows[0].GetSimdValue(), mulVec),
Simd::Vec4::Mul(m_rows[1].GetSimdValue(), mulVec),
Simd::Vec4::Mul(m_rows[2].GetSimdValue(), mulVec)
);
}
AZ_MATH_INLINE Matrix3x4& Matrix3x4::operator*=(float multiplier)
{
*this = *this * multiplier;
return *this;
}
AZ_MATH_INLINE Matrix3x4 Matrix3x4::operator/(float divisor) const
{
const Simd::Vec4::FloatType divVec = Simd::Vec4::Splat(divisor);
return Matrix3x4
(
Simd::Vec4::Div(m_rows[0].GetSimdValue(), divVec),
Simd::Vec4::Div(m_rows[1].GetSimdValue(), divVec),
Simd::Vec4::Div(m_rows[2].GetSimdValue(), divVec)
);
}
AZ_MATH_INLINE Matrix3x4& Matrix3x4::operator/=(float divisor)
{
*this = *this / divisor;
return *this;
}
AZ_MATH_INLINE Matrix3x4 Matrix3x4::operator-() const
{
const Simd::Vec4::FloatType zeroVec = Simd::Vec4::ZeroFloat();
return Matrix3x4
(
Simd::Vec4::Sub(zeroVec, m_rows[0].GetSimdValue()),
Simd::Vec4::Sub(zeroVec, m_rows[1].GetSimdValue()),
Simd::Vec4::Sub(zeroVec, m_rows[2].GetSimdValue())
);
}
AZ_MATH_INLINE Vector3 Matrix3x4::operator*(const Vector3& rhs) const
{
return Vector3
@@ -583,6 +669,12 @@ namespace AZ
}
AZ_MATH_INLINE Vector3 Matrix3x4::RetrieveScaleSq() const
{
return Vector3(GetColumn(0).GetLengthSq(), GetColumn(1).GetLengthSq(), GetColumn(2).GetLengthSq());
}
AZ_MATH_INLINE Vector3 Matrix3x4::ExtractScale()
{
const Vector3 scale = RetrieveScale();
@@ -600,6 +692,14 @@ namespace AZ
}
AZ_MATH_INLINE Matrix3x4 Matrix3x4::GetReciprocalScaled() const
{
Matrix3x4 result = *this;
result.MultiplyByScale(RetrieveScaleSq().GetReciprocal());
return result;
}
AZ_MATH_INLINE void Matrix3x4::Orthogonalize()
{
*this = GetOrthogonalized();
@@ -660,4 +760,10 @@ namespace AZ
{
return reinterpret_cast<Simd::Vec4::FloatType*>(m_rows);
}
AZ_MATH_INLINE Matrix3x4 operator*(float lhs, const Matrix3x4& rhs)
{
return rhs * lhs;
}
} // namespace AZ
+39 -5
View File
@@ -171,14 +171,38 @@ namespace AZ
void SetTranslation(const Vector3& v);
//! @}
Matrix4x4 operator+(const Matrix4x4& rhs) const;
//! Operator for matrix-matrix addition.
//! @{
[[nodiscard]] Matrix4x4 operator+(const Matrix4x4& rhs) const;
Matrix4x4& operator+=(const Matrix4x4& rhs);
//! @}
Matrix4x4 operator-(const Matrix4x4& rhs) const;
//! Operator for matrix-matrix substraction.
//! @{
[[nodiscard]] Matrix4x4 operator-(const Matrix4x4& rhs) const;
Matrix4x4& operator-=(const Matrix4x4& rhs);
//! @}
Matrix4x4 operator*(const Matrix4x4& rhs) const;
//! Operator for matrix-matrix multiplication.
//! @{
[[nodiscard]] Matrix4x4 operator*(const Matrix4x4& rhs) const;
Matrix4x4& operator*=(const Matrix4x4& rhs);
//! @}
//! Operator for multiplying all matrix's elements with a scalar
//! @{
[[nodiscard]] Matrix4x4 operator*(float multiplier) const;
Matrix4x4& operator*=(float multiplier);
//! @}
//! Operator for dividing all matrix's elements with a scalar
//! @{
[[nodiscard]] Matrix4x4 operator/(float divisor) const;
Matrix4x4& operator/=(float divisor);
//! @}
//! Operator for negating all matrix's elements
[[nodiscard]] Matrix4x4 operator-() const;
//! Post-multiplies the matrix by a vector.
//! Assumes that the w-component of the Vector3 is 1.0.
@@ -222,7 +246,10 @@ namespace AZ
//! @}
//! Gets the scale part of the transformation, i.e. the length of the scale components.
Vector3 RetrieveScale() const;
[[nodiscard]] Vector3 RetrieveScale() const;
//! Gets the squared scale part of the transformation (the squared length of the basis vectors).
[[nodiscard]] Vector3 RetrieveScaleSq() const;
//! Gets the scale part of the transformation as in RetrieveScale, and also removes this scaling from the matrix.
Vector3 ExtractScale();
@@ -230,6 +257,9 @@ namespace AZ
//! Quick multiplication by a scale matrix, equivalent to m*=Matrix4x4::CreateScale(scale).
void MultiplyByScale(const Vector3& scale);
//! Returns a matrix with the reciprocal scale, keeping the same rotation and translation.
[[nodiscard]] Matrix4x4 GetReciprocalScaled() const;
bool IsClose(const Matrix4x4& rhs, float tolerance = Constants::Tolerance) const;
bool operator==(const Matrix4x4& rhs) const;
@@ -270,6 +300,10 @@ namespace AZ
//! Pre-multiplies the matrix by a vector in-place.
//! Note that this is not the usual multiplication order for transformations.
Vector4& operator*=(Vector4& lhs, const Matrix4x4& rhs);
}
//! Pre-multiplies the matrix by a scalar.
Matrix4x4 operator*(float lhs, const Matrix4x4& rhs);
} // namespace AZ
#include <AzCore/Math/Matrix4x4.inl>
+92 -15
View File
@@ -480,20 +480,12 @@ namespace AZ
AZ_MATH_INLINE Matrix4x4 Matrix4x4::operator+(const Matrix4x4& rhs) const
{
return Matrix4x4
( Simd::Vec4::Add(m_rows[0].GetSimdValue(), rhs.m_rows[0].GetSimdValue())
, Simd::Vec4::Add(m_rows[1].GetSimdValue(), rhs.m_rows[1].GetSimdValue())
, Simd::Vec4::Add(m_rows[2].GetSimdValue(), rhs.m_rows[2].GetSimdValue())
, Simd::Vec4::Add(m_rows[3].GetSimdValue(), rhs.m_rows[3].GetSimdValue()));
}
AZ_MATH_INLINE Matrix4x4 Matrix4x4::operator-(const Matrix4x4& rhs) const
{
return Matrix4x4
( Simd::Vec4::Sub(m_rows[0].GetSimdValue(), rhs.m_rows[0].GetSimdValue())
, Simd::Vec4::Sub(m_rows[1].GetSimdValue(), rhs.m_rows[1].GetSimdValue())
, Simd::Vec4::Sub(m_rows[2].GetSimdValue(), rhs.m_rows[2].GetSimdValue())
, Simd::Vec4::Sub(m_rows[3].GetSimdValue(), rhs.m_rows[3].GetSimdValue()));
(
Simd::Vec4::Add(m_rows[0].GetSimdValue(), rhs.m_rows[0].GetSimdValue()),
Simd::Vec4::Add(m_rows[1].GetSimdValue(), rhs.m_rows[1].GetSimdValue()),
Simd::Vec4::Add(m_rows[2].GetSimdValue(), rhs.m_rows[2].GetSimdValue()),
Simd::Vec4::Add(m_rows[3].GetSimdValue(), rhs.m_rows[3].GetSimdValue())
);
}
AZ_MATH_INLINE Matrix4x4& Matrix4x4::operator+=(const Matrix4x4& rhs)
@@ -502,6 +494,18 @@ namespace AZ
return *this;
}
AZ_MATH_INLINE Matrix4x4 Matrix4x4::operator-(const Matrix4x4& rhs) const
{
return Matrix4x4
(
Simd::Vec4::Sub(m_rows[0].GetSimdValue(), rhs.m_rows[0].GetSimdValue()),
Simd::Vec4::Sub(m_rows[1].GetSimdValue(), rhs.m_rows[1].GetSimdValue()),
Simd::Vec4::Sub(m_rows[2].GetSimdValue(), rhs.m_rows[2].GetSimdValue()),
Simd::Vec4::Sub(m_rows[3].GetSimdValue(), rhs.m_rows[3].GetSimdValue())
);
}
AZ_MATH_INLINE Matrix4x4& Matrix4x4::operator-=(const Matrix4x4& rhs)
{
*this = *this - rhs;
@@ -523,6 +527,59 @@ namespace AZ
}
AZ_MATH_INLINE Matrix4x4 Matrix4x4::operator*(float multiplier) const
{
const Simd::Vec4::FloatType mulVec = Simd::Vec4::Splat(multiplier);
return Matrix4x4
(
Simd::Vec4::Mul(m_rows[0].GetSimdValue(), mulVec),
Simd::Vec4::Mul(m_rows[1].GetSimdValue(), mulVec),
Simd::Vec4::Mul(m_rows[2].GetSimdValue(), mulVec),
Simd::Vec4::Mul(m_rows[3].GetSimdValue(), mulVec)
);
}
AZ_MATH_INLINE Matrix4x4& Matrix4x4::operator*=(float multiplier)
{
*this = *this * multiplier;
return *this;
}
AZ_MATH_INLINE Matrix4x4 Matrix4x4::operator/(float divisor) const
{
const Simd::Vec4::FloatType divVec = Simd::Vec4::Splat(divisor);
return Matrix4x4
(
Simd::Vec4::Div(m_rows[0].GetSimdValue(), divVec),
Simd::Vec4::Div(m_rows[1].GetSimdValue(), divVec),
Simd::Vec4::Div(m_rows[2].GetSimdValue(), divVec),
Simd::Vec4::Div(m_rows[3].GetSimdValue(), divVec)
);
}
AZ_MATH_INLINE Matrix4x4& Matrix4x4::operator/=(float divisor)
{
*this = *this / divisor;
return *this;
}
AZ_MATH_INLINE Matrix4x4 Matrix4x4::operator-() const
{
const Simd::Vec4::FloatType zeroVec = Simd::Vec4::ZeroFloat();
return Matrix4x4
(
Simd::Vec4::Sub(zeroVec, m_rows[0].GetSimdValue()),
Simd::Vec4::Sub(zeroVec, m_rows[1].GetSimdValue()),
Simd::Vec4::Sub(zeroVec, m_rows[2].GetSimdValue()),
Simd::Vec4::Sub(zeroVec, m_rows[3].GetSimdValue())
);
}
AZ_MATH_INLINE Vector3 Matrix4x4::operator*(const Vector3& rhs) const
{
return Vector3(Simd::Vec4::Mat4x4TransformPoint3(GetSimdValues(), rhs.GetSimdValue()));
@@ -595,6 +652,12 @@ namespace AZ
}
AZ_MATH_INLINE Vector3 Matrix4x4::RetrieveScaleSq() const
{
return Vector3(GetBasisX().GetLengthSq(), GetBasisY().GetLengthSq(), GetBasisZ().GetLengthSq());
}
AZ_MATH_INLINE Vector3 Matrix4x4::ExtractScale()
{
Vector4 x = GetBasisX();
@@ -619,6 +682,14 @@ namespace AZ
}
AZ_MATH_INLINE Matrix4x4 Matrix4x4::GetReciprocalScaled() const
{
Matrix4x4 result = *this;
result.MultiplyByScale(RetrieveScaleSq().GetReciprocal());
return result;
}
AZ_MATH_INLINE bool Matrix4x4::IsClose(const Matrix4x4& rhs, float tolerance) const
{
const Simd::Vec4::FloatType vecTolerance = Simd::Vec4::Splat(tolerance);
@@ -702,4 +773,10 @@ namespace AZ
lhs = lhs * rhs;
return lhs;
}
}
AZ_MATH_INLINE Matrix4x4 operator*(float lhs, const Matrix4x4& rhs)
{
return rhs * lhs;
}
} // namespace AZ
@@ -816,7 +816,7 @@ namespace AZ
template<size_t Index>
static void ReflectUnpackMethodFold(BehaviorContext::ClassBuilder<ContainerType>& builder)
{
AZStd::string methodName = AZStd::string::format("Get%ld", Index);
const AZStd::string methodName = AZStd::string::format("Get%zu", Index);
builder->Method(methodName.data(), [](ContainerType& value) { return AZStd::get<Index>(value); })
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
->Attribute(AZ::ScriptCanvasAttributes::TupleGetFunctionIndex, Index)
@@ -97,7 +97,8 @@ namespace AZ
return context.Report(Tasks::RetrieveInfo, Outcomes::Unknown,
AZStd::string::format("Failed to retrieve rtti information for %s.", classData->m_name));
}
AZ_Assert(classData->m_azRtti->GetTypeId() == typeId, "Type id mismatch during deserialization of a json file. (%s vs %s)");
AZ_Assert(classData->m_azRtti->GetTypeId() == typeId, "Type id mismatch during deserialization of a json file. (%s vs %s)",
classData->m_azRtti->GetTypeId().ToString<AZStd::string>().c_str(), typeId.ToString<AZStd::string>().c_str());
void** objectPtr = reinterpret_cast<void**>(object);
bool isNull = *objectPtr == nullptr;
@@ -512,27 +513,24 @@ namespace AZ
if (*object)
{
const AZ::Uuid& actualClassId = rtti.GetActualUuid(*object);
if (actualClassId != objectType)
const SerializeContext::ClassData* actualClassData = context.GetSerializeContext()->FindClassData(actualClassId);
if (!actualClassData)
{
const SerializeContext::ClassData* actualClassData = context.GetSerializeContext()->FindClassData(actualClassId);
if (!actualClassData)
{
status = context.Report(Tasks::RetrieveInfo, Outcomes::Unknown,
AZStd::string::format("Unable to find serialization information for type %s.", actualClassId.ToString<AZStd::string>().c_str()));
return ResolvePointerResult::FullyProcessed;
}
status = context.Report(Tasks::RetrieveInfo, Outcomes::Unknown,
AZStd::string::format("Unable to find serialization information for type %s.", actualClassId.ToString<AZStd::string>().c_str()));
return ResolvePointerResult::FullyProcessed;
}
if (actualClassData->m_factory)
{
actualClassData->m_factory->Destroy(*object);
*object = nullptr;
}
else
{
status = context.Report(Tasks::RetrieveInfo, Outcomes::Catastrophic,
"Unable to find the factory needed to clear out the default value.");
return ResolvePointerResult::FullyProcessed;
}
if (actualClassData->m_factory)
{
actualClassData->m_factory->Destroy(*object);
*object = nullptr;
}
else
{
status = context.Report(Tasks::RetrieveInfo, Outcomes::Catastrophic,
"Unable to find the factory needed to clear out the default value.");
return ResolvePointerResult::FullyProcessed;
}
}
status = ResultCode(Tasks::ReadField, Outcomes::Success);
@@ -38,6 +38,20 @@ namespace AZ
};
//! Core class to handle serialization to and from json documents.
//! The Json Serialization works by taking a default constructed object and then apply the information found in the JSON document
//! on top of that object. This allows the Json Serialization to avoid storing default values and helps guarantee that the final
//! object is in a valid state even if non-fatal issues are encountered.
//! Note on containers: Containers such as vector or map are always considered to be empty even if there's entries in the provided
//! default object. During deserialization entries will be appended to any existing values. A flag is provided to automatically
//! clear containers during deserialization.
//! Note on maps: If the key for map containers such as unordered_map can be interpret as a string the Json Serialization will use
//! a JSON Object to store the data in instead of an array with key/value objects.
//! Note on pointers: The Json Serialization assumes that are always constructed, so a default JSON value of "{}" is interpret as
//! creating a new default instance even if the default value is a null pointer. A JSON Null needs to be explicitly stored in
//! the JSON Document in order to default or explicitly set a pointer to null.
//! Note on pointer memory: Objects created/destroyed by the Json Serialization for pointers require that the AZ_CLASS_ALLOCATOR is
//! declared and the object is created using aznew or memory is allocated using azmalloc. Without these the application may
//! crash if the Json Serialization tries to create or destroy an object pointed to by a pointer.
class JsonSerialization final
{
public:
@@ -23,13 +23,6 @@ namespace AZ
{
namespace JSR = JsonSerializationResult;
if (IsExplicitDefault(inputValue))
{
// Do nothing if the input is an explicit default.
return context.Report(JSR::Tasks::ReadField, JSR::Outcomes::DefaultsUsed,
"Default value for smart pointer requested so no change was made.");
}
const SerializeContext::ClassData* containerClass = context.GetSerializeContext()->FindClassData(outputValueTypeId);
if (!containerClass)
{
@@ -153,8 +146,7 @@ namespace AZ
if (defaultValue)
{
bool typesMatch = false;
auto defaultInputCallback = [&defaultValue, &inputPtrType, &typesMatch]
auto defaultInputCallback = [&defaultValue]
(void* elementPtr, const Uuid&, const SerializeContext::ClassData*, const SerializeContext::ClassElement*)
{
defaultValue = elementPtr;
@@ -164,11 +156,6 @@ namespace AZ
}
JSR::ResultCode result = ContinueStoring(outputValue, inputValue, defaultValue, inputPtrType, context, Flags::ResolvePointer);
if (result.GetOutcome() == JSR::Outcomes::DefaultsUsed)
{
outputValue = GetExplicitDefault();
return context.Report(result, "Smart pointer used all defaults.");
}
return context.Report(result, result.GetProcessing() != JSR::Processing::Halted ?
"Successfully processed smart pointer." : "A problem occurred while processing a smart pointer.");
}
@@ -330,4 +330,163 @@ namespace UnitTest
}
}
}
// The AssetManagerStreamerImmediateCompletionTests class adjusts the asset loading to force it to complete immediately,
// while still within the callstack for GetAsset(). This can be used to test various conditions in which the load thread
// completes more rapidly than expected, and can expose subtle race conditions.
// There are a few key things that this class does to make this work:
// - The file I/O streamer is mocked
// - The asset stream data is mocked to a 0-byte length for the asset so that the stream load will bypass the I/O streamer and
// just immediately return completion.
// - The number of JobManager threads is set to 0, forcing jobs to execute synchronously inline when they are started.
// With these changes, GetAssetInternal() will queue the stream, which will immediately call the callback that creates LoadAssetJob,
// which immediately executes in-place to process the asset due to the synchronous JobManager.
// Note that if we just created the asset in a Ready state, most of the asset loading code is completely bypassed, and so we
// wouldn't be able to test for race conditions in the AssetContainer.
//
// This class also unregisters the catalog and asset handler before shutting down the asset manager. This is done to catch
// any outstanding asset references that exist due to loads not completing and cleaning up successfully.
struct AssetManagerStreamerImmediateCompletionTests : public BaseAssetManagerTest,
public AZ::Data::AssetCatalogRequestBus::Handler,
public AZ::Data::AssetHandler,
public AZ::Data::AssetCatalog
{
static inline const AZ::Uuid TestAssetId{"{E970B177-5F45-44EB-A2C4-9F29D9A0B2A2}"};
static inline constexpr AZStd::string_view TestAssetPath = "test";
void SetUp() override
{
BaseAssetManagerTest::SetUp();
AssetManager::Descriptor desc;
AssetManager::Create(desc);
// Register the handler and catalog after creation, because we intend to destroy them before AssetManager destruction.
// The specific asset we load is irrelevant, so register EmptyAsset.
AZ::Data::AssetManager::Instance().RegisterHandler(this, AZ::AzTypeInfo<EmptyAsset>::Uuid());
AZ::Data::AssetManager::Instance().RegisterCatalog(this, AZ::AzTypeInfo<EmptyAsset>::Uuid());
// Intercept messages for finding assets by name so that we can mock out the asset we're loading.
AZ::Data::AssetCatalogRequestBus::Handler::BusConnect();
}
void TearDown() override
{
// Unregister before destroying AssetManager.
// This will catch any assets that got stuck in a loading state without getting cleaned up.
AZ::Data::AssetManager::Instance().UnregisterCatalog(this);
AZ::Data::AssetManager::Instance().UnregisterHandler(this);
AZ::Data::AssetCatalogRequestBus::Handler::BusDisconnect();
AssetManager::Destroy();
BaseAssetManagerTest::TearDown();
}
size_t GetNumJobManagerThreads() const override
{
// Return 0 threads so that the Job Manager executes jobs synchronously inline. This lets us finish a load while still
// in the callstack that initiates the load.
return 0;
}
// Create a mock streamer instead of a real one, since we don't really want to load an asset.
IO::IStreamer* CreateStreamer() override
{
m_mockStreamer = AZStd::make_unique<StreamerWrapper>();
return &(m_mockStreamer->m_mockStreamer);
}
void DestroyStreamer([[maybe_unused]] IO::IStreamer* streamer) override
{
m_mockStreamer = nullptr;
}
// AssetHandler implementation
// Minimalist mock to create a new EmptyAsset with the desired asset ID.
AZ::Data::AssetPtr CreateAsset(const AZ::Data::AssetId& id, [[maybe_unused]] const AZ::Data::AssetType& type) override
{
return new EmptyAsset(id);
}
void DestroyAsset(AZ::Data::AssetPtr ptr) override
{
delete ptr;
}
// The mocked-out Asset Catalog handles EmptyAsset types.
void GetHandledAssetTypes(AZStd::vector<AZ::Data::AssetType>& assetTypes) override
{
assetTypes.push_back(AZ::AzTypeInfo<EmptyAsset>::Uuid());
}
// This is a mocked-out load, so just immediately return completion without doing anything.
AZ::Data::AssetHandler::LoadResult LoadAssetData(
[[maybe_unused]] const AZ::Data::Asset<AZ::Data::AssetData>& asset,
[[maybe_unused]] AZStd::shared_ptr<AZ::Data::AssetDataStream> stream,
[[maybe_unused]] const AZ::Data::AssetFilterCB& assetLoadFilterCB)
{
return AZ::Data::AssetHandler::LoadResult::LoadComplete;
}
// AssetCatalogRequestBus implementation
// Minimalist mocks to provide our desired asset path or asset id
AZStd::string GetAssetPathById([[maybe_unused]] const AZ::Data::AssetId& id) override
{
return TestAssetPath;
}
AZ::Data::AssetId GetAssetIdByPath(
[[maybe_unused]] const char* path, [[maybe_unused]] const AZ::Data::AssetType& typeToRegister,
[[maybe_unused]] bool autoRegisterIfNotFound) override
{
return TestAssetId;
}
// Return the mocked-out information for our test asset
AZ::Data::AssetInfo GetAssetInfoById([[maybe_unused]] const AZ::Data::AssetId& id) override
{
AZ::Data::AssetInfo assetInfo;
assetInfo.m_assetId = TestAssetId;
assetInfo.m_assetType = AZ::AzTypeInfo<EmptyAsset>::Uuid();
assetInfo.m_relativePath = TestAssetPath;
return assetInfo;
}
// AssetCatalog implementation
// Set the mocked-out asset load to have a 0-byte length so that the load skips I/O and immediately returns success
AZ::Data::AssetStreamInfo GetStreamInfoForLoad(
[[maybe_unused]] const AZ::Data::AssetId& id, const AZ::Data::AssetType& type) override
{
EXPECT_TRUE(type == AZ::AzTypeInfo<EmptyAsset>::Uuid());
AZ::Data::AssetStreamInfo info;
info.m_dataOffset = 0;
info.m_streamName = TestAssetPath;
info.m_dataLen = 0;
info.m_streamFlags = AZ::IO::OpenMode::ModeRead;
return info;
}
AZStd::unique_ptr<StreamerWrapper> m_mockStreamer;
};
// This test will verify that even if the asset loading stream/job returns immediately, all of the loading
// code works successfully. The test here is fairly simple - it just loads the asset and verifies that it
// loaded successfully. The bulk of the test is really in the setup class above, where the load is forced
// to complete immediately. Also, the true failure condition is caught in the setup class too, which is
// the presence of any assets at the point that the asset handler is unregistered. If they're present, then
// the immediate load wasn't truly successful, as it left around extra references to the asset that haven't
// been cleaned up.
TEST_F(AssetManagerStreamerImmediateCompletionTests, LoadAssetWithImmediateJobCompletion_WorksSuccessfully)
{
AZ::Data::AssetLoadParameters loadParams;
auto testAsset =
AssetManager::Instance().GetAsset<EmptyAsset>(TestAssetId, AZ::Data::AssetLoadBehavior::Default, loadParams);
AZ::Data::AssetManager::Instance().DispatchEvents();
EXPECT_TRUE(testAsset.IsReady());
}
} // namespace UnitTest
@@ -24,6 +24,13 @@ namespace UnitTest
public:
AZ_CLASS_ALLOCATOR(EmptyAsset, AZ::SystemAllocator, 0);
AZ_RTTI(EmptyAsset, "{098E3F7F-13AC-414B-9B4E-49B5AD1BD7FE}", AZ::Data::AssetData);
EmptyAsset(
const AZ::Data::AssetId& assetId = AZ::Data::AssetId(),
AZ::Data::AssetData::AssetStatus status = AZ::Data::AssetData::AssetStatus::NotLoaded)
: AZ::Data::AssetData(assetId, status)
{
}
};
// EmptyAssetWithNoHandler: no data contained within, and no AssetHandler registered for this type
@@ -14,6 +14,7 @@
#include <AzCore/Math/Transform.h>
#include <AzCore/Math/Quaternion.h>
#include <AzCore/UnitTest/TestTypes.h>
#include <AZTestShared/Math/MathTestHelpers.h>
using namespace AZ;
@@ -251,19 +252,19 @@ namespace UnitTest
m2.SetRow(2, 13.0f, 14.0f, 15.0f);
Matrix3x3 m3 = m1 * m2;
AZ_TEST_ASSERT(m3.GetRow(0).IsClose(Vector3(66.0f, 72.0f, 78.0f)));
AZ_TEST_ASSERT(m3.GetRow(1).IsClose(Vector3(156.0f, 171.0f, 186.0f)));
AZ_TEST_ASSERT(m3.GetRow(2).IsClose(Vector3(246.0f, 270.0f, 294.0f)));
EXPECT_THAT(m3.GetRow(0), IsClose(Vector3(66.0f, 72.0f, 78.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(Vector3(156.0f, 171.0f, 186.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(Vector3(246.0f, 270.0f, 294.0f)));
Matrix3x3 m4 = m1;
m4 *= m2;
AZ_TEST_ASSERT(m4.GetRow(0).IsClose(Vector3(66.0f, 72.0f, 78.0f)));
AZ_TEST_ASSERT(m4.GetRow(1).IsClose(Vector3(156.0f, 171.0f, 186.0f)));
AZ_TEST_ASSERT(m4.GetRow(2).IsClose(Vector3(246.0f, 270.0f, 294.0f)));
EXPECT_THAT(m4.GetRow(0), IsClose(Vector3(66.0f, 72.0f, 78.0f)));
EXPECT_THAT(m4.GetRow(1), IsClose(Vector3(156.0f, 171.0f, 186.0f)));
EXPECT_THAT(m4.GetRow(2), IsClose(Vector3(246.0f, 270.0f, 294.0f)));
m3 = m1.TransposedMultiply(m2);
AZ_TEST_ASSERT(m3.GetRow(0).IsClose(Vector3(138.0f, 150.0f, 162.0f)));
AZ_TEST_ASSERT(m3.GetRow(1).IsClose(Vector3(168.0f, 183.0f, 198.0f)));
AZ_TEST_ASSERT(m3.GetRow(2).IsClose(Vector3(198.0f, 216.0f, 234.0f)));
EXPECT_THAT(m3.GetRow(0), IsClose(Vector3(138.0f, 150.0f, 162.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(Vector3(168.0f, 183.0f, 198.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(Vector3(198.0f, 216.0f, 234.0f)));
}
TEST(MATH_Matrix3x3, TestVectorMultiplication)
@@ -277,11 +278,11 @@ namespace UnitTest
m2.SetRow(1, 10.0f, 11.0f, 12.0f);
m2.SetRow(2, 13.0f, 14.0f, 15.0f);
AZ_TEST_ASSERT((m1 * Vector3(1.0f, 2.0f, 3.0f)).IsClose(Vector3(14.0f, 32.0f, 50.0f)));
EXPECT_THAT((m1 * Vector3(1.0f, 2.0f, 3.0f)), IsClose(Vector3(14.0f, 32.0f, 50.0f)));
Vector3 v1(1.0f, 2.0f, 3.0f);
AZ_TEST_ASSERT((v1 * m1).IsClose(Vector3(30.0f, 36.0f, 42.0f)));
EXPECT_THAT((v1 * m1), IsClose(Vector3(30.0f, 36.0f, 42.0f)));
v1 *= m1;
AZ_TEST_ASSERT(v1.IsClose(Vector3(30.0f, 36.0f, 42.0f)));
EXPECT_THAT(v1, IsClose(Vector3(30.0f, 36.0f, 42.0f)));
}
TEST(MATH_Matrix3x3, TestSum)
@@ -296,15 +297,15 @@ namespace UnitTest
m2.SetRow(2, 13.0f, 14.0f, 15.0f);
Matrix3x3 m3 = m1 + m2;
AZ_TEST_ASSERT(m3.GetRow(0).IsClose(Vector3(8.0f, 10.0f, 12.0f)));
AZ_TEST_ASSERT(m3.GetRow(1).IsClose(Vector3(14.0f, 16.0f, 18.0f)));
AZ_TEST_ASSERT(m3.GetRow(2).IsClose(Vector3(20.0f, 22.0f, 24.0f)));
EXPECT_THAT(m3.GetRow(0), IsClose(Vector3(8.0f, 10.0f, 12.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(Vector3(14.0f, 16.0f, 18.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(Vector3(20.0f, 22.0f, 24.0f)));
m3 = m1;
m3 += m2;
AZ_TEST_ASSERT(m3.GetRow(0).IsClose(Vector3(8.0f, 10.0f, 12.0f)));
AZ_TEST_ASSERT(m3.GetRow(1).IsClose(Vector3(14.0f, 16.0f, 18.0f)));
AZ_TEST_ASSERT(m3.GetRow(2).IsClose(Vector3(20.0f, 22.0f, 24.0f)));
EXPECT_THAT(m3.GetRow(0), IsClose(Vector3(8.0f, 10.0f, 12.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(Vector3(14.0f, 16.0f, 18.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(Vector3(20.0f, 22.0f, 24.0f)));
}
TEST(MATH_Matrix3x3, TestDifference)
@@ -319,14 +320,14 @@ namespace UnitTest
m2.SetRow(2, 13.0f, 14.0f, 15.0f);
Matrix3x3 m3 = m1 - m2;
AZ_TEST_ASSERT(m3.GetRow(0).IsClose(Vector3(-6.0f, -6.0f, -6.0f)));
AZ_TEST_ASSERT(m3.GetRow(1).IsClose(Vector3(-6.0f, -6.0f, -6.0f)));
AZ_TEST_ASSERT(m3.GetRow(2).IsClose(Vector3(-6.0f, -6.0f, -6.0f)));
EXPECT_THAT(m3.GetRow(0), IsClose(Vector3(-6.0f, -6.0f, -6.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(Vector3(-6.0f, -6.0f, -6.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(Vector3(-6.0f, -6.0f, -6.0f)));
m3 = m1;
m3 -= m2;
AZ_TEST_ASSERT(m3.GetRow(0).IsClose(Vector3(-6.0f, -6.0f, -6.0f)));
AZ_TEST_ASSERT(m3.GetRow(1).IsClose(Vector3(-6.0f, -6.0f, -6.0f)));
AZ_TEST_ASSERT(m3.GetRow(2).IsClose(Vector3(-6.0f, -6.0f, -6.0f)));
EXPECT_THAT(m3.GetRow(0), IsClose(Vector3(-6.0f, -6.0f, -6.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(Vector3(-6.0f, -6.0f, -6.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(Vector3(-6.0f, -6.0f, -6.0f)));
}
TEST(MATH_Matrix3x3, TestScalarMultiplication)
@@ -341,18 +342,18 @@ namespace UnitTest
m2.SetRow(2, 13.0f, 14.0f, 15.0f);
Matrix3x3 m3 = m1 * 2.0f;
AZ_TEST_ASSERT(m3.GetRow(0).IsClose(Vector3(2.0f, 4.0f, 6.0f)));
AZ_TEST_ASSERT(m3.GetRow(1).IsClose(Vector3(8.0f, 10.0f, 12.0f)));
AZ_TEST_ASSERT(m3.GetRow(2).IsClose(Vector3(14.0f, 16.0f, 18.0f)));
EXPECT_THAT(m3.GetRow(0), IsClose(Vector3(2.0f, 4.0f, 6.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(Vector3(8.0f, 10.0f, 12.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(Vector3(14.0f, 16.0f, 18.0f)));
m3 = m1;
m3 *= 2.0f;
AZ_TEST_ASSERT(m3.GetRow(0).IsClose(Vector3(2.0f, 4.0f, 6.0f)));
AZ_TEST_ASSERT(m3.GetRow(1).IsClose(Vector3(8.0f, 10.0f, 12.0f)));
AZ_TEST_ASSERT(m3.GetRow(2).IsClose(Vector3(14.0f, 16.0f, 18.0f)));
EXPECT_THAT(m3.GetRow(0), IsClose(Vector3(2.0f, 4.0f, 6.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(Vector3(8.0f, 10.0f, 12.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(Vector3(14.0f, 16.0f, 18.0f)));
m3 = 2.0f * m1;
AZ_TEST_ASSERT(m3.GetRow(0).IsClose(Vector3(2.0f, 4.0f, 6.0f)));
AZ_TEST_ASSERT(m3.GetRow(1).IsClose(Vector3(8.0f, 10.0f, 12.0f)));
AZ_TEST_ASSERT(m3.GetRow(2).IsClose(Vector3(14.0f, 16.0f, 18.0f)));
EXPECT_THAT(m3.GetRow(0), IsClose(Vector3(2.0f, 4.0f, 6.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(Vector3(8.0f, 10.0f, 12.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(Vector3(14.0f, 16.0f, 18.0f)));
}
TEST(MATH_Matrix3x3, TestScalarDivision)
@@ -367,18 +368,32 @@ namespace UnitTest
m2.SetRow(2, 13.0f, 14.0f, 15.0f);
Matrix3x3 m3 = m1 / 0.5f;
AZ_TEST_ASSERT(m3.GetRow(0).IsClose(Vector3(2.0f, 4.0f, 6.0f)));
AZ_TEST_ASSERT(m3.GetRow(1).IsClose(Vector3(8.0f, 10.0f, 12.0f)));
AZ_TEST_ASSERT(m3.GetRow(2).IsClose(Vector3(14.0f, 16.0f, 18.0f)));
EXPECT_THAT(m3.GetRow(0), IsClose(Vector3(2.0f, 4.0f, 6.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(Vector3(8.0f, 10.0f, 12.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(Vector3(14.0f, 16.0f, 18.0f)));
m3 = m1;
m3 /= 0.5f;
AZ_TEST_ASSERT(m3.GetRow(0).IsClose(Vector3(2.0f, 4.0f, 6.0f)));
AZ_TEST_ASSERT(m3.GetRow(1).IsClose(Vector3(8.0f, 10.0f, 12.0f)));
AZ_TEST_ASSERT(m3.GetRow(2).IsClose(Vector3(14.0f, 16.0f, 18.0f)));
m3 = -m1;
AZ_TEST_ASSERT(m3.GetRow(0).IsClose(Vector3(-1.0f, -2.0f, -3.0f)));
AZ_TEST_ASSERT(m3.GetRow(1).IsClose(Vector3(-4.0f, -5.0f, -6.0f)));
AZ_TEST_ASSERT(m3.GetRow(2).IsClose(Vector3(-7.0f, -8.0f, -9.0f)));
EXPECT_THAT(m3.GetRow(0), IsClose(Vector3(2.0f, 4.0f, 6.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(Vector3(8.0f, 10.0f, 12.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(Vector3(14.0f, 16.0f, 18.0f)));
}
TEST(MATH_Matrix3x3, TestNegation)
{
Matrix3x3 m1;
m1.SetRow(0, 1.0f, 2.0f, 3.0f);
m1.SetRow(1, 4.0f, 5.0f, 6.0f);
m1.SetRow(2, 7.0f, 8.0f, 9.0f);
EXPECT_THAT(-(-m1), IsClose(m1));
EXPECT_THAT(-Matrix3x3::CreateZero(), IsClose(Matrix3x3::CreateZero()));
Matrix3x3 m2 = -m1;
EXPECT_THAT(m2.GetRow(0), IsClose(Vector3(-1.0f, -2.0f, -3.0f)));
EXPECT_THAT(m2.GetRow(1), IsClose(Vector3(-4.0f, -5.0f, -6.0f)));
EXPECT_THAT(m2.GetRow(2), IsClose(Vector3(-7.0f, -8.0f, -9.0f)));
Matrix3x3 m3 = m1 + (-m1);
EXPECT_THAT(m3, IsClose(Matrix3x3::CreateZero()));
}
TEST(MATH_Matrix3x3, TestTranspose)
@@ -425,11 +440,33 @@ namespace UnitTest
TEST(MATH_Matrix3x3, TestScaleAccess)
{
Matrix3x3 m1 = Matrix3x3::CreateRotationX(DegToRad(40.0f)) * Matrix3x3::CreateScale(Vector3(2.0f, 3.0f, 4.0f));
AZ_TEST_ASSERT(m1.RetrieveScale().IsClose(Vector3(2.0f, 3.0f, 4.0f)));
AZ_TEST_ASSERT(m1.ExtractScale().IsClose(Vector3(2.0f, 3.0f, 4.0f)));
AZ_TEST_ASSERT(m1.RetrieveScale().IsClose(Vector3::CreateOne()));
EXPECT_THAT(m1.RetrieveScale(), IsClose(Vector3(2.0f, 3.0f, 4.0f)));
EXPECT_THAT(m1.ExtractScale(), IsClose(Vector3(2.0f, 3.0f, 4.0f)));
EXPECT_THAT(m1.RetrieveScale(), IsClose(Vector3::CreateOne()));
m1.MultiplyByScale(Vector3(3.0f, 4.0f, 5.0f));
AZ_TEST_ASSERT(m1.RetrieveScale().IsClose(Vector3(3.0f, 4.0f, 5.0f)));
EXPECT_THAT(m1.RetrieveScale(), IsClose(Vector3(3.0f, 4.0f, 5.0f)));
}
TEST(MATH_Matrix3x3, TestScaleSqAccess)
{
Matrix3x3 m1 = Matrix3x3::CreateRotationX(DegToRad(40.0f)) * Matrix3x3::CreateScale(Vector3(2.0f, 3.0f, 4.0f));
EXPECT_THAT(m1.RetrieveScaleSq(), IsClose(Vector3(4.0f, 9.0f, 16.0f)));
m1.ExtractScale();
EXPECT_THAT(m1.RetrieveScaleSq(), IsClose(Vector3::CreateOne()));
m1.MultiplyByScale(Vector3(3.0f, 4.0f, 5.0f));
EXPECT_THAT(m1.RetrieveScaleSq(), IsClose(Vector3(9.0f, 16.0f, 25.0f)));
}
TEST(MATH_Matrix3x3, TestReciprocalScaled)
{
Matrix3x3 orthogonalMatrix = Matrix3x3::CreateRotationX(DegToRad(40.0f));
EXPECT_THAT(orthogonalMatrix.GetReciprocalScaled(), IsClose(orthogonalMatrix));
const AZ::Vector3 scale(2.8f, 0.7f, 1.3f);
AZ::Matrix3x3 scaledMatrix = orthogonalMatrix;
scaledMatrix.MultiplyByScale(scale);
AZ::Matrix3x3 reciprocalScaledMatrix = orthogonalMatrix;
reciprocalScaledMatrix.MultiplyByScale(scale.GetReciprocal());
EXPECT_THAT(scaledMatrix.GetReciprocalScaled(), IsClose(reciprocalScaledMatrix));
}
TEST(MATH_Matrix3x3, TestPolarDecomposition)
@@ -467,21 +467,136 @@ namespace UnitTest
EXPECT_THAT(matrix.Multiply3x3(axisDirection), IsClose(forwardDirection));
}
TEST(MATH_Matrix3x4, MultiplyByMatrix3x4)
TEST(MATH_Matrix3x4, TestMatrixMultiplication)
{
const AZ::Matrix3x4 matrix1 = AZ::Matrix3x4::CreateFromValue(1.2f);
const AZ::Matrix3x4 matrix2 = AZ::Matrix3x4::CreateDiagonal(AZ::Vector3(1.3f, 1.5f, 0.4f));
const AZ::Matrix3x4 matrix3 = AZ::Matrix3x4::CreateFromQuaternionAndTranslation(
AZ::Quaternion(0.42f, 0.46f, -0.66f, 0.42f), AZ::Vector3(2.8f, -3.7f, 1.6f));
const AZ::Matrix3x4 matrix4 = AZ::Matrix3x4::CreateRotationX(-0.7f) * AZ::Matrix3x4::CreateScale(AZ::Vector3(0.6f, 1.3f, 0.7f));
AZ::Matrix3x4 matrix5 = matrix1;
matrix5 *= matrix4;
const AZ::Vector3 vector(1.9f, 2.3f, 0.2f);
EXPECT_TRUE((matrix1 * (matrix2 * matrix3)).IsClose((matrix1 * matrix2) * matrix3));
EXPECT_THAT((matrix3 * matrix4) * vector, IsClose(matrix3 * (matrix4 * vector)));
EXPECT_TRUE((matrix2 * AZ::Matrix3x4::Identity()).IsClose(matrix2));
EXPECT_TRUE((matrix3 * AZ::Matrix3x4::Identity()).IsClose(AZ::Matrix3x4::Identity() * matrix3));
EXPECT_TRUE(matrix5.IsClose(matrix1 * matrix4));
AZ::Matrix3x4 m1;
m1.SetRow(0, 1.0f, 2.0f, 3.0f, 4.0f);
m1.SetRow(1, 5.0f, 6.0f, 7.0f, 8.0f);
m1.SetRow(2, 9.0f, 10.0f, 11.0f, 12.0f);
AZ::Matrix3x4 m2;
m2.SetRow(0, 7.0f, 8.0f, 9.0f, 10.0f);
m2.SetRow(1, 11.0f, 12.0f, 13.0f, 14.0f);
m2.SetRow(2, 15.0f, 16.0f, 17.0f, 18.0f);
AZ::Matrix3x4 m3 = m1 * m2;
EXPECT_THAT(m3.GetRow(0), IsClose(AZ::Vector4(74.0f, 80.0f, 86.0f, 96.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(AZ::Vector4(206.0f, 224.0f, 242.0f, 268.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(AZ::Vector4(338.0f, 368.0f, 398.0f, 440.0f)));
AZ::Matrix3x4 m4 = m1;
m4 *= m2;
EXPECT_THAT(m4.GetRow(0), IsClose(AZ::Vector4(74.0f, 80.0f, 86.0f, 96.0f)));
EXPECT_THAT(m4.GetRow(1), IsClose(AZ::Vector4(206.0f, 224.0f, 242.0f, 268.0f)));
EXPECT_THAT(m4.GetRow(2), IsClose(AZ::Vector4(338.0f, 368.0f, 398.0f, 440.0f)));
}
TEST(MATH_Matrix3x4, TestSum)
{
AZ::Matrix3x4 m1;
m1.SetRow(0, 1.0f, 2.0f, 3.0f, 4.0f);
m1.SetRow(1, 5.0f, 6.0f, 7.0f, 8.0f);
m1.SetRow(2, 9.0f, 10.0f, 11.0f, 12.0f);
AZ::Matrix3x4 m2;
m2.SetRow(0, 7.0f, 8.0f, 9.0f, 10.0f);
m2.SetRow(1, 11.0f, 12.0f, 13.0f, 14.0f);
m2.SetRow(2, 15.0f, 16.0f, 17.0f, 18.0f);
AZ::Matrix3x4 m3 = m1 + m2;
EXPECT_THAT(m3.GetRow(0), IsClose(AZ::Vector4(8.0f, 10.0f, 12.0f, 14.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(AZ::Vector4(16.0f, 18.0f, 20.0f, 22.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(AZ::Vector4(24.0f, 26.0f, 28.0f, 30.0f)));
m3 = m1;
m3 += m2;
EXPECT_THAT(m3.GetRow(0), IsClose(AZ::Vector4(8.0f, 10.0f, 12.0f, 14.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(AZ::Vector4(16.0f, 18.0f, 20.0f, 22.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(AZ::Vector4(24.0f, 26.0f, 28.0f, 30.0f)));
}
TEST(MATH_Matrix3x4, TestDifference)
{
AZ::Matrix3x4 m1;
m1.SetRow(0, 1.0f, 2.0f, 3.0f, 4.0f);
m1.SetRow(1, 5.0f, 6.0f, 7.0f, 8.0f);
m1.SetRow(2, 9.0f, 10.0f, 11.0f, 12.0f);
AZ::Matrix3x4 m2;
m2.SetRow(0, 7.0f, 8.0f, 9.0f, 10.0f);
m2.SetRow(1, 11.0f, 12.0f, 13.0f, 14.0f);
m2.SetRow(2, 15.0f, 16.0f, 17.0f, 18.0f);
AZ::Matrix3x4 m3 = m1 - m2;
EXPECT_THAT(m3.GetRow(0), IsClose(AZ::Vector4(-6.0f, -6.0f, -6.0f, -6.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(AZ::Vector4(-6.0f, -6.0f, -6.0f, -6.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(AZ::Vector4(-6.0f, -6.0f, -6.0f, -6.0f)));
m3 = m1;
m3 -= m2;
EXPECT_THAT(m3.GetRow(0), IsClose(AZ::Vector4(-6.0f, -6.0f, -6.0f, -6.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(AZ::Vector4(-6.0f, -6.0f, -6.0f, -6.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(AZ::Vector4(-6.0f, -6.0f, -6.0f, -6.0f)));
}
TEST(MATH_Matrix3x4, TestScalarMultiplication)
{
AZ::Matrix3x4 m1;
m1.SetRow(0, 1.0f, 2.0f, 3.0f, 4.0f);
m1.SetRow(1, 5.0f, 6.0f, 7.0f, 8.0f);
m1.SetRow(2, 9.0f, 10.0f, 11.0f, 12.0f);
AZ::Matrix3x4 m2;
m2.SetRow(0, 7.0f, 8.0f, 9.0f, 10.0f);
m2.SetRow(1, 11.0f, 12.0f, 13.0f, 14.0f);
m2.SetRow(2, 15.0f, 16.0f, 17.0f, 18.0f);
AZ::Matrix3x4 m3 = m1 * 2.0f;
EXPECT_THAT(m3.GetRow(0), IsClose(AZ::Vector4(2.0f, 4.0f, 6.0f, 8.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(AZ::Vector4(10.0f, 12.0f, 14.0f, 16.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(AZ::Vector4(18.0f, 20.0f, 22.0f, 24.0f)));
m3 = m1;
m3 *= 2.0f;
EXPECT_THAT(m3.GetRow(0), IsClose(AZ::Vector4(2.0f, 4.0f, 6.0f, 8.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(AZ::Vector4(10.0f, 12.0f, 14.0f, 16.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(AZ::Vector4(18.0f, 20.0f, 22.0f, 24.0f)));
m3 = 2.0f * m1;
EXPECT_THAT(m3.GetRow(0), IsClose(AZ::Vector4(2.0f, 4.0f, 6.0f, 8.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(AZ::Vector4(10.0f, 12.0f, 14.0f, 16.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(AZ::Vector4(18.0f, 20.0f, 22.0f, 24.0f)));
}
TEST(MATH_Matrix3x4, TestScalarDivision)
{
AZ::Matrix3x4 m1;
m1.SetRow(0, 1.0f, 2.0f, 3.0f, 4.0f);
m1.SetRow(1, 5.0f, 6.0f, 7.0f, 8.0f);
m1.SetRow(2, 9.0f, 10.0f, 11.0f, 12.0f);
AZ::Matrix3x4 m2;
m2.SetRow(0, 7.0f, 8.0f, 9.0f, 10.0f);
m2.SetRow(1, 11.0f, 12.0f, 13.0f, 14.0f);
m2.SetRow(2, 15.0f, 16.0f, 17.0f, 18.0f);
AZ::Matrix3x4 m3 = m1 / 0.5f;
EXPECT_THAT(m3.GetRow(0), IsClose(AZ::Vector4(2.0f, 4.0f, 6.0f, 8.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(AZ::Vector4(10.0f, 12.0f, 14.0f, 16.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(AZ::Vector4(18.0f, 20.0f, 22.0f, 24.0f)));
m3 = m1;
m3 /= 0.5f;
EXPECT_THAT(m3.GetRow(0), IsClose(AZ::Vector4(2.0f, 4.0f, 6.0f, 8.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(AZ::Vector4(10.0f, 12.0f, 14.0f, 16.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(AZ::Vector4(18.0f, 20.0f, 22.0f, 24.0f)));
}
TEST(MATH_Matrix3x4, TestNegation)
{
AZ::Matrix3x4 m1;
m1.SetRow(0, 1.0f, 2.0f, 3.0f, 4.0f);
m1.SetRow(1, 5.0f, 6.0f, 7.0f, 8.0f);
m1.SetRow(2, 9.0f, 10.0f, 11.0f, 12.0f);
EXPECT_THAT(-(-m1), IsClose(m1));
EXPECT_THAT(-AZ::Matrix3x4::CreateZero(), IsClose(AZ::Matrix3x4::CreateZero()));
AZ::Matrix3x4 m2 = -m1;
EXPECT_THAT(m2.GetRow(0), IsClose(AZ::Vector4(-1.0f, -2.0f, -3.0f, -4.0f)));
EXPECT_THAT(m2.GetRow(1), IsClose(AZ::Vector4(-5.0f, -6.0f, -7.0f, -8.0f)));
EXPECT_THAT(m2.GetRow(2), IsClose(AZ::Vector4(-9.0f, -10.0f, -11.0f, -12.0f)));
AZ::Matrix3x4 m3 = m1 + (-m1);
EXPECT_THAT(m3, IsClose(AZ::Matrix3x4::CreateZero()));
}
TEST(MATH_Matrix3x4, MultiplyByVector3)
@@ -652,6 +767,34 @@ namespace UnitTest
EXPECT_THAT(scaledMatrix.RetrieveScale(), IsClose(AZ::Vector3::CreateOne()));
}
TEST_P(Matrix3x4ScaleFixture, ScaleSq)
{
const AZ::Matrix3x4 orthogonalMatrix = GetParam();
EXPECT_THAT(orthogonalMatrix.RetrieveScaleSq(), IsClose(AZ::Vector3::CreateOne()));
AZ::Matrix3x4 unscaledMatrix = orthogonalMatrix;
unscaledMatrix.ExtractScale();
EXPECT_THAT(unscaledMatrix.RetrieveScaleSq(), IsClose(AZ::Vector3::CreateOne()));
const AZ::Vector3 scale(2.8f, 0.7f, 1.3f);
AZ::Matrix3x4 scaledMatrix = orthogonalMatrix;
scaledMatrix.MultiplyByScale(scale);
EXPECT_THAT(scaledMatrix.RetrieveScaleSq(), IsClose(scale * scale));
EXPECT_THAT(scaledMatrix.RetrieveScaleSq(), IsClose(scaledMatrix.RetrieveScale() * scaledMatrix.RetrieveScale()));
scaledMatrix.ExtractScale();
EXPECT_THAT(scaledMatrix.RetrieveScaleSq(), IsClose(AZ::Vector3::CreateOne()));
}
TEST_P(Matrix3x4ScaleFixture, GetReciprocalScaled)
{
const AZ::Matrix3x4 orthogonalMatrix = GetParam();
EXPECT_THAT(orthogonalMatrix.GetReciprocalScaled(), IsClose(orthogonalMatrix));
const AZ::Vector3 scale(2.8f, 0.7f, 1.3f);
AZ::Matrix3x4 scaledMatrix = orthogonalMatrix;
scaledMatrix.MultiplyByScale(scale);
AZ::Matrix3x4 reciprocalScaledMatrix = orthogonalMatrix;
reciprocalScaledMatrix.MultiplyByScale(scale.GetReciprocal());
EXPECT_THAT(scaledMatrix.GetReciprocalScaled(), IsClose(reciprocalScaledMatrix));
}
INSTANTIATE_TEST_CASE_P(MATH_Matrix3x4, Matrix3x4ScaleFixture, ::testing::ValuesIn(MathTestData::OrthogonalMatrix3x4s));
TEST(MATH_Matrix3x4, IsOrthogonal)
@@ -246,16 +246,16 @@ namespace UnitTest
m2.SetRow(2, 15.0f, 16.0f, 17.0f, 18.0f);
m2.SetRow(3, 19.0f, 20.0f, 21.0f, 22.0f);
Matrix4x4 m3 = m1 * m2;
AZ_TEST_ASSERT(m3.GetRow(0).IsClose(Vector4(150.0f, 160.0f, 170.0f, 180.0f)));
AZ_TEST_ASSERT(m3.GetRow(1).IsClose(Vector4(358.0f, 384.0f, 410.0f, 436.0f)));
AZ_TEST_ASSERT(m3.GetRow(2).IsClose(Vector4(566.0f, 608.0f, 650.0f, 692.0f)));
AZ_TEST_ASSERT(m3.GetRow(3).IsClose(Vector4(774.0f, 832.0f, 890.0f, 948.0f)));
EXPECT_THAT(m3.GetRow(0), IsClose(Vector4(150.0f, 160.0f, 170.0f, 180.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(Vector4(358.0f, 384.0f, 410.0f, 436.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(Vector4(566.0f, 608.0f, 650.0f, 692.0f)));
EXPECT_THAT(m3.GetRow(3), IsClose(Vector4(774.0f, 832.0f, 890.0f, 948.0f)));
Matrix4x4 m4 = m1;
m4 *= m2;
AZ_TEST_ASSERT(m4.GetRow(0).IsClose(Vector4(150.0f, 160.0f, 170.0f, 180.0f)));
AZ_TEST_ASSERT(m4.GetRow(1).IsClose(Vector4(358.0f, 384.0f, 410.0f, 436.0f)));
AZ_TEST_ASSERT(m4.GetRow(2).IsClose(Vector4(566.0f, 608.0f, 650.0f, 692.0f)));
AZ_TEST_ASSERT(m4.GetRow(3).IsClose(Vector4(774.0f, 832.0f, 890.0f, 948.0f)));
EXPECT_THAT(m4.GetRow(0), IsClose(Vector4(150.0f, 160.0f, 170.0f, 180.0f)));
EXPECT_THAT(m4.GetRow(1), IsClose(Vector4(358.0f, 384.0f, 410.0f, 436.0f)));
EXPECT_THAT(m4.GetRow(2), IsClose(Vector4(566.0f, 608.0f, 650.0f, 692.0f)));
EXPECT_THAT(m4.GetRow(3), IsClose(Vector4(774.0f, 832.0f, 890.0f, 948.0f)));
}
TEST(MATH_Matrix4x4, TestVectorMultiplication)
@@ -265,18 +265,148 @@ namespace UnitTest
m1.SetRow(1, 5.0f, 6.0f, 7.0f, 8.0f);
m1.SetRow(2, 9.0f, 10.0f, 11.0f, 12.0f);
m1.SetRow(3, 13.0f, 14.0f, 15.0f, 16.0f);
AZ_TEST_ASSERT((m1 * Vector3(1.0f, 2.0f, 3.0f)).IsClose(Vector3(18.0f, 46.0f, 74.0f)));
AZ_TEST_ASSERT((m1 * Vector4(1.0f, 2.0f, 3.0f, 4.0f)).IsClose(Vector4(30.0f, 70.0f, 110.0f, 150.0f)));
AZ_TEST_ASSERT(m1.TransposedMultiply3x3(Vector3(1.0f, 2.0f, 3.0f)).IsClose(Vector3(38.0f, 44.0f, 50.0f)));
AZ_TEST_ASSERT(m1.Multiply3x3(Vector3(1.0f, 2.0f, 3.0f)).IsClose(Vector3(14.0f, 38.0f, 62.0f)));
EXPECT_THAT((m1 * Vector3(1.0f, 2.0f, 3.0f)), IsClose(Vector3(18.0f, 46.0f, 74.0f)));
EXPECT_THAT((m1 * Vector4(1.0f, 2.0f, 3.0f, 4.0f)), IsClose(Vector4(30.0f, 70.0f, 110.0f, 150.0f)));
EXPECT_THAT(m1.TransposedMultiply3x3(Vector3(1.0f, 2.0f, 3.0f)), IsClose(Vector3(38.0f, 44.0f, 50.0f)));
EXPECT_THAT(m1.Multiply3x3(Vector3(1.0f, 2.0f, 3.0f)), IsClose(Vector3(14.0f, 38.0f, 62.0f)));
Vector3 v1(1.0f, 2.0f, 3.0f);
AZ_TEST_ASSERT((v1 * m1).IsClose(Vector3(51.0f, 58.0f, 65.0f)));
EXPECT_THAT((v1 * m1), IsClose(Vector3(51.0f, 58.0f, 65.0f)));
v1 *= m1;
AZ_TEST_ASSERT(v1.IsClose(Vector3(51.0f, 58.0f, 65.0f)));
EXPECT_THAT(v1, IsClose(Vector3(51.0f, 58.0f, 65.0f)));
Vector4 v2(1.0f, 2.0f, 3.0f, 4.0f);
AZ_TEST_ASSERT((v2 * m1).IsClose(Vector4(90.0f, 100.0f, 110.0f, 120.0f)));
EXPECT_THAT((v2 * m1), IsClose(Vector4(90.0f, 100.0f, 110.0f, 120.0f)));
v2 *= m1;
AZ_TEST_ASSERT(v2.IsClose(Vector4(90.0f, 100.0f, 110.0f, 120.0f)));
EXPECT_THAT(v2, IsClose(Vector4(90.0f, 100.0f, 110.0f, 120.0f)));
}
TEST(MATH_Matrix4x4, TestSum)
{
Matrix4x4 m1;
m1.SetRow(0, 1.0f, 2.0f, 3.0f, 4.0f);
m1.SetRow(1, 5.0f, 6.0f, 7.0f, 8.0f);
m1.SetRow(2, 9.0f, 10.0f, 11.0f, 12.0f);
m1.SetRow(3, 13.0f, 14.0f, 15.0f, 16.0f);
Matrix4x4 m2;
m2.SetRow(0, 7.0f, 8.0f, 9.0f, 10.0f);
m2.SetRow(1, 11.0f, 12.0f, 13.0f, 14.0f);
m2.SetRow(2, 15.0f, 16.0f, 17.0f, 18.0f);
m2.SetRow(3, 19.0f, 20.0f, 21.0f, 22.0f);
Matrix4x4 m3 = m1 + m2;
EXPECT_THAT(m3.GetRow(0), IsClose(Vector4(8.0f, 10.0f, 12.0f, 14.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(Vector4(16.0f, 18.0f, 20.0f, 22.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(Vector4(24.0f, 26.0f, 28.0f, 30.0f)));
EXPECT_THAT(m3.GetRow(3), IsClose(Vector4(32.0f, 34.0f, 36.0f, 38.0f)));
m3 = m1;
m3 += m2;
EXPECT_THAT(m3.GetRow(0), IsClose(Vector4(8.0f, 10.0f, 12.0f, 14.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(Vector4(16.0f, 18.0f, 20.0f, 22.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(Vector4(24.0f, 26.0f, 28.0f, 30.0f)));
EXPECT_THAT(m3.GetRow(3), IsClose(Vector4(32.0f, 34.0f, 36.0f, 38.0f)));
}
TEST(MATH_Matrix4x4, TestDifference)
{
Matrix4x4 m1;
m1.SetRow(0, 1.0f, 2.0f, 3.0f, 4.0f);
m1.SetRow(1, 5.0f, 6.0f, 7.0f, 8.0f);
m1.SetRow(2, 9.0f, 10.0f, 11.0f, 12.0f);
m1.SetRow(3, 13.0f, 14.0f, 15.0f, 16.0f);
Matrix4x4 m2;
m2.SetRow(0, 7.0f, 8.0f, 9.0f, 10.0f);
m2.SetRow(1, 11.0f, 12.0f, 13.0f, 14.0f);
m2.SetRow(2, 15.0f, 16.0f, 17.0f, 18.0f);
m2.SetRow(3, 19.0f, 20.0f, 21.0f, 22.0f);
Matrix4x4 m3 = m1 - m2;
EXPECT_THAT(m3.GetRow(0), IsClose(Vector4(-6.0f, -6.0f, -6.0f, -6.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(Vector4(-6.0f, -6.0f, -6.0f, -6.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(Vector4(-6.0f, -6.0f, -6.0f, -6.0f)));
EXPECT_THAT(m3.GetRow(3), IsClose(Vector4(-6.0f, -6.0f, -6.0f, -6.0f)));
m3 = m1;
m3 -= m2;
EXPECT_THAT(m3.GetRow(0), IsClose(Vector4(-6.0f, -6.0f, -6.0f, -6.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(Vector4(-6.0f, -6.0f, -6.0f, -6.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(Vector4(-6.0f, -6.0f, -6.0f, -6.0f)));
EXPECT_THAT(m3.GetRow(3), IsClose(Vector4(-6.0f, -6.0f, -6.0f, -6.0f)));
}
TEST(MATH_Matrix4x4, TestScalarMultiplication)
{
Matrix4x4 m1;
m1.SetRow(0, 1.0f, 2.0f, 3.0f, 4.0f);
m1.SetRow(1, 5.0f, 6.0f, 7.0f, 8.0f);
m1.SetRow(2, 9.0f, 10.0f, 11.0f, 12.0f);
m1.SetRow(3, 13.0f, 14.0f, 15.0f, 16.0f);
Matrix4x4 m2;
m2.SetRow(0, 7.0f, 8.0f, 9.0f, 10.0f);
m2.SetRow(1, 11.0f, 12.0f, 13.0f, 14.0f);
m2.SetRow(2, 15.0f, 16.0f, 17.0f, 18.0f);
m2.SetRow(3, 19.0f, 20.0f, 21.0f, 22.0f);
Matrix4x4 m3 = m1 * 2.0f;
EXPECT_THAT(m3.GetRow(0), IsClose(Vector4(2.0f, 4.0f, 6.0f, 8.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(Vector4(10.0f, 12.0f, 14.0f, 16.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(Vector4(18.0f, 20.0f, 22.0f, 24.0f)));
EXPECT_THAT(m3.GetRow(3), IsClose(Vector4(26.0f, 28.0f, 30.0f, 32.0f)));
m3 = m1;
m3 *= 2.0f;
EXPECT_THAT(m3.GetRow(0), IsClose(Vector4(2.0f, 4.0f, 6.0f, 8.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(Vector4(10.0f, 12.0f, 14.0f, 16.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(Vector4(18.0f, 20.0f, 22.0f, 24.0f)));
EXPECT_THAT(m3.GetRow(3), IsClose(Vector4(26.0f, 28.0f, 30.0f, 32.0f)));
m3 = 2.0f * m1;
EXPECT_THAT(m3.GetRow(0), IsClose(Vector4(2.0f, 4.0f, 6.0f, 8.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(Vector4(10.0f, 12.0f, 14.0f, 16.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(Vector4(18.0f, 20.0f, 22.0f, 24.0f)));
EXPECT_THAT(m3.GetRow(3), IsClose(Vector4(26.0f, 28.0f, 30.0f, 32.0f)));
}
TEST(MATH_Matrix4x4, TestScalarDivision)
{
Matrix4x4 m1;
m1.SetRow(0, 1.0f, 2.0f, 3.0f, 4.0f);
m1.SetRow(1, 5.0f, 6.0f, 7.0f, 8.0f);
m1.SetRow(2, 9.0f, 10.0f, 11.0f, 12.0f);
m1.SetRow(3, 13.0f, 14.0f, 15.0f, 16.0f);
Matrix4x4 m2;
m2.SetRow(0, 7.0f, 8.0f, 9.0f, 10.0f);
m2.SetRow(1, 11.0f, 12.0f, 13.0f, 14.0f);
m2.SetRow(2, 15.0f, 16.0f, 17.0f, 18.0f);
m2.SetRow(3, 19.0f, 20.0f, 21.0f, 22.0f);
Matrix4x4 m3 = m1 / 0.5f;
EXPECT_THAT(m3.GetRow(0), IsClose(Vector4(2.0f, 4.0f, 6.0f, 8.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(Vector4(10.0f, 12.0f, 14.0f, 16.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(Vector4(18.0f, 20.0f, 22.0f, 24.0f)));
EXPECT_THAT(m3.GetRow(3), IsClose(Vector4(26.0f, 28.0f, 30.0f, 32.0f)));
m3 = m1;
m3 /= 0.5f;
EXPECT_THAT(m3.GetRow(0), IsClose(Vector4(2.0f, 4.0f, 6.0f, 8.0f)));
EXPECT_THAT(m3.GetRow(1), IsClose(Vector4(10.0f, 12.0f, 14.0f, 16.0f)));
EXPECT_THAT(m3.GetRow(2), IsClose(Vector4(18.0f, 20.0f, 22.0f, 24.0f)));
EXPECT_THAT(m3.GetRow(3), IsClose(Vector4(26.0f, 28.0f, 30.0f, 32.0f)));
}
TEST(MATH_Matrix4x4, TestNegation)
{
Matrix4x4 m1;
m1.SetRow(0, 1.0f, 2.0f, 3.0f, 4.0f);
m1.SetRow(1, 5.0f, 6.0f, 7.0f, 8.0f);
m1.SetRow(2, 9.0f, 10.0f, 11.0f, 12.0f);
m1.SetRow(3, 13.0f, 14.0f, 15.0f, 16.0f);
EXPECT_THAT(-(-m1), IsClose(m1));
EXPECT_THAT(-Matrix4x4::CreateZero(), IsClose(Matrix4x4::CreateZero()));
Matrix4x4 m2 = -m1;
EXPECT_THAT(m2.GetRow(0), IsClose(Vector4(-1.0f, -2.0f, -3.0f, -4.0f)));
EXPECT_THAT(m2.GetRow(1), IsClose(Vector4(-5.0f, -6.0f, -7.0f, -8.0f)));
EXPECT_THAT(m2.GetRow(2), IsClose(Vector4(-9.0f, -10.0f, -11.0f, -12.0f)));
EXPECT_THAT(m2.GetRow(3), IsClose(Vector4(-13.0f, -14.0f, -15.0f, -16.0f)));
Matrix4x4 m3 = m1 + (-m1);
EXPECT_THAT(m3, IsClose(Matrix4x4::CreateZero()));
}
TEST(MATH_Matrix4x4, TestTranspose)
@@ -368,4 +498,36 @@ namespace UnitTest
m1.SetRow(3, 13.0f, 14.0f, 15.0f, 16.0f);
AZ_TEST_ASSERT(m1.GetDiagonal() == Vector4(1.0f, 6.0f, 11.0f, 16.0f));
}
TEST(MATH_Matrix4x4, TestScaleAccess)
{
Matrix4x4 m1 = Matrix4x4::CreateRotationX(DegToRad(40.0f)) * Matrix4x4::CreateScale(Vector3(2.0f, 3.0f, 4.0f));
EXPECT_THAT(m1.RetrieveScale(), IsClose(Vector3(2.0f, 3.0f, 4.0f)));
EXPECT_THAT(m1.ExtractScale(), IsClose(Vector3(2.0f, 3.0f, 4.0f)));
EXPECT_THAT(m1.RetrieveScale(), IsClose(Vector3::CreateOne()));
m1.MultiplyByScale(Vector3(3.0f, 4.0f, 5.0f));
EXPECT_THAT(m1.RetrieveScale(), IsClose(Vector3(3.0f, 4.0f, 5.0f)));
}
TEST(MATH_Matrix4x4, TestScaleSqAccess)
{
Matrix4x4 m1 = Matrix4x4::CreateRotationX(DegToRad(40.0f)) * Matrix4x4::CreateScale(Vector3(2.0f, 3.0f, 4.0f));
EXPECT_THAT(m1.RetrieveScaleSq(), IsClose(Vector3(4.0f, 9.0f, 16.0f)));
m1.ExtractScale();
EXPECT_THAT(m1.RetrieveScaleSq(), IsClose(Vector3::CreateOne()));
m1.MultiplyByScale(Vector3(3.0f, 4.0f, 5.0f));
EXPECT_THAT(m1.RetrieveScaleSq(), IsClose(Vector3(9.0f, 16.0f, 25.0f)));
}
TEST(MATH_Matrix4x4, TestReciprocalScaled)
{
Matrix4x4 orthogonalMatrix = Matrix4x4::CreateRotationX(DegToRad(40.0f));
EXPECT_THAT(orthogonalMatrix.GetReciprocalScaled(), IsClose(orthogonalMatrix));
const AZ::Vector3 scale(2.8f, 0.7f, 1.3f);
AZ::Matrix4x4 scaledMatrix = orthogonalMatrix;
scaledMatrix.MultiplyByScale(scale);
AZ::Matrix4x4 reciprocalScaledMatrix = orthogonalMatrix;
reciprocalScaledMatrix.MultiplyByScale(scale.GetReciprocal());
EXPECT_THAT(scaledMatrix.GetReciprocalScaled(), IsClose(reciprocalScaledMatrix));
}
}

Some files were not shown because too many files have changed in this diff Show More