/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/UnitTests/GameEngineTest/EffectsTest/EffectsTest.cpp
147 строк
4 KB
C-Core
Mesh decals fixes and unit tests (#1966)
18 июн 2026, 22:20
Не верифицирован
18 июн 2026, 22:20
e4ba71a
Код
Авторство
О чём код?
#include <GameEngineTest/GameEngineTestPCH.h> #include "EffectsTest.h" #include <Core/WorldSerializer/WorldReader.h> #include <Foundation/IO/FileSystem/FileReader.h> #include <Foundation/IO/FileSystem/FileWriter.h> #include <Foundation/Profiling/Profiling.h> #include <Foundation/Profiling/ProfilingUtils.h> #include <ParticlePlugin/Components/ParticleComponent.h> static ezGameEngineTestEffects s_GameEngineTestEffects; const char* ezGameEngineTestEffects::GetTestName() const { return "Effects Tests"; } ezGameEngineTestApplication* ezGameEngineTestEffects::CreateApplication() { m_pOwnApplication = EZ_DEFAULT_NEW(ezGameEngineTestApplication, "Effects"); return m_pOwnApplication; } void ezGameEngineTestEffects::SetupSubTests() { AddSubTest("Decals", SubTests::Decals); AddSubTest("Heightfield", SubTests::Heightfield); AddSubTest("WindClothRopes", SubTests::WindClothRopes); AddSubTest("Reflections", SubTests::Reflections); AddSubTest("StressTest", SubTests::StressTest); AddSubTest("AdvancedMeshes", SubTests::AdvancedMeshes); AddSubTest("Lighting", SubTests::Lighting); AddSubTest("MeshDecals", SubTests::MeshDecals); } ezResult ezGameEngineTestEffects::InitializeSubTest(ezInt32 iIdentifier) { EZ_SUCCEED_OR_RETURN(SUPER::InitializeSubTest(iIdentifier)); m_iFrame = -1; m_uiImgCompIdx = 0; m_ImgCompFrames.Clear(); switch (iIdentifier) { case SubTests::Decals: { m_ImgCompFrames.PushBack({5}); m_ImgCompFrames.PushBack({30}); m_ImgCompFrames.PushBack({60}); return m_pOwnApplication->LoadScene("Effects/AssetCache/Common/Scenes/Decals.ezBinScene"); } case SubTests::Heightfield: { m_ImgCompFrames.PushBack({20}); return m_pOwnApplication->LoadScene("Effects/AssetCache/Common/Scenes/Heightfield.ezBinScene"); } case SubTests::WindClothRopes: { m_ImgCompFrames.PushBack({20, 550}); // TODO: This needs to be investigated why the result is so different on platforms other than windows. #if EZ_ENABLED(EZ_PLATFORM_WINDOWS) m_ImgCompFrames.PushBack({100, 850}); #else m_ImgCompFrames.PushBack({100, 2000}); #endif return m_pOwnApplication->LoadScene("Effects/AssetCache/Common/Scenes/Wind.ezBinScene"); } case SubTests::Reflections: { m_ImgCompFrames.PushBack({30}); return m_pOwnApplication->LoadScene("Effects/AssetCache/Common/Scenes/Reflections.ezBinScene"); } case SubTests::StressTest: { m_ImgCompFrames.PushBack({100}); return m_pOwnApplication->LoadScene("Effects/AssetCache/Common/Scenes/StressTest.ezBinScene"); } case SubTests::AdvancedMeshes: { m_ImgCompFrames.PushBack({20}); return m_pOwnApplication->LoadScene("Effects/AssetCache/Common/Scenes/AdvancedMeshes.ezBinScene"); } case SubTests::Lighting: { m_ImgCompFrames.PushBack({20}); m_ImgCompFrames.PushBack({40}); return m_pOwnApplication->LoadScene("Effects/AssetCache/Common/Scenes/Lighting.ezBinScene"); } case SubTests::MeshDecals: { m_ImgCompFrames.PushBack({5, 150}); return m_pOwnApplication->LoadScene("Effects/AssetCache/Common/Scenes/MeshDecals.ezBinScene"); } EZ_DEFAULT_CASE_NOT_IMPLEMENTED; } return EZ_FAILURE; } ezTestAppRun ezGameEngineTestEffects::RunSubTest(ezInt32 iIdentifier, ezUInt32 uiInvocationCount) { ++m_iFrame; m_pOwnApplication->Run(); if (m_pOwnApplication->ShouldApplicationQuit()) return ezTestAppRun::Quit; m_pOwnApplication->SwitchToCamera(m_iFrame); if (m_ImgCompFrames[m_uiImgCompIdx].m_uiFrame == m_iFrame) { EZ_TEST_IMAGE(m_uiImgCompIdx, m_ImgCompFrames[m_uiImgCompIdx].m_uiThreshold); ++m_uiImgCompIdx; if (m_uiImgCompIdx >= m_ImgCompFrames.GetCount()) { if (false) { ezStringBuilder sPath(":appdata/Profiling/", ezApplication::GetApplicationInstance()->GetApplicationName()); sPath.AppendPath("effectsProfiling.json"); ezProfilingUtils::SaveProfilingCapture(sPath).IgnoreResult(); } return ezTestAppRun::Quit; } } return ezTestAppRun::Continue; }