Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8081 in orxonox.OLD for branches/bsp_model/src/world_entities


Ignore:
Timestamp:
Jun 1, 2006, 4:42:01 PM (18 years ago)
Author:
bottac
Message:

Loadable from .oxw

Location:
branches/bsp_model/src/world_entities
Files:
2 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/bsp_model/src/world_entities/WorldEntities.am

    r7167 r8081  
    1515                world_entities/test_entity.cc \
    1616                world_entities/planet.cc \
     17                world_entities/bsp_entity.cc \
    1718                \
    1819                world_entities/weapons/test_gun.cc \
     
    6566                test_entity.h \
    6667                planet.h \
     68                bsp_entity.h \
    6769                \
    6870                weapons/test_gun.h \
  • branches/bsp_model/src/world_entities/bsp_entity.cc

    r7540 r8081  
    1414*/
    1515
    16 #include "proto_world_entity.h"
    17 
     16#include "bsp_entity.h"
     17#include "util/loading/resource_manager.h"
    1818using namespace std;
    1919
    20 
     20CREATE_FACTORY(BSPEntity, CL_BSP_ENTITY);
    2121/**
    22  * constructs and loads a ProtoWorldEntity from a XML-element
     22 * constructs and loads a BSPEntity from a XML-element
    2323 * @param root the XML-element to load from
    2424 */
    25 ProtoWorldEntity::ProtoWorldEntity(const TiXmlElement* root)
     25BSPEntity::BSPEntity(const TiXmlElement* root)
    2626{
    2727  this->init();
     
    3434 * standard deconstructor
    3535 */
    36 ProtoWorldEntity::~ProtoWorldEntity ()
     36BSPEntity::~BSPEntity ()
    3737{
    3838
    3939}
    4040
     41void BSPEntity::setName(const std::string& name)
     42{
     43  printf("+++++++++++ LOADING NAME %s\n", name.c_str());
     44 
     45  this->bspManager->load(name.c_str(), 0.1f);
     46}
     47
     48
    4149
    4250/**
    43  * initializes the ProtoWorldEntity
     51 * initializes the BSPEntity
    4452 * @todo change this to what you wish
    4553 */
    46 void ProtoWorldEntity::init()
     54void BSPEntity::init()
    4755{
    48   this->setClassID(CL_PROTO_WORLD_ENTITY, "ProtoWorldEntity");
     56  this->bspManager = new BspManager();
     57  this->setClassID(CL_BSP_ENTITY, "BSPEntity");
    4958
     59  this->toList(OM_ENVIRON);
     60 
    5061  /**
    51    * @todo: Write CL_PROTO_WORLD_ENTITY INTO THE src/defs/class_id.h (your own definition)
     62   * @todo: Write CL_BSP_ENTITY INTO THE src/defs/class_id.h (your own definition)
    5263   */
    5364
     
    5667
    5768/**
    58  * loads a ProtoWorldEntity from a XML-element
     69 * loads a BSPEntity from a XML-element
    5970 * @param root the XML-element to load from
    6071 * @todo make the class Loadable
    6172 */
    62 void ProtoWorldEntity::loadParams(const TiXmlElement* root)
     73void BSPEntity::loadParams(const TiXmlElement* root)
    6374{
    6475  // all the clases this Entity is directly derived from must be called in this way, to load all settings.
    65   WorldEntity::loadParam(root);
     76 // WorldEntity::loadParam(root);
     77 
     78  LoadParam(root, "Name", this, BSPEntity, setName)
     79      .describe("Sets the of the BSP file.");
    6680
     81/*  LoadParam(root, "Scale", this, BSpEntity, setScale)
     82      .describe("Sets the scale factore of the bsp level.");
     83*/
    6784
    6885  /**
     
    7390
    7491/**
    75  * advances the ProtoWorldEntity about time seconds
     92 * advances the BSPEntity about time seconds
    7693 * @param time the Time to step
    7794 */
    78 ProtoWorldEntity::tick(float time)
     95void BSPEntity::tick(float time)
    7996{
    8097
    8198}
    8299
     100
    83101/**
    84102 * draws this worldEntity
    85103 */
    86 void ProtoWorldEntity::draw () const
     104void BSPEntity::draw () const
    87105{
    88   glMatrixMode(GL_MODELVIEW);
    89   glPushMatrix();
    90   float matrix[4][4];
    91 
    92   /* translate */
    93   glTranslatef (this->getAbsCoor ().x,
    94                 this->getAbsCoor ().y,
    95                 this->getAbsCoor ().z);
    96   /* rotate */
    97   this->getAbsDir().matrix(matrix);
    98   glMultMatrixf((float*)matrix);
    99 
    100   if (model)
    101     model->draw();
    102   glPopMatrix();
     106  this->bspManager->draw();
    103107}
    104108
     
    108112 *
    109113 */
    110 void ProtoWorldEntity::collidesWith (WorldEntity* entity, const Vector& location)
     114void BSPEntity::collidesWith (WorldEntity* entity, const Vector& location)
    111115{
    112116
  • branches/bsp_model/src/world_entities/bsp_entity.h

    r7540 r8081  
    11/*!
    2  * @file proto_world_entity.h
     2 * @file bsp_entity.h
    33 * @brief description
    44*/
    55
    6 #ifndef _PROTO_WORLD_ENTITY_H
    7 #define _PROTO_WORLD_ENTITY_H
     6#ifndef _BSP_ENTITY_H
     7#define _BSP_ENTITY_H
    88
    99#include "world_entity.h"
     10#include "bsp_manager.h"
     11
     12#include "util/loading/factory.h"
     13#include "util/loading/load_param.h"
     14
     15
    1016
    1117//! A Class to ...
    12 class ProtoWorldEntity : public WorldEntity
     18class BSPEntity : public WorldEntity
    1319{
    14 
     20 
    1521 public:
    16   ProtoWorldEntity(const TiXmlElement* root = NULL);
    17   virtual ~ProtoWorldEntity();
     22  BSPEntity(const TiXmlElement* root = NULL);
     23  virtual ~BSPEntity();
    1824
    1925  virtual void loadParams(const TiXmlElement* root);
     26 
     27  void setName(const std::string& name);
     28
    2029  void init();
    21 
    22   virtual void postSpawn ();
    23   virtual void leftWorld ();
    24 
    2530
    2631  virtual void draw() const;
     
    2934
    3035 private:
     36   BspManager* bspManager;
    3137
    3238};
    3339
    34 #endif /* _PROTO_WORLD_ENTITY_H */
     40#endif /* _BSP_ENTITY_H */
  • branches/bsp_model/src/world_entities/terrain.cc

    r7352 r8081  
    117117       
    118118  this->bspManager = new BspManager();
     119  this->bspManager->load("test.bsp", 0.4);
    119120  //this->loadTexture("maps/wall1.jpeg");
    120121}
     
    208209  // Vector tmpRot = this->getAbsDir().getSpacialAxis();
    209210  //glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    210 /*
     211
    211212  if (this->objectList)
    212213    glCallList(this->objectList);
     
    226227  }
    227228
    228 */
    229 
    230   this->bspManager->draw();
     229
     230
     231 // this->bspManager->draw();
    231232  glPopMatrix();
    232233
Note: See TracChangeset for help on using the changeset viewer.