class Quake2Level : public Model {
private:
BspFile * file;
long * clusterTable; // table of visible clusters
// (cluster visible // if value == frameNo)
long * faceTable; // table of visible facets
// (bit per face)
Entities * entities;
Polygon3D ** polys; // pointers to polygons
//of the level Polygon3D ** visPolys; // list of visible polys
int numFaces;
int numClusters; int numVisibleFaces;
float angle; // angle of player (yaw ?)
Sky * sky;
Bool drawSky,-
Long frameNo; // current frame number
// (count of drawn frames)
public:
Quake2Level ( Data * data ); ~Quake2Level ();
virtual int init () ;
bool loadPolys ();
bool isLeafInFrustrum ( const Quake2BspLeaf * leaf,
const Frustrum& frustrum ) const;
Quake2BspLeaf * findLeaf ( const Vector3D& pos ) const,-void buildClusterTable ( const Vector3D& pos ); void addFacesList ( int firstFace, int numFaces,
const Vector3D& pos );
void buildFacesList ( const Cameras camera ); void drawFaces ( Views view, const Cameras
camera ) ,-
void render ( Views view, const Camera&
camera );
void setLightmap ( int offset, Polygon3D *
poly );
const Vector3DS getStartPos () const return pos;
float getAngle () const return angle;
void markFace ( int index ) faceTable [index] = frameNo,-
bool isFaceMarked ( int index ) const return faceTable [index] == frameNo;
};

Метод loadPolys данного класса служит для загрузки информации о гранях и перевода ее в объекты класса Polygon3D.

га

bool Quake2Level :: loadPolys () {
String dir ( "textures/" );

Пишем рендерер уровней Quake 11

for ( int i = 0; i < numFaces; i++ )
{
Quake2Face * face = &file -> faces [i];
Quake2TexInfo * texlnfo = &file ->
texlnfos [face -> texlnfo] ,-Quake2BspPlane * qPlane = &file -> planes [face ->
plane];
String texName = texlnfo -> texName;

⇐ Предыдущая| |Следующая ⇒