refactor: Transform 字段封装 + dirty 标记(对齐 UE USceneComponent 真实现)

- 修正上一版"全量暴力重算":UE 实为 dirty 标记 + 惰性计算,前提是
  字段私有(SetRelativeLocation 等 setter 标脏 + 子级传播)
- TransformComponent:SRT 字段私有化,Set/Get/World()/IsDirty 访问器;
  Set* 变更才标脏;AddRotationY 便捷接口
- Scene::UpdateTransforms 只重算脏实体——静止实体零成本;
  层级(父子)传播在脏标记基础上扩展
- 迁移 Camera/SceneRenderer/main.cpp 到封装 API
This commit is contained in:
2026-09-23 15:35:20 +08:00
parent 57ab8901a9
commit 7d137fa9b1
5 changed files with 63 additions and 47 deletions
+2 -2
View File
@@ -112,8 +112,8 @@ protected:
for (size_t i = 0; i < m_Spinners.size(); ++i)
{
auto& t = m_Spinners[i].GetComponent<TransformComponent>();
t.rotation.y = m_Time * 60.0f + static_cast<f32>(i) * 40.0f;
t.scale = glm::vec3(0.5f); // dirty → 帧循环统一 Compose
t.SetRotation(glm::vec3(0.0f, m_Time * 60.0f + static_cast<f32>(i) * 40.0f, 0.0f));
t.SetScale(glm::vec3(0.5f));
}
}