-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel.h
115 lines (94 loc) · 2.63 KB
/
model.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#ifndef MODEL_H
#define MODEL_H
#include <cmath>
#include "vec.h"
#include "properties.h"
/** Forward-declare ICamera because it's used in Model yet is a Model. */
class ICamera;
/**
* Forward-declare ParticleSystem because it's used in Model yet it's a
* Model.
*/
class ParticleSystem;
/**
* You will extend this class to create your model.
*/
class Model {
protected:
/**
* A GroupProperty containing your model's name and a list of its
* properties. Modeler will obtain this object using the getProperties()
* method, so it can link controls to your properties.
*/
GroupProperty properties;
public:
Model(const char* name);
/**
* This method returns the model's list of properties.
*/
GroupProperty* getProperties();
/**
* Override this method to draw your model to the current OpenGL context.
*/
virtual void draw();
/**
* (Optional) Override this method to update your animation counters.
*/
virtual void tick();
/**
* Override this method to load your textures, shaders, and anything else
* that requires an OpenGL context.
*/
virtual void load();
/**
* Override this method to return the camera you want to look through.
*/
virtual ICamera* getCamera();
/**
* Override this method to return the particle system you want to control.
*/
virtual ParticleSystem* getParticleSystem();
};
/**
* This class is abstract. Don't mess with it.
*/
class Light : public Model {
protected:
GLuint lightNumber;
public:
RGBProperty diffuse, specular, ambient;
BooleanProperty isOn;
RangeProperty lightX, lightY, lightZ;
Light(const char* name, GLuint lightNumber,
float x = 0, float y = 0, float z = 0,
float dr = 1, float dg = 1, float db = 1,
float sr = 1, float sg = 1, float sb = 1,
float ar = .1, float ag = .1, float ab = .1);
void draw(bool directional);
};
/**
* A point light.
*/
class PointLight : public Light {
public:
RangeProperty attenA, attenB, attenC;
PointLight(const char* name, GLuint lightNumber,
float x = 0, float y = 0, float z = 0,
float dr = 1, float dg = 1, float db = 1,
float sr = 1, float sg = 1, float sb = 1,
float ar = .1, float ag = .1, float ab = .1,
float attA = .5, float attB = .7, float attC = 0);
void draw();
};
/**
* A directional light.
*/
class DirectionalLight : public Light {
public:
DirectionalLight(const char* name, GLuint lightNumber,
float x = 0, float y = 0, float z = 0,
float dr = 1, float dg = 1, float db = 1,
float sr = 1, float sg = 1, float sb = 1);
void draw();
};
#endif // MODEL_H