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

ObjLevel Class Reference

#include <ObjLevel.h>

List of all members.

Public Member Functions

 ObjLevel (LevelInfo &lvl, Renderer *renderer)
virtual ~ObjLevel ()
bool load ()
void draw ()
void drawFloor ()
void drawWalls ()
void drawShadow ()
void drawWater ()
void drawWaterSurface ()
void drawObjects ()
void createVertexBuffer ()
void clearVertexBuffer ()
bool collission (Vec3 &pos, float radius)
Vec3 getSpawnpool ()
Vec3 getExtras ()
bool isWater (Vec3 pos)
bool isWall (Vec3 pos)

Private Member Functions

bool isColor (unsigned char *data, int r, int g, int b)
bool isColor (unsigned char *data, int r, int g)
bool isColor (unsigned char *data, int r)
bool isSpawnPool (unsigned char *data)
bool isWall (unsigned char *data)
void setVertex (Vertex &v, float tu, float tv, float nx, float ny, float nz, float vx, float vy, float vz)
Vertex newVertex (float tu, float tv, float nx, float ny, float nz, float vx, float vy, float vz)
bool vertEqual (Vert &a, Vert &b)

Private Attributes

OpenGLObjectm_walls
Vertexm_wallVertices
OpenGLObjectm_floor
Vertexm_floorVertices
OpenGLObjectm_water
Vertexm_waterVertices
OpenGLObjectm_waterSurface
Vertexm_waterSurfaceVertices
int waterSurfaceIndex
OpenGLObjectm_shadow
Vertm_shadowVertices
LevelInfomp_lvl
Renderermp_renderer
TextureID m_texWall
TextureID m_texFloor
TextureID m_texWater
TextureID m_texWaterSurface
Vec3 m_spawnpools [MAX_SPAWNPOOLS]
unsigned int m_nSpawnpools
Vec3 m_extras [MAX_EXTRAS]
unsigned int m_nExtras
int m_numObjects
LevelObjectPos m_objects [MAX_LEVEL_OBJECTS]
MilkShape m_models [LVL_MAX_MODELS]


Detailed Description

Definition at line 32 of file ObjLevel.h.


Constructor & Destructor Documentation

ObjLevel::ObjLevel LevelInfo lvl,
Renderer renderer
 

ObjLevel.cpp

Author: Petter Alstermark, petter@alstermark.com

Definition at line 9 of file ObjLevel.cpp.

References m_floorVertices, m_nSpawnpools, m_shadowVertices, m_wallVertices, m_waterSurface, m_waterVertices, mp_lvl, and mp_renderer.

ObjLevel::~ObjLevel  )  [virtual]
 

Definition at line 553 of file ObjLevel.cpp.

References MilkShape::clear(), Renderer::deleteTexture(), LOG_SUCCESS, m_floor, m_floorVertices, m_models, m_shadow, m_shadowVertices, m_texFloor, m_texWall, m_texWater, m_texWaterSurface, m_walls, m_wallVertices, m_water, m_waterVertices, and mp_renderer.

Here is the call graph for this function:


Member Function Documentation

void ObjLevel::clearVertexBuffer  ) 
 

Definition at line 693 of file ObjLevel.cpp.

References OpenGLObject::clearVertexBuffer(), m_floor, m_shadow, m_walls, and m_water.

Here is the call graph for this function:

bool ObjLevel::collission Vec3 pos,
float  radius
 

Definition at line 719 of file ObjLevel.cpp.

References LevelInfo::data, int(), isColor(), mp_lvl, round, LevelInfo::width, Vec3::x, and Vec3::z.

Referenced by Play::bot(), Play::drawProjectiles(), Play::update(), and Granade::update().

Here is the call graph for this function:

void ObjLevel::createVertexBuffer  ) 
 

Definition at line 685 of file ObjLevel.cpp.

References OpenGLObject::createVertexBuffer(), m_floor, m_shadow, m_walls, and m_water.

Referenced by Play::loadObjects().

Here is the call graph for this function:

void ObjLevel::draw  ) 
 

Definition at line 582 of file ObjLevel.cpp.

References OpenGLObject::draw(), m_floor, and m_walls.

Here is the call graph for this function:

void ObjLevel::drawFloor  ) 
 

Definition at line 587 of file ObjLevel.cpp.

