-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTransformObject.h
56 lines (44 loc) · 1.47 KB
/
TransformObject.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
//
// Created by Parth on 12/20/2019.
//
#ifndef PHYSICS_ENGINE_TRANSFORMOBJECT_H
#define PHYSICS_ENGINE_TRANSFORMOBJECT_H
#include "polygons/Polygon.h"
#include "polygons/Circle.h"
#include "polygons/Rectangle.h"
#include "shaders/Shader.h"
class TransformObject {
private:
float position[2] = {0.0, 0.0};
float velocity[2] = {0.0, 0.0};
float acceleration[2] = {0.0, 0.0};
float centerOfMass[2];
Polygon* polygon;
void calculateCenterOfMass();
public:
float rotation = 0.0;
float angularVelocity = 0.0;
float angularAcceleration = 0.0;
float mass = -1.0;
float elasticity;
bool hasPhysics;
Shader shader;
//TransformObject();
TransformObject(Shader objectShader);
TransformObject(Polygon* shape, Shader objectShader);
void setRotation(float angle);
void setPosition(float x, float y);
float* getPosition();
void setVelocity(float x, float y);
float* getVelocity();
void setAcceleration(float x, float y);
float* getAcceleration();
Polygon* getPolygon();
void addPhysics();
void addForce(const float force[2]);
void addForceAtPosition(float forcePosition[2], float force[2]);
void addTorque(float torquePosition[2], float torque[2]);
void setCenterOfMass(float x, float y);
float* getCenterOfMass();
};
#endif //PHYSICS_ENGINE_TRANSFORMOBJECT_H