Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6222 in orxonox.OLD for trunk/src/world_entities


Ignore:
Timestamp:
Dec 21, 2005, 1:49:06 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the christmas branche to the trunk
merged with command:
svn merge -r6165:HEAD christmas_branche/ ../trunk/
no conflicts

Location:
trunk
Files:
30 edited
3 copied

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore set to
      Makefile.in
      Makefile
      configure
      *.kdevelop
      Doxyfile
      config.log
      config.h
      config.status
      stamp-h1
      autom4te.cache
      aclocal.m4
  • trunk/src

    • Property svn:ignore set to
      .deps
      orxonox
      Makefile
      Makefile.in

  • trunk/src/world_entities/Makefile.am

    r6139 r6222  
    88                  camera.cc \
    99                  playable.cc \
    10                               player.cc \
     10                  player.cc \
    1111                  npc.cc \
    1212                  npc2.cc \
     
    1818                  character_attributes.cc \
    1919                  test_entity.cc \
    20                               space_ships/space_ship.cc \
     20                  space_ships/space_ship.cc \
     21                  creatures/md2_creature.cc \
    2122                  weapons/weapon_manager.cc \
    2223                  weapons/weapon.cc \
     
    2728                  weapons/rocket.cc \
    2829                  weapons/laser.cc \
    29                               weapons/ground_turret.cc \
     30                  weapons/ground_turret.cc \
    3031                  weapons/crosshair.cc \
    31                               weapons/ground_turret.cc \
     32                  weapons/ground_turret.cc \
    3233                  power_ups/power_up.cc \
    3334                  power_ups/turret_power_up.cc \
     
    3839                 camera.h \
    3940                 playable.h \
    40                              player.h \
     41                 player.h \
    4142                 npc.h \
    4243                 npc2.h \
     
    4950                 test_entity.h \
    5051                 space_ships/space_ship.h \
     52                 creatures/md2_creature.cc \
    5153                 weapons/weapon_manager.h \
    5254                 weapons/weapon.h \
  • trunk/src/world_entities/camera.cc

    r6034 r6222  
    119119    case VIEW_NORMAL:
    120120      this->toFovy = 60.0;
    121       this->setParentSoft("TrackNode");
    122       this->target->setParentSoft("TrackNode");
     121/*      this->setParentSoft("TrackNode");
     122      this->target->setParentSoft("TrackNode"); */
    123123      this->setRelCoorSoft(-10, 5, 0);
    124124      this->target->setRelCoorSoft(0,0,0);
     
    129129  //    this->target->setRelCoorSoft(Vector(10,0,0));
    130130
    131       if (!strcmp(this->target->getParent()->getName(), "Player"))
    132         this->target->setParentSoft("TrackNode");
    133       else
    134         this->target->setParentSoft("Player");
    135       this->getParent()->debugNode(0);
     131//       if (!strcmp(this->target->getParent()->getName(), "Player"))
     132//         this->target->setParentSoft("TrackNode");
     133//       else
     134//         this->target->setParentSoft("Player");
     135//       this->getParent()->debugNode(0);
    136136
    137137//      this->setParent("main-Turret");
     
    142142    case VIEW_FRONT:
    143143      this->toFovy = 120.0;
    144        this->setParentSoft("Player");
    145        this->target->setParentSoft("Player");
     144/*       this->setParentSoft("Player");
     145       this->target->setParentSoft("Player");*/
    146146       this->setRelCoorSoft(4, 0, 0, 5);
    147147       this->target->setRelCoorSoft(Vector(10,0,0), 5);
     
    150150    case VIEW_LEFT:
    151151      this->toFovy = 90;
    152       this->setParentSoft("TrackNode");
    153       this->target->setParentSoft("TrackNode");
     152/*      this->setParentSoft("TrackNode");
     153      this->target->setParentSoft("TrackNode");*/
    154154      this->setRelCoorSoft(0, 1, -10, .5);
    155155      this->target->setRelCoorSoft(0,0,0);
     
    157157    case VIEW_RIGHT:
    158158      this->toFovy = 90;
    159       this->setParentSoft("TrackNode");
    160       this->target->setParentSoft("TrackNode");
     159/*      this->setParentSoft("TrackNode");
     160      this->target->setParentSoft("TrackNode");*/
    161161      this->setRelCoorSoft(Vector(0, 1, 10));
    162162      this->target->setRelCoorSoft(0,0,0);
     
    164164    case VIEW_TOP:
    165165      this->toFovy= 120;
    166       this->setParentSoft("TrackNode");
    167       this->target->setParentSoft("TrackNode");
     166/*      this->setParentSoft("TrackNode");
     167      this->target->setParentSoft("TrackNode");*/
    168168      this->setRelCoorSoft(Vector(30, 50, 0));
    169169      this->target->setRelCoorSoft(35,0,0);
  • trunk/src/world_entities/npcs/npc.cc

    r6142 r6222  
    2222
    2323#include "state.h"
    24 #include "list.h"
    2524#include "stdlibincl.h"
    2625#include "power_ups/turret_power_up.h"
  • trunk/src/world_entities/npcs/npc_test.cc

    r6054 r6222  
    2323#include "shader.h"
    2424#include "state.h"
    25 #include "list.h"
    2625#include "stdlibincl.h"
    2726#include "debug.h"
  • trunk/src/world_entities/npcs/npc_test1.cc

    r6054 r6222  
    2222
    2323#include "state.h"
    24 #include "list.h"
    25 #include "stdlibincl.h"
    2624#include "power_ups/turret_power_up.h"
    2725#include "power_ups/laser_power_up.h"
  • trunk/src/world_entities/playable.h

    r6162 r6222  
    2525    virtual ~Playable();
    2626
     27    virtual void enter() {};
     28    virtual void leave() {};
    2729
    2830    virtual void addWeapon(Weapon* weapon )  {}//= 0;
     
    3436
    3537    virtual void process(const Event &event) = 0;
    36    
     38
    3739
    3840
  • trunk/src/world_entities/player.cc

    r5915 r6222  
    1919#include "event_handler.h"
    2020
     21
     22#include "class_list.h"
     23#include "state.h"
     24
    2125using namespace std;
    2226
     
    2832{
    2933  this->init();
     34
     35  EventHandler::getInstance()->subscribe(this, ES_GAME, SDLK_l);
    3036}
    3137
     
    7985 void Player::process(const Event &event)
    8086 {
     87   if (event.type == SDLK_l && event.bPressed)
     88   {
     89     /// FIXME this should be in the ObjectManager
     90     const std::list<BaseObject*>* objectList = ClassList::getList(CL_PLAYABLE);
     91     if (objectList != NULL)
     92     {
     93       list<BaseObject*>::const_iterator node;
     94       for (node = objectList->begin(); node != objectList->end(); node++)
     95         if (this->controllable != (*node) && (dynamic_cast<PNode*>(*node)->getAbsCoor() - this->controllable->getAbsCoor()).len() < 10.0)
     96       {
     97         this->controllable->leave();
     98         this->disconnectControllable();
     99         this->setControllable(dynamic_cast<Playable*>(*node));
     100         this->controllable->enter();
     101         State::getCamera()->setParentSoft(this->controllable);
     102         State::getCameraTarget()->setParentSoft(this->controllable);
     103
     104         break;
     105       }
     106     }
     107   }
     108
    81109   if (likely(this->controllable != NULL))
    82110     this->controllable->process(event);
  • trunk/src/world_entities/power_ups/laser_power_up.cc

    r6142 r6222  
    1919#include "factory.h"
    2020#include "state.h"
    21 #include "list.h"
    2221
    2322#include "primitive_model.h"
  • trunk/src/world_entities/power_ups/param_power_up.cc

    r6113 r6222  
    1919#include "factory.h"
    2020#include "state.h"
    21 #include "list.h"
    2221
    2322#include "primitive_model.h"
  • trunk/src/world_entities/power_ups/turret_power_up.cc

    r6142 r6222  
    1919#include "factory.h"
    2020#include "state.h"
    21 #include "list.h"
    2221
    2322#include "primitive_model.h"
  • trunk/src/world_entities/power_ups/weapon_power_up.cc

    r6113 r6222  
    1919#include "factory.h"
    2020#include "state.h"
    21 #include "list.h"
    2221
    2322#include "primitive_model.h"
  • trunk/src/world_entities/satellite.cc

    r5994 r6222  
    2121
    2222#include "objModel.h"
    23 #include "list.h"
    2423#include "vector.h"
    2524
  • trunk/src/world_entities/space_ships/helicopter.cc

    r6162 r6222  
    9595
    9696  this->getWeaponManager()->changeWeaponConfig(1);
     97  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
    9798}
    9899
     
    184185
    185186
     187
     188
     189void Helicopter::enter()
     190{
     191  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( true);
     192
     193
     194}
     195
     196void Helicopter::leave()
     197{
     198  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
     199
     200
     201}
     202
     203
    186204/**
    187205 * adds a weapon to the weapon list of the spaceship
     
    324342         if(this->getAbsDirZ().y > 0.02) this->shiftDir(Quaternion(time/5, Vector(1,0,0)));
    325343   }
    326    
     344
    327345  if( this->bRight /* > this->getRelCoor().z*2*/)
    328346  {
  • trunk/src/world_entities/space_ships/helicopter.h

    r6162 r6222  
    2424    void loadParams(const TiXmlElement* root);
    2525
     26    virtual void enter();
     27    virtual void leave();
     28
    2629    void addWeapon(Weapon* weapon );
    2730    void removeWeapon(Weapon* weapon);
     
    3942
    4043  private:
    41 
    4244    void calculateVelocity(float time);
    4345    void weaponAction();
     
    6567    float                 travelSpeed;        //!< the current speed of the player (to make soft movement)
    6668    float                 acceleration;       //!< the acceleration of the player.
    67    
     69
    6870    float                 airViscosity;
    6971
  • trunk/src/world_entities/space_ships/space_ship.cc

    r6162 r6222  
    112112  PRINTF(4)("SPACESHIP INIT\n");
    113113
    114   EventHandler::getInstance()->grabEvents(true);
     114//   EventHandler::getInstance()->grabEvents(true);
    115115
    116116  bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
     
    177177  this->getWeaponManager()->getFixedTarget()->setRelCoor(100000,0,0);
    178178
     179  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
    179180}
    180181
     
    188189}
    189190
     191
     192void SpaceShip::enter()
     193{
     194  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( true);
     195
     196
     197}
     198
     199void SpaceShip::leave()
     200{
     201  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
     202
     203
     204}
    190205
    191206/**
     
    267282  velocity += ((this->getAbsDirX())*travelSpeed-velocity)*airViscosity;
    268283  velocity = (velocity.getNormalized())*travelSpeed;
    269  
     284
    270285  //orient the spaceship in direction of the mouse
    271286   rotQuat = Quaternion::quatSlerp( this->getAbsDir(),mouseDir,fabsf(time)*3);
    272    if (this->getAbsDir().distance(rotQuat) > 0.001) 
     287   if (this->getAbsDir().distance(rotQuat) > 0.001)
    273288    this->setAbsDir( rotQuat);
    274289   //this->setAbsDirSoft(mouseDir,5);
    275    
     290
    276291  // this is the air friction (necessary for a smooth control)
    277292  if(velocity.len() != 0) velocity -= velocity*0.01;
     
    308323  /* calculate the direction in which the craft is heading  */
    309324
     325  Plane plane(Vector(0,1,0), Vector(0,0,0));
     326
    310327  if( this->bUp )
    311328   {
    312329     //this->shiftCoor(this->getAbsDirX());
    313330      accel += (this->getAbsDirX())*2;
    314      
     331
    315332      /* Heli-Steuerung
    316333         accel += (this->getAbsDirX()*2;
  • trunk/src/world_entities/space_ships/space_ship.h

    r6162 r6222  
    2626    void init();
    2727    void loadParams(const TiXmlElement* root);
     28
     29    virtual void enter();
     30    virtual void leave();
    2831
    2932    void addWeapon(Weapon* weapon );
  • trunk/src/world_entities/test_entity.cc

    r6142 r6222  
    1818
    1919
     20#include "executor/executor.h"
     21#include "factory.h"
     22#include "load_param.h"
     23
    2024#include "test_entity.h"
    2125#include "stdincl.h"
     
    2428#include "obb_tree.h"
    2529#include "state.h"
    26 #include "list.h"
    2730
    2831using namespace std;
    2932
    3033
     34CREATE_FACTORY(TestEntity, CL_TEST_ENTITY);
     35
    3136
    3237TestEntity::TestEntity ()
    3338{
    34   this->setClassID(CL_TEST_ENTITY, "TestEntity");
    35   // TO SOME LIST!!
     39  this->init();
     40}
    3641
    37   this->md2Model = new MD2Model("models/droidika.md2", "models/droideka.pcx");
    38 //   this->md2Model = new MD2Model("models/tris.md2", "models/tris.pcx");
    39 // this->md2Model = new MD2Model("models/goblin.md2", "maps/goblin.bmp");
    4042
    41 /// FIXME
    42 //  this->obbTree = new OBBTree(4, (sVec3D*)this->md2Model->data->pVertices, this->md2Model->data->numVertices);
    4343
    44   this->md2Model->setAnim(RUN);
    45   this->md2Model->debug();
     44TestEntity::TestEntity(const TiXmlElement* root)
     45{
     46  this->init();
     47  if (root != NULL)
     48    this->loadParams(root);
     49
     50  this->init();
    4651}
    4752
    4853
    4954TestEntity::~TestEntity ()
     55{}
     56
     57
     58
     59void TestEntity::init()
    5060{
    51   delete this->md2Model;
     61  this->setClassID(CL_TEST_ENTITY, "TestEntity");
     62  this->toList(OM_COMMON);
     63}
     64
     65/**
     66 * loads the Settings of a MD2Creature from an XML-element.
     67 * @param root the XML-element to load the MD2Creature's properties from
     68 */
     69void TestEntity::loadParams(const TiXmlElement* root)
     70{
     71  static_cast<WorldEntity*>(this)->loadParams(root);
     72
     73  LoadParam(root, "md2animation", this, TestEntity, setAnim)
     74      .describe("sets the animation of the md2 model")
     75      .defaultValues(1, 1);
     76
    5277}
    5378
     
    5580void  TestEntity::setAnim(int animationIndex)
    5681{
    57   this->md2Model->setAnim(animationIndex);
     82  if( likely(this->getModel(0) != NULL))
     83    ((MD2Model*)this->getModel(0))->setAnim(animationIndex);
    5884}
    5985
     
    6187void TestEntity::tick (float time)
    6288{
    63   this->md2Model->tick(time);
     89  if( likely(this->getModel(0) != NULL))
     90    ((MD2Model*)this->getModel(0))->tick(time);
     91
    6492}
    6593
    6694
    6795void TestEntity::collidesWith(WorldEntity* entity, const Vector& location)
    68 {
    69   if (entity->isA(CL_PROJECTILE))
    70   {
    71     PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getName(), entity->getName(), location.x, location.y, location.z);
    72   this->setVisibiliy(false);
    73   this->toList(OM_DEAD);
    74   }
    75 }
    76 
    77 void TestEntity::destroy () {}
    78 
     96{}
    7997
    8098
     
    82100void TestEntity::draw () const
    83101{
    84   glMatrixMode(GL_MODELVIEW);
    85   glPushMatrix();
    86   float matrix[4][4];
    87 
    88 
    89   glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
    90   this->getAbsDir().matrix (matrix);
    91   glMultMatrixf((float*)matrix);
    92   this->md2Model->draw();
    93 
    94 
    95   glPopMatrix();
     102  this->drawLODsafe();
    96103}
    97104
  • trunk/src/world_entities/test_entity.h

    r5500 r6222  
    1010struct t3DModel;
    1111class Material;
     12class TiXmlElement;
    1213
    1314class TestEntity : public WorldEntity, PhysicsInterface
     
    1718 public:
    1819  TestEntity ();
     20  TestEntity(const TiXmlElement* root);
    1921  virtual ~TestEntity ();
     22
     23  void init();
     24  void loadParams(const TiXmlElement* root);
    2025
    2126  void setAnim(int animationIndex);
    2227
    2328  virtual void tick (float time);
    24   virtual void destroy ();
    2529  virtual void collidesWith(WorldEntity* entity, const Vector& location);
    2630  virtual void draw () const;
  • trunk/src/world_entities/weapons/aim.cc

    r6142 r6222  
    2121#include "graphics_engine.h"
    2222#include "state.h"
    23 #include "list.h"
    2423#include "material.h"
    2524#include "t_animation.h"
     
    104103void Aim::searchTarget(float range)
    105104{
    106   //FIXME//
    107 /*  tIterator<WorldEntity>* iterator = State::getWorldEntityList()->getIterator();
    108   WorldEntity* entity = iterator->firstElement();
    109   while (likely(entity != NULL))
     105  std::list<WorldEntity*>::iterator entity;
     106
     107  for (entity = State::getObjectManager()->getObjectList(OM_GROUP_00).begin();
     108       entity != State::getObjectManager()->getObjectList(OM_GROUP_00).end();
     109       entity ++)
    110110  {
    111     if (entity->isA(CL_NPC) && this->source->getAbsCoor().x < entity->getAbsCoor().x && (this->source->getAbsCoor() - entity->getAbsCoor()).len() < range)
     111    if (this->source->getAbsCoor().x < (*entity)->getAbsCoor().x && (this->source->getAbsCoor() - (*entity)->getAbsCoor()).len() < range)
    112112    {
    113       if (this->getParent() != entity)
     113      if (this->getParent() != (*entity))
    114114      {
    115115        this->anim->replay();
    116         this->setParentSoft(entity, 5);
     116        this->setParentSoft(*entity, 5);
     117        return;
    117118      }
    118       delete iterator;
    119       return;
    120119    }
    121     entity = iterator->nextElement();
    122120  }
    123 
    124   delete iterator;*/
    125121}
    126122
  • trunk/src/world_entities/weapons/bomb.cc

    r6142 r6222  
    2121
    2222#include "fast_factory.h"
    23 #include "list.h"
     23
    2424
    2525#include "object_manager.h"
  • trunk/src/world_entities/weapons/guided_missile.cc

    r6162 r6222  
    2020#include "fast_factory.h"
    2121
    22 #include "model.h"
    2322#include "state.h"
    24 #include "list.h"
    2523#include "class_list.h"
    2624
  • trunk/src/world_entities/weapons/laser.cc

    r6162 r6222  
    2121
    2222#include "state.h"
    23 #include "list.h"
    2423#include "class_list.h"
    2524#include "model.h"
  • trunk/src/world_entities/weapons/rocket.cc

    r6142 r6222  
    2020#include "fast_factory.h"
    2121
    22 #include "model.h"
    2322#include "state.h"
    24 #include "list.h"
    2523#include "class_list.h"
    2624
  • trunk/src/world_entities/weapons/test_bullet.cc

    r6142 r6222  
    2020#include "fast_factory.h"
    2121
    22 #include "model.h"
    2322#include "state.h"
    24 #include "list.h"
    2523#include "class_list.h"
    2624
  • trunk/src/world_entities/weapons/test_gun.cc

    r6162 r6222  
    2929#include "factory.h"
    3030
    31 #include "vector.h"
    32 #include "list.h"
    3331#include "animation3d.h"
    3432
  • trunk/src/world_entities/weapons/turret.cc

    r6074 r6222  
    2323
    2424#include "state.h"
    25 #include "list.h"
    2625#include "animation3d.h"
    2726
  • trunk/src/world_entities/world_entity.cc

    r6142 r6222  
    2121
    2222#include "model.h"
     23#include "md2Model.h"
    2324#include "resource_manager.h"
    2425#include "load_param.h"
    25 #include "list.h"
    2626#include "vector.h"
    2727#include "obb_tree.h"
     
    8484  // Do the PNode loading stuff
    8585  static_cast<PNode*>(this)->loadParams(root);
     86
     87  LoadParam(root, "md2texture", this, WorldEntity, loadMD2Texture)
     88      .describe("the fileName of the texture, that should be loaded onto this world-entity. (must be relative to the data-dir)")
     89      .defaultValues(1, NULL);
    8690
    8791  // Model Loading
     
    8993      .describe("the fileName of the model, that should be loaded onto this world-entity. (must be relative to the data-dir)")
    9094      .defaultValues(3, NULL, 1.0f, 0);
    91 
    92 }
     95}
     96
    9397
    9498/**
     
    103107  if (fileName != NULL)
    104108  {
    105     // search for the special character # in the LoadParam
     109   // search for the special character # in the LoadParam
    106110    if (strchr(fileName, '#') != NULL)
     111    {
     112      PRINTF(4)("Found # in %s... searching for LOD's\n", fileName);
     113      char* lodFile = new char[strlen(fileName)+1];
     114      strcpy(lodFile, fileName);
     115      char* depth = strchr(lodFile, '#');
     116      for (unsigned int i = 0; i < 5; i++)
    107117      {
    108         PRINTF(4)("Found # in %s... searching for LOD's\n", fileName);
    109         char* lodFile = new char[strlen(fileName)+1];
    110         strcpy(lodFile, fileName);
    111         char* depth = strchr(lodFile, '#');
    112         for (unsigned int i = 0; i < 5; i++)
    113           {
    114             *depth = 48+(int)i;
    115             printf("-------%s\n", lodFile);
    116             if (ResourceManager::isInDataDir(lodFile))
    117               this->loadModel(lodFile, scaling, i);
    118           }
    119         return;
     118        *depth = 48+(int)i;
     119        printf("-------%s\n", lodFile);
     120        if (ResourceManager::isInDataDir(lodFile))
     121          this->loadModel(lodFile, scaling, i);
    120122      }
    121 
    122     PRINTF(4)("fetching %s\n", fileName);
    123     if (scaling == 1.0)
    124       this->setModel((Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN), modelNumber);
    125     else
    126       this->setModel((Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN, &scaling), modelNumber);
    127     if (modelNumber == 0)
    128     this->buildObbTree(4);
     123      return;
     124    }
     125
     126    if(strstr(fileName, ".obj"))
     127    {
     128      PRINTF(4)("fetching OBJ file: %s\n", fileName);
     129      if (scaling == 1.0)
     130        this->setModel((Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN), modelNumber);
     131      else
     132        this->setModel((Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN, &scaling), modelNumber);
     133
     134      if( modelNumber == 0)
     135        this->buildObbTree(4);
     136    }
     137    else if(strstr(fileName, ".md2"))
     138    {
     139      PRINTF(4)("fetching MD2 file: %s\n", fileName);
     140      Model* m = new MD2Model(fileName, this->md2TextureFileName);
     141        //this->setModel((Model*)ResourceManager::getInstance()->load(fileName, MD2, RP_CAMPAIGN), 0);
     142      this->setModel(m, 0);
     143    }
    129144  }
    130145  else
     
    145160  {
    146161    Resource* resource = ResourceManager::getInstance()->locateResourceByPointer(this->models[modelNumber]);
    147     if (resource != NULL)
    148       ResourceManager::getInstance()->unload(resource, RP_LEVEL);
    149     else
    150       delete this->models[modelNumber];
    151   }
     162//     if (resource != NULL)
     163    ResourceManager::getInstance()->unload(resource, RP_LEVEL);
     164  }
     165  else
     166    delete this->models[modelNumber];
     167
    152168  this->models[modelNumber] = model;
     169
    153170
    154171//   if (this->model != NULL)
     
    272289}
    273290
     291
     292/**
     293 *  this functions draws the model automaticaly in multiple LOD
     294 */
    274295void WorldEntity::drawLODsafe() const
    275296{
    276   if (!this->models.empty())
     297  if (!unlikely(this->models.empty()))
    277298  {
    278299    glMatrixMode(GL_MODELVIEW);
     
    291312    if (cameraDistance > 30 && this->models.size() >= 3 && this->models[2] != NULL)
    292313    {
    293        this->models[2]->draw();
     314      this->models[2]->draw();
    294315    }
    295316    else if (cameraDistance > 10 && this->models.size() >= 2 && this->models[1] != NULL)
  • trunk/src/world_entities/world_entity.h

    r6142 r6222  
    3737  Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; };
    3838
     39  inline void loadMD2Texture(const char* fileName) { this->md2TextureFileName = fileName; }
     40
    3941  bool buildObbTree(unsigned int depth);
    4042  /** @returns a reference to the obb tree of this worldentity */
     
    7274  /** @returns a Reference to the Iterator */
    7375  std::list<WorldEntity*>::iterator& getEntityIterator() { return this->objectListIterator; }
     76
     77
    7478 protected:
    7579  //  CharacterAttributes*    charAttr;         //!< the character attributes of a world_entity
     
    7781 private:
    7882  std::vector<Model*>     models;             //!< The model that should be loaded for this entity.
     83  const char*             md2TextureFileName; //!< the file name of the md2 model texture, only if this
    7984  BVTree*                 obbTree;            //!< this is the obb tree reference needed for collision detection
    8085
Note: See TracChangeset for help on using the changeset viewer.