SparrowEngine/src/scene/meshnode.h

43 lines
996 B
C++

#ifndef MESHNODE_H
#define MESHNODE_H
#include "graphicalnode.h"
#include "glm/mat4x4.hpp"
#include "scene.h"
class btRigidBody;
class btIndexedMesh;
/**
* @brief The MeshNode class holds a mesh
*/
class MeshNode : public GraphicalNode
{
GeometryNode m_geometry;
btIndexedMesh *bulletMesh;
public:
// temp
glm::mat4 m_movement;
glm::mat4 m_acceleration;
MeshNode(Mesh* mesh, bool visible = true) : GraphicalNode(visible), m_geometry(mesh, glm::mat4()), bulletMesh(nullptr) {}
virtual void update()
{
m_movement = m_acceleration * m_movement;
m_geometry.modelMatrix = m_movement * m_geometry.modelMatrix;
}
void setTransform(const glm::mat4 &transform) { m_geometry.modelMatrix = transform; }
const glm::mat4& getTransform() { return m_geometry.modelMatrix; }
void setDepth(float depth);
virtual GeometryNode* getGeometryNode() { return &m_geometry; }
btRigidBody* buildStaticCollider();
};
#endif // MESHNODE_H