00001
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef MD2SHAPE_H
00031 #define MD2SHAPE_H
00032
00033 #include <iostream>
00034 #include <stdio.h>
00035 #include <stdlib.h>
00036
00037 # include <string>
00038 # include <vector>
00039 # include <map>
00040
00041 #include "constants.h"
00042 #include "glshape.h"
00043
00044 class MD2Shape : public GLShape {
00045
00046
00047
00048
00049 private:
00050 bool attackEffect;
00051 float div;
00052 char *skin_name;
00053 GLuint textureId;
00054
00055 t3DModel * g_3DModel;
00056 int g_ViewMode;
00057 int dir;
00058 vect3d *vect;
00059
00060
00061 float elapsedTime;
00062 float lastTime;
00063 bool pauseAnimation;
00064 int currentAnim;
00065 int currentFrame;
00066 int animationWaiting;
00067 float angle;
00068
00069 bool debug;
00070
00071
00072 bool playedOnce;
00073
00074 float creatureSpeed;
00075
00076
00077
00078 void AnimateMD2Model();
00079
00080
00081 float ReturnCurrentTime(int nextFrame);
00082
00083 GLShape *debugShape;
00084
00085 MD2Shape(t3DModel * g_3DModel, GLuint textureId, float div,
00086 GLuint texture[], int width, int depth, int height,
00087 char *name, int descriptionGroup,
00088 Uint32 color, Uint8 shapePalIndex=0);
00089
00090 public:
00091 ~MD2Shape();
00092
00093 inline GLShape *getDebugShape() { return debugShape; }
00094
00095 inline void setCreatureSpeed( float n ) { creatureSpeed = n; }
00096
00097 inline void setDebug(bool b) { debug = b; }
00098
00099 inline bool getAttackEffect() { return attackEffect; }
00100 inline void setAttackEffect(bool b) { attackEffect = b; }
00101
00102 void setCurrentAnimation(int numAnim, bool force=false);
00103 inline int getCurrentAnimation() { return currentAnim; }
00104
00105 void draw();
00106 void outline( float r, float g, float b );
00107 void setupToDraw();
00108
00109 void setDir(int dir);
00110 bool drawFirst();
00111
00112 bool drawLater();
00113 void setupBlending();
00114 void endBlending();
00115 inline void setPauseAnimation(bool pause) { pauseAnimation = pause; }
00116 inline GLuint getTextureId() { return textureId; }
00117 inline void setSkinName(char *s) { skin_name = s; }
00118 inline char *getSkinName() { return skin_name; }
00119
00120 inline void setAngle(float angle) {
00121 float a = angle + 90.0f;
00122 if(a >= 360.0f) a -= 360.0f;
00123 this->angle = a;
00124 }
00125
00126
00127
00128 static MD2Shape *createShape(t3DModel *g_3DModel, GLuint textureId, float div,
00129 GLuint texture[], char *name, int descriptionGroup,
00130 Uint32 color, Uint8 shapePalIndex);
00131
00132 protected:
00133 void commonInit(t3DModel * g_3DModel, GLuint textureId, float div);
00134 };
00135
00136 #endif