ULRE/src/SceneGraph/component/MeshComponentManager.cpp

31 lines
746 B
C++
Raw Normal View History

2025-06-15 17:53:15 +08:00
#include<hgl/component/MeshComponent.h>
2025-04-01 01:11:32 +08:00
#include<hgl/graph/SceneNode.h>
2025-06-14 02:32:15 +08:00
#include<hgl/graph/Mesh.h>
2025-04-01 01:11:32 +08:00
COMPONENT_NAMESPACE_BEGIN
2025-06-15 17:53:15 +08:00
MeshComponentData::~MeshComponentData()
2025-06-14 02:32:15 +08:00
{
2025-06-14 04:13:49 +08:00
if(mesh)
{
//mesh->Release(); //外面有RenderResource管理不需要在这里释放.但未来要考虑是增加Release函数通知这里释放了一次使用权
mesh=nullptr;
}
2025-06-14 02:32:15 +08:00
}
2025-06-15 17:53:15 +08:00
Component *MeshComponentManager::CreateComponent(ComponentData *data)
2025-06-14 02:32:15 +08:00
{
if(!data)return(nullptr);
2025-06-15 17:53:15 +08:00
return CreateComponent(reinterpret_cast<MeshComponentData *>(data));
2025-06-14 02:32:15 +08:00
}
2025-06-15 17:53:15 +08:00
MeshComponent *MeshComponentManager::CreateComponent(MeshComponentData *data)
2025-06-14 02:32:15 +08:00
{
if(!data)return(nullptr);
2025-06-15 17:53:15 +08:00
return(new MeshComponent(data,this));
2025-06-14 02:32:15 +08:00
}
2025-04-01 01:11:32 +08:00
COMPONENT_NAMESPACE_END