-
Notifications
You must be signed in to change notification settings - Fork 1
/
GameObject.hpp
68 lines (57 loc) · 1.38 KB
/
GameObject.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef GAMEOBJECT_HPP_
#define GAMEOBJECT_HPP_
#include <iostream>
#include <vector>
#include <glm/glm.hpp>
#include <bullet/btBulletDynamicsCommon.h>
#include "Graphics/model.hpp"
#include "Graphics/Texture.hpp"
#include "stdint.h"
#define GOMAGIC "Game"
class GameObject{
public:
std::string magic;
std::string modelName;
std::string tag;
uint32_t id;
bool moved;
bool scaled;
bool rotated;
Model *model;
glm::vec3 position;
glm::vec3 rotation;
glm::vec3 scale;
glm::vec3 lookat;
glm::vec3 right;
std::string currentAnimation;
std::vector<glm::mat4> outframe;
std::vector<Texture> textures;
float aTime;
//Don't forget to delete pointers
btScalar mass;
btRigidBody *body;
btMotionState *motion;
btQuaternion rot;
btVector3 originOffset = btVector3(0,0,0); //For primative mesh types
//variables for checking if the object has moved
glm::vec3 oldPos;
btQuaternion oldRot;
bool visible, animate, hasAnimation, castShadow;
GameObject();
~GameObject();
void setModel(Model *model);
void move(float amount);
void strafe(float amount);
void turn(glm::vec2 amount);
void updateLookat();
void createTriangleRigidBody();
void createConvexRigidBody();
void createCubeRigidBody();
void createCubeRigidBody(extents e);
void createSphereRigidBody(float radius);
void updateMass(float mass);
private:
btTriangleMesh *trimesh;
btCollisionShape *collisionshape;
};
#endif