Big 3D update (WIP)
Former-commit-id: 9f55dae0521bded91640a7ea2d223a49a378c97c
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/3D/SceneNode.hpp>
|
||||
#include <Nazara/Core/Updatable.hpp>
|
||||
#include <Nazara/Renderer/Material.hpp>
|
||||
#include <Nazara/Utility/Animation.hpp>
|
||||
#include <Nazara/Utility/Mesh.hpp>
|
||||
@@ -21,18 +22,27 @@ struct NzModelParameters
|
||||
NzMaterialParams materialParams;
|
||||
};
|
||||
|
||||
class NAZARA_API NzModel : public NzSceneNode
|
||||
class NAZARA_API NzModel : public NzSceneNode, public NzUpdatable
|
||||
{
|
||||
friend class NzScene;
|
||||
|
||||
public:
|
||||
NzModel();
|
||||
NzModel(const NzModel& model);
|
||||
~NzModel();
|
||||
|
||||
void AddToRenderQueue(NzRenderQueue& renderQueue) const;
|
||||
void AdvanceAnimation(float elapsedTime);
|
||||
|
||||
void EnableAnimation(bool animation);
|
||||
void EnableDraw(bool draw);
|
||||
|
||||
NzAnimation* GetAnimation() const;
|
||||
const NzAxisAlignedBox& GetAABB() const;
|
||||
const NzBoundingBoxf& GetBoundingBox() const;
|
||||
NzMaterial* GetMaterial(unsigned int matIndex) const;
|
||||
NzMaterial* GetMaterial(unsigned int skinIndex, unsigned int matIndex) const;
|
||||
unsigned int GetMaterialCount() const;
|
||||
unsigned int GetSkin() const;
|
||||
unsigned int GetSkinCount() const;
|
||||
NzMesh* GetMesh() const;
|
||||
nzSceneNodeType GetSceneNodeType() const override;
|
||||
@@ -41,6 +51,10 @@ class NAZARA_API NzModel : public NzSceneNode
|
||||
|
||||
bool HasAnimation() const;
|
||||
|
||||
bool IsAnimationEnabled() const;
|
||||
bool IsDrawEnabled() const;
|
||||
bool IsVisible(const NzFrustumf& frustum) const override;
|
||||
|
||||
bool LoadFromFile(const NzString& meshPath, const NzMeshParams& meshParameters = NzMeshParams(), const NzModelParameters& modelParameters = NzModelParameters());
|
||||
bool LoadFromMemory(const void* data, std::size_t size, const NzMeshParams& meshParameters = NzMeshParams(), const NzModelParameters& modelParameters = NzModelParameters());
|
||||
bool LoadFromStream(NzInputStream& stream, const NzMeshParams& meshParameters = NzMeshParams(), const NzModelParameters& modelParameters = NzModelParameters());
|
||||
@@ -51,22 +65,32 @@ class NAZARA_API NzModel : public NzSceneNode
|
||||
void SetMaterial(unsigned int matIndex, NzMaterial* material);
|
||||
void SetMaterial(unsigned int skinIndex, unsigned int matIndex, NzMaterial* material);
|
||||
void SetMesh(NzMesh* mesh, const NzModelParameters& parameters = NzModelParameters());
|
||||
void SetSkin(unsigned int skin);
|
||||
void SetSkinCount(unsigned int skinCount);
|
||||
bool SetSequence(const NzString& sequenceName);
|
||||
void SetSequence(unsigned int sequenceIndex);
|
||||
|
||||
void Update(float elapsedTime);
|
||||
|
||||
private:
|
||||
void Invalidate() override;
|
||||
void Register() override;
|
||||
void Unregister() override;
|
||||
void Update() override;
|
||||
void UpdateBoundingBox() const;
|
||||
|
||||
std::vector<NzMaterial*> m_materials;
|
||||
mutable NzBoundingBoxf m_boundingBox;
|
||||
NzSkeleton m_skeleton; // Uniquement pour les animations squelettiques
|
||||
NzAnimation* m_animation;
|
||||
NzMesh* m_mesh;
|
||||
const NzSequence* m_currentSequence;
|
||||
bool m_animationEnabled;
|
||||
mutable bool m_boundingBoxUpdated;
|
||||
bool m_drawEnabled;
|
||||
float m_interpolation;
|
||||
unsigned int m_currentFrame;
|
||||
unsigned int m_matCount;
|
||||
unsigned int m_nextFrame;
|
||||
unsigned int m_skin;
|
||||
unsigned int m_skinCount;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user