ULRE/src/SceneGraph/component/MeshComponentManager.cpp

31 lines
746 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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