#ifndef MESHNODE_H #define MESHNODE_H #include "graphicalnode.h" #include "glm/mat4x4.hpp" #include "SparrowRenderer/scene.h" class btRigidBody; class btIndexedMesh; class btRigidBody; /** * @brief The MeshNode class holds a mesh */ class MeshNode : public GraphicalNode { protected: GeometryNode m_geometry; // physics btRigidBody *m_rigidBody; public: // WARNING ! this class doesn't handle the destruction of the rendered mesh and the eventually generated rigidbody // this behaviour allows the use of the same meshes in multiple nodes MeshNode(Mesh* mesh, bool visible = true) : GraphicalNode(visible), m_geometry(mesh, glm::mat4()), m_rigidBody(nullptr) {} virtual void setSceneTree(SceneTree* tree); virtual void update(); void setDepth(float depth); virtual GeometryNode* getGeometryNode() { return &m_geometry; } // this creates a new rigidbody, you must handle its destruction manually btRigidBody* buildStaticCollider(); }; #endif // MESHNODE_H