feat: 清理默认场景中的多余3D网格与光源,仅保留相机和方向光,同步更新冒烟测试并重新烘焙运行时场景

This commit is contained in:
ayuan9957 2026-05-21 17:33:00 +08:00
parent 4a95a1a4d5
commit e85a5b8422
8 changed files with 44 additions and 594 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,17 @@
# emit_after_seconds data_point_id value_type payload
0.00 cube.position vec3 0.0 0.5 0.0
0.00 cube.visible bool true
0.00 cube.base_color vec3 0.4 0.6 0.9
0.00 valve.visible bool true
0.00 tank.base_color vec3 0.35 0.65 0.90
0.00 alarm.intensity double 0.0
0.50 cube.position vec3 1.5 0.5 0.0
0.50 cube.base_color vec3 0.8 0.6 0.5
0.50 tank.base_color vec3 0.20 0.80 0.25
0.50 alarm.intensity double 2.0
1.00 cube.visible bool false
1.00 valve.visible bool false
1.50 cube.position vec3 -1.5 0.5 0.0
1.50 cube.visible bool true
1.50 valve.visible bool true
1.50 alarm.intensity double 0.0

Binary file not shown.

View File

@ -57,575 +57,14 @@
1.0 1.0
] ]
} }
},
{
"Id": 3,
"MeshRenderer": {
"AlphaCutoff": 0.5,
"AlphaMode": 0,
"AoTextureGuid": "",
"AoTexturePath": "",
"BaseColor": [
0.75,
0.7799999713897705,
0.8399999737739563
],
"BaseColorTextureGuid": "",
"BaseColorTexturePath": "",
"BuiltinMesh": 0,
"DoubleSided": true,
"EmissiveColor": [
0.0,
0.0,
0.0
],
"EmissiveTextureGuid": "",
"EmissiveTexturePath": "",
"MaterialAssetGuids": [],
"MeshAssetGuid": "",
"MeshSource": 1,
"Metallic": 0.0,
"MetallicRoughnessTextureGuid": "",
"MetallicRoughnessTexturePath": "",
"ModelNodeIndex": -1,
"NormalTextureGuid": "",
"NormalTexturePath": "",
"Roughness": 1.0,
"SourceModelAssetGuid": "",
"SourceModelPath": "Assets/Models/box1.glb",
"SourceNodePath": "",
"SubMeshIndex": -1,
"Visible": true
},
"Name": "box1.glb",
"ParentId": 0,
"Transform": {
"Position": [
0.0,
0.5,
0.0
],
"RotationEulerDegrees": [
0.0,
0.0,
0.0
],
"Scale": [
1.0,
1.0,
1.0
]
}
},
{
"Id": 4,
"Light": {
"Color": [
1.0,
0.15000000596046448,
0.10000000149011612
],
"Intensity": 0.0
},
"Name": "Alarm Beacon",
"ParentId": 0,
"Transform": {
"Position": [
0.0,
2.5,
0.0
],
"RotationEulerDegrees": [
0.0,
0.0,
0.0
],
"Scale": [
1.0,
1.0,
1.0
]
}
},
{
"Id": 5,
"MeshRenderer": {
"AlphaCutoff": 0.5,
"AlphaMode": 0,
"AoTextureGuid": "",
"AoTexturePath": "",
"BaseColor": [
0.75,
0.7799999713897705,
0.8399999737739563
],
"BaseColorTextureGuid": "",
"BaseColorTexturePath": "",
"BuiltinMesh": 0,
"DoubleSided": true,
"EmissiveColor": [
0.0,
0.0,
0.0
],
"EmissiveTextureGuid": "",
"EmissiveTexturePath": "",
"MaterialAssetGuids": [],
"MeshAssetGuid": "",
"MeshSource": 1,
"Metallic": 0.0,
"MetallicRoughnessTextureGuid": "",
"MetallicRoughnessTexturePath": "",
"ModelNodeIndex": 0,
"NormalTextureGuid": "",
"NormalTexturePath": "",
"Roughness": 1.0,
"SourceModelAssetGuid": "",
"SourceModelPath": "",
"SourceNodePath": "",
"SubMeshIndex": -1,
"Visible": true
},
"Name": "立方体",
"ParentId": 3,
"Transform": {
"Position": [
-1.6927926540374756,
-4.459673881530762,
1.949385364241607e-07
],
"RotationEulerDegrees": [
0.0,
-0.0,
0.0
],
"Scale": [
0.9999998807907104,
1.0,
1.0
]
}
},
{
"Id": 6,
"MeshRenderer": {
"AlphaCutoff": 0.5,
"AlphaMode": 0,
"AoTextureGuid": "",
"AoTexturePath": "",
"BaseColor": [
0.75,
0.7799999713897705,
0.8399999737739563
],
"BaseColorTextureGuid": "",
"BaseColorTexturePath": "",
"BuiltinMesh": 0,
"DoubleSided": true,
"EmissiveColor": [
0.0,
0.0,
0.0
],
"EmissiveTextureGuid": "",
"EmissiveTexturePath": "",
"MaterialAssetGuids": [],
"MeshAssetGuid": "",
"MeshSource": 1,
"Metallic": 0.0,
"MetallicRoughnessTextureGuid": "",
"MetallicRoughnessTexturePath": "",
"ModelNodeIndex": 1,
"NormalTextureGuid": "",
"NormalTexturePath": "",
"Roughness": 1.0,
"SourceModelAssetGuid": "",
"SourceModelPath": "",
"SourceNodePath": "",
"SubMeshIndex": -1,
"Visible": true
},
"Name": "立方体.001",
"ParentId": 5,
"Transform": {
"Position": [
0.0,
-3.55507755279541,
1.553973731915903e-07
],
"RotationEulerDegrees": [
0.0,
-0.0,
0.0
],
"Scale": [
0.9999998807907104,
1.0,
1.0
]
}
},
{
"Id": 7,
"MeshRenderer": {
"AlphaCutoff": 0.5,
"AlphaMode": 0,
"AoTextureGuid": "",
"AoTexturePath": "",
"BaseColor": [
0.75,
0.7799999713897705,
0.8399999737739563
],
"BaseColorTextureGuid": "",
"BaseColorTexturePath": "",
"BuiltinMesh": 0,
"DoubleSided": true,
"EmissiveColor": [
0.0,
0.0,
0.0
],
"EmissiveTextureGuid": "",
"EmissiveTexturePath": "",
"MaterialAssetGuids": [],
"MeshAssetGuid": "",
"MeshSource": 1,
"Metallic": 0.0,
"MetallicRoughnessTextureGuid": "",
"MetallicRoughnessTexturePath": "",
"ModelNodeIndex": 2,
"NormalTextureGuid": "",
"NormalTexturePath": "",
"Roughness": 1.0,
"SourceModelAssetGuid": "",
"SourceModelPath": "",
"SourceNodePath": "",
"SubMeshIndex": -1,
"Visible": true
},
"Name": "立方体.007",
"ParentId": 6,
"Transform": {
"Position": [
4.175572872161865,
0.0,
0.0
],
"RotationEulerDegrees": [
0.0,
-0.0,
0.0
],
"Scale": [
0.9999998807907104,
1.0,
1.0
]
}
},
{
"Id": 8,
"MeshRenderer": {
"AlphaCutoff": 0.5,
"AlphaMode": 0,
"AoTextureGuid": "",
"AoTexturePath": "",
"BaseColor": [
0.75,
0.7799999713897705,
0.8399999737739563
],
"BaseColorTextureGuid": "",
"BaseColorTexturePath": "",
"BuiltinMesh": 0,
"DoubleSided": true,
"EmissiveColor": [
0.0,
0.0,
0.0
],
"EmissiveTextureGuid": "",
"EmissiveTexturePath": "",
"MaterialAssetGuids": [],
"MeshAssetGuid": "",
"MeshSource": 1,
"Metallic": 0.0,
"MetallicRoughnessTextureGuid": "",
"MetallicRoughnessTexturePath": "",
"ModelNodeIndex": 3,
"NormalTextureGuid": "",
"NormalTexturePath": "",
"Roughness": 1.0,
"SourceModelAssetGuid": "",
"SourceModelPath": "",
"SourceNodePath": "",
"SubMeshIndex": -1,
"Visible": true
},
"Name": "立方体.003",
"ParentId": 3,
"Transform": {
"Position": [
0.0,
0.0,
0.0
],
"RotationEulerDegrees": [
0.0,
-0.0,
0.0
],
"Scale": [
0.9999998807907104,
1.0,
1.0
]
}
},
{
"Id": 9,
"MeshRenderer": {
"AlphaCutoff": 0.5,
"AlphaMode": 0,
"AoTextureGuid": "",
"AoTexturePath": "",
"BaseColor": [
0.75,
0.7799999713897705,
0.8399999737739563
],
"BaseColorTextureGuid": "",
"BaseColorTexturePath": "",
"BuiltinMesh": 0,
"DoubleSided": true,
"EmissiveColor": [
0.0,
0.0,
0.0
],
"EmissiveTextureGuid": "",
"EmissiveTexturePath": "",
"MaterialAssetGuids": [],
"MeshAssetGuid": "",
"MeshSource": 1,
"Metallic": 0.0,
"MetallicRoughnessTextureGuid": "",
"MetallicRoughnessTexturePath": "",
"ModelNodeIndex": 4,
"NormalTextureGuid": "",
"NormalTexturePath": "",
"Roughness": 1.0,
"SourceModelAssetGuid": "",
"SourceModelPath": "",
"SourceNodePath": "",
"SubMeshIndex": -1,
"Visible": true
},
"Name": "立方体.002",
"ParentId": 8,
"Transform": {
"Position": [
0.0,
-1.4481612709005276e-07,
-3.31300687789917
],
"RotationEulerDegrees": [
0.0,
-0.0,
0.0
],
"Scale": [
0.9999998807907104,
1.0,
1.0
]
}
},
{
"Id": 10,
"MeshRenderer": {
"AlphaCutoff": 0.5,
"AlphaMode": 0,
"AoTextureGuid": "",
"AoTexturePath": "",
"BaseColor": [
0.75,
0.7799999713897705,
0.8399999737739563
],
"BaseColorTextureGuid": "",
"BaseColorTexturePath": "",
"BuiltinMesh": 0,
"DoubleSided": true,
"EmissiveColor": [
0.0,
0.0,
0.0
],
"EmissiveTextureGuid": "",
"EmissiveTexturePath": "",
"MaterialAssetGuids": [],
"MeshAssetGuid": "",
"MeshSource": 1,
"Metallic": 0.0,
"MetallicRoughnessTextureGuid": "",
"MetallicRoughnessTexturePath": "",
"ModelNodeIndex": 5,
"NormalTextureGuid": "",
"NormalTexturePath": "",
"Roughness": 1.0,
"SourceModelAssetGuid": "",
"SourceModelPath": "",
"SourceNodePath": "",
"SubMeshIndex": -1,
"Visible": true
},
"Name": "立方体.004",
"ParentId": 8,
"Transform": {
"Position": [
3.776623010635376,
0.0,
0.0
],
"RotationEulerDegrees": [
0.0,
-0.0,
0.0
],
"Scale": [
0.9999998807907104,
1.0,
1.0
]
}
},
{
"Id": 11,
"MeshRenderer": {
"AlphaCutoff": 0.5,
"AlphaMode": 0,
"AoTextureGuid": "",
"AoTexturePath": "",
"BaseColor": [
0.75,
0.7799999713897705,
0.8399999737739563
],
"BaseColorTextureGuid": "",
"BaseColorTexturePath": "",
"BuiltinMesh": 0,
"DoubleSided": true,
"EmissiveColor": [
0.0,
0.0,
0.0
],
"EmissiveTextureGuid": "",
"EmissiveTexturePath": "",
"MaterialAssetGuids": [],
"MeshAssetGuid": "",
"MeshSource": 1,
"Metallic": 0.0,
"MetallicRoughnessTextureGuid": "",
"MetallicRoughnessTexturePath": "",
"ModelNodeIndex": 6,
"NormalTextureGuid": "",
"NormalTexturePath": "",
"Roughness": 1.0,
"SourceModelAssetGuid": "",
"SourceModelPath": "",
"SourceNodePath": "",
"SubMeshIndex": -1,
"Visible": true
},
"Name": "立方体.005",
"ParentId": 8,
"Transform": {
"Position": [
0.0,
4.31797981262207,
-1.8874489171594178e-07
],
"RotationEulerDegrees": [
0.0,
-0.0,
0.0
],
"Scale": [
0.9999998807907104,
1.0,
1.0
]
}
},
{
"Id": 12,
"MeshRenderer": {
"AlphaCutoff": 0.5,
"AlphaMode": 0,
"AoTextureGuid": "",
"AoTexturePath": "",
"BaseColor": [
0.75,
0.7799999713897705,
0.8399999737739563
],
"BaseColorTextureGuid": "",
"BaseColorTexturePath": "",
"BuiltinMesh": 0,
"DoubleSided": true,
"EmissiveColor": [
0.0,
0.0,
0.0
],
"EmissiveTextureGuid": "",
"EmissiveTexturePath": "",
"MaterialAssetGuids": [],
"MeshAssetGuid": "",
"MeshSource": 1,
"Metallic": 0.0,
"MetallicRoughnessTextureGuid": "",
"MetallicRoughnessTexturePath": "",
"ModelNodeIndex": 7,
"NormalTextureGuid": "",
"NormalTexturePath": "",
"Roughness": 1.0,
"SourceModelAssetGuid": "",
"SourceModelPath": "",
"SourceNodePath": "",
"SubMeshIndex": -1,
"Visible": true
},
"Name": "立方体.006",
"ParentId": 8,
"Transform": {
"Position": [
-12.448348045349121,
0.0,
0.0
],
"RotationEulerDegrees": [
0.0,
0.0,
-0.0
],
"Scale": [
0.9999998807907104,
1.0,
1.0
]
}
} }
], ],
"SceneName": "Untitled", "SceneName": "Untitled",
"Selection": { "Selection": {
"ActiveObjectId": 12, "ActiveObjectId": 1,
"SelectedObjectIds": [ "SelectedObjectIds": [
12 1
], ],
"SelectionAnchorId": 12 "SelectionAnchorId": 1
} }
} }

