18 #include "constants.h" 21 #include "lua5.1/lua.h" 22 #include "lua5.1/lualib.h" 23 #include "lua5.1/lauxlib.h" 30 #define MAX_TEXTURES 32 40 void processCollisions(
Object*);
43 virtual void draw(
Object*) = 0;
44 virtual void drawOutline(
Object*) = 0;
45 virtual void handleCollision(
Object*) = 0;
46 virtual void update(
Vector*) = 0;
47 virtual void printTypeName() = 0;
48 virtual void drawShadow(
Vector*) {}
49 virtual void animate(
const float&,
Object*);
51 virtual void setHeightFromTerrain(
Terrain *temp,
const float &offset){}
52 virtual void buildLuaObjectTable(lua_State *L);
53 virtual void transferLuaObjectTable(lua_State *L);
56 void showCollisionBox();
57 void showControlTriangle();
59 float calcTriangleCenter(
const float&,
const float&,
const float&);
65 void loadScript(
const std::string&, lua_State* luaState);
66 void animateScript(
const float&);
69 void setPosition(
const GLfloat&,
const GLfloat&,
const GLfloat&);
70 void setPosition(
const Vector&);
71 void setRotationAxis(
const GLfloat&,
const GLfloat&,
const GLfloat&,
const GLfloat&);
72 void setRotationAxis(
const Vector&,
const GLfloat&);
73 void setRotationEuler(
const GLfloat&,
const GLfloat&,
const GLfloat&);
74 void setRotationEuler(
const Vector&);
76 void setVelocity(
const GLfloat&,
const GLfloat&,
const GLfloat&);
77 void setVelocity(
const Vector&);
78 void setRotationVelocity(
const GLfloat&,
const GLfloat&,
const GLfloat&);
79 void setRotationVelocity(
const Vector&);
81 void setScale(
const GLfloat&,
const GLfloat&,
const GLfloat&);
82 void setScale(
const Vector&);
83 void setScaleRate(
const GLfloat&,
const GLfloat&,
const GLfloat&);
84 void setScaleRate(
const Vector&);
86 void setDrawEnabled(
const bool &isDrawEnabled) { isDrawEnabled_ = isDrawEnabled; }
87 bool getDrawEnabled() {
return isDrawEnabled_; }
89 bool getInView() {
return isInView_; }
90 void setParticleSystem(
const int&);
92 float getScriptValue(
const char* s) {
97 value = (float)lua_tonumber(L_, -1);
104 void setScriptValue(
const char* s,
const float &value) {
106 lua_pushnumber(L_, value);
107 lua_setglobal(L_, s);
111 void setState(
const unsigned char&);
112 void setScript(
const std::string&);
114 void setSpeed(
const GLfloat&,
const GLfloat&,
const GLfloat&);
115 void setSpeed(
const Vector&);
117 void setCollisionDetectionEnabled(
const bool &isCollisionDetectionEnabled) {
118 isCollisionDetectionEnabled_ = isCollisionDetectionEnabled;
121 bool getCollisionDetectionEnabled() {
return isCollisionDetectionEnabled_; }
123 void setActive(
const bool &new_active) { active_ = new_active; }
124 bool getActive() {
return active_; }
126 Vector getPosition() {
return position_; }
127 Vector getVelocity() {
return velocity_; }
128 Vector getRotationVelocity() {
return rotationVelocity_; }
129 Vector getScaleRate() {
return scaleRate_; }
130 Vector getSpeed() {
return speed_; }
132 bool isRotationChanged() {
return rotationChanged_; }
133 void setRotationChanged(
const bool &rotationChanged_l) { rotationChanged_ = rotationChanged_l; }
134 Quaternion getRotation() {
return rotation_; }
135 void setRotation(
const Quaternion &rotation) { rotation_ = rotation; rotationChanged_ =
true;}
136 Vector getDirection() {
return direction_; }
137 Vector getUp() {
return up_; }
138 Vector getScale() {
return scale_; }
140 Quaternion getRInterpStart() {
return rInterpStart_; }
141 Quaternion getRInterpEnd() {
return rInterpEnd_; }
142 void setRInterpStart(
const Quaternion &rInterpStart_l) { rInterpStart_ = rInterpStart_l;}
143 void setRInterpEnd(
const Quaternion &rInterpEnd_l) { rInterpEnd_= rInterpEnd_l;}
145 bool isInterpolationEnabled() {
return isInterpolationEnabled_; }
146 void setIsInterpolationEnabled(
const bool &isInterpolationEnabled_l) {
147 isInterpolationEnabled_ = isInterpolationEnabled_l;
150 float getValInterpBegin() {
return valInterpBegin_; }
151 float getValInterpCurrent() {
return valInterpCurrent_; }
152 float getValInterpEnd() {
return valInterpEnd_; }
154 void setValInterpBegin(
const float &valInterpBegin) { valInterpBegin_ = valInterpBegin; }
155 void setValInterpCurrent(
const float &valInterpCurrent) { valInterpCurrent_ = valInterpCurrent; }
156 void setValInterpEnd(
const float &valInterpEnd) { valInterpEnd_ = valInterpEnd; }
158 void setSuspendTime(
const float &time) { suspendTime_ = time; }
160 void setState(
const int &state_l) {state_ = state_l; }
161 int getState() {
return state_; }
163 void setScaleChanged(
const bool &scaleChanged_l) { scaleChanged_ = scaleChanged_l; }
165 void setIsAlwaysLit(
const bool &isAlwaysLit) { isAlwaysLit_ = isAlwaysLit; }
166 bool getIsAlwaysLit() {
return isAlwaysLit_; }
168 void setTypeId (
const int &type_id) { typeId_ = type_id; }
169 int getTypeId() {
return typeId_; }
171 Sphere getBoundingSphere() {
return boundingSphere_; }
173 std::string getScriptName() {
return scriptName_; }
175 Vector getOrth() {
return orth_; }
177 bool getEnableSphereTest() {
return enableSphereTest_; }
180 return getActive() &&
186 void setGameLevelId(
const unsigned int& gameLevelId) { gameLevelId_ = gameLevelId; }
187 unsigned int getGameLevelId() {
return gameLevelId_; }
189 static unsigned int textureIds[MAX_TEXTURES];
190 static std::map <std::string, unsigned int> textureHash;
215 unsigned char state_;
221 bool isCollisionDetectionEnabled_;
227 float valInterpBegin_, valInterpCurrent_, valInterpEnd_;
228 bool isInterpolationEnabled_;
232 std::string scriptName_;
240 unsigned int gameLevelId_;
244 bool rotationChanged_;
248 bool enableSphereTest_;
251 void traverseAndCopyLuaTable(lua_State*, lua_State*,
const int&);
252 void copyLuaTableKey(lua_State*, lua_State*);
Definition: Quaternion.h:14
representation of a quaternion.
represent and operate on a sphere.
Definition: ParticleSystem.h:23
A game object link in the game list linked list.
Definition: ObjectNode.h:11
Base class from which all concrete particle systems are derived.