Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6021 in orxonox.OLD for branches/newModel/src/lib/graphics/importer


Ignore:
Timestamp:
Dec 10, 2005, 7:52:50 PM (18 years ago)
Author:
bensch
Message:

newModel new static_model class added

Location:
branches/newModel/src/lib/graphics/importer
Files:
9 edited
2 moved

Legend:

Unmodified
Added
Removed
  • branches/newModel/src/lib/graphics/importer/Makefile.am

    r6010 r6021  
    44noinst_LIBRARIES = libORXimporter.a
    55
    6 libORXimporter_a_SOURCES = abstract_model.cc \
     6libORXimporter_a_SOURCES = model.cc \
    77                           vertex_array_model.cc \
    8                            model.cc \
     8                           static_model.cc \
    99                           objModel.cc \
    1010                           primitive_model.cc \
     
    1616
    1717
    18 noinst_HEADERS = abstract_model.h \
     18noinst_HEADERS = model.h \
    1919                 vertex_array_model.h \
    20                  model.h \
     20                 static_model.h \
    2121                 objModel.h \
    2222                 primitive_model.h \
  • branches/newModel/src/lib/graphics/importer/md2Model.cc

    r5284 r6021  
    160160
    161161/**
    162   \brief draws the model: interface for all other classes out in the world
    163 */
     162 * @brief draws the model: interface for all other classes out in the world
     163 * @todo make it const and virtual
     164 * FIXME
     165 */
    164166void MD2Model::draw()
    165167{
  • branches/newModel/src/lib/graphics/importer/md2Model.h

    r5304 r6021  
    1919#define _MD2MODEL_H
    2020
    21 #include "abstract_model.h"
     21#include "model.h"
    2222#include "base_object.h"
    2323#include "stdincl.h"
     
    137137
    138138//! This is a MD2 Model class
    139 class MD2Model : public AbstractModel {
     139class MD2Model : public Model {
    140140
    141141public:
  • branches/newModel/src/lib/graphics/importer/model.cc

    r6016 r6021  
    1616#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_MODEL
    1717
    18 #include "abstract_model.h"
     18#include "model.h"
    1919
    2020using namespace std;
    21 
    2221
    2322/**
     
    2524 * @todo this constructor is not jet implemented - do it
    2625*/
    27 AbstractModel::AbstractModel()
     26Model::Model()
    2827{
    2928//   this->setClassID(CL_PROTO_ID, "ProtoClass");
     
    4241 * standard deconstructor
    4342*/
    44 AbstractModel::~AbstractModel()
     43Model::~Model()
    4544{
    4645  // delete what has to be deleted here
  • branches/newModel/src/lib/graphics/importer/model.h

    r6016 r6021  
    1515
    1616/*!
    17  * @file abstract_model.h
    18  *  Definition of an abstract model. containing all needed for other model
     17 * @file model.h
     18 *  Definition of an abstract model.
     19 *  containing all needed for other models
    1920 */
    2021
    21 #ifndef _ABSTRACT_MODEL_H
    22 #define _ABSTRACT_MODEL_H
     22#ifndef _MODEL_H
     23#define _MODEL_H
    2324
    2425#include "base_object.h"
     
    125126
    126127//! This class defines the basic components of a model
    127 class AbstractModel : public BaseObject {
     128class Model : public BaseObject {
    128129
    129130  public:
    130     AbstractModel();
    131     virtual ~AbstractModel();
     131    Model();
     132    virtual ~Model();
     133
     134    virtual void draw() const {  }
    132135
    133136    inline const modelInfo* getModelInfo() const { return &this->pModelInfo; }
     
    158161};
    159162
    160 #endif /* _ABSTRACT_MODEL_H */
     163#endif /* _MODEL_H */
  • branches/newModel/src/lib/graphics/importer/objModel.cc

    r5319 r6021  
    3232 * @param scaling The factor that the model will be scaled with.
    3333*/
    34 OBJModel::OBJModel(const char* fileName, float scaling) : Model(fileName)
     34OBJModel::OBJModel(const char* fileName, float scaling) : StaticModel(fileName)
    3535{
    3636  this->objPath = "./";
  • branches/newModel/src/lib/graphics/importer/objModel.h

    r4468 r6021  
    77#define _OBJMODEL_H
    88
    9 #include "model.h"
     9#include "static_model.h"
    1010
    1111//! A Class, that handles the parsing of an obj-file, and inclusion as a Model.
    12 class OBJModel : public Model
     12class OBJModel : public StaticModel
    1313{
    1414 public:
  • branches/newModel/src/lib/graphics/importer/primitive_model.h

    r5039 r6021  
    88#define _PRIMITIVE_MODEL_H
    99
    10 #include "model.h"
     10#include "static_model.h"
    1111
    1212//! Specification of different primitives the Model knows
     
    1818
    1919//! A Class to create some default Models
    20 class PrimitiveModel : public Model {
     20class PrimitiveModel : public StaticModel {
    2121
    2222 public:
  • branches/newModel/src/lib/graphics/importer/static_model.cc

    r6020 r6021  
    1818#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER
    1919
    20 #include "model.h"
     20#include "static_model.h"
    2121
    2222#include "stdlibincl.h"
     
    141141   assigns it a Name and a Type
    142142*/
    143 Model::Model(const char* modelName, MODEL_TYPE type)
     143StaticModel::StaticModel(const char* modelName, MODEL_TYPE type)
    144144{
    145145  this->setClassID(CL_MODEL, "Model");
     
    174174   Looks if any from model allocated space is still in use, and if so deleted it.
    175175*/
    176 Model::~Model()
     176StaticModel::~StaticModel()
    177177{
    178178  PRINTF(4)("Deleting Model ");
     
    209209 *  Finalizes an Object. This can be done outside of the Class.
    210210*/
    211 void Model::finalize()
     211void StaticModel::finalize()
    212212{
    213213  // this creates the display List.
     
    236236 * rebuild the Model from the Information we got.
    237237 */
    238 void Model::rebuild()
     238void StaticModel::rebuild()
    239239{
    240240  PRINTF(3)("Rebuilding Model '%s'\n", this->getName());
     
    250250   It does this by just calling the Lists that must have been created earlier.
    251251*/
    252 void Model::draw () const
     252void StaticModel::draw () const
    253253{
    254254
     
    295295   It does this by just calling the List that must have been created earlier.
    296296*/
    297 void Model::draw (int groupNumber) const
     297void StaticModel::draw (int groupNumber) const
    298298{
    299299  if (groupNumber >= this->groupCount)
     
    327327   It does this by just calling the List that must have been created earlier.
    328328*/
    329 void Model::draw (char* groupName) const
     329void StaticModel::draw (char* groupName) const
    330330{
    331331  PRINTF(4)("drawing the requested 3D-Models if found.\n");
     
    351351 *  deletes all the arrays
    352352*/
    353 bool Model::deleteArrays()
     353bool StaticModel::deleteArrays()
    354354{
    355355  if (this->vertices)
     
    375375 * This will be applied at the end of the importing Process.
    376376*/
    377 bool Model::cleanup()
     377bool StaticModel::cleanup()
    378378{
    379379  PRINTF(4)("cleaning up the 3D-Model to save Memory.\n");
     
    393393 * with this option set the Materials will not be deleted with the Model.
    394394 */
    395 Material* Model::addMaterial(Material* material)
     395Material* StaticModel::addMaterial(Material* material)
    396396{
    397397  if (material == NULL)
     
    409409 * @returns the added material
    410410*/
    411 Material* Model::addMaterial(const char* materialName)
     411Material* StaticModel::addMaterial(const char* materialName)
    412412{
    413413  ModelMaterial* modMat = new ModelMaterial;
     
    425425 * @returns the Material if found, NULL otherwise
    426426*/
    427 Material* Model::findMaterialByName(const char* materialName)
     427Material* StaticModel::findMaterialByName(const char* materialName)
    428428{
    429429  list<ModelMaterial*>::iterator modMat;
     
    441441   With it you should be able to create Models with more than one SubModel inside
    442442*/
    443 bool Model::addGroup(const char* groupString)
     443bool StaticModel::addGroup(const char* groupString)
    444444{
    445445  PRINTF(5)("Read Group: %s.\n", groupString);
     
    464464   If a vertex line is found this function will inject it into the vertex-Array
    465465*/
    466 bool Model::addVertex (const char* vertexString)
     466bool StaticModel::addVertex (const char* vertexString)
    467467{
    468468  float subbuffer1;
     
    482482
    483483*/
    484 bool Model::addVertex(float x, float y, float z)
     484bool StaticModel::addVertex(float x, float y, float z)
    485485{
    486486  PRINTF(5)("reading in a vertex: %f %f %f\n", x, y, z);
     
    496496   If a vertexNormal line is found this function will inject it into the vertexNormal-Array
    497497*/
    498 bool Model::addVertexNormal (const char* normalString)
     498bool StaticModel::addVertexNormal (const char* normalString)
    499499{
    500500  float subbuffer1;
     
    515515   If a vertexNormal line is found this function will inject it into the vertexNormal-Array
    516516*/
    517 bool Model::addVertexNormal(float x, float y, float z)
     517bool StaticModel::addVertexNormal(float x, float y, float z)
    518518{
    519519  PRINTF(5)("found vertex-Normal %f, %f, %f\n", x, y, z);
     
    532532   !! WARNING THIS IS DIFFERNT FROM addVervexTexture(float, float); because it changes the second entry to 1-v !!
    533533*/
    534 bool Model::addVertexTexture (const char* vTextureString)
     534bool StaticModel::addVertexTexture (const char* vTextureString)
    535535{
    536536  float subbuffer1;
     
    550550   If a TextureCoordinate line is found this function will inject it into the TextureCoordinate-Array
    551551*/
    552 bool Model::addVertexTexture(float u, float v)
     552bool StaticModel::addVertexTexture(float u, float v)
    553553{
    554554  PRINTF(5)("found vertex-Texture %f, %f\n", u, v);
     
    567567   String is different from the argument addFace, in this that the first Vertex/Normal/Texcoord is 1 instead of 0
    568568*/
    569 bool Model::addFace (const char* faceString)
     569bool StaticModel::addFace (const char* faceString)
    570570{
    571571  if (this->currentGroup->faceCount >0)
     
    623623 * @param type The information Passed with each Vertex
    624624*/
    625 bool Model::addFace(int faceElemCount, VERTEX_FORMAT type, ...)
     625bool StaticModel::addFace(int faceElemCount, VERTEX_FORMAT type, ...)
    626626{
    627627  if (this->currentGroup->faceCount > 0)
     
    655655 * @param matString the Material that will be set.
    656656*/
    657 bool Model::setMaterial(const char* matString)
     657bool StaticModel::setMaterial(const char* matString)
    658658{
    659659  if (this->currentGroup->faceCount > 0)
     
    670670 * @param mtl the Material that will be set.
    671671*/
    672 bool Model::setMaterial(Material* mtl)
     672bool StaticModel::setMaterial(Material* mtl)
    673673{
    674674  if (this->currentGroup->faceCount > 0)
     
    690690   4. It goes through all the normale-Points and calculates the VertexNormale and includes it in the normals-Array.
    691691*/
    692 bool Model::buildVertexNormals ()
     692bool StaticModel::buildVertexNormals ()
    693693{
    694694  PRINTF(4)("Normals are being calculated.\n");
     
    763763 *  reads and includes the Faces/Materials into the openGL state Machine
    764764*/
    765 bool Model::importToDisplayList()
     765bool StaticModel::importToDisplayList()
    766766{
    767767  // finalize the Arrays
     
    855855 *  reads and includes the Faces/Materials into the openGL state Machine
    856856*/
    857 bool Model::importToVertexArray()
     857bool StaticModel::importToVertexArray()
    858858{
    859859  // finalize the Arrays
     
    875875 *  builds an array of triangles, that can later on be used for obb separation and octree separation
    876876 */
    877 bool Model::buildTriangleList()
     877bool StaticModel::buildTriangleList()
    878878{
    879879  if( unlikely(this->triangles != NULL))
     
    10071007   merging this information, the face will be drawn.
    10081008*/
    1009 bool Model::addGLElement (ModelFaceElement* elem)
     1009bool StaticModel::addGLElement (ModelFaceElement* elem)
    10101010{
    10111011  PRINTF(5)("importing grafical Element to openGL.\n");
     
    10431043   This will inject a Cube, because this is the most basic model.
    10441044*/
    1045 void Model::cubeModel()
     1045void StaticModel::cubeModel()
    10461046{
    10471047  this->addVertex (-0.5, -0.5, 0.5);
  • branches/newModel/src/lib/graphics/importer/static_model.h

    r6020 r6021  
    11/*!
    2   \file model.h
    3   \brief Contains the Model Class that handles 3D-Models
    4 */
    5 
    6 #ifndef _MODEL_H
    7 #define _MODEL_H
    8 
    9 #include "abstract_model.h"
     2 * @file static_model.h
     3 * @brief Contains the Model Class that handles Static 3D-Models rendered with glList's
     4 */
     5
     6#ifndef _STATIC_MODEL_H
     7#define _STATIC_MODEL_H
     8
     9#include "model.h"
    1010
    1111#include "material.h"
     
    103103/// MODEL ///
    104104/////////////
    105 //! Class that handles 3D-Models. it can also read them in and display them.
    106 class Model : public AbstractModel
    107 {
    108  public:
    109   Model(const char* modelName = NULL, MODEL_TYPE type = MODEL_DISPLAY_LIST);
    110   virtual ~Model();
    111 
    112   void draw() const;
     105//! Class that handles static 3D-Models.
     106/**
     107 * it can also read them in and display them.
     108 * All the objects are rendered with glLists
     109 */
     110class StaticModel : public Model
     111{
     112 public:
     113  StaticModel(const char* modelName = NULL, MODEL_TYPE type = MODEL_DISPLAY_LIST);
     114  virtual ~StaticModel();
     115
     116  virtual void draw() const;
    113117  void draw(int groupNumber) const;
    114118  void draw(char* groupName) const;
     
    188192  tArray<GLfloat>*           normals;         //!< The Array that handles the Normals.
    189193  tArray<GLfloat>*           vTexture;        //!< The Array that handles the VertexTextureCoordinates.
    190   sTriangleExt*              triangles;       //!< The Array of triangles in the abstract_model.h style
     194  sTriangleExt*              triangles;       //!< The Array of triangles in the model.h style
    191195
    192196  ModelGroup*                firstGroup;      //!< The first of all groups.
  • branches/newModel/src/lib/graphics/importer/vertex_array_model.h

    r6012 r6021  
    77#define _VERTEX_ARRAY_MODEL_H
    88
    9 #include "abstract_model.h"
     9#include "model.h"
    1010
    1111#include "glincl.h"
     
    2222/////////////
    2323//! Class that handles 3D-Models. it can also read them in and display them.
    24 class VertexArrayModel : public AbstractModel
     24class VertexArrayModel : public Model
    2525{
    2626 public:
Note: See TracChangeset for help on using the changeset viewer.