Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3521 in orxonox.OLD for orxonox/trunk/src/story_entities


Ignore:
Timestamp:
Mar 12, 2005, 8:45:59 PM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: parenting revisited. fixed some bugs some missunderstandings. made it a little more secure to use. still dev

Location:
orxonox/trunk/src/story_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/story_entities/world.cc

    r3507 r3521  
    2222#include "camera.h"
    2323#include "environment.h"
     24#include "primitive.h"
    2425#include "p_node.h"
    2526#include "null_parent.h"
     
    232233            this->glmis->step();
    233234
     235           
     236            WorldEntity* env = new Environment();
     237            env->setName ("env");
     238            this->spawn(env);
     239            this->trackManager->setBindSlave(env);
     240
    234241            Vector* es = new Vector (50, 2, 0);
    235242            Quaternion* qs = new Quaternion ();
    236             WorldEntity* env = new Environment();
    237             env->setName ("env");
    238             this->spawn(env, es, qs);
    239            
     243            WorldEntity* pr = new Primitive(PSPHERE);
     244            pr->setName("primitive");
     245            this->spawn(pr, this->localPlayer, es, qs, ROTATION);
     246           
     247
    240248            /*monitor progress*/
    241249            this->glmis->step();
    242 
    243             trackManager->setBindSlave(env);
    244250
    245251            break;
     
    896902
    897903
     904/**
     905   \brief add and spawn a new entity to this world
     906   \param entity to be added
     907   \param entity to be added to (PNode)
     908   \param At what relative  coordinates to add this entity.
     909   \param In which relative direction should it look.
     910*/
     911void World::spawn(WorldEntity* entity, PNode* parentNode,
     912                  Vector* relCoor, Quaternion* relDir,
     913                  parentingMode mode)
     914{
     915
     916  if( parentNode != NULL && entity->parent == NULL)
     917    {
     918      parentNode->addChild (entity);
     919     
     920      entity->setRelCoor (relCoor);
     921      entity->setRelDir (relDir);
     922     
     923      this->entities->add (entity);
     924     
     925      entity->postSpawn ();
     926    }
     927}
     928
     929
    898930
    899931/**
  • orxonox/trunk/src/story_entities/world.h

    r3475 r3521  
    99#include "stdincl.h"
    1010#include "story_entity.h"
    11 
     11#include "p_node.h"
    1212
    1313class TrackManager;
     
    1919class Light;
    2020class FontSet;
     21
    2122
    2223//! The game world
     
    5152  void spawn (WorldEntity* entity);
    5253  void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir);
    53 
     54  void spawn(WorldEntity* entity, PNode* parentNode, Vector* relCoor, Quaternion* relDir,
     55             parentingMode mode);
    5456
    5557
Note: See TracChangeset for help on using the changeset viewer.