Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Loadable from .oxw

File:
1 copied

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.