Added (move) assignement operator to Model

Former-commit-id: eee1b92633656e47454218583f8e8bdabcddc157
This commit is contained in:
Lynix 2013-03-23 22:49:24 +01:00
parent 8f21a75c43
commit 7ddff94a30
2 changed files with 56 additions and 2 deletions

View File

@ -30,6 +30,7 @@ class NAZARA_API NzModel : public NzSceneNode, public NzUpdatable
public: public:
NzModel(); NzModel();
NzModel(const NzModel& model); NzModel(const NzModel& model);
NzModel(NzModel&& model);
~NzModel(); ~NzModel();
void AddToRenderQueue(NzRenderQueue& renderQueue) const; void AddToRenderQueue(NzRenderQueue& renderQueue) const;
@ -65,10 +66,13 @@ class NAZARA_API NzModel : public NzSceneNode, public NzUpdatable
void SetMaterial(unsigned int matIndex, NzMaterial* material); void SetMaterial(unsigned int matIndex, NzMaterial* material);
void SetMaterial(unsigned int skinIndex, unsigned int matIndex, NzMaterial* material); void SetMaterial(unsigned int skinIndex, unsigned int matIndex, NzMaterial* material);
void SetMesh(NzMesh* mesh, const NzModelParameters& parameters = NzModelParameters()); void SetMesh(NzMesh* mesh, const NzModelParameters& parameters = NzModelParameters());
void SetSkin(unsigned int skin);
void SetSkinCount(unsigned int skinCount);
bool SetSequence(const NzString& sequenceName); bool SetSequence(const NzString& sequenceName);
void SetSequence(unsigned int sequenceIndex); void SetSequence(unsigned int sequenceIndex);
void SetSkin(unsigned int skin);
void SetSkinCount(unsigned int skinCount);
NzModel& operator=(const NzModel& node);
NzModel& operator=(NzModel&& node);
private: private:
void Invalidate() override; void Invalidate() override;

View File

@ -533,6 +533,56 @@ void NzModel::SetSkinCount(unsigned int skinCount)
m_skinCount = skinCount; m_skinCount = skinCount;
} }
NzModel& NzModel::operator=(const NzModel& node)
{
NzSceneNode::operator=(node);
m_animation = node.m_animation;
m_animationEnabled = node.m_animationEnabled;
m_boundingBox = node.m_boundingBox;
m_boundingBoxUpdated = node.m_boundingBoxUpdated;
m_currentFrame = node.m_currentFrame;
m_currentSequence = node.m_currentSequence;
m_drawEnabled = node.m_drawEnabled;
m_interpolation = node.m_interpolation;
m_matCount = node.m_matCount;
m_materials = node.m_materials;
m_mesh = node.m_mesh;
m_nextFrame = node.m_nextFrame;
m_skin = node.m_skin;
m_skinCount = node.m_skinCount;
if (m_mesh->GetAnimationType() == nzAnimationType_Skeletal)
m_skeleton = node.m_skeleton;
return *this;
}
NzModel& NzModel::operator=(NzModel&& node)
{
NzSceneNode::operator=(node);
m_animation = std::move(node.m_animation);
m_animationEnabled = node.m_animationEnabled;
m_boundingBox = node.m_boundingBox;
m_boundingBoxUpdated = node.m_boundingBoxUpdated;
m_currentFrame = node.m_currentFrame;
m_currentSequence = node.m_currentSequence;
m_drawEnabled = node.m_drawEnabled;
m_interpolation = node.m_interpolation;
m_matCount = node.m_matCount;
m_materials = std::move(node.m_materials);
m_mesh = std::move(node.m_mesh);
m_nextFrame = node.m_nextFrame;
m_skin = node.m_skin;
m_skinCount = node.m_skinCount;
if (m_mesh->GetAnimationType() == nzAnimationType_Skeletal)
m_skeleton = std::move(node.m_skeleton);
return *this;
}
void NzModel::Invalidate() void NzModel::Invalidate()
{ {
NzSceneNode::Invalidate(); NzSceneNode::Invalidate();