Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6021 in orxonox.OLD for branches/newModel


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

newModel new static_model class added

Location:
branches/newModel/src
Files:
24 edited
2 moved

Legend:

Unmodified
Added
Removed
  • branches/newModel/src/lib/collision_detection/bounding_volume.h

    r5688 r6021  
    99
    1010#include "base_object.h"
    11 #include "abstract_model.h"
     11#include "model.h"
    1212
    1313class Vector;
  • branches/newModel/src/lib/collision_detection/bv_tree.h

    r5684 r6021  
    1010
    1111#include "base_object.h"
    12 #include "abstract_model.h"
     12#include "model.h"
    1313
    1414// FORWARD DECLARATION
  • branches/newModel/src/lib/collision_detection/bv_tree_node.h

    r5688 r6021  
    99
    1010#include "base_object.h"
    11 #include "abstract_model.h"
     11#include "model.h"
    1212#include "vector.h"
    1313
  • branches/newModel/src/lib/collision_detection/cd_engine.cc

    r5915 r6021  
    2121#include "list.h"
    2222
    23 #include "abstract_model.h"
     23#include "model.h"
    2424#include "world_entity.h"
    2525#include "terrain.h"
  • branches/newModel/src/lib/collision_detection/cd_engine.h

    r5915 r6021  
    1010#include "base_object.h"
    1111#include "collision_defs.h"
    12 #include "abstract_model.h"
     12#include "model.h"
    1313
    1414
  • branches/newModel/src/lib/collision_detection/obb_tree.h

    r5684 r6021  
    99
    1010#include "bv_tree.h"
    11 #include "abstract_model.h"
     11#include "model.h"
    1212#include "material.h"
    1313
  • branches/newModel/src/lib/collision_detection/obb_tree_node.cc

    r5694 r6021  
    2121#include "obb_tree.h"
    2222#include "matrix.h"
    23 #include "abstract_model.h"
     23#include "model.h"
    2424#include "world_entity.h"
    2525
  • 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:
  • branches/newModel/src/lib/graphics/spatial_separation/quadtree.h

    r5430 r6021  
    1212
    1313#include "base_object.h"
    14 #include "abstract_model.h"
     14#include "model.h"
    1515
    1616
  • branches/newModel/src/lib/graphics/spatial_separation/quadtree_node.cc

    r5819 r6021  
    2121#include "quadtree.h"
    2222#include "material.h"
    23 #include "abstract_model.h"
     23#include "model.h"
    2424#include "debug.h"
    2525
     
    346346/**
    347347 *  gets the maximal dimension of a model
    348  * @return the dimension of the AbstractModel as a Rectangle
     348 * @return the dimension of the Model as a Rectangle
    349349
    350350   The rectangle is x-z axis aligned. ATTENTION: if there are any vertices in the model, that exceed the
  • branches/newModel/src/lib/graphics/spatial_separation/quadtree_node.h

    r5819 r6021  
    1717#include "base_object.h"
    1818
    19 #include "abstract_model.h"
     19#include "model.h"
    2020
    2121// FORWARD DECLARATION
  • branches/newModel/src/lib/graphics/spatial_separation/spatial_separation.cc

    r5427 r6021  
    1818#include "spatial_separation.h"
    1919
    20 #include "abstract_model.h"
     20#include "model.h"
    2121#include "quadtree.h"
    2222#include "debug.h"
     
    3434
    3535 */
    36 SpatialSeparation::SpatialSeparation (AbstractModel* model, float overlapSize)
     36SpatialSeparation::SpatialSeparation (Model* model, float overlapSize)
    3737{
    3838  PRINT(3)("+---------Debug Information SpatialSeparation----------\n");
     
    5252   The boxes are overlaping because this makes collision detection a lot simpler
    5353 */
    54 SpatialSeparation::SpatialSeparation (AbstractModel* model, AbstractModel* playerModel)
     54SpatialSeparation::SpatialSeparation (Model* model, Model* playerModel)
    5555{
    5656  this->setClassID(CL_SPATIAL_SEPARATION, "SpatialSeparation");
     
    7575 * @return the new quadtree
    7676 */
    77 Quadtree* SpatialSeparation::createQuadtree(AbstractModel* model, float minLength)
     77Quadtree* SpatialSeparation::createQuadtree(Model* model, float minLength)
    7878{
    7979  this->minLength = minLength;
     
    8888 * @return the new quadtree
    8989 */
    90 Quadtree* SpatialSeparation::createQuadtree(AbstractModel* model, int treeDepth)
     90Quadtree* SpatialSeparation::createQuadtree(Model* model, int treeDepth)
    9191{
    9292  this->treeDepth = treeDepth;
     
    100100 * @return the new quadtree
    101101 */
    102 Quadtree* SpatialSeparation::createQuadtree(AbstractModel* model)
     102Quadtree* SpatialSeparation::createQuadtree(Model* model)
    103103{
    104104  this->quadtree = new Quadtree(model->getModelInfo(), 4);
  • branches/newModel/src/lib/graphics/spatial_separation/spatial_separation.h

    r5356 r6021  
    99
    1010
    11 class AbstractModel;
     11class Model;
    1212class Quadtree;
    1313
     
    2121
    2222  public:
    23     SpatialSeparation(AbstractModel* model, float overlapSize);
    24     SpatialSeparation(AbstractModel* model, AbstractModel* playerModel);
     23    SpatialSeparation(Model* model, float overlapSize);
     24    SpatialSeparation(Model* model, Model* playerModel);
    2525    virtual ~SpatialSeparation();
    2626
     
    2828    void setMinLength(int minLength) { this->minLength = minLength; }
    2929
    30     Quadtree* createQuadtree(AbstractModel* model, float minLength);
    31     Quadtree* createQuadtree(AbstractModel* model, int treeDepth);
    32     Quadtree* createQuadtree(AbstractModel* model);
     30    Quadtree* createQuadtree(Model* model, float minLength);
     31    Quadtree* createQuadtree(Model* model, int treeDepth);
     32    Quadtree* createQuadtree(Model* model);
    3333
    3434    inline Quadtree* getQuadtree() { return this->quadtree; }
     
    4141
    4242  private:
    43     AbstractModel*             model;        //!< the reference to the model that has to be handled
     43    Model*             model;        //!< the reference to the model that has to be handled
    4444    Quadtree*                  quadtree;     //!< the reference to the created quadtree
    4545
    46     AbstractModel*             playerModel;  //!< referece to the player model, if needed for overlap calculations
     46    Model*             playerModel;  //!< referece to the player model, if needed for overlap calculations
    4747    float                      overlapSize;  //!< the size of overlaping
    4848
  • branches/newModel/src/world_entities/skybox.cc

    r5994 r6021  
    2020#include "load_param.h"
    2121#include "factory.h"
    22 #include "model.h"
    23 
     22#include "static_model.h"
     23#include "material.h"
    2424
    2525using namespace std;
     
    170170void SkyBox::rebuild()
    171171{
    172   Model* model = new Model();
     172  StaticModel* model = new StaticModel();
    173173
    174174  model->addVertex (-0.5*size, -0.5*size, 0.5*size);
  • branches/newModel/src/world_entities/terrain.cc

    r5994 r6021  
    4040
    4141//  if (this->model != NULL)
    42     //this->ssp = new SpatialSeparation((AbstractModel*)this->model, 10.0f);
     42    //this->ssp = new SpatialSeparation((Model*)this->model, 10.0f);
    4343}
    4444
  • branches/newModel/src/world_entities/weapons/test_gun.cc

    r5994 r6021  
    2424
    2525#include "world_entity.h"
    26 #include "model.h"
     26#include "static_model.h"
    2727#include "test_bullet.h"
    2828#include "weapon_manager.h"
     
    219219  if( this->leftRight == W_RIGHT)
    220220    glScalef(1.0, 1.0, -1.0);
    221   this->getModel()->draw(1);
     221  static_cast<StaticModel*>(this->getModel())->draw(1);
    222222  glPopMatrix();
    223223
     
    230230  tmpRot = this->objectComponent1->getAbsDir().getSpacialAxis();
    231231  glRotatef (this->objectComponent1->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    232   this->getModel()->draw(0);
     232  static_cast<StaticModel*>(this->getModel())->draw(0);
    233233  glPopMatrix();
    234234}
Note: See TracChangeset for help on using the changeset viewer.