Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3398 in orxonox.OLD for orxonox/trunk/src/importer/model.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/model.cc

    r3397 r3398  
    1515
    1616#include "model.h"
    17 int verbose = 1; //! \todo should be GLOBAL
     17
    1818using namespace std;
    1919
    2020/**
    21    \brief Creates a 3D-Model, but does not load any 3D-models.
    22 
    23    This Constructor is pretty useless, because why load no model in an model-loader??
    24 */
    25 Model::Model ()
    26 {
    27 
     21   \brief Creates a 3D-Model.
     22
     23   This only initializes a 3D-Model, but does not cleanup the Faces.
     24*/
     25Model::Model(void)
     26{
    2827  this->initialize();
    29 
    30   this->BoxModel();
     28}
     29
     30/**
     31   \brief Creates a 3D-Model of Primitive-Type type
     32
     33   if you want to just display a Cube/Sphere/Cylinder/... without any material.
     34   
     35   \todo implement Cube/Sphere/Cylinder/...
     36*/
     37Model::Model(PRIMITIVE type)
     38{
     39  this->initialize();
     40
     41  if (type == CUBE)
     42    this->BoxModel();
    3143
    3244  this->importToGL ();
     
    3648
    3749/**
     50   \brief Creates a 3D-Model. and assigns it a Name.
     51*/
     52Model::Model(char* modelName)
     53{
     54  this->initialize();
     55  this->setName(modelName);
     56}
     57
     58/**
    3859   \brief deletes an Model.
    3960
    4061   Looks if any from model allocated space is still in use, and if so deleted it.
    4162*/
    42 Model::~Model()
     63Model::~Model(void)
    4364{
    4465  PRINTF(3)("Deleting Model ");
     
    6485  if (this->material)
    6586    delete this->material;
     87}
     88
     89/**
     90   \brief Finalizes an Object. This can be done outside of the Class.
     91*/
     92void Model::finalize(void)
     93{
     94  this->importToGL ();
     95 
     96  this->cleanup();
     97
     98  this->finalized = true;
    6699}
    67100
     
    157190
    158191  this->name = NULL;
     192  this->finalized = false;
    159193  // setting the start group;
    160194  this->firstGroup = new Group;
     
    173207}
    174208
     209void Model::setName(const char* name)
     210{
     211  if (this->name)
     212    delete this->name;
     213  this->name = new char[strlen(name)+1];
     214  strcpy(this->name, name);
     215}
    175216/**
    176217   \brief initializes a new Group model
Note: See TracChangeset for help on using the changeset viewer.