35class Object :
public ObjectNode {
40 void processCollisions(Object*);
43 virtual void draw(Object*) = 0;
44 virtual void drawOutline(Object*) = 0;
45 virtual void drawShadow(
Vector*) {}
47 virtual void handleCollision(Object*) = 0;
49 virtual void update(
Vector*) = 0;
50 virtual void animate(
const float&, Object*);
53 virtual void setHeightFromTerrain(
Terrain *temp,
const float &offset){}
55 virtual void buildLuaObjectTable(lua_State *L);
56 virtual void transferLuaObjectTable(lua_State *L);
58 virtual void printTypeName() = 0;
61 void showCollisionBox();
62 void showControlTriangle();
64 float calcTriangleCenter(
const float& p1,
const float& p2,
const float& p3);
70 void loadScript(
const std::string&, lua_State* luaState);
71 void animateScript(
const float&);
74 void setPosition(
const GLfloat&,
const GLfloat&,
const GLfloat&);
75 void setPosition(
const Vector&);
76 void setRotationAxis(
const GLfloat&,
const GLfloat&,
const GLfloat&,
const GLfloat&);
77 void setRotationAxis(
const Vector&,
const GLfloat&);
78 void setRotationEuler(
const GLfloat&,
const GLfloat&,
const GLfloat&);
79 void setRotationEuler(
const Vector&);
81 void setVelocity(
const GLfloat&,
const GLfloat&,
const GLfloat&);
82 void setVelocity(
const Vector&);
83 void setRotationVelocity(
const GLfloat&,
const GLfloat&,
const GLfloat&);
84 void setRotationVelocity(
const Vector&);
86 void setScale(
const GLfloat&,
const GLfloat&,
const GLfloat&);
87 void setScale(
const Vector&);
88 void setScaleRate(
const GLfloat&,
const GLfloat&,
const GLfloat&);
89 void setScaleRate(
const Vector&);
91 void setDrawEnabled(
const bool &isDrawEnabled) { isDrawEnabled_ = isDrawEnabled; }
92 bool getDrawEnabled() {
return isDrawEnabled_; }
94 bool getInView() {
return isInView_; }
95 void setParticleSystem(
const int&);
97 float getScriptValue(
const char* s) {
101 lua_getglobal(L_, s);
102 value = (float)lua_tonumber(L_, -1);
109 void setScriptValue(
const char* s,
const float &value) {
111 lua_pushnumber(L_, value);
112 lua_setglobal(L_, s);
117 void setState(
const unsigned char&);
118 void setScript(
const std::string&);
120 void setSpeed(
const GLfloat&,
const GLfloat&,
const GLfloat&);
121 void setSpeed(
const Vector&);
123 void setCollisionDetectionEnabled(
const bool &isCollisionDetectionEnabled) {
124 isCollisionDetectionEnabled_ = isCollisionDetectionEnabled;
127 bool getCollisionDetectionEnabled() {
return isCollisionDetectionEnabled_; }
129 void setActive(
const bool &new_active) { active_ = new_active; }
130 bool getActive() {
return active_; }
132 Vector getPosition() {
return position_; }
133 Vector getVelocity() {
return velocity_; }
134 Vector getRotationVelocity() {
return rotationVelocity_; }
135 Vector getScaleRate() {
return scaleRate_; }
136 Vector getSpeed() {
return speed_; }
138 bool isRotationChanged() {
return rotationChanged_; }
139 void setRotationChanged(
const bool &rotationChanged_l) { rotationChanged_ = rotationChanged_l; }
140 Quaternion getRotation() {
return rotation_; }
141 void setRotation(
const Quaternion &rotation) { rotation_ = rotation; rotationChanged_ =
true;}
142 Vector getDirection() {
return direction_; }
143 Vector getUp() {
return up_; }
144 Vector getScale() {
return scale_; }
146 Quaternion getRInterpStart() {
return rInterpStart_; }
147 Quaternion getRInterpEnd() {
return rInterpEnd_; }
148 void setRInterpStart(
const Quaternion &rInterpStart_l) { rInterpStart_ = rInterpStart_l;}
149 void setRInterpEnd(
const Quaternion &rInterpEnd_l) { rInterpEnd_= rInterpEnd_l;}
151 bool isInterpolationEnabled() {
return isInterpolationEnabled_; }
152 void setIsInterpolationEnabled(
const bool &isInterpolationEnabled_l) {
153 isInterpolationEnabled_ = isInterpolationEnabled_l;
156 float getValInterpBegin() {
return valInterpBegin_; }
157 float getValInterpCurrent() {
return valInterpCurrent_; }
158 float getValInterpEnd() {
return valInterpEnd_; }
160 void setValInterpBegin(
const float &valInterpBegin) { valInterpBegin_ = valInterpBegin; }
161 void setValInterpCurrent(
const float &valInterpCurrent) { valInterpCurrent_ = valInterpCurrent; }
162 void setValInterpEnd(
const float &valInterpEnd) { valInterpEnd_ = valInterpEnd; }
164 void setSuspendTime(
const float &time) { suspendTime_ = time; }
167 void setState(
const int &state_l) {state_ = state_l; }
168 int getState() {
return state_; }
170 void setScaleChanged(
const bool &scaleChanged_l) { scaleChanged_ = scaleChanged_l; }
172 void setIsAlwaysLit(
const bool &isAlwaysLit) { isAlwaysLit_ = isAlwaysLit; }
173 bool getIsAlwaysLit() {
return isAlwaysLit_; }
175 void setTypeId (
const int &type_id) { typeId_ = type_id; }
176 int getTypeId() {
return typeId_; }
178 Sphere getBoundingSphere() {
return boundingSphere_; }
180 std::string getScriptName() {
return scriptName_; }
182 Vector getOrth() {
return orth_; }
184 bool getEnableSphereTest() {
return enableSphereTest_; }
187 return getActive() &&
193 void setGameLevelId(
const unsigned int& gameLevelId) { gameLevelId_ = gameLevelId; }
194 unsigned int getGameLevelId() {
return gameLevelId_; }
196 static unsigned int textureIds[MAX_TEXTURES];
197 static std::map <std::string, unsigned int> textureHash;
202 Quaternion rotation_;
205 Vector baseDirection_;
213 Vector rotationVelocity_;
217 Vector collisionBox_[2];
218 Vector controlPoints_[3];
219 Sphere boundingSphere_;
222 unsigned char state_;
228 bool isCollisionDetectionEnabled_;
231 Quaternion rInterpStart_;
232 Quaternion rInterpEnd_;
234 float valInterpBegin_, valInterpCurrent_, valInterpEnd_;
235 bool isInterpolationEnabled_;
239 std::string scriptName_;
244 ParticleSystem *particleSystem_;
247 unsigned int gameLevelId_;
251 bool rotationChanged_;
255 bool enableSphereTest_;
258 void traverseAndCopyLuaTable(lua_State*, lua_State*,
const int&);
259 void copyLuaTableKey(lua_State*, lua_State*);
Base class from which all concrete particle systems are derived.