-
Notifications
You must be signed in to change notification settings - Fork 2
/
Ball.h
52 lines (42 loc) · 1.14 KB
/
Ball.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
/*
* Caleb Everett
* graphics final
*
* header file for Ball class
*/
#if !defined(BALL_H)
#define BALL_H
#ifdef __APPLE__
# include <GLUT/glut.h>
#else
# include <GL/glut.h>
#endif
#include <btBulletDynamicsCommon.h>
#include <iostream>
#include <math.h>
#define PI 3.14
using namespace std;
class Ball
{
private:
// bullet objects
btCollisionShape *shape;
btMotionState *motionState;
btRigidBody *rigidBody;
btScalar ballMatrix[16];
// color, type and position of the ball
int color;
int type;
float x, y, z; // the original position of the ball
public:
Ball(); // defaults to 0, 0, 0, BLACK, STRIPE
Ball(float x, float y, float z, int color, int type);
void add(btDiscreteDynamicsWorld *dynamicsWorld); // add the ball to the physics world
void draw(); // draw the ball
void update(); // update the balls physical properties
void reset(); // Reset the ball to it's initial position
btRigidBody* getBody(); // Return the rigid body, used to get phyiscal properties
btTransform getTrans(); // Return more specific phyisc properties than getBody()
~Ball(); // deconstructor, empty, could not debug
};
#endif