Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5769 in orxonox.OLD


Ignore:
Timestamp:
Nov 24, 2005, 11:18:39 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: sync

Location:
trunk/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/coord/p_node.cc

    r5671 r5769  
    496496  if (child != NULL)
    497497  {
    498    child->remove();
     498   child->removeNode();
    499499//   this->children->remove(child);
    500500//   child->parent = NULL;
     
    507507 * this can be the case, if an entity in the world is being destroyed.
    508508 */
    509 void PNode::remove()
     509void PNode::removeNode()
    510510{
    511511  tIterator<PNode>* iterator = this->children->getIterator();
     
    513513
    514514  while( pn != NULL)
    515     {
     515  {
    516516      NullParent::getInstance()->addChild(pn);
    517517      pn = iterator->nextElement();
     
    609609 * worry, normaly...
    610610 */
    611 void PNode::update (float dt)
     611void PNode::updateNode (float dt)
    612612{
    613613  if( likely(this->parent != NULL))
     
    698698          pn->parentDirChanged ();
    699699
    700         pn->update(dt);
     700        pn->updateNode(dt);
    701701        pn = iterator->nextElement();
    702702      }
     
    708708}
    709709
     710
     711void PNode::countChildNodes(int& nodes) const
     712{
     713  nodes++;
     714  tIterator<PNode>* it = this->children->getIterator();
     715  PNode* node = it->firstElement();
     716  while(node != NULL)
     717  {
     718    node->countChildNodes(nodes);
     719    node = it->nextElement();
     720  }
     721
     722}
     723
     724
    710725/**
    711726 *  displays some information about this pNode
     
    714729 * @param level !! INTERNAL !! The n-th level of the Node we draw (this is internal and only for nice output).
    715730 */
    716 void PNode::debug(unsigned int depth, unsigned int level) const
     731void PNode::debugNode(unsigned int depth, unsigned int level) const
    717732{
    718733  for (unsigned int i = 0; i < level; i++)
     
    722737  else
    723738    PRINT(0)(" -");
    724   PRINT(0)("PNode(%s::%s) - absCoord: (%0.2f, %0.2f, %0.2f), relCoord(%0.2f, %0.2f, %0.2f), direction(%0.2f, %0.2f, %0.2f) - %s\n",
     739
     740  int childNodeCount = 0;
     741  this->countChildNodes(childNodeCount);
     742
     743  PRINT(0)("PNode(%s::%s) - absCoord: (%0.2f, %0.2f, %0.2f), relCoord(%0.2f, %0.2f, %0.2f), direction(%0.2f, %0.2f, %0.2f) - %s - %d childs\n",
    725744           this->getClassName(),
    726745           this->getName(),
     
    734753           this->getAbsDirV().y,
    735754           this->getAbsDirV().z,
    736            this->parentingModeToChar(parentMode));
     755           this->parentingModeToChar(parentMode),
     756           childNodeCount);
    737757  if (depth >= 2 || depth == 0)
    738758  {
     
    743763    {
    744764      if (depth == 0)
    745         pn->debug(0, level + 1);
     765        pn->debugNode(0, level + 1);
    746766      else
    747         pn->debug(depth - 1, level +1);
     767        pn->debugNode(depth - 1, level +1);
    748768      pn = iterator->nextElement();
    749769    }
  • trunk/src/lib/coord/p_node.h

    r5750 r5769  
    3030typedef enum
    3131{
    32   PNODE_LOCAL_ROTATE          =   1,    //!< Rotates all the children around their centers.
    33   PNODE_ROTATE_MOVEMENT       =   2,    //!< Moves all the children around the center of their parent, without the rotation around their own centers.
     32  // PARENTAL FOLLOWING
     33  PNODE_LOCAL_ROTATE                   = 0x00000001,    //!< Rotates all the children around their centers.
     34  PNODE_ROTATE_MOVEMENT                = 0x00000002,    //!< Moves all the children around the center of their parent, without the rotation around their own centers.
    3435
    35   PNODE_MOVEMENT              =   4,    //!< Moves all children along with the parent.
     36  PNODE_MOVEMENT                       = 0x00000004,    //!< Moves all children along with the parent.
    3637// special linkage modes
    37   PNODE_ALL                   =   3,    //!< Moves all children around the center of their parent, and also rotates their centers
    38   PNODE_ROTATE_AND_MOVE       =   5     //!< Rotates all children around their axis, and moves them as the Parent Moves, but does not rotate around the center of their parent.
     38  PNODE_ALL                            = 0x00000003,    //!< Moves all children around the center of their parent, and also rotates their centers
     39  PNODE_ROTATE_AND_MOVE                = 0x00000005,    //!< Rotates all children around their axis, and moves them as the Parent Moves, but does not rotate around the center of their parent.
     40
     41
     42  PNODE_INACTIVE_NODE                  = 0x00000010,    //!< If the node is Active (if not, it and its child wont be updated).
     43
     44  // REPARENTING
     45  PNODE_REPARENT_TO_NULLPARENT         = 0x00000100,
     46  PNODE_REPARENT_KEEP_POSITION         = 0x00000200,
     47
     48
     49  // DELETION
     50  PNODE_PROHIBIT_CHILD_DELETE          = 0x00010000,
     51  PNODE_PROHIBIT_DELETE_WITH_PARENT    = 0x00020000,
    3952
    4053} PARENT_MODE;
    4154
    4255//! The default mode of the translation-binding.
    43 #define PNODE_PARENT_MODE_DEFAULT PNODE_ALL
     56#define PNODE_PARENT_MODE_DEFAULT PNODE_ALL | PNODE_REPARENT_KEEP_POSITION
    4457
    4558
     
    101114  void addChild (const char* childName);
    102115  void removeChild (PNode* child);
    103   void remove();
     116  void removeNode();
    104117
    105118  void setParent (PNode* parent);
     
    108121  inline PNode* getParent () const { return this->parent; };
    109122  /** @returns the List of Children of this PNode */
    110   inline const tList<PNode>* getChildren() const { return this->children; };
     123 // inline const tList<PNode>* getChildren() const { return this->children; };
    111124
    112125  void setParentSoft(PNode* parentNode, float bias = 1.0);
     
    119132  int getParentMode() const { return this->parentMode; };
    120133
    121   void update (float dt);
     134  void updateNode (float dt);
    122135
    123   void debug (unsigned int depth = 1, unsigned int level = 0) const;
     136  void countChildNodes(int& nodes) const;
     137  void debugNode (unsigned int depth = 1, unsigned int level = 0) const;
    124138  void debugDraw(unsigned int depth = 1, float size = 1.0, const Vector& color = Vector(1, 0, 0), unsigned int level = 0) const;
    125139
  • trunk/src/lib/graphics/importer/texture.cc

    r5768 r5769  
    3333{
    3434  this->setClassID(CL_TEXTURE, "Texture");
    35   this->setName(imageName);
    3635
    3736  this->bAlpha = false;
     
    4039
    4140  if (imageName != NULL)
     41  {
     42    this->setName(imageName);
    4243    this->loadImage(imageName);
     44  }
    4345}
    4446
     
    116118  if (this->image != NULL)
    117119    {
    118       PRINTF(4)("Reloading Texture %s\n", this->getName());
     120      PRINTF(1)("Reloading Texture of %s '%s'\n", this->getClassName(), this->getName());
    119121      this->loadTexToGL();
    120122    }
  • trunk/src/story_entities/world.cc

    r5751 r5769  
    666666
    667667  /* update the object position before game start - so there are no wrong coordinates used in the first processing */
    668   NullParent::getInstance()->update (0.001f);
    669   NullParent::getInstance()->update (0.001f);
     668  NullParent::getInstance()->updateNode (0.001f);
     669  NullParent::getInstance()->updateNode (0.001f);
    670670
    671671}
     
    928928  GarbageCollector::getInstance()->update();
    929929  GraphicsEngine::getInstance()->update(this->dtS);
    930   NullParent::getInstance()->update (this->dtS);
     930  NullParent::getInstance()->updateNode (this->dtS);
    931931
    932932  SoundEngine::getInstance()->update();
  • trunk/src/world_entities/camera.cc

    r5751 r5769  
    134134      else
    135135        this->target->setParentSoft("Player");
    136       this->getParent()->debug(0);
     136      this->getParent()->debugNode(0);
    137137
    138138//      this->setParent("main-Turret");
  • trunk/src/world_entities/weapons/aiming_turret.cc

    r5750 r5769  
    9191  this->setMaximumEnergy(10000, 50);
    9292  this->increaseEnergy(100000);
    93   //this->minCharge = 2;
    9493
    9594  this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET);
  • trunk/src/world_entities/weapons/bomb.cc

    r5750 r5769  
    4646  this->energyMin = 1;
    4747  this->energyMax = 1;
    48   this->remove();
    4948  this->lifeSpan = 15;
    5049
     
    146145void Bomb::collidesWith (WorldEntity* entity, const Vector& location)
    147146{
    148         this->detonate();
     147        this->detonate();
    149148}
    150149
     
    168167  while(lm != NULL)
    169168  {
    170    
     169
    171170    lm = it->nextElement();
    172171  }
  • trunk/src/world_entities/weapons/guided_missile.cc

    r5766 r5769  
    4848  this->energyMin = 1;
    4949  this->energyMax = 10;
    50   this->remove();
    5150  this->lifeSpan = 5;
    5251  this->agility = 5;
  • trunk/src/world_entities/weapons/laser.cc

    r5750 r5769  
    4545  this->energyMin = 1;
    4646  this->energyMax = 10;
    47   this->remove();
    4847  this->lifeSpan = 1.0;
    4948
  • trunk/src/world_entities/weapons/projectile.cc

    r5766 r5769  
    4040  this->target = NULL;
    4141
    42   this->remove();
     42  this->removeNode();
    4343}
    4444
  • trunk/src/world_entities/weapons/rocket.cc

    r5693 r5769  
    4646  this->energyMin = 1;
    4747  this->energyMax = 10;
    48   this->remove();
    4948  this->lifeSpan = 2;
    5049
     
    116115  ParticleEngine::getInstance()->addConnection(this->emitter, Rocket::trailParticles);
    117116
    118   this->update(0);
     117  this->updateNode(0);
    119118  this->emitter->setEmissionRate(45.0);
    120119  this->emitter->setEmissionVelocity(0.0);
  • trunk/src/world_entities/weapons/test_bullet.cc

    r5511 r5769  
    4646  this->energyMin = 1;
    4747  this->energyMax = 10;
    48   this->remove();
    4948  this->lifeSpan = 2;
    5049
Note: See TracChangeset for help on using the changeset viewer.