恢复Duplication(SceneNode *),并实现MeshComponent::Duplication...下一步Component::Duplication()改成由基类实现.
This commit is contained in:
@@ -61,31 +61,33 @@ class MeshComponent:public RenderComponent
|
||||
{
|
||||
MeshComponentData *sm_data;
|
||||
|
||||
public:
|
||||
|
||||
COMPONENT_CLASS_BODY(Mesh)
|
||||
|
||||
public:
|
||||
|
||||
MeshComponent(MeshComponentData *cd,MeshComponentManager *cm):RenderComponent(cd,cm){sm_data=cd;}
|
||||
|
||||
virtual ~MeshComponent()=default;
|
||||
|
||||
static MeshComponentManager *GetDefaultManager()
|
||||
{
|
||||
return MeshComponentManager::GetDefaultManager();
|
||||
}
|
||||
|
||||
static constexpr const size_t StaticHashCode()
|
||||
{
|
||||
return hgl::GetTypeHash<MeshComponent>();
|
||||
}
|
||||
|
||||
const size_t GetHashCode()const override
|
||||
{
|
||||
return MeshComponent::StaticHashCode();
|
||||
}
|
||||
|
||||
MeshComponentData &GetData() {return *sm_data;}
|
||||
const MeshComponentData &GetData()const {return *sm_data;}
|
||||
|
||||
Mesh *GetMesh() const{return sm_data->mesh;}
|
||||
|
||||
public:
|
||||
|
||||
virtual Component *Duplication() override
|
||||
{
|
||||
MeshComponentManager *manager=GetManager();
|
||||
|
||||
MeshComponent *mc=manager->CreateComponent(sm_data->mesh);
|
||||
|
||||
mc->SetLocalMatrix(GetLocalMatrix());
|
||||
|
||||
return mc;
|
||||
}
|
||||
};//class MeshComponent
|
||||
|
||||
COMPONENT_NAMESPACE_END
|
||||
|
Reference in New Issue
Block a user