Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

ObjLevel.h

Go to the documentation of this file.
00001 
00007 #ifndef _OPENGL_OBJLEVEL_H_
00008 #define _OPENGL_OBJLEVEL_H_
00009 
00010 #include "../../Graphics/OpenGL/OpenGLRenderer.h"
00011 #include "../OpenGL/OpenGLObject.h"
00012 #include "../../Game/Level.h"
00013 #include "../../Util/Set.h"
00014 #include "../../Util/String.h"
00015 #include "../../Math/Math.h"
00016 #include "../../Util/MilkShape.h"
00017 
00018 #define MAX_SPAWNPOOLS          16
00019 #define MAX_LEVEL_OBJECTS       32
00020 #define MAX_EXTRAS                      32
00021 
00022 struct Vert {
00023         float x, y, z;
00024 };
00025 
00026 struct LevelObjectPos {
00027         bool alive;
00028         float x, y, z;
00029         int model;
00030 };
00031 
00032 class ObjLevel {
00033         public:
00034                 ObjLevel(LevelInfo &lvl, Renderer *renderer);
00035                 virtual ~ObjLevel();
00036 
00037                 bool load();
00038 
00039                 void draw();
00040                 void drawFloor();
00041                 void drawWalls();
00042                 void drawShadow();
00043                 void drawWater();
00044                 void drawWaterSurface();
00045                 void drawObjects();
00046                 void createVertexBuffer();
00047                 void clearVertexBuffer();
00048 
00049                 bool collission(Vec3 &pos, float radius);
00050 
00051                 Vec3 getSpawnpool();
00052                 Vec3 getExtras();
00053 
00054                 bool isWater(Vec3 pos);
00055                 bool isWall(Vec3 pos);
00056 
00057         private:
00058                 bool isColor(unsigned char *data, int r, int g, int b);
00059                 bool isColor(unsigned char *data, int r, int g);
00060                 bool isColor(unsigned char *data, int r);
00061                 bool isSpawnPool(unsigned char *data);
00062                 bool isWall(unsigned char *data);
00063                 void setVertex(Vertex &v, float tu, float tv, float nx, float ny, float nz, float vx, float vy, float vz);
00064                 Vertex newVertex(float tu, float tv, float nx, float ny, float nz, float vx, float vy, float vz);
00065                 bool vertEqual(Vert &a, Vert &b);
00066 
00067         private:
00068                 OpenGLObject *m_walls;
00069                 Vertex *m_wallVertices;
00070                 OpenGLObject *m_floor;
00071                 Vertex *m_floorVertices;
00072                 OpenGLObject *m_water;
00073                 Vertex *m_waterVertices;
00074                 OpenGLObject *m_waterSurface;
00075                 Vertex *m_waterSurfaceVertices;
00076                 int waterSurfaceIndex;
00077 
00078                 OpenGLObject *m_shadow;
00079                 Vert *m_shadowVertices;
00080 
00081                 LevelInfo *mp_lvl;
00082 
00083                 Renderer *mp_renderer;
00084 
00085                 TextureID m_texWall;
00086                 TextureID m_texFloor;
00087                 TextureID m_texWater;
00088                 TextureID m_texWaterSurface;
00089 
00090                 Vec3 m_spawnpools[MAX_SPAWNPOOLS];
00091                 unsigned int m_nSpawnpools;
00092 
00093                 Vec3 m_extras[MAX_EXTRAS];
00094                 unsigned int m_nExtras;
00095 
00096                 int                             m_numObjects;
00097                 LevelObjectPos  m_objects[MAX_LEVEL_OBJECTS];
00098                 MilkShape               m_models[LVL_MAX_MODELS];
00099 };
00100 
00101 #endif

Generated on Sun Jun 5 15:47:04 2005 for Defacto by  doxygen 1.4.3