-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBall.h
67 lines (50 loc) · 1.59 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//
// Ball.h
// game
//
// Created by Xinyuan Huang on 10/19/13.
//
//
#ifndef __game__Ball__
#define __game__Ball__
#include <zenilib.h>
#include <Zeni/Collision.h>
#include <Zeni/Model.h>
#include <Zeni/Quaternion.h>
#include <Zeni/Sound.h>
#include <Zeni/Vector3f.h>
class Ball {
public:
Ball(const Zeni::Point3f ¢er_ = Zeni::Point3f(0.0f, 0.0f, 0.0f),
const float &radius_ = 15.0,
const Zeni::Vector3f &scale_ = Zeni::Vector3f(1.0f, 1.0f, 1.0f),
const Zeni::Quaternion &rotation_ = Zeni::Quaternion::Axis_Angle(Zeni::Vector3f(0.0f, 0.0f, 1.0f), 0.0f));
Ball(const Ball &rhs) = delete;
Ball & operator=(const Ball &rhs) = delete;
~Ball();
void render();
void move_to(const Zeni::Point3f &pos);
void bounce(const Zeni::Vector3f &normal);
void collide();
const Zeni::Collision::Sphere & get_body() const {return m_body;}
Zeni::Vector3f get_velocity() const {return m_velocity;}
void set_velocity(const Zeni::Vector3f &vel) {m_velocity = vel;}
void reset(const Zeni::Point3f &pos);
private:
void create_body();
// Level 1
static Zeni::Model * m_model;
static unsigned long m_instance_count;
// Level 2
Zeni::Point3f m_center;
float m_radius;
Zeni::Vector3f m_scale;
Zeni::Quaternion m_rotation;
//Zeni::Vector3f m_origin;
Zeni::Vector3f m_velocity;
// Level 3
Zeni::Collision::Sphere m_body; // not motion so much as collision
// Level 4
// A stationary Crate has no controls
};
#endif /* defined(__game__Ball__) */