References Renderer::apply(), OpenGLObject::draw(), m_floor, m_texFloor, mp_renderer, and Renderer::setTextures().

Referenced by Play::drawFrame().

Here is the call graph for this function:

void ObjLevel::drawObjects  ) 
 

Definition at line 786 of file ObjLevel.cpp.

References m_models, m_numObjects, m_objects, LevelObjectPos::model, and MilkShape::render().

Referenced by Play::drawFrame().

Here is the call graph for this function:

void ObjLevel::drawShadow  ) 
 

ifdef STENCIL_BUFFER glEnable(GL_STENCIL_TEST); { glEnable(GL_CULL_FACE); { mp_renderer->setDepthFunc(LESS); mp_renderer->setMask(NONE); mp_renderer->apply();

glStencilFunc(GL_ALWAYS, 0, ~0);

glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); glCullFace(GL_FRONT); m_shadow->draw();

glStencilOp(GL_KEEP, GL_KEEP, GL_DECR); glCullFace(GL_BACK); m_shadow->draw(); } glDisable(GL_CULL_FACE); } glDisable(GL_STENCIL_TEST);

else

glEnable(GL_CULL_FACE); glCullFace(GL_FRONT); glColor4f(0.0f, 0.0f, 0.0f, 0.5f); mp_renderer->setMask(COLOR); mp_renderer->setBlending(ONE, SRC_ALPHA); mp_renderer->apply();

m_shadow->draw();

glDisable(GL_CULL_FACE); endif

Definition at line 601 of file ObjLevel.cpp.

References OpenGLObject::draw(), and m_shadow.

Referenced by Play::drawFrame().

Here is the call graph for this function:

void ObjLevel::drawWalls  ) 
 

Definition at line 594 of file ObjLevel.cpp.

References Renderer::apply(), OpenGLObject::draw(), m_texWall, m_walls, mp_renderer, and Renderer::setTextures().

Referenced by Play::drawFrame().

Here is the call graph for this function:

void ObjLevel::drawWater  ) 
 

Definition at line 646 of file ObjLevel.cpp.

References Renderer::apply(), OpenGLObject::draw(), m_texWater, m_water, mp_renderer, and Renderer::setTextures().

Referenced by Play::drawFrame().

Here is the call graph for this function:

void ObjLevel::drawWaterSurface  ) 
 

Definition at line 653 of file ObjLevel.cpp.

References Renderer::apply(), OpenGLObject::draw(), g_frameTime, Object::getVertices(), m_texWaterSurface, m_waterSurface, mp_lvl, mp_renderer, ONE, Renderer::setBlending(), Renderer::setTextures(), Vertex::tu, Vertex::tv, waterSurfaceIndex, and LevelInfo::waterSurfaceSpeed.

Referenced by Play::drawFrame().

Here is the call graph for this function:

Vec3 ObjLevel::getExtras  ) 
 

Definition at line 764 of file ObjLevel.cpp.

References m_extras, m_nExtras, and round.

Referenced by Play::dealExtras().

Vec3 ObjLevel::getSpawnpool  ) 
 

Definition at line 741 of file ObjLevel.cpp.

References m_nSpawnpools, m_spawnpools, and round.

Referenced by Play::serverLoop().

bool ObjLevel::isColor unsigned char data,
int  r
[private]
 

Definition at line 517 of file ObjLevel.cpp.

bool ObjLevel::isColor unsigned char data,
int  r,
int  g
[private]
 

Definition at line 513 of file ObjLevel.cpp.

bool ObjLevel::isColor unsigned char data,
int  r,
int  g,
int  b
[private]
 

Definition at line 509 of file ObjLevel.cpp.

Referenced by collission(), isWall(), isWater(), and load().

bool ObjLevel::isSpawnPool unsigned char data  )  [private]
 

Definition at line 525 of file ObjLevel.cpp.

Referenced by load().

bool ObjLevel::isWall unsigned char data  )  [private]
 

Definition at line 521 of file ObjLevel.cpp.

References isColor().

Here is the call graph for this function:

bool ObjLevel::isWall Vec3  pos  ) 
 

Definition at line 712 of file ObjLevel.cpp.

References LevelInfo::data, int(), mp_lvl, round, LevelInfo::width, Vec3::x, and Vec3::z.

Referenced by load(), and Granade::update().