View File

@ -457,20 +457,6 @@ MetaCoreScene MetaCoreCreateDefaultScene() {
directionalLight.AddComponent<MetaCoreLightComponent>(); directionalLight.AddComponent<MetaCoreLightComponent>();
directionalLight.GetComponent<MetaCoreTransformComponent>().RotationEulerDegrees = glm::vec3(-45.0F, 30.0F, 0.0F); directionalLight.GetComponent<MetaCoreTransformComponent>().RotationEulerDegrees = glm::vec3(-45.0F, 30.0F, 0.0F);
MetaCoreGameObject cube = scene.CreateGameObject("box1.glb");
auto& meshRenderer = cube.AddComponent<MetaCoreMeshRendererComponent>();
meshRenderer.MeshSource = MetaCoreMeshSourceKind::Asset;
meshRenderer.SourceModelPath = "Assets/Models/box1.glb";
meshRenderer.SourceModelAssetGuid = MetaCoreAssetRegistry::Get().ResolvePathToGuid("Assets/Models/box1.glb");
cube.AddComponent<MetaCoreModelRootTag>(MetaCoreModelRootTag{ "Assets/Models/box1.glb" });
cube.GetComponent<MetaCoreTransformComponent>().Position = glm::vec3(0.0F, 0.5F, 0.0F);
MetaCoreGameObject alarmBeacon = scene.CreateGameObject("Alarm Beacon");
auto& beaconLight = alarmBeacon.AddComponent<MetaCoreLightComponent>();
beaconLight.Intensity = 0.0F;
beaconLight.Color = glm::vec3(1.0F, 0.15F, 0.1F);
alarmBeacon.GetComponent<MetaCoreTransformComponent>().Position = glm::vec3(0.0F, 2.5F, 0.0F);
return scene; return scene;
} }

