Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10284 in orxonox.OLD


Ignore:
Timestamp:
Jan 17, 2007, 9:11:34 PM (17 years ago)
Author:
bknecht
Message:

some modification for the track

Location:
branches/playability/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/util/track/track.cc

    r10209 r10284  
    2727
    2828#include "p_node.h"
     29
     30#include "stdincl.h"
    2931
    3032#include "debug.h"
     
    6870  this->curve = new BezierCurve();
    6971  this->trackNode = new PNode(PNode::getNullParent(), PNODE_ALL);
     72  this->nodeCount = 0;
    7073}
    7174
     
    8386     LOAD_PARAM_START_CYCLE(root, element);
    8487     {
    85            LoadParam_CYCLE(element, "Point", this, Track, addPoint)
     88           LoadParam_CYCLE(element, "addPoint", this, Track, addPoint)
    8689             .describe("Adds a new Point to the currently selected TrackElement");
    8790
     
    100103void Track::addPoint(float x, float y, float z)
    101104{
    102      this->addPoint(Vector (x,y,z));
     105     this->addPointV(Vector (x,y,z));
    103106}
    104107
     
    108111 * @param newPoint
    109112 */
    110 void Track::addPoint(Vector newPoint)
     113void Track::addPointV(Vector newPoint)
    111114{
    112115   this->curve->addNode(newPoint);
     116   if( this->nodeCount == 0) this->trackNode->setAbsCoor(newPoint);
    113117   this->nodeCount++;
     118   PRINTF(4)("Point added to curve %d\n");
    114119}
    115120
     
    117122 * We probably doesn't even need this
    118123 */
    119 void Track::finalize()
    120 {
     124//void Track::finalize()
     125//{
    121126//   for (int i = 1; i<= trackElemCount ;i++)
    122127//     {
     
    159164      this->maxTime = this->firstTrackElem->findByID(i)->endTime; // very bad implemented :/
    160165      */
    161 }
     166//}
    162167
    163168Vector Track::calcPos() const
     
    204209
    205210       // move trackNode of the track
    206        this->trackNode->setAbsCoor(tmp);
     211       this->trackNode->shiftCoor(tmp - this->trackNode->getAbsCoor());
    207212       // set direction and roll angle of trackNode
    208        this->trackNode->setAbsDir(quat);
     213       // this->trackNode->setAbsDir(quat);
    209214     }
    210215}
     
    217222  return this->trackNode;
    218223}
     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*/
     232void 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  
    2424   virtual void loadParams(const TiXmlElement* root);
    2525   void addPoint(float x, float y, float z);
    26    void addPoint(Vector newPoint);
     26   void addPointV(Vector newPoint);
    2727
    28    void finalize();
     28   //void finalize();
    2929   inline Vector calcPos() const;
    3030   inline Vector calcDir() const;
     
    3232
    3333   PNode* getTrackNode();
     34   
     35   void drawGraph(float dt) const;
    3436     
    3537   //float                 startingTime;         //!< The time at which this Track begins.
  • branches/playability/src/world_entities/WorldEntities.am

    r10235 r10284  
    8282                world_entities/environments/building.cc \
    8383                world_entities/environments/mapped_water.cc \
     84                world_entities/environments/rotor.cc \
    8485                \
    8586                world_entities/elements/image_entity.cc \
     
    203204                environments/building.h \
    204205                environments/mapped_water.h \
     206                environments/rotor.h \
    205207                \
    206208                elements/image_entity.h \
  • branches/playability/src/world_entities/space_ships/space_ship.cc

    r10282 r10284  
    823823        this->travelNode->setAbsCoor(this->getAbsCoor());
    824824        this->travelNode->updateNode(0.01f);
    825 
     825       
    826826        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       
    827834        this->setRelCoor(0,0,0);
    828835
    829836        State::getCameraNode()->setParentSoft(this->travelNode);
    830         //State::getCameraNode()->setParentSoft(this);
     837        //State::getCameraNode()->setParentSoft(this->entityTrack->getTrackNode());
    831838        //State::getCameraNode()->setRelCoorSoft(-0.01, 40, 0);
    832839        State::getCameraTargetNode()->setParentSoft(this->travelNode);
    833         //State::getCameraTargetNode()->setParentSoft(this);
     840        //State::getCameraTargetNode()->setParentSoft(this->entityTrack->getTrackNode());
    834841        //State::getCameraTargetNode()->setRelCoorSoft(0,0,0);
    835842        this->setCameraMode(Camera::ViewTop);
     
    10041011
    10051012    //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));
    10071015
    10081016    break;
  • branches/playability/src/world_entities/world_entity.cc

    r10209 r10284  
    682682      this->models[0]->draw();
    683683    }
     684   
     685    if (this->entityTrack)
     686       this->entityTrack->drawGraph(0.02);
    684687
    685688    //     if( this->aabbNode != NULL)
Note: See TracChangeset for help on using the changeset viewer.