Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Mar 17, 2005, 2:47:16 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: name-fix for TrackManager and minor fix in Curve.
There has also been a little fix in the light-class: light is a BaseObject not a World-Entity

Location:
orxonox/trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/math/curve.cc

    r3473 r3588  
    2828#include <math.h>
    2929#include <stdio.h>
     30
     31
     32/**
     33    \brief default constructor for a Curve
     34*/
     35Curve::Curve(void)
     36{
     37  nodeCount = 0;
     38  firstNode = new PathNode;
     39  currentNode = firstNode;
     40
     41  firstNode->position = Vector (.0, .0, .0);
     42  firstNode->number = 0;
     43  firstNode->next = 0; // not sure if this really points to NULL!!
     44}
    3045
    3146/**
     
    131146  this->derivation = 0;
    132147  dirCurve = new BezierCurve(1);
    133   this->init();
    134148}
    135149
     
    141155  this->derivation = derivation;
    142156  dirCurve=NULL;
    143   this->init();
    144157}
    145158
     
    161174  if (dirCurve)
    162175    delete dirCurve;
    163 }
    164 
    165 /**
    166    \brief Initializes a BezierCurve
    167 */
    168 void BezierCurve::init(void)
    169 {
    170   nodeCount = 0;
    171   firstNode = new PathNode;
    172   currentNode = firstNode;
    173 
    174   firstNode->position = Vector (.0, .0, .0);
    175   firstNode->number = 0;
    176   firstNode->next = 0; // not sure if this really points to NULL!!
    177 
    178   return;
    179176}
    180177
     
    297294{
    298295  this->derivation = 0;
    299   this->init();
    300296}
    301297
     
    307303  this->derivation = derivation;
    308304  dirCurve=NULL;
    309   this->init();
    310305}
    311306
     
    327322  if (dirCurve)
    328323    delete dirCurve;
    329 }
    330 
    331 /**
    332    \brief Initializes a UPointCurve
    333 */
    334 void UPointCurve::init(void)
    335 {
    336   nodeCount = 0;
    337   firstNode = new PathNode;
    338   currentNode = firstNode;
    339 
    340   firstNode->position = Vector (.0, .0, .0);
    341   firstNode->number = 0;
    342   firstNode->next = 0; // not sure if this really points to NULL!!
    343 
    344   return;
    345324}
    346325
  • orxonox/trunk/src/lib/math/curve.h

    r3473 r3588  
    3838  PathNode* currentNode; //!< The node we are working with (the Last node).
    3939
     40
    4041 private:
    4142  virtual void rebuild(void) = 0;
    4243 public:
     44  Curve(void);
     45
    4346  Curve* dirCurve;       //!< The derivation-curve of this Curve.
    4447  void addNode(const Vector& newNode);
     
    6871  BezierCurve(void);
    6972  BezierCurve(int derivation);
    70   ~BezierCurve(void);
    71   void init(void);
     73  virtual ~BezierCurve(void);
    7274
    7375  Vector calcPos(float t);
     
    106108  UPointCurve(int derivation);
    107109  ~UPointCurve(void);
    108   void init(void);
    109110
    110111  Vector calcPos(float t);
  • orxonox/trunk/src/light.h

    r3544 r3588  
    3232   A Light is a source that emits light rays (photons)
    3333*/
    34 class Light : public WorldEntity
     34class Light : public BaseObject
    3535{
    3636 private:
  • orxonox/trunk/src/story_entities/world.cc

    r3587 r3588  
    7171  delete this->nullParent;
    7272  delete this->entities;
    73 
     73  delete this->light;
    7474  delete this->trackManager;
    7575}
     
    296296  // LIGHT initialisation
    297297  light = Light::getInstance();
    298   light->addLight(0);
     298  light->setAmbientColor(.1,.1,.1);
     299  light->addLight();
    299300  light->setAttenuation(QUADRATIC, 1.0);
    300301  light->setAttenuation(CONSTANT, 2.0);
  • orxonox/trunk/src/track_manager.cc

    r3556 r3588  
    3737  this->mainJoin = false;
    3838  this->ID = -1;
    39   this->startingTime = 0; //!< \todo eventually set this to the max time of TrackManager.
    40   this->duration = 1;
     39  this->startingTime = 0;
     40  this->duration = TMAN_DEFAULT_DURATION;
    4141  this->endTime = 1;
    4242  this->jumpTime = 0;
    43   this->curveType = BEZIERCURVE;
    4443  this->nodeCount = 0;
    4544  this->childCount = 0;
     
    115114
    116115/**
     116   \param name the Name to set.
     117*/
     118void TrackElement::setName(const char* name)
     119{
     120  //  delete the old name
     121  if (this->name)
     122    delete []this->name;
     123  // if a name was given already.
     124  if (name)
     125    {
     126      this->name = new char[strlen(name)+1];
     127      strcpy(this->name, name);
     128    }
     129  else
     130    this->name = NULL;
     131}
     132
     133/**
     134   \returns The name of this TrackElement
     135*/
     136char* TrackElement::getName(void) const
     137{
     138  return this->name;
     139}
     140
     141
     142/**
    117143   \brief CONDITION that chooses the first child for the decision (static)
    118144   \param nothing Nothing in this function
     
    266292      this->addPoint(this->currentTrackElem->curve->getNode(this->currentTrackElem->curve->getNodeCount()), this->currentTrackElem->children[i]);
    267293    }
     294  if (childCount == 1)
     295    this->currentTrackElem->children[0]->setName(this->currentTrackElem->getName());
    268296}
    269297
     
    307335      return;
    308336    }
    309   trackElem->curveType = curveType;
     337  this->curveType = curveType;
    310338  switch (curveType)
    311339    {
     
    348376  if (trackElem->isFresh)
    349377    {
    350       this->setCurveType(BEZIERCURVE, trackElem);
     378      this->setCurveType(TMAN_DEFAULT_CURVETYPE, trackElem);
    351379      trackElem->isFresh = false;
    352380    }
     
    757785          TrackElement* tmpElem = this->findTrackElementByID(i);
    758786          PRINT(0)("--== TrackElement:%i ==--", tmpElem->ID);
    759           if(tmpElem->name)
    760             PRINT(0)("Name: %s::", tmpElem->name);
     787          if(tmpElem->getName())
     788            PRINT(0)("Name: %s::", tmpElem->getName());
    761789          if(tmpElem->isFresh)
    762790            PRINT(0)("  -- has not jet eddited in any way --\n");
  • orxonox/trunk/src/track_manager.h

    r3556 r3588  
    1717class PNode;
    1818
     19// Static Definitions
     20
     21//! The Default Curve-Type to set for the whole path (if not chosen otherwise).
     22#define TMAN_DEFAULT_CURVETYPE BEZIERCURVE
     23#define TMAN_DEFAULT_DURATION 10
     24
     25
    1926//! A Graph-Element, that holds the curve-structure of a Level.
    2027/**
     
    3138  bool backLoopCheck(TrackElement* trackElem);
    3239
     40  // atributes
    3341  bool isFresh;              //!< If no Points where added until now
    3442  bool isHotPoint;           //!< If the first node is a specialPoint;
     
    4250  float endTime;             //!< The time at which this Track ends.
    4351  float jumpTime;            //!< The Time this Track has to jump to its preceding Track (only >0 if Track isJoined==true)
    44   CurveType curveType;       //!< The CurveType this will have.
    4552  int nodeCount;             //!< The count of points this TrackElement has.
    46   char* name;                //!< A name for the Trac.
    4753  Curve* curve;              //!< The Curve of this TrackElement
    4854  int childCount;            //!< The number of Children This TrackElement has.
    4955  TrackElement** children;   //!< A TrackElement can have a Tree of following TrackElements.
     56
     57  void setName(const char* name);
     58  char* getName(void) const;
    5059
    5160  // runtime
     
    6372  int nearest(void* node);
    6473  // todo  int enemyKilled(void* entity);
     74
     75 private:
     76  char* name;                //!< A name for the Trac.
     77 
    6578};
    6679
     
    108121  TrackManager(void);
    109122
    110   static TrackManager* singletonRef;  //!< There may only be one TrackManager existing.
     123  static TrackManager* singletonRef;  //!< There may only be one TrackManager.
     124
    111125  TrackElement* firstTrackElem;       //!< The first TrackElement that exists.
    112126  TrackElement* currentTrackElem;     //!< The TrackElement we are working on.
     127  CurveType curveType;                //!< The CurveType the entire TrackSystem will have.
    113128  float localTime;                    //!< The time that has been passed since the traveling the Track.
    114129  float maxTime;                      //!< The maximal time the track has.
  • orxonox/trunk/src/world_entities/primitive.cc

    r3587 r3588  
    4141  this->material->setDiffuseMap("../data/pictures/sky-replace.jpg");
    4242  this->material->setIllum(3);
    43   this->material->setAmbient(1.0, 1.0, 1.0);
     43  this->material->setSpecular(.3, .3, .3);
    4444}
    4545
Note: See TracChangeset for help on using the changeset viewer.