Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3408 in orxonox.OLD


Ignore:
Timestamp:
Feb 18, 2005, 4:56:49 PM (19 years ago)
Author:
dave
Message:

branches/dave/src: Die Skybox bewegt sich schon mal, dafuer neuer fehler beim Steuern

Location:
orxonox/branches/dave/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/dave/src/skybox.cc

    r3407 r3408  
    1111#include "skybox.h"
    1212#include "stdincl.h"
     13#include "vector.h"
    1314#include "world_entity.h"
    14 #include "vector.h"
    1515
    1616
    1717using namespace std;
    1818
    19 Skybox::Skybox():WorldEntity()
     19Skybox::Skybox()
    2020
    2121    //GLUquadricObj *sphereObj=0;
     
    2727Skybox::~Skybox(){}
    2828
    29 void Skybox::tick(float time){
    30     this->move(time);
    31 }
    32 
    33 void Skybox::hit(WorldEntity* weapon,Vector loc){}
    34 
    35 void Skybox::destroy(){}
    36 
    37 void Skybox::collide(WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitlags){}
    38 
    39 void Skybox::command(Command* cmd)
    40 {
    41     if(!strcmp(cmd->cmd, "up")) bUp=!cmd->bUp;
    42     else if(!strcmp(cmd->cmd,"down"))bDown=!cmd->bUp;
    43     else if(!strcmp(cmd->cmd,"left"))bLeft=!cmd->bUp;
    44     else if(!strcmp(cmd->cmd,"right"))bRight=!cmd->bUp;
    4529
    4630
    47 }
    4831
    49 
    50 void Skybox::draw()
     32void Skybox::draw(WorldEntity* myplayer)
    5133{
    5234
    5335    glPushMatrix();
    54     glTranslatef(this->getAbsCoor().x,this->getAbsCoor().y,this->getAbsCoor().z);
    55     glRotatef(180.0f,0.0f,0.0f,1.0f);
    56     glRotatef(45.0f,0.0,1.0f,0.0f);
     36    //Vector shift(myplayer->getRelCoor());
     37    //glTranslatef(shift.x,shift.y,shift.z);
     38    glTranslatef(myplayer->absCoordinate.x,myplayer->absCoordinate.y,myplayer->absCoordinate.z);
     39    glRotatef(-180.0f,0.0f,0.0f,1.0f);
     40    glRotatef(0.0f,0.0,1.0f,0.0f);
    5741    gluSphere(sphereObj,250.0f,20,20);
    5842    glPopMatrix();
    59 
    60 
    61 }
    62 
    63 void Skybox::leftWorld(){}
    64 
    65 void Skybox::move(float time)
    66 {
    67     Vector accel(0.0,0.0,0.0);
    68     Vector direction (1.0,0.0,0.0);
    69     Vector orthDirection (0.0,0.0,1.0);
    70    
    71     if(bUp){accel=accel+(direction*20.0f);}
    72     if(bDown){accel=accel-(direction*20.0f);}
    73     if(bLeft){accel=accel-(orthDirection*20.0f);}
    74     if(bRight){accel=accel+(orthDirection*20.0f);}
    75    
    76     Vector shift(15.0f*time,0,0);
    77     this->shiftCoor(&shift);
    78     Vector move=accel*time;
    79     this->shiftCoor(&move);
    80    
    81    
    82    
    83    
    8443
    8544
     
    9049
    9150
     51
     52
     53
  • orxonox/branches/dave/src/skybox.h

    r3407 r3408  
    11#ifndef _SKYBOX_H
    22#define _SKYBOX_H
    3 
     3#include "p_node.h"
    44#include "world_entity.h"
    55
    6 class Skybox: public WorldEntity
     6class Skybox: public PNode
    77{
    88
     
    1010private:
    1111    GLUquadricObj *sphereObj;
    12     bool bUp,bDown,bLeft,bRight;
    13     void move(float time);
     12   
     13   
    1414
    1515public:
     
    1717   ~Skybox();
    1818   
    19    virtual void tick(float time);
    20    virtual void hit(WorldEntity* weapon, Vector loc);
    21    virtual void destroy();
    22    virtual void collide(WorldEntity* other, Uint32 ownhitlags, Uint32 otherhitflags);
    23    virtual void command(Command* cmd);
    24    virtual void draw();
    25    virtual void leftWorld();
     19   
     20   
     21   void draw(WorldEntity* myplayer);
     22   
    2623   
    2724};
  • orxonox/branches/dave/src/world.cc

    r3407 r3408  
    290290            orx->getLocalInput()->bind (myPlayer);
    291291           
     292           
    292293            // create skybox
    293            
    294             this->skybox = new Skybox();
     294            this->skybox =new Skybox();
     295                   
    295296                   
    296297            // bind camera
     
    394395 
    395396 
    396   Material* sky = new Material("Sky");
     397  sky = new Material("Sky");
    397398  sky->setDiffuseMap("../data/pictures/sky-replace.jpg");
    398   sky->setIllum(2);
     399  sky->setIllum(3);
    399400 
    400401 
     
    525526  glEnable(GL_TEXTURE_2D);
    526527  sky->select();
    527   skybox->draw();
     528 
    528529 
    529530  glEndList(); 
     
    593594  // draw debug coord system
    594595  //glLoadIdentity();
     596 
    595597  glCallList (objectList);
    596 
     598  skybox->draw(localPlayer);
     599 
    597600}
    598601
     
    607610void World::update ()
    608611{
     612   
    609613  /*
    610614  //List<WorldEntity> *l;
     
    674678      entity = entities->nextElement();
    675679    }
    676 
     680 
     681 
     682 
    677683  //for( int i = 0; i < tracklen; i++) track[i].tick (seconds);
    678684}
  • orxonox/branches/dave/src/world.h

    r3407 r3408  
    8787  WorldEntity* localPlayer;
    8888  Skybox* skybox;
    89  
     89  Material* sky;
    9090  PNode* nullParent;
    9191 
Note: See TracChangeset for help on using the changeset viewer.