Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4680 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Jun 24, 2005, 12:12:41 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: WorldEntity now has the ability to return its FaceCounts

Location:
orxonox/trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/particles/particle_system.h

    r4677 r4680  
    101101  inline float getMass(void) const { return this->initialMass; };
    102102
    103   unsigned int getFaceCount(void) const;
     103  virtual unsigned int getFaceCount(void) const;
    104104
    105105
  • orxonox/trunk/src/world_entities/skybox.cc

    r4621 r4680  
    7474  this->size = 100.0;
    7575
    76   this->skyModel = NULL;
    7776  this->material = new Material*[6];
    7877  for (int i = 0; i < 6; i++)
     
    179178  glTranslatef(r.x, r.y, r.z);
    180179
    181   this->skyModel->draw();
     180  this->model->draw();
    182181
    183182  glPopMatrix();
     
    192191void SkyBox::rebuild()
    193192{
    194   if (this->skyModel)
    195     delete skyModel;
    196   skyModel = new Model();
    197 
    198   this->skyModel->addVertex (-0.5*size, -0.5*size, 0.5*size);
    199   this->skyModel->addVertex (0.5*size, -0.5*size, 0.5*size);
    200   this->skyModel->addVertex (-0.5*size, 0.5*size, 0.5*size);
    201   this->skyModel->addVertex (0.5*size, 0.5*size, 0.5*size);
    202   this->skyModel->addVertex (-0.5*size, 0.5*size, -0.5*size);
    203   this->skyModel->addVertex (0.5*size, 0.5*size, -0.5*size);
    204   this->skyModel->addVertex (-0.5*size, -0.5*size, -0.5*size);
    205   this->skyModel->addVertex (0.5*size, -0.5*size, -0.5*size);
    206 
    207   this->skyModel->addVertexTexture (0.0, 1.0);
    208   this->skyModel->addVertexTexture (1.0, 1.0);
    209   this->skyModel->addVertexTexture (1.0, 0.0);
    210   this->skyModel->addVertexTexture (0.0, 0.0);
    211 
    212   this->skyModel->addVertexNormal (0.0, 0.0, 1.0);
    213   this->skyModel->addVertexNormal (0.0, 1.0, 0.0);
    214   this->skyModel->addVertexNormal (0.0, 0.0, -1.0);
    215   this->skyModel->addVertexNormal (0.0, -1.0, 0.0);
    216   this->skyModel->addVertexNormal (1.0, 0.0, 0.0);
    217   this->skyModel->addVertexNormal (-1.0, 0.0, 0.0);
    218 
    219   this->skyModel->setMaterial(material[0]);
    220   this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,0,3, 3,1,3, 5,2,3, 4,3,3); // top
    221   this->skyModel->setMaterial(material[1]);
    222   this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,0,1, 7,1,1, 1,2,1, 0,3,1); // bottom
    223   this->skyModel->setMaterial(material[2]);
    224   this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 4,2,2, 5,3,2, 7,0,2, 6,1,2); // left
    225   this->skyModel->setMaterial(material[3]);
    226   this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 0,0,0, 1,1,0, 3,2,0, 2,3,0); // right
    227   this->skyModel->setMaterial(material[4]);
    228   this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,0,5, 7,1,5, 5,2,5, 3,3,5); // front
    229   this->skyModel->setMaterial(material[5]);
    230   this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,0,4, 0,1,4, 2,2,4, 4,3,4); // back
    231 
    232   this->skyModel->finalize();
    233 }
     193  if (this->model)
     194    delete this->model;
     195  model = new Model();
     196
     197  this->model->addVertex (-0.5*size, -0.5*size, 0.5*size);
     198  this->model->addVertex (0.5*size, -0.5*size, 0.5*size);
     199  this->model->addVertex (-0.5*size, 0.5*size, 0.5*size);
     200  this->model->addVertex (0.5*size, 0.5*size, 0.5*size);
     201  this->model->addVertex (-0.5*size, 0.5*size, -0.5*size);
     202  this->model->addVertex (0.5*size, 0.5*size, -0.5*size);
     203  this->model->addVertex (-0.5*size, -0.5*size, -0.5*size);
     204  this->model->addVertex (0.5*size, -0.5*size, -0.5*size);
     205
     206  this->model->addVertexTexture (0.0, 1.0);
     207  this->model->addVertexTexture (1.0, 1.0);
     208  this->model->addVertexTexture (1.0, 0.0);
     209  this->model->addVertexTexture (0.0, 0.0);
     210
     211  this->model->addVertexNormal (0.0, 0.0, 1.0);
     212  this->model->addVertexNormal (0.0, 1.0, 0.0);
     213  this->model->addVertexNormal (0.0, 0.0, -1.0);
     214  this->model->addVertexNormal (0.0, -1.0, 0.0);
     215  this->model->addVertexNormal (1.0, 0.0, 0.0);
     216  this->model->addVertexNormal (-1.0, 0.0, 0.0);
     217
     218  this->model->setMaterial(material[0]);
     219  this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,0,3, 3,1,3, 5,2,3, 4,3,3); // top
     220  this->model->setMaterial(material[1]);
     221  this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,0,1, 7,1,1, 1,2,1, 0,3,1); // bottom
     222  this->model->setMaterial(material[2]);
     223  this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 4,2,2, 5,3,2, 7,0,2, 6,1,2); // left
     224  this->model->setMaterial(material[3]);
     225  this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 0,0,0, 1,1,0, 3,2,0, 2,3,0); // right
     226  this->model->setMaterial(material[4]);
     227  this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,0,5, 7,1,5, 5,2,5, 3,3,5); // front
     228  this->model->setMaterial(material[5]);
     229  this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,0,4, 0,1,4, 2,2,4, 4,3,4); // back
     230
     231  this->model->finalize();
     232}
  • orxonox/trunk/src/world_entities/skybox.h

    r4620 r4680  
    2626  virtual ~SkyBox();
    2727
     28  void preInit(void);
     29
    2830  void loadParams(const TiXmlElement* root);
    2931
    30   void preInit(void);
    3132  void postInit(void);
    3233
     
    3536  /** \brief assumes jpg as input-format */
    3637  void setTexture(const char* name) { setTextureAndType (name, "jpg"); };
     38
    3739  void setTextureAndType(const char* name, const char* extension);
    38   void setTextures(const char* top, const char* bottom, const char* left, const char* right, const char* front, const char* back);
     40  void setTextures(const char* top, const char* bottom, const char* left,
     41                   const char* right, const char* front, const char* back);
    3942
    4043  virtual void draw();
     
    4346  void rebuild();
    4447
    45   Model*          skyModel;        //!< A Model for the Sky. This must not be the same as the Model from WorldEntity, because it is not alocated through the ResourceManager.
    4648  Material**      material;        //!< Materials for the SkyBox. sorted by number (0-5) top, bottom, left, right, front, back
    4749  float           size;            //!< Size of the SkyBox. This should match the frustum maximum range.
  • orxonox/trunk/src/world_entities/world_entity.cc

    r4597 r4680  
    1919
    2020#include "world_entity.h"
    21 #include "model.h"
    2221#include "list.h"
    2322#include "vector.h"
  • orxonox/trunk/src/world_entities/world_entity.h

    r4504 r4680  
    1 /*! 
     1/*!
    22    \file world_entity.h
    33    \brief Definition of the basic WorldEntity
     
    1212#include "factory.h"
    1313#include "load_param.h"
     14#include "model.h"
    1415
    1516//class CollisionCluster;
    1617class CharacterAttributes;
    17 class Model;
    1818class SoundEngine;
    1919class SoundBuffer;
     
    2222//! Basic class from which all interactive stuff in the world is derived from
    2323class WorldEntity : public PNode
    24 {       
     24{
    2525  friend class World;
    2626
     
    3333
    3434  //void setCollision (CollisionCluster* newhull);
    35  
     35
    3636  //void addAbility(Ability* ability);
    3737  //void removeAbility(Ability* ability);
    38   void setDrawable (bool bDraw); 
     38  void setDrawable (bool bDraw);
    3939  void setCharacterAttributes(CharacterAttributes* charAttr);
    4040  CharacterAttributes* getCharacterAttributes();
     
    4747  virtual void command (Command* cmd);
    4848
     49  /** \returns the Count of Faces on this WorldEntity */
     50  virtual unsigned int getFaceCount (void) const { if (this->model) return this->model->getFaceCount(); else return 0; };
     51
    4952  void processDraw ();
    5053  virtual void draw ();
    5154  virtual void tick (float time);
    52  
     55
    5356 protected:
    5457  Model* model;                  //!< The model that should be loaded for this entity.
    5558  CharacterAttributes* charAttr;      //!< the character attributes of a world_entity
    56  
     59
    5760 private:
    5861  bool bCollide;                      //!< If it should be considered for the collisiontest.
Note: See TracChangeset for help on using the changeset viewer.