- Timestamp:
- Jan 17, 2007, 9:11:34 PM (18 years ago)
- Location:
- branches/playability/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/util/track/track.cc
r10209 r10284 27 27 28 28 #include "p_node.h" 29 30 #include "stdincl.h" 29 31 30 32 #include "debug.h" … … 68 70 this->curve = new BezierCurve(); 69 71 this->trackNode = new PNode(PNode::getNullParent(), PNODE_ALL); 72 this->nodeCount = 0; 70 73 } 71 74 … … 83 86 LOAD_PARAM_START_CYCLE(root, element); 84 87 { 85 LoadParam_CYCLE(element, " Point", this, Track, addPoint)88 LoadParam_CYCLE(element, "addPoint", this, Track, addPoint) 86 89 .describe("Adds a new Point to the currently selected TrackElement"); 87 90 … … 100 103 void Track::addPoint(float x, float y, float z) 101 104 { 102 this->addPoint (Vector (x,y,z));105 this->addPointV(Vector (x,y,z)); 103 106 } 104 107 … … 108 111 * @param newPoint 109 112 */ 110 void Track::addPoint (Vector newPoint)113 void Track::addPointV(Vector newPoint) 111 114 { 112 115 this->curve->addNode(newPoint); 116 if( this->nodeCount == 0) this->trackNode->setAbsCoor(newPoint); 113 117 this->nodeCount++; 118 PRINTF(4)("Point added to curve %d\n"); 114 119 } 115 120 … … 117 122 * We probably doesn't even need this 118 123 */ 119 void Track::finalize()120 {124 //void Track::finalize() 125 //{ 121 126 // for (int i = 1; i<= trackElemCount ;i++) 122 127 // { … … 159 164 this->maxTime = this->firstTrackElem->findByID(i)->endTime; // very bad implemented :/ 160 165 */ 161 }166 //} 162 167 163 168 Vector Track::calcPos() const … … 204 209 205 210 // move trackNode of the track 206 this->trackNode->s etAbsCoor(tmp);211 this->trackNode->shiftCoor(tmp - this->trackNode->getAbsCoor()); 207 212 // set direction and roll angle of trackNode 208 this->trackNode->setAbsDir(quat);213 // this->trackNode->setAbsDir(quat); 209 214 } 210 215 } … … 217 222 return this->trackNode; 218 223 } 224 225 /** 226 * Imports a model of the Graph into the OpenGL-environment. 227 * @param dt The Iterator used in seconds for Painting the Graph. 228 229 This is for testing facility only. Do this if you want to see the Path inside the Level. 230 eventually this will all be packed into a gl-list. 231 */ 232 void Track::drawGraph(float dt) const 233 { 234 glBegin(GL_LINE_STRIP); 235 for(float f = 0.0; f < 1.0; f+=dt) 236 { 237 // PRINTF(4)("drawing",this->calcPos().x, this->calcPos().y, this->calcPos().z); 238 Vector tmpVector = this->curve->calcPos(f); 239 glVertex3f(tmpVector.x, tmpVector.y, tmpVector.z); 240 } 241 glEnd(); 242 } -
branches/playability/src/util/track/track.h
r10096 r10284 24 24 virtual void loadParams(const TiXmlElement* root); 25 25 void addPoint(float x, float y, float z); 26 void addPoint (Vector newPoint);26 void addPointV(Vector newPoint); 27 27 28 void finalize();28 //void finalize(); 29 29 inline Vector calcPos() const; 30 30 inline Vector calcDir() const; … … 32 32 33 33 PNode* getTrackNode(); 34 35 void drawGraph(float dt) const; 34 36 35 37 //float startingTime; //!< The time at which this Track begins. -
branches/playability/src/world_entities/WorldEntities.am
r10235 r10284 82 82 world_entities/environments/building.cc \ 83 83 world_entities/environments/mapped_water.cc \ 84 world_entities/environments/rotor.cc \ 84 85 \ 85 86 world_entities/elements/image_entity.cc \ … … 203 204 environments/building.h \ 204 205 environments/mapped_water.h \ 206 environments/rotor.h \ 205 207 \ 206 208 elements/image_entity.h \ -
branches/playability/src/world_entities/space_ships/space_ship.cc
r10282 r10284 823 823 this->travelNode->setAbsCoor(this->getAbsCoor()); 824 824 this->travelNode->updateNode(0.01f); 825 825 826 826 this->setParent(this->travelNode); 827 828 // If track exists put travelNode on trackNode of track 829 if (this->entityTrack) 830 this->travelNode->setParent(this->entityTrack->getTrackNode()); 831 832 833 827 834 this->setRelCoor(0,0,0); 828 835 829 836 State::getCameraNode()->setParentSoft(this->travelNode); 830 //State::getCameraNode()->setParentSoft(this );837 //State::getCameraNode()->setParentSoft(this->entityTrack->getTrackNode()); 831 838 //State::getCameraNode()->setRelCoorSoft(-0.01, 40, 0); 832 839 State::getCameraTargetNode()->setParentSoft(this->travelNode); 833 //State::getCameraTargetNode()->setParentSoft(this );840 //State::getCameraTargetNode()->setParentSoft(this->entityTrack->getTrackNode()); 834 841 //State::getCameraTargetNode()->setRelCoorSoft(0,0,0); 835 842 this->setCameraMode(Camera::ViewTop); … … 1004 1011 1005 1012 //this moves camera and ship along the travel path. 1006 this->travelNode->shiftCoor(Vector(this->cameraSpeed * dt, 0, 0)); 1013 if (!this->entityTrack) 1014 this->travelNode->shiftCoor(Vector(this->cameraSpeed * dt, 0, 0)); 1007 1015 1008 1016 break; -
branches/playability/src/world_entities/world_entity.cc
r10209 r10284 682 682 this->models[0]->draw(); 683 683 } 684 685 if (this->entityTrack) 686 this->entityTrack->drawGraph(0.02); 684 687 685 688 // if( this->aabbNode != NULL)
Note: See TracChangeset
for help on using the changeset viewer.