View File

@ -6,6 +6,7 @@
#include "MetaCoreFoundation/MetaCoreGeneratedReflection.h" #include "MetaCoreFoundation/MetaCoreGeneratedReflection.h"
#include "MetaCoreFoundation/MetaCoreLogService.h" #include "MetaCoreFoundation/MetaCoreLogService.h"
#include "MetaCoreFoundation/MetaCoreProject.h" #include "MetaCoreFoundation/MetaCoreProject.h"
#include "MetaCoreFoundation/MetaCoreAssetRegistry.h"
#include "MetaCorePlatform/MetaCoreWindow.h" #include "MetaCorePlatform/MetaCoreWindow.h"
#include "MetaCoreRender/MetaCoreEditorViewportRenderer.h" #include "MetaCoreRender/MetaCoreEditorViewportRenderer.h"
#include "MetaCoreRender/MetaCoreRenderDevice.h" #include "MetaCoreRender/MetaCoreRenderDevice.h"
@ -593,16 +594,16 @@ void MetaCoreTestJsonSceneSaveCurrentSceneUsesMcsceneJson() {
const auto scenePersistenceService = moduleRegistry.ResolveService<MetaCore::MetaCoreIScenePersistenceService>(); const auto scenePersistenceService = moduleRegistry.ResolveService<MetaCore::MetaCoreIScenePersistenceService>();
MetaCoreExpect(scenePersistenceService != nullptr, "应解析到 ScenePersistenceService"); MetaCoreExpect(scenePersistenceService != nullptr, "应解析到 ScenePersistenceService");
MetaCore::MetaCoreId cubeId = 0; MetaCore::MetaCoreId lightId = 0;
for (const MetaCore::MetaCoreGameObject& object : scene.GetGameObjects()) { for (const MetaCore::MetaCoreGameObject& object : scene.GetGameObjects()) {
if (object.GetName() == "box1.glb") { if (object.GetName() == "Directional Light") {
cubeId = object.GetId(); lightId = object.GetId();
break; break;
} }
} }
MetaCoreExpect(cubeId != 0, "默认场景应包含 box1.glb"); MetaCoreExpect(lightId != 0, "默认场景应包含 Directional Light");
editorContext.SelectOnly(cubeId); editorContext.SelectOnly(lightId);
const std::filesystem::path scenePath = std::filesystem::path("Scenes") / "Main.mcscene.json"; const std::filesystem::path scenePath = std::filesystem::path("Scenes") / "Main.mcscene.json";
MetaCoreExpect(scenePersistenceService->SaveSceneAs(editorContext, scenePath), "应能保存 JSON 场景"); MetaCoreExpect(scenePersistenceService->SaveSceneAs(editorContext, scenePath), "应能保存 JSON 场景");
MetaCoreExpect(scenePersistenceService->GetCurrentScenePath() == scenePath, "当前场景路径应使用 .mcscene.json"); MetaCoreExpect(scenePersistenceService->GetCurrentScenePath() == scenePath, "当前场景路径应使用 .mcscene.json");
@ -611,7 +612,7 @@ void MetaCoreTestJsonSceneSaveCurrentSceneUsesMcsceneJson() {
MetaCoreExpect(!scenePersistenceService->IsSceneDirty(), "保存后场景不应为 dirty"); MetaCoreExpect(!scenePersistenceService->IsSceneDirty(), "保存后场景不应为 dirty");
const bool renamed = editorContext.ExecuteSnapshotCommand("重命名对象", [&]() { const bool renamed = editorContext.ExecuteSnapshotCommand("重命名对象", [&]() {
return scene.RenameGameObject(cubeId, "RoundTripCube"); return scene.RenameGameObject(lightId, "RoundTripLight");
}); });
MetaCoreExpect(renamed, "应能修改场景对象"); MetaCoreExpect(renamed, "应能修改场景对象");
MetaCoreExpect(scenePersistenceService->IsSceneDirty(), "修改后场景应变为 dirty"); MetaCoreExpect(scenePersistenceService->IsSceneDirty(), "修改后场景应变为 dirty");
@ -624,17 +625,17 @@ void MetaCoreTestJsonSceneSaveCurrentSceneUsesMcsceneJson() {
MetaCoreExpect(scene.GetGameObjects().empty(), "清空快照后场景应为空"); MetaCoreExpect(scene.GetGameObjects().empty(), "清空快照后场景应为空");
MetaCoreExpect(scenePersistenceService->LoadScene(editorContext, scenePath), "应能重新加载 JSON 场景"); MetaCoreExpect(scenePersistenceService->LoadScene(editorContext, scenePath), "应能重新加载 JSON 场景");
MetaCoreExpect(scene.GetGameObjects().size() == 4, "重新加载后对象数量应恢复"); MetaCoreExpect(scene.GetGameObjects().size() == 2, "重新加载后对象数量应恢复");
MetaCoreExpect(editorContext.GetSelectedObjectId() != 0, "重新加载后应恢复选中对象"); MetaCoreExpect(editorContext.GetSelectedObjectId() != 0, "重新加载后应恢复选中对象");
bool foundRenamedCube = false; bool foundRenamedLight = false;
for (const MetaCore::MetaCoreGameObject& object : scene.GetGameObjects()) { for (const MetaCore::MetaCoreGameObject& object : scene.GetGameObjects()) {
if (object.GetName() == "RoundTripCube") { if (object.GetName() == "RoundTripLight") {
foundRenamedCube = true; foundRenamedLight = true;
break; break;
} }
} }
MetaCoreExpect(foundRenamedCube, "重新加载后应保留保存过的对象名称"); MetaCoreExpect(foundRenamedLight, "重新加载后应保留保存过的对象名称");
coreServicesModule->Shutdown(moduleRegistry); coreServicesModule->Shutdown(moduleRegistry);
moduleRegistry.ShutdownServices(); moduleRegistry.ShutdownServices();
@ -1261,7 +1262,7 @@ void MetaCoreTestBootstrapStartupSceneCreation() {
MetaCoreExpect(std::filesystem::exists(tempProjectRoot / bootstrapScenePath), "应生成 Main.mcscene.json"); MetaCoreExpect(std::filesystem::exists(tempProjectRoot / bootstrapScenePath), "应生成 Main.mcscene.json");
MetaCoreExpect(scenePersistenceService->LoadStartupScene(editorContext), "设置后应能加载 startup scene"); MetaCoreExpect(scenePersistenceService->LoadStartupScene(editorContext), "设置后应能加载 startup scene");
MetaCoreExpect(scenePersistenceService->GetCurrentScenePath() == bootstrapScenePath, "startup scene 路径应正确"); MetaCoreExpect(scenePersistenceService->GetCurrentScenePath() == bootstrapScenePath, "startup scene 路径应正确");
MetaCoreExpect(scene.GetGameObjects().size() == 4, "bootstrap scene 应保存默认场景内容"); MetaCoreExpect(scene.GetGameObjects().size() == 2, "bootstrap scene 应保存默认场景内容");
coreServicesModule->Shutdown(moduleRegistry); coreServicesModule->Shutdown(moduleRegistry);
moduleRegistry.ShutdownServices(); moduleRegistry.ShutdownServices();
@ -2427,6 +2428,16 @@ void MetaCoreTestUiDocumentSerialization() {
void MetaCoreTestDecoupledSnapshotSync() { void MetaCoreTestDecoupledSnapshotSync() {
// 1. 创建默认场景并收集核心对象 ID // 1. 创建默认场景并收集核心对象 ID
MetaCore::MetaCoreScene scene = MetaCore::MetaCoreCreateDefaultScene(); MetaCore::MetaCoreScene scene = MetaCore::MetaCoreCreateDefaultScene();
// 动态添加一个 box1.glb测试需要它作为网格对象进行解耦同步验证
MetaCore::MetaCoreGameObject cubeObj = scene.CreateGameObject("box1.glb");
auto& meshRenderer = cubeObj.AddComponent<MetaCore::MetaCoreMeshRendererComponent>();
meshRenderer.MeshSource = MetaCore::MetaCoreMeshSourceKind::Asset;
meshRenderer.SourceModelPath = "Assets/Models/box1.glb";
meshRenderer.SourceModelAssetGuid = MetaCore::MetaCoreAssetRegistry::Get().ResolvePathToGuid("Assets/Models/box1.glb");
cubeObj.AddComponent<MetaCore::MetaCoreModelRootTag>(MetaCore::MetaCoreModelRootTag{ "Assets/Models/box1.glb" });
cubeObj.GetComponent<MetaCore::MetaCoreTransformComponent>().Position = glm::vec3(0.0F, 0.5F, 0.0F);
MetaCore::MetaCoreId cubeId = 0; MetaCore::MetaCoreId cubeId = 0;
MetaCore::MetaCoreId lightId = 0; MetaCore::MetaCoreId lightId = 0;
MetaCore::MetaCoreId cameraId = 0; MetaCore::MetaCoreId cameraId = 0;
@ -2533,20 +2544,17 @@ int main() {
std::cout << "[RUN] MetaCoreCreateDefaultScene..." << std::endl; std::cout << "[RUN] MetaCoreCreateDefaultScene..." << std::endl;
MetaCore::MetaCoreScene scene = MetaCore::MetaCoreCreateDefaultScene(); MetaCore::MetaCoreScene scene = MetaCore::MetaCoreCreateDefaultScene();
std::cout << "[RUN] MetaCoreExpect default objects count..." << std::endl; std::cout << "[RUN] MetaCoreExpect default objects count..." << std::endl;
MetaCoreExpect(scene.GetGameObjects().size() == 4, "默认场景应包含四个对象"); MetaCoreExpect(scene.GetGameObjects().size() == 2, "默认场景应包含两个对象");
bool hasCamera = false; bool hasCamera = false;
bool hasLight = false; bool hasLight = false;
bool hasCube = false;
for (const MetaCore::MetaCoreGameObject& object : scene.GetGameObjects()) { for (const MetaCore::MetaCoreGameObject& object : scene.GetGameObjects()) {
hasCamera = hasCamera || object.HasComponent<MetaCore::MetaCoreCameraComponent>(); hasCamera = hasCamera || object.HasComponent<MetaCore::MetaCoreCameraComponent>();
hasLight = hasLight || object.HasComponent<MetaCore::MetaCoreLightComponent>(); hasLight = hasLight || object.HasComponent<MetaCore::MetaCoreLightComponent>();
hasCube = hasCube || object.HasComponent<MetaCore::MetaCoreMeshRendererComponent>();
} }
MetaCoreExpect(hasCamera, "默认场景应包含摄像机"); MetaCoreExpect(hasCamera, "默认场景应包含摄像机");
MetaCoreExpect(hasLight, "默认场景应包含光源"); MetaCoreExpect(hasLight, "默认场景应包含光源");
MetaCoreExpect(hasCube, "默认场景应包含立方体");
std::cout << "[RUN] MetaCoreDummyPanelProvider test..." << std::endl; std::cout << "[RUN] MetaCoreDummyPanelProvider test..." << std::endl;
MetaCore::MetaCoreEditorModuleRegistry moduleRegistry; MetaCore::MetaCoreEditorModuleRegistry moduleRegistry;