refactor(editor): 重构 Editor 使用 Engine 的 Component/Scene 系统

- Editor CMakeLists.txt 链接 XCEngine 库
- 删除 editor/src/Core/GameObject.h (简化版)
- SelectionManager 使用 Engine::Components::GameObject*
- SceneManager 使用 Engine::Scene
- HierarchyPanel 使用 Engine GameObject API
- InspectorPanel 使用 Engine TransformComponent

注意: Engine RHI Shader 接口有编译错误需要修复
This commit is contained in:
2026-03-24 18:38:01 +08:00
parent c66ba2feb3
commit 135fe9145b
12 changed files with 346 additions and 560 deletions

View File

@@ -25,35 +25,28 @@ public:
bool Compile(const char* source, ShaderType type);
void Use() const;
void Bind() override { Use(); }
void Unbind() override;
void SetInt(const char* name, int value) override;
void SetIntArray(const char* name, const int* values, unsigned int count);
void SetFloat(const char* name, float value) override;
void SetFloatArray(const char* name, const float* values, unsigned int count);
void SetVec3(const char* name, float x, float y, float z) override;
void SetVec3(const char* name, const float* values);
void SetVec4(const char* name, float x, float y, float z, float w) override;
void SetVec4(const char* name, const float* values);
void SetMat2(const char* name, const float* value);
void SetMat3(const char* name, const float* value);
void SetMat4(const char* name, const float* value) override;
void SetMat4Array(const char* name, const float* values, unsigned int count);
int GetUniformLocation(const char* name) const;
unsigned int GetID() const { return m_program; }
void* GetNativeHandle() override { return reinterpret_cast<void*>(static_cast<uintptr_t>(m_program)); }
bool IsValid() const override { return m_program != 0; }
ShaderType GetType() const override { return m_type; }
const std::vector<UniformInfo>& GetUniformInfos() const override;
const UniformInfo* GetUniformInfo(const char* name) const override;
int GetUniformLocation(const char* name) const;
unsigned int GetID() const { return m_program; }
private:
void CacheUniformInfos() const;
unsigned int m_program;
ShaderType m_type = ShaderType::Vertex;
mutable std::vector<UniformInfo> m_uniformInfos;
mutable bool m_uniformsCached = false;
bool CheckCompileErrors(unsigned int shader, const char* type);
bool CheckLinkErrors(unsigned int program);
};
} // namespace RHI
} // namespace XCEngine
} // namespace XCEngine

View File

@@ -3,6 +3,7 @@
#include "RHITypes.h"
#include "RHIEnums.h"
#include <string>
#include <vector>
namespace XCEngine {
namespace RHI {
@@ -17,19 +18,21 @@ public:
virtual ShaderType GetType() const = 0;
virtual bool IsValid() const = 0;
virtual void Bind() = 0;
virtual void Unbind() = 0;
virtual void* GetNativeHandle() = 0;
virtual void SetInt(const char* name, int value) = 0;
virtual void SetFloat(const char* name, float value) = 0;
virtual void SetVec3(const char* name, float x, float y, float z) = 0;
virtual void SetVec4(const char* name, float x, float y, float z, float w) = 0;
virtual void SetMat4(const char* name, const float* value) = 0;
virtual void Shutdown() = 0;
struct UniformInfo {
std::string name;
uint32_t bindPoint;
uint32_t size;
uint32_t type;
uint32_t arraySize;
};
virtual const std::vector<UniformInfo>& GetUniformInfos() const = 0;
virtual const UniformInfo* GetUniformInfo(const char* name) const = 0;
};
} // namespace RHI
} // namespace XCEngine
} // namespace XCEngine