Here is the call graph for this function:

bool ObjLevel::isWater Vec3  pos  ) 
 

Definition at line 705 of file ObjLevel.cpp.

References LevelInfo::data, int(), isColor(), mp_lvl, round, LevelInfo::width, Vec3::x, and Vec3::z.

Referenced by Play::bot(), Play::update(), and Granade::update().

Here is the call graph for this function:

bool ObjLevel::load  ) 
 

v[0].x = m_wallVertices[i+2].vx; v[0].y = m_wallVertices[i+2].vy; v[0].z = m_wallVertices[i+2].vz; v[1].x = v2.x; v[1].y = v2.y; v[1].z = v2.z; v[2].x = v3.x; v[2].y = v3.y; v[2].z = v3.z; v[3].x = m_wallVertices[i+3].vx; v[3].y = m_wallVertices[i+3].vy; v[3].z = m_wallVertices[i+3].vz;

shadowVertices.add(v[0]); shadowVertices.add(v[1]); shadowVertices.add(v[2]); shadowVertices.add(v[3]);

Definition at line 20 of file ObjLevel.cpp.

References Set< TYPE >::add(), Object::addFormat(), Renderer::addTexture(), LevelObjectPos::alive, ATT_FLOAT, ATT_NORMAL, ATT_TEX, ATT_VERTEX, LevelInfo::data, dot(), Set< TYPE >::getArray(), Set< TYPE >::getCount(), LevelInfo::height, isColor(), isSpawnPool(), isWall(), LevelInfo::lights, MilkShape::loadFromAsciiFile(), LOG_SUCCESS, m_extras, m_floor, m_floorVertices, m_models, m_nExtras, m_nSpawnpools, m_numObjects, m_objects, m_shadow, m_shadowVertices, m_spawnpools, m_texFloor, m_texWall, m_texWater, m_texWaterSurface, m_walls, m_wallVertices, m_water, m_waterSurface, m_waterSurfaceVertices, m_waterVertices, MAX_EXTRAS, MAX_LEVEL_OBJECTS, MAX_SPAWNPOOLS, LevelObjectPos::model, LevelInfo::models, LevelInfo::modelsPath, mp_lvl, mp_renderer, newVertex(), LevelLight::pos, PRIM_QUADS, Object::setPrimitive(), Object::setVertices(), LevelInfo::texFloor, TEXTURE_NONE, LevelInfo::texWall, LevelInfo::texWater, LevelInfo::texWaterSurface, vertEqual(), Vertex::vx, Vertex::vy, Vertex::vz, waterSurfaceIndex, LevelInfo::width, Vert::x, LevelObjectPos::x, Vec3::x, Vert::y, LevelObjectPos::y, Vec3::y, Vert::z, LevelObjectPos::z, and Vec3::z.

Referenced by Play::loadObjects().

Here is the call graph for this function:

Vertex ObjLevel::newVertex float  tu,
float  tv,
float  nx,
float  ny,
float  nz,
float  vx,
float  vy,
float  vz
[private]
 

Definition at line 540 of file ObjLevel.cpp.

References Vertex::nx, Vertex::ny, Vertex::nz, Vertex::tu, Vertex::tv, Vertex::vx, Vertex::vy, and Vertex::vz.

Referenced by load().

void ObjLevel::setVertex Vertex v,
float  tu,
float  tv,
float  nx,
float  ny,
float  nz,
float  vx,
float  vy,
float  vz
[private]
 

Definition at line 529 of file ObjLevel.cpp.

References Vertex::nx, Vertex::ny, Vertex::nz, Vertex::tu, Vertex::tv, Vertex::vx, Vertex::vy, and Vertex::vz.

bool ObjLevel::vertEqual Vert a,
Vert b
[private]
 

Definition at line 701 of file ObjLevel.cpp.

References Vert::x, Vert::y, and Vert::z.

Referenced by load().


Member Data Documentation

Vec3 ObjLevel::m_extras[MAX_EXTRAS] [private]
 

Definition at line 93 of file ObjLevel.h.

Referenced by getExtras(), and load().

OpenGLObject* ObjLevel::m_floor [private]
 

Definition at line 70 of file ObjLevel.h.

Referenced by clearVertexBuffer(), createVertexBuffer(), draw(), drawFloor(), load(), and ~ObjLevel().

Vertex* ObjLevel::m_floorVertices [private]
 

Definition at line 71 of file ObjLevel.h.

Referenced by load(), ObjLevel(), and ~ObjLevel().

MilkShape ObjLevel::m_models[LVL_MAX_MODELS] [private]
 

Definition at line 98 of file ObjLevel.h.

Referenced by drawObjects(), load(), and ~ObjLevel().

unsigned int ObjLevel::m_nExtras [private]
 

Definition at line 94 of file ObjLevel.h.

Referenced by getExtras(), and load().

unsigned int ObjLevel::m_nSpawnpools [private]
 

Definition at line 91 of file ObjLevel.h.

Referenced by getSpawnpool(), load(), and ObjLevel().

int ObjLevel::m_numObjects [private]
 

Definition at line 96 of file ObjLevel.h.

Referenced by drawObjects(), and load().

LevelObjectPos ObjLevel::m_objects[MAX_LEVEL_OBJECTS] [private]
 

Definition at line 97 of file ObjLevel.h.

Referenced by drawObjects(), and load().

OpenGLObject* ObjLevel::m_shadow [private]
 

Definition at line 78 of file ObjLevel.h.

Referenced by clearVertexBuffer(), createVertexBuffer(), drawShadow(), load(), and ~ObjLevel().

Vert* ObjLevel::m_shadowVertices [private]
 

Definition at line 79 of file ObjLevel.h.

Referenced by load(), ObjLevel(), and ~ObjLevel().

Vec3 ObjLevel::m_spawnpools[MAX_SPAWNPOOLS] [private]
 

Definition at line 90 of file ObjLevel.h.

Referenced by getSpawnpool(), and load().

TextureID ObjLevel::m_texFloor [private]
 

Definition at line 86 of file ObjLevel.h.

Referenced by drawFloor(), load(), and ~ObjLevel().

TextureID ObjLevel::m_texWall [private]
 

Definition at line 85 of file ObjLevel.h.

Referenced by drawWalls(), load(), and ~ObjLevel().

TextureID ObjLevel::m_texWater [private]
 

Definition at line 87 of file ObjLevel.h.

Referenced by drawWater(), load(), and ~ObjLevel().

TextureID ObjLevel::m_texWaterSurface [private]
 

Definition at line 88 of file ObjLevel.h.

Referenced by drawWaterSurface(), load(), and ~ObjLevel().

OpenGLObject* ObjLevel::m_walls [private]
 

Definition at line 68 of file ObjLevel.h.

Referenced by clearVertexBuffer(), createVertexBuffer(), draw(), drawWalls(), load(), and ~ObjLevel().

Vertex* ObjLevel::m_wallVertices [private]
 

Definition at line 69 of file ObjLevel.h.

Referenced by load(), ObjLevel(), and ~ObjLevel().

OpenGLObject* ObjLevel::m_water [private]
 

Definition at line 72 of file ObjLevel.h.

Referenced by clearVertexBuffer(), createVertexBuffer(), drawWater(), load(), and ~ObjLevel().

OpenGLObject* ObjLevel::m_waterSurface [private]
 

Definition at line 74 of file ObjLevel.h.

Referenced by drawWaterSurface(), load(), and ObjLevel().

Vertex* ObjLevel::m_waterSurfaceVertices [private]
 

Definition at line 75 of file ObjLevel.h.

Referenced by load().

Vertex* ObjLevel::m_waterVertices [private]
 

Definition at line 73 of file ObjLevel.h.

Referenced by load(), ObjLevel(), and ~ObjLevel().

LevelInfo* ObjLevel::mp_lvl [private]
 

Definition at line 81 of file ObjLevel.h.

Referenced by collission(), drawWaterSurface(), isWall(), isWater(), load(), and ObjLevel().

Renderer* ObjLevel::mp_renderer [private]
 

Definition at line 83 of file ObjLevel.h.

Referenced by drawFloor(), drawWalls(), drawWater(), drawWaterSurface(), load(), ObjLevel(), and ~ObjLevel().

int ObjLevel::waterSurfaceIndex [private]
 

Definition at line 76 of file ObjLevel.h.

Referenced by drawWaterSurface(), and load().


Generated on Sun Jun 5 15:50:29 2005 for Defacto by  doxygen 1.4.3