- Timestamp:
- Feb 18, 2005, 4:56:49 PM (20 years ago)
- Location:
- orxonox/branches/dave/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/dave/src/skybox.cc
r3407 r3408 11 11 #include "skybox.h" 12 12 #include "stdincl.h" 13 #include "vector.h" 13 14 #include "world_entity.h" 14 #include "vector.h"15 15 16 16 17 17 using namespace std; 18 18 19 Skybox::Skybox() :WorldEntity()19 Skybox::Skybox() 20 20 { 21 21 //GLUquadricObj *sphereObj=0; … … 27 27 Skybox::~Skybox(){} 28 28 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;45 29 46 30 47 }48 31 49 50 void Skybox::draw() 32 void Skybox::draw(WorldEntity* myplayer) 51 33 { 52 34 53 35 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); 57 41 gluSphere(sphereObj,250.0f,20,20); 58 42 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 84 43 85 44 … … 90 49 91 50 51 52 53 -
orxonox/branches/dave/src/skybox.h
r3407 r3408 1 1 #ifndef _SKYBOX_H 2 2 #define _SKYBOX_H 3 3 #include "p_node.h" 4 4 #include "world_entity.h" 5 5 6 class Skybox: public WorldEntity6 class Skybox: public PNode 7 7 { 8 8 … … 10 10 private: 11 11 GLUquadricObj *sphereObj; 12 bool bUp,bDown,bLeft,bRight;13 void move(float time);12 13 14 14 15 15 public: … … 17 17 ~Skybox(); 18 18 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 26 23 27 24 }; -
orxonox/branches/dave/src/world.cc
r3407 r3408 290 290 orx->getLocalInput()->bind (myPlayer); 291 291 292 292 293 // create skybox 293 294 this->skybox = new Skybox();294 this->skybox =new Skybox(); 295 295 296 296 297 // bind camera … … 394 395 395 396 396 Material*sky = new Material("Sky");397 sky = new Material("Sky"); 397 398 sky->setDiffuseMap("../data/pictures/sky-replace.jpg"); 398 sky->setIllum( 2);399 sky->setIllum(3); 399 400 400 401 … … 525 526 glEnable(GL_TEXTURE_2D); 526 527 sky->select(); 527 skybox->draw();528 528 529 529 530 glEndList(); … … 593 594 // draw debug coord system 594 595 //glLoadIdentity(); 596 595 597 glCallList (objectList); 596 598 skybox->draw(localPlayer); 599 597 600 } 598 601 … … 607 610 void World::update () 608 611 { 612 609 613 /* 610 614 //List<WorldEntity> *l; … … 674 678 entity = entities->nextElement(); 675 679 } 676 680 681 682 677 683 //for( int i = 0; i < tracklen; i++) track[i].tick (seconds); 678 684 } -
orxonox/branches/dave/src/world.h
r3407 r3408 87 87 WorldEntity* localPlayer; 88 88 Skybox* skybox; 89 89 Material* sky; 90 90 PNode* nullParent; 91 91
Note: See TracChangeset
for help on using the changeset viewer.