46 lines
976 B
C++
46 lines
976 B
C++
#ifndef GIBGENERATORNODE_H
|
|
#define GIBGENERATORNODE_H
|
|
|
|
#include "scenenode.h"
|
|
#include <glm/vec3.hpp>
|
|
#include <BulletDynamics/Dynamics/btRigidBody.h>
|
|
|
|
class btCollisionShape;
|
|
class btRigidBody;
|
|
class SceneNode;
|
|
|
|
class GibGeneratorNode : public SceneNode
|
|
{
|
|
struct Gib
|
|
{
|
|
btRigidBody* body;
|
|
SceneNode* graphics;
|
|
unsigned int expiration;
|
|
|
|
Gib(btRigidBody* b, SceneNode* g, unsigned int e) :
|
|
body(b),
|
|
graphics(g),
|
|
expiration(e)
|
|
{}
|
|
|
|
~Gib()
|
|
{
|
|
delete body;
|
|
}
|
|
};
|
|
|
|
std::vector<Gib*> m_gibs;
|
|
|
|
public:
|
|
void createGib(SceneNode* graphicalPart,
|
|
btCollisionShape *physicsShape,
|
|
float masses,
|
|
const glm::vec3 &pos = glm::vec3(0),
|
|
const glm::vec3 &velocity = glm::vec3(0),
|
|
unsigned int lifeSpan = 5000);
|
|
|
|
virtual void update();
|
|
};
|
|
|
|
#endif // GIBGENERATORNODE_H
|