Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3398 in orxonox.OLD for orxonox/trunk/src/importer/framework.cc


Ignore:
Timestamp:
Feb 6, 2005, 11:02:45 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: Made the Model-class externalizable
meaning:

  1. There is now a possibility to initialize a Model without adding default vertex info
  2. Then you can add your vertices
  3. Then you can add any other model-specific stuff, like normals/texcoords/Faces
  4. For the time-being Materials have to be handled externaly, but this will change.

PATRICK: if you read this, you should be able, to implement this into the loading-screen, look at src/importer/framework.cc→main and then the big table.

with this aproach the Developer is farther away from OpenGL and closer to logic.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/importer/framework.cc

    r3396 r3398  
    1515
    1616#include "framework.h"
    17 
     17int verbose;
    1818void DrawGLScene()
    1919{
     
    5353{
    5454  verbose = 2;
    55 
    56   PRINTF(2)("This is The big verbose-Test %i, %s\n", 1, "cool");
    5755
    5856  Uint8* keys; // This variable will be used in the keyboard routine
     
    7573    obj = new OBJModel(argv[1]);
    7674  else
    77     obj = (OBJModel*) new Model();
    78  
     75    {
     76      // This is an example, of how it is possible, to create a new Model, and adding some vertex-information.
     77      // This also packs everything into a DisplayList, and can be handled exactly as any other model.
     78      // This is an example of a cube with Texture-Coordinates, but without explicite Vertex-Normals. (they are soft-created).
     79
     80      obj = (OBJModel*) new Model();
     81      obj->setName("CUBE");
     82      obj->addVertex ("-0.5 -0.5 0.5");
     83      obj->addVertex ("0.5 -0.5 0.5");
     84      obj->addVertex ("-0.5 0.5 0.5");
     85      obj->addVertex ("0.5 0.5 0.5");
     86      obj->addVertex ("-0.5 0.5 -0.5");
     87      obj->addVertex ("0.5 0.5 -0.5");
     88      obj->addVertex ("-0.5 -0.5 -0.5");
     89      obj->addVertex ("0.5 -0.5 -0.5");
     90     
     91      obj->addVertexTexture ("0.0 0.0");
     92      obj->addVertexTexture ("1.0 0.0");
     93      obj->addVertexTexture ("0.0 1.0");
     94      obj->addVertexTexture ("1.0 1.0");
     95      obj->addVertexTexture ("0.0 2.0");
     96      obj->addVertexTexture ("1.0 2.0");
     97      obj->addVertexTexture ("0.0 3.0");
     98      obj->addVertexTexture ("1.0 3.0");
     99      obj->addVertexTexture ("0.0 4.0");
     100      obj->addVertexTexture ("1.0 4.0");
     101      obj->addVertexTexture ("2.0 0.0");
     102      obj->addVertexTexture ("2.0 1.0");
     103      obj->addVertexTexture ("-1.0 0.0");
     104      obj->addVertexTexture ("-1.0 1.0");
     105
     106      obj->addFace ("1 2 4 3");
     107      obj->addFace ("3 4 6 5");
     108      obj->addFace ("5 6 8 7");
     109      obj->addFace ("7 8 2 1");
     110      obj->addFace ("2 8 6 4");
     111      obj->addFace ("7 1 3 5");
     112      obj->finalize();
     113    }
    79114  M = Vector(wHandler.screen->w/2, wHandler.screen->h/2, 0);
    80115  rotAxis = Vector (0.0,1.0,0.0);
Note: See TracChangeset for help on using the changeset viewer.