Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


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
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/Makefile.am

    r3493 r3521  
    4141                 world_entities/environment.cc \
    4242                 world_entities/skysphere.cc \
     43                 world_entities/primitive.cc \
    4344                 ai/ai.cc \
    4445                 lib/coord/p_node.cc \
     
    8384                 world_entities/shoot_rocket.h \
    8485                 world_entities/power_up.h \
     86                 world_entities/primitive.h \
    8587                 ai/ai.h \
    8688                 network/synchronisable.h \
  • orxonox/trunk/src/Makefile.in

    r3502 r3521  
    5858        campaign.$(OBJEXT) world.$(OBJEXT) world_entity.$(OBJEXT) \
    5959        player.$(OBJEXT) environment.$(OBJEXT) skysphere.$(OBJEXT) \
    60         ai.$(OBJEXT) p_node.$(OBJEXT) null_parent.$(OBJEXT) \
    61         helper_parent.$(OBJEXT) data_tank.$(OBJEXT) fontset.$(OBJEXT) \
    62         array.$(OBJEXT) objModel.$(OBJEXT) model.$(OBJEXT) \
    63         material.$(OBJEXT) texture.$(OBJEXT) base_entity.$(OBJEXT) \
    64         base_object.$(OBJEXT) ini_parser.$(OBJEXT) list.$(OBJEXT) \
    65         vector.$(OBJEXT) matrix.$(OBJEXT) curve.$(OBJEXT) \
    66         glmenu_imagescreen.$(OBJEXT)
     60        primitive.$(OBJEXT) ai.$(OBJEXT) p_node.$(OBJEXT) \
     61        null_parent.$(OBJEXT) helper_parent.$(OBJEXT) \
     62        data_tank.$(OBJEXT) fontset.$(OBJEXT) array.$(OBJEXT) \
     63        objModel.$(OBJEXT) model.$(OBJEXT) material.$(OBJEXT) \
     64        texture.$(OBJEXT) base_entity.$(OBJEXT) base_object.$(OBJEXT) \
     65        ini_parser.$(OBJEXT) list.$(OBJEXT) vector.$(OBJEXT) \
     66        matrix.$(OBJEXT) curve.$(OBJEXT) glmenu_imagescreen.$(OBJEXT)
    6767orxonox_OBJECTS = $(am_orxonox_OBJECTS)
    6868orxonox_LDADD = $(LDADD)
     
    8686@AMDEP_TRUE@    ./$(DEPDIR)/objModel.Po ./$(DEPDIR)/orxonox.Po \
    8787@AMDEP_TRUE@    ./$(DEPDIR)/p_node.Po ./$(DEPDIR)/player.Po \
    88 @AMDEP_TRUE@    ./$(DEPDIR)/skysphere.Po \
     88@AMDEP_TRUE@    ./$(DEPDIR)/primitive.Po ./$(DEPDIR)/skysphere.Po \
    8989@AMDEP_TRUE@    ./$(DEPDIR)/story_entity.Po ./$(DEPDIR)/texture.Po \
    9090@AMDEP_TRUE@    ./$(DEPDIR)/track_manager.Po ./$(DEPDIR)/vector.Po \
     
    231231                 world_entities/environment.cc \
    232232                 world_entities/skysphere.cc \
     233                 world_entities/primitive.cc \
    233234                 ai/ai.cc \
    234235                 lib/coord/p_node.cc \
     
    273274                 world_entities/shoot_rocket.h \
    274275                 world_entities/power_up.h \
     276                 world_entities/primitive.h \
    275277                 ai/ai.h \
    276278                 network/synchronisable.h \
     
    392394@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_node.Po@am__quote@
    393395@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/player.Po@am__quote@
     396@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/primitive.Po@am__quote@
    394397@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skysphere.Po@am__quote@
    395398@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/story_entity.Po@am__quote@
     
    527530@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    528531@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o skysphere.obj `if test -f 'world_entities/skysphere.cc'; then $(CYGPATH_W) 'world_entities/skysphere.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/skysphere.cc'; fi`
     532
     533primitive.o: world_entities/primitive.cc
     534@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT primitive.o -MD -MP -MF "$(DEPDIR)/primitive.Tpo" -c -o primitive.o `test -f 'world_entities/primitive.cc' || echo '$(srcdir)/'`world_entities/primitive.cc; \
     535@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/primitive.Tpo" "$(DEPDIR)/primitive.Po"; else rm -f "$(DEPDIR)/primitive.Tpo"; exit 1; fi
     536@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='world_entities/primitive.cc' object='primitive.o' libtool=no @AMDEPBACKSLASH@
     537@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/primitive.Po' tmpdepfile='$(DEPDIR)/primitive.TPo' @AMDEPBACKSLASH@
     538@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     539@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o primitive.o `test -f 'world_entities/primitive.cc' || echo '$(srcdir)/'`world_entities/primitive.cc
     540
     541primitive.obj: world_entities/primitive.cc
     542@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT primitive.obj -MD -MP -MF "$(DEPDIR)/primitive.Tpo" -c -o primitive.obj `if test -f 'world_entities/primitive.cc'; then $(CYGPATH_W) 'world_entities/primitive.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/primitive.cc'; fi`; \
     543@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/primitive.Tpo" "$(DEPDIR)/primitive.Po"; else rm -f "$(DEPDIR)/primitive.Tpo"; exit 1; fi
     544@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='world_entities/primitive.cc' object='primitive.obj' libtool=no @AMDEPBACKSLASH@
     545@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/primitive.Po' tmpdepfile='$(DEPDIR)/primitive.TPo' @AMDEPBACKSLASH@
     546@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     547@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o primitive.obj `if test -f 'world_entities/primitive.cc'; then $(CYGPATH_W) 'world_entities/primitive.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/primitive.cc'; fi`
    529548
    530549ai.o: ai/ai.cc
  • orxonox/trunk/src/lib/coord/p_node.cc

    r3511 r3521  
    2222
    2323#include "p_node.h"
    24 
     24#include "null_parent.h"
    2525
    2626using namespace std;
     
    259259{}
    260260
    261 
    262 
    263261/**
    264262   \brief adds a child and makes this node to a parent
     
    282280void PNode::addChild (PNode* pNode, parentingMode mode)
    283281{
    284   pNode->mode = mode;
    285   pNode->parent = this;
    286   this->children->add (pNode);
     282  if( pNode->parent == NULL )
     283    {
     284      pNode->mode = mode;
     285      pNode->parent = this;
     286      this->children->add (pNode);
     287    }
     288  else
     289    {
     290      PRINTF(1)("PNode::addChild() - this node has already been added - closed Loop MARK \n");
     291    }
    287292}
    288293
     
    295300{
    296301  this->children->remove (pNode);
     302  pNode->parent = NULL;
    297303}
    298304
     
    302308   \param parent the Parent to set
    303309*/
     310/*
    304311void PNode::setParent (PNode* parent)
    305312{
    306313  parent->addChild(this);
    307314}
     315*/
    308316
    309317/**
     
    368376                }
    369377              else
    370                 this->absCoordinate = parent->getAbsCoor () + this->relCoordinate;            /* update the current absCoordinate */
     378                this->absCoordinate = parent->getAbsCoor() + this->relCoordinate;             /* update the current absCoordinate */
    371379            }
    372380        }
    373381     
    374       if( this->mode == ROTATION && this->mode == ALL)
     382      if( this->mode == ROTATION || this->mode == ALL)
    375383        {
    376384          if( this->bAbsDirChanged /*&& this->timeStamp != DataTank::timeStamp*/)
    377385            {
    378386              /* if you have set the absolute coordinates this overrides all other changes */
    379               this->relDirection = this->absDirection - parent->getAbsDir ();
     387              this->relDirection = this->absDirection - parent->getAbsDir();
    380388            }
    381389          else if( this->bRelDirChanged /*&& this->timeStamp != DataTank::timeStamp*/)
    382390            {
    383391              /* update the current absDirection - remember * means rotation around sth.*/
    384               this->absDirection = parent->getAbsDir () * this->relDirection;
     392              this->absDirection = parent->getAbsDir() * this->relDirection;
    385393            }
    386394        }   
    387       // }
    388395  PNode* pn = this->children->enumerate();
    389396  while( pn != NULL)
     
    457464  return this->objectName;
    458465}
     466
  • orxonox/trunk/src/lib/coord/p_node.h

    r3488 r3521  
    6464  void addChild (PNode* pNode, parentingMode mode);
    6565  void removeChild (PNode* pNode);
    66   void setParent (PNode* parent);
     66  //void setParent (PNode* parent);
    6767  void parentCoorChanged ();
    6868  void parentDirChanged ();
     
    7979  void debug ();
    8080
     81 protected:
    8182  float timeStamp;         //!< this the timeStamp of when the abs{Coordinat, Direction} has been calculated
    8283  char* objectName;        //!< The name of the Object
  • 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.