diff --git a/include/Nazara/Graphics/Model.hpp b/include/Nazara/Graphics/Model.hpp index c46a0c5aa..53458e09d 100644 --- a/include/Nazara/Graphics/Model.hpp +++ b/include/Nazara/Graphics/Model.hpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include struct NAZARA_API NzModelParameters @@ -29,17 +29,17 @@ class NzModel; using NzModelLoader = NzResourceLoader; -class NAZARA_API NzModel : public NzResource, public NzSceneNode +class NAZARA_API NzModel : public NzRenderable, public NzResource { friend NzModelLoader; friend class NzScene; public: NzModel(); - NzModel(const NzModel& model); + NzModel(const NzModel& model) = default; virtual ~NzModel(); - void AddToRenderQueue(NzAbstractRenderQueue* renderQueue) const override; + void AddToRenderQueue(NzAbstractRenderQueue* renderQueue, const NzMatrix4f& transformMatrix) const override; NzModel* Clone() const; NzModel* Create() const; @@ -52,12 +52,8 @@ class NAZARA_API NzModel : public NzResource, public NzSceneNode unsigned int GetSkin() const; unsigned int GetSkinCount() const; NzMesh* GetMesh() const; - nzSceneNodeType GetSceneNodeType() const override; virtual bool IsAnimated() const; - bool IsDrawable() const; - - void InvalidateBoundingVolume(); bool LoadFromFile(const NzString& filePath, const NzModelParameters& params = NzModelParameters()); bool LoadFromMemory(const void* data, std::size_t size, const NzModelParameters& params = NzModelParameters()); @@ -75,7 +71,7 @@ class NAZARA_API NzModel : public NzResource, public NzSceneNode void SetSkin(unsigned int skin); void SetSkinCount(unsigned int skinCount); - NzModel& operator=(const NzModel& node); + NzModel& operator=(const NzModel& node) = default; protected: void MakeBoundingVolume() const override; diff --git a/src/Nazara/Graphics/Model.cpp b/src/Nazara/Graphics/Model.cpp index 4339db399..fb08b4984 100644 --- a/src/Nazara/Graphics/Model.cpp +++ b/src/Nazara/Graphics/Model.cpp @@ -31,27 +31,13 @@ m_skinCount(1) { } -NzModel::NzModel(const NzModel& model) : -NzResource(model), -NzSceneNode(model), -m_materials(model.m_materials), -m_mesh(model.m_mesh), -m_matCount(model.m_matCount), -m_skin(model.m_skin), -m_skinCount(model.m_skinCount) -{ - SetParent(model.GetParent()); -} - NzModel::~NzModel() { Reset(); } -void NzModel::AddToRenderQueue(NzAbstractRenderQueue* renderQueue) const +void NzModel::AddToRenderQueue(NzAbstractRenderQueue* renderQueue, const NzMatrix4f& transformMatrix) const { - const NzMatrix4f& transformMatrix = GetTransformMatrix(); - unsigned int submeshCount = m_mesh->GetSubMeshCount(); for (unsigned int i = 0; i < submeshCount; ++i) { @@ -173,11 +159,6 @@ NzMesh* NzModel::GetMesh() const return m_mesh; } -nzSceneNodeType NzModel::GetSceneNodeType() const -{ - return nzSceneNodeType_Model; -} - unsigned int NzModel::GetSkin() const { return m_skin; @@ -193,17 +174,6 @@ bool NzModel::IsAnimated() const return false; } -bool NzModel::IsDrawable() const -{ - return m_mesh != nullptr && m_mesh->GetSubMeshCount() >= 1; -} - -void NzModel::InvalidateBoundingVolume() -{ - m_boundingVolume.MakeNull(); - m_boundingVolumeUpdated = false; -} - bool NzModel::LoadFromFile(const NzString& filePath, const NzModelParameters& params) { return NzModelLoader::LoadFromFile(this, filePath, params); @@ -389,22 +359,6 @@ void NzModel::SetSkinCount(unsigned int skinCount) m_skinCount = skinCount; } -NzModel& NzModel::operator=(const NzModel& node) -{ - NzResource::operator=(node); - NzSceneNode::operator=(node); - - m_boundingVolume = node.m_boundingVolume; - m_boundingVolumeUpdated = node.m_boundingVolumeUpdated; - m_matCount = node.m_matCount; - m_materials = node.m_materials; - m_mesh = node.m_mesh; - m_skin = node.m_skin; - m_skinCount = node.m_skinCount; - - return *this; -} - void NzModel::MakeBoundingVolume() const { if (m_mesh)