-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWorldModel.h
91 lines (71 loc) · 2.76 KB
/
WorldModel.h
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#ifndef _WorldModel_H_
#define _WorldModel_H_
// My libraries
#include "Model.h"
#include "Collider.h"
#include "SphereCollider.h"
#include "BoxCollider.h"
// STL
#include <memory>
// GLM
#include "GLInclude.h"
using namespace std;
////////////////////////////////////////////////////////////////////////////////
/// @class Worldmodel class for overlying model data
////////////////////////////////////////////////////////////////////////////////
class WorldModel{
public:
////////////////////////////////////////////////////////////////////////////
/// @brief Constructor
/// @param ifs Stream to read in model data
///
/// Constructor to make world model and maintain organization
WorldModel(std::ifstream& ifs);
////////////////////////////////////////////////////////////////////////////
/// @brief Intialization for model and data
void Initialize();
////////////////////////////////////////////////////////////////////////////
/// @brief Update model
/// @param _dt Delta time
/// @param _models Models
void Update(float _dt,
const std::vector<std::unique_ptr<WorldModel>>& _models);
////////////////////////////////////////////////////////////////////////////
/// @brief Drawing for models
/// @param _program Shader program id
/// @param _projection Camera projection
/// @param _view Camera view matrix
void Draw(GLuint _program, const glm::mat4& _projection,
const glm::mat4& _view);
////////////////////////////////////////////////////////////////////////////
/// @brief Output data for debugging
void Print_Data();
////////////////////////////////////////////////////////////////////////////
/// @brief Gets rotation angle
float getAngle() const;
////////////////////////////////////////////////////////////////////////////
/// @brief Gets physicsOn
bool getPhysicsOn();
////////////////////////////////////////////////////////////////////////////
// Collider
// Collider collider; //< Collider
private:
unique_ptr<Model> model; //< Model
glm::vec3 translation; //< Location in 3d space
glm::vec3 scale; //< Scale of object
float angle; //< Rotation angle
glm::vec3 rotation_axis; //< Rotation Axis
glm::vec3 color; //< World color
// Dedicated physics
void Physics(float _dt); //< Calculates physics
bool CollidesWith(const std::vector<std::unique_ptr<WorldModel>>& _models);
bool physicsOn = false; //< Physics on or off
int mass = 0; //< Mass of object
glm::vec3 velocity = glm::vec3(0, 0, 0); //< Physics velocity
BoxCollider collider = BoxCollider();
// Constants
//
// Note: all data is in metric system ex: 9.8m/s^2 = gravity
const float gravity = 9.8; //< Force of gravity
};
#endif