Formalize material-driven panoramic skybox path

This commit is contained in:
2026-04-06 00:39:08 +08:00
parent 8151be0f45
commit 66a6818b89
18 changed files with 860 additions and 82 deletions

View File

@@ -2,6 +2,7 @@
#include <XCEngine/Components/CameraComponent.h>
#include <XCEngine/Components/LightComponent.h>
#include <XCEngine/Resources/BuiltinResources.h>
#include <sstream>
@@ -26,6 +27,8 @@ TEST(CameraComponent_Test, DefaultValues) {
EXPECT_FLOAT_EQ(camera.GetViewportRect().width, 1.0f);
EXPECT_FLOAT_EQ(camera.GetViewportRect().height, 1.0f);
EXPECT_FALSE(camera.IsSkyboxEnabled());
EXPECT_TRUE(camera.GetSkyboxMaterialPath().empty());
EXPECT_FALSE(camera.GetSkyboxMaterialAssetRef().IsValid());
EXPECT_FLOAT_EQ(camera.GetSkyboxTopColor().r, 0.18f);
EXPECT_FLOAT_EQ(camera.GetSkyboxHorizonColor().g, 0.84f);
EXPECT_FLOAT_EQ(camera.GetSkyboxBottomColor().b, 0.95f);
@@ -62,6 +65,7 @@ TEST(CameraComponent_Test, SerializeRoundTripPreservesViewportAndClearState) {
source.SetCullingMask(0x0000000Fu);
source.SetViewportRect(XCEngine::Math::Rect(0.25f, 0.125f, 0.5f, 0.625f));
source.SetSkyboxEnabled(true);
source.SetSkyboxMaterialPath(XCEngine::Resources::GetBuiltinDefaultPrimitiveMaterialPath().CStr());
source.SetSkyboxTopColor(XCEngine::Math::Color(0.12f, 0.21f, 0.64f, 1.0f));
source.SetSkyboxHorizonColor(XCEngine::Math::Color(0.71f, 0.76f, 0.88f, 1.0f));
source.SetSkyboxBottomColor(XCEngine::Math::Color(0.92f, 0.82f, 0.58f, 1.0f));
@@ -80,6 +84,7 @@ TEST(CameraComponent_Test, SerializeRoundTripPreservesViewportAndClearState) {
EXPECT_FLOAT_EQ(target.GetViewportRect().width, 0.5f);
EXPECT_FLOAT_EQ(target.GetViewportRect().height, 0.625f);
EXPECT_TRUE(target.IsSkyboxEnabled());
EXPECT_EQ(target.GetSkyboxMaterialPath(), XCEngine::Resources::GetBuiltinDefaultPrimitiveMaterialPath().CStr());
EXPECT_FLOAT_EQ(target.GetSkyboxTopColor().b, 0.64f);
EXPECT_FLOAT_EQ(target.GetSkyboxHorizonColor().g, 0.76f);
EXPECT_FLOAT_EQ(target.GetSkyboxBottomColor().r, 0.92f);