Changeset 3331 in orxonox.OLD for orxonox/branches/parenting
- Timestamp:
- Jan 4, 2005, 1:39:32 PM (20 years ago)
- Location:
- orxonox/branches/parenting/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/parenting/src/curve.h
r3330 r3331 13 13 14 14 //! An Enumerator that defines what sort of Curves are availible 15 enum CurveType {BEZIER , UPOINT};15 enum CurveType {BEZIERCURVE, UPOINTCURVE}; 16 16 17 17 -
orxonox/branches/parenting/src/track_manager.cc
r3330 r3331 22 22 using namespace std; 23 23 24 /** 25 \brief initializes a TrackElement (sets the default values) 26 */ 27 TrackElement::TrackElement(void) 28 { 29 this->isSavePoint = false; 30 this->isFork = false; 31 this->isJoined = false; 32 this->cond; //!< todo think!! 33 this->ID = -1; 34 this->length =0; 35 this->curveType = BEZIERCURVE; 36 this->nodeCount = 0; 37 childCount = 0; 38 this->curve = NULL; 39 this->children = NULL; 40 } 41 42 /** 43 \destroys all alocated memory) 44 \todo eventually when deleting a TrackElement you would not like to delete all its preceding TrackElements 45 */ 46 TrackElement::~TrackElement(void) 47 { 48 if (this->curve) 49 delete this->curve; 50 if (this->childCount > 0) 51 { 52 for (int i=0; i < this->childCount; i++) 53 delete this->children[i]; 54 } 55 } 56 57 58 24 59 25 60 /** … … 30 65 TrackManager::TrackManager () 31 66 { 32 this->setClassName ("TrackManager"); 33 } 34 35 36 /** 37 \brief standard deconstructor 67 this->setClassName ("TrackManager"); 68 69 PRINTF(3)("Initializing the TrackManager\n"); 70 this->firstTrackElem = NULL; 71 this->currentTrackElem = firstTrackElem; 72 this->localTime = 0; 73 this->maxTime = 0; 74 this->trackElemCount = 0; 75 } 76 77 78 /** 79 \brief standard destructor 38 80 39 81 \todo this deconstructor is not jet implemented - do it … … 41 83 TrackManager::~TrackManager () 42 84 { 43 85 PRINTF(3)("Destruct TrackManager\n"); 86 87 PRINTF(3)("Deleting all the TrackElements\n"); 88 delete this->firstTrackElem; 89 // we do not have a TrackManager anymore 90 singletonRef = NULL; 91 } 92 93 TrackManager* TrackManager::singletonRef = NULL; 94 95 /** 96 \returns The reference on the TrackManager. 97 98 If the TrackManager does not exist, it will be created. 99 */ 100 TrackManager* TrackManager::getInstance(void) 101 { 102 if (singletonRef) 103 return singletonRef; 104 else 105 return singletonRef = new TrackManager(); 44 106 } 45 107 … … 201 263 202 264 /** 265 \brief Jumps to a certain point on the Track. 266 \param time The time on the Track to jump to. 267 268 This should be used to Jump backwards on a Track, because moving forward means to change between the Path. (it then tries to choose the default.) 269 Max is trackLengthMax. 270 */ 271 void TrackManager::jumpTo(float time) 272 { 273 274 } 275 276 /** 203 277 \brief a Function that decides which Path we should follow. 204 278 \param graphID The Path to choose. -
orxonox/branches/parenting/src/track_manager.h
r3330 r3331 13 13 14 14 #include "stdincl.h" 15 16 17 //! condition for choosing a certain Path. \todo implement a useful way. 18 struct PathCondition 19 { 20 21 }; 22 23 24 //! A Graph-Element, that holds the curve-structure of a Level. 25 /** 26 A TrackElement is used, to define the structure of the Track itself. 27 It is a graph and not a tree, because paths can fork and join again. 28 */ 29 class TrackElement 30 { 31 public: 32 TrackElement(void); 33 ~TrackElement(void); 34 35 bool isSavePoint; //!< If the first node is a savePoint 36 bool isFork; //!< If the first node is a Fork 37 bool isJoined; //!< If the End of the Curve is joined. 38 PathCondition cond; //!< The Split Condition; 39 int ID; //!< The ID of this TrackElement 40 float length; //!< The time usedto cross this TrackElement (curve). 41 CurveType curveType; //!< The CurveType this will have. 42 int nodeCount; //!< The count of points this TrackElement has. 43 Curve* curve; //!< The Curve of this TrackElement 44 int childCount; //!< The number of Children This TrackElement has. 45 TrackElement** children; //!< A TrackElement can have a Tree of following TrackElements. 46 }; 47 15 48 16 49 … … 42 75 43 76 TrackManager can be handled as a StateMachine. 77 \n\n 78 Names: 79 \li TrackManager: handles Tracks 80 \li Track: The Track that the ship can follow 81 \li Path: one way through the Level, that is dependent on conditionals. 82 \li Conditional: A decition making device, that chooses betwen different TrackElements for the Path. 83 \li TrackElement: A Part of A whole Track 44 84 */ 45 class TrackManager : public BaseObject { 85 class TrackManager : public BaseObject 86 { 46 87 private: 47 //! condition for choosing a certain Path. \todo implement a useful way. 48 struct PathCondition 49 { 50 51 }; 88 TrackManager(void); 89 90 static TrackManager* singletonRef; //!< There may only be one TrackManager existing. 91 TrackElement* firstTrackElem; //!< The first TrackElement that exists. 92 TrackElement* currentTrackElem; //!< The TrackElement we are working on. 93 float localTime; //!< The time that has been passed since the traveling the Track. 94 float maxTime; //!< The maximal time the track has. 95 int trackElemCount; //!< The count of TrackElements that exist. 52 96 53 //! A Graph, that holds the curve-structure of a Level.54 /**55 A CurveGraph is used, to Define the structure of the Track itself.56 It is a graph and not a tree, because paths can fork and join again.57 */58 struct TrackElement59 {60 bool isSavePoint; //!< If the first node is a savePoint61 bool isFork; //!< If the first node is a Fork62 bool isJoined; //!< If the End of the Curve is joined.63 PathCondition cond; //!< The Split Condition;64 int ID; //!< The ID of this TrackElement65 float length; //!< The time usedto cross this TrackElement (curve).66 CurveType curveType; //!< The CurveType this will have.67 int nodeCount; //!< The count of points this TrackElement has.68 Curve* curve; //!< The Curve of this TrackElement69 TrackElement** children; //!< A TrackElement can have a Tree of following TrackElements.70 };71 97 72 73 TrackElement* firstGraph; //!< The first Graph-element we are on. 74 TrackElement* currentGraph; //!< The Graph-element we are working on. 75 float localTime; //!< The time that has been passed since the traveling the Track. 76 int trackElementCount; //!< The count of TrackElements that exist. 98 TrackElement findTrackElementByID(int trackID); 77 99 78 TrackElement findTrackElementByID(int trackID);79 100 80 101 public: 81 TrackManager ();82 ~TrackManager ();102 ~TrackManager(void); 103 static TrackManager* getInstance(void); 83 104 84 105 // Methods to change the Path (initialisation) … … 99 120 Vector calcDir(); 100 121 void tick(float dt); 122 void jumpTo(float time); 101 123 void choosePath(int graphID); 102 124
Note: See TracChangeset
for help on using the changeset viewer.