Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4070 in orxonox.OLD for orxonox/branches/md2_loader/src/lib/graphics


Ignore:
Timestamp:
May 5, 2005, 10:59:35 PM (20 years ago)
Author:
patrick
Message:

orxonox/branches/md2_loader: added md2 file structures and modified the way the fps is displayed

Location:
orxonox/branches/md2_loader/src/lib/graphics
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/md2_loader/src/lib/graphics/graphics_engine.cc

    r4067 r4070  
    3131{
    3232  this->bDisplayFPS = false;
     33  this->minFPS = 9999;
     34  this->maxFPS = 0;
    3335  this->setClassName ("GraphicsEngine");
    3436  this->initVideo();
     
    276278         
    277279          // temporary, only for showing how fast the text-engine is
    278           char tmpChar[20];
    279           sprintf(tmpChar, "fps: %4.0f", this->currentFPS);
    280           this->geText->setPosition(0, 500);
    281           //this->geText->setText(tmpChar);
    282           //this->geText->setPosition(0, 420);
    283           this->geText->setText("TEST\nTEST2");
     280          char tmpChar1[20];
     281          sprintf(tmpChar1, "Current: %4.0f", this->currentFPS);
     282          this->geTextCFPS->setText(tmpChar1);
     283          char tmpChar2[20];
     284          sprintf(tmpChar2, "Max: %4.0f", this->maxFPS);
     285          this->geTextMaxFPS->setText(tmpChar2);
     286          char tmpChar3[20];
     287          sprintf(tmpChar3, "Min: %4.0f", this->minFPS);
     288          this->geTextMinFPS->setText(tmpChar3);
    284289        }
    285290}
     
    287292void GraphicsEngine::displayFPS(bool display)
    288293{
    289   this->geText = TextEngine::getInstance()->createText("fonts/earth.ttf", 30, TEXT_DYNAMIC, 0, 255, 0);
    290   this->geText->setAlignment(TEXT_ALIGN_LEFT);
    291   this->bDisplayFPS = display;
    292 }
    293 
    294  
     294        if( display)
     295        {
     296                this->geTextCFPS = TextEngine::getInstance()->createText("fonts/earth.ttf", 30, TEXT_DYNAMIC, 0, 255, 0);
     297                this->geTextCFPS->setAlignment(TEXT_ALIGN_LEFT);
     298                this->geTextCFPS->setPosition(0, 500);
     299                this->geTextMaxFPS = TextEngine::getInstance()->createText("fonts/earth.ttf", 30, TEXT_DYNAMIC, 0, 255, 0);
     300                this->geTextMaxFPS->setAlignment(TEXT_ALIGN_LEFT);
     301                this->geTextMaxFPS->setPosition(0, 530);
     302                this->geTextMinFPS = TextEngine::getInstance()->createText("fonts/earth.ttf", 30, TEXT_DYNAMIC, 0, 255, 0);
     303                this->geTextMinFPS->setAlignment(TEXT_ALIGN_LEFT);
     304                this->geTextMinFPS->setPosition(0, 560);       
     305        }
     306        this->bDisplayFPS = display;
     307}
     308
     309 
  • orxonox/branches/md2_loader/src/lib/graphics/graphics_engine.h

    r4066 r4070  
    6666  float minFPS;      //!< minimal frame rate we ever got since start
    6767
    68   Text* geText;
     68  Text* geTextCFPS;
     69  Text* geTextMaxFPS;
     70  Text* geTextMinFPS;
    6971
    7072  SDL_Rect **videoModes;
  • orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.h

    r4065 r4070  
    1212#include "abstract_model.h"
    1313
     14
     15//! These are the needed defines for the max values when loading .MD2 files
     16#define MD2_MAX_TRIANGLES               4096
     17#define MD2_MAX_VERTICES                2048
     18#define MD2_MAX_TEXCOORDS               2048
     19#define MD2_MAX_FRAMES                  512
     20#define MD2_MAX_SKINS                   32
     21#define MD2_MAX_FRAMESIZE               (MD2_MAX_VERTICES * 4 + 128)
     22
     23//! This holds the header information that is read in at the beginning of the file
     24struct tMd2Header
     25{
     26   int magic;                                   //!< This is used to identify the file
     27   int version;                                 //!< The version number of the file (Must be 8)
     28   int skinWidth;                               //!< The skin width in pixels
     29   int skinHeight;                              //!< The skin height in pixels
     30   int frameSize;                               //!< The size in bytes the frames are
     31   int numSkins;                                //!< The number of skins associated with the model
     32   int numVertices;                             //!< The number of vertices (constant for each frame)
     33   int numTexCoords;                    //!< The number of texture coordinates
     34   int numTriangles;                    //!< The number of faces (polygons)
     35   int numGlCommands;                   //!< The number of gl commands
     36   int numFrames;                               //!< The number of animation frames
     37   int offsetSkins;                             //!< The offset in the file for the skin data
     38   int offsetTexCoords;                 //!< The offset in the file for the texture data
     39   int offsetTriangles;                 //!< The offset in the file for the face data
     40   int offsetFrames;                    //!< The offset in the file for the frames data
     41   int offsetGlCommands;                //!< The offset in the file for the gl commands data
     42   int offsetEnd;                               //!< The end of the file offset
     43};
     44
     45
     46//! This is used to store the vertices that are read in for the current frame directly from the file (compressed)
     47struct tMd2AliasTriangle
     48{
     49   byte vertex[3];
     50   byte lightNormalIndex;
     51};
     52
     53//! This stores the normals and vertices for the frames (uncompressed)
     54struct tMd2Triangle
     55{
     56   float vertex[3];
     57   float normal[3];
     58};
     59
     60//! This stores the indices into the vertex and texture coordinate arrays
     61struct tMd2Face
     62{
     63   short vertexIndices[3];
     64   short textureIndices[3];
     65};
     66
     67//! This stores UV coordinates
     68struct tMd2TexCoord
     69{
     70   short u, v;
     71};
     72
     73// This stores the animation scale, translation and name information for a frame, plus verts
     74struct tMd2AliasFrame
     75{
     76   float scale[3];
     77   float translate[3];
     78   char name[16];
     79   tMd2AliasTriangle aliasVertices[1];
     80};
     81
     82// This stores the frames vertices after they have been transformed
     83struct tMd2Frame
     84{
     85   char strName[16];
     86   tMd2Triangle *pVertices;
     87};
     88
     89// This stores a skin name
     90typedef char tMd2Skin[64];
     91
     92
     93
     94
    1495//! A class for representating a MD2Model
    1596class MD2Model : public AbstractModel {
     
    20101
    21102
    22  private:
    23 
    24103};
    25104
Note: See TracChangeset for help on using the changeset viewer.