Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3698 in orxonox.OLD


Ignore:
Timestamp:
Mar 31, 2005, 9:04:45 PM (19 years ago)
Author:
dave
Message:

branches/shadows: so jetzt ist die Ausgangslage geschaffen

Location:
orxonox/branches/shadows/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/shadows/src/Makefile.am

    r3680 r3698  
    3838                 curve.cc \
    3939                 glmenu_imagescreen.cc\
    40                  shadow.cc
     40                 shadow.cc \
     41                 skysphere.cc
    4142
    4243
     
    8081                 curve.h \
    8182                 glmenu_imagescreen.h \
    82                  debug.h
    8383                 debug.h \
    84                  shadow.h
     84                 debug.h \
     85                 shadow.h \
     86                 skysphere.h
    8587
    8688
  • orxonox/branches/shadows/src/Makefile.in

    r3680 r3698  
    6464        base_object.$(OBJEXT) helper_parent.$(OBJEXT) \
    6565        track_manager.$(OBJEXT) matrix.$(OBJEXT) curve.$(OBJEXT) \
    66         glmenu_imagescreen.$(OBJEXT) shadow.$(OBJEXT)
     66        glmenu_imagescreen.$(OBJEXT) shadow.$(OBJEXT) \
     67        skysphere.$(OBJEXT)
    6768orxonox_OBJECTS = $(am_orxonox_OBJECTS)
    6869orxonox_LDADD = $(LDADD)
     
    8687@AMDEP_TRUE@    ./$(DEPDIR)/orxonox.Po ./$(DEPDIR)/p_node.Po \
    8788@AMDEP_TRUE@    ./$(DEPDIR)/player.Po ./$(DEPDIR)/shadow.Po \
     89@AMDEP_TRUE@    ./$(DEPDIR)/skysphere.Po \
    8890@AMDEP_TRUE@    ./$(DEPDIR)/story_entity.Po ./$(DEPDIR)/texture.Po \
    8991@AMDEP_TRUE@    ./$(DEPDIR)/track.Po ./$(DEPDIR)/track_manager.Po \
     
    240242                 curve.cc \
    241243                 glmenu_imagescreen.cc\
    242                  shadow.cc
     244                 shadow.cc \
     245                 skysphere.cc
    243246
    244247noinst_HEADERS = ability.h \
     
    281284                 curve.h \
    282285                 glmenu_imagescreen.h \
    283                  debug.h
     286                 debug.h \
     287                 debug.h \
     288                 shadow.h \
     289                 skysphere.h
    284290
    285291EXTRA_DIST = orxonox.conf
     
    309315          esac; \
    310316        done; \
    311         echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/Makefile'; \
     317        echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/Makefile'; \
    312318        cd $(top_srcdir) && \
    313           $(AUTOMAKE) --gnu  src/Makefile
     319          $(AUTOMAKE) --foreign  src/Makefile
    314320.PRECIOUS: Makefile
    315321Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
     
    387393@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/player.Po@am__quote@
    388394@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shadow.Po@am__quote@
     395@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skysphere.Po@am__quote@
    389396@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/story_entity.Po@am__quote@
    390397@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture.Po@am__quote@
     
    749756        uninstall-binPROGRAMS uninstall-info-am
    750757
    751                  debug.h \
    752                  shadow.h
    753758
    754759#  uncomment the following if orxonox requires the math library
  • orxonox/branches/shadows/src/camera.cc

    r3365 r3698  
    171171        {
    172172          //FIXME: camera should be made via relative coordinates
    173           Vector* cameraOffset = new Vector (-10, 5, 0);
     173          Vector* cameraOffset = new Vector (-22, 10, 0);
    174174          this->setRelCoor (cameraOffset);
    175175        }
  • orxonox/branches/shadows/src/console/Makefile.in

    r3680 r3698  
    195195          esac; \
    196196        done; \
    197         echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/console/Makefile'; \
     197        echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/console/Makefile'; \
    198198        cd $(top_srcdir) && \
    199           $(AUTOMAKE) --gnu  src/console/Makefile
     199          $(AUTOMAKE) --foreign  src/console/Makefile
    200200.PRECIOUS: Makefile
    201201Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • orxonox/branches/shadows/src/gui/Makefile.in

    r3680 r3698  
    222222          esac; \
    223223        done; \
    224         echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/gui/Makefile'; \
     224        echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/gui/Makefile'; \
    225225        cd $(top_srcdir) && \
    226           $(AUTOMAKE) --gnu  src/gui/Makefile
     226          $(AUTOMAKE) --foreign  src/gui/Makefile
    227227.PRECIOUS: Makefile
    228228Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • orxonox/branches/shadows/src/importer/Makefile.in

    r3680 r3698  
    207207          esac; \
    208208        done; \
    209         echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/importer/Makefile'; \
     209        echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/importer/Makefile'; \
    210210        cd $(top_srcdir) && \
    211           $(AUTOMAKE) --gnu  src/importer/Makefile
     211          $(AUTOMAKE) --foreign  src/importer/Makefile
    212212.PRECIOUS: Makefile
    213213Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • orxonox/branches/shadows/src/player.cc

    r3396 r3698  
    6666  bUp = bDown = bLeft = bRight = bAscend = bDescend = false;
    6767  bFire = false;
    68   acceleration = 10.0;
     68  acceleration = 20.0;
    6969  setCollision(new CollisionCluster(1.0, Vector(0,0,0)));
    7070}
     
    103103  glLoadIdentity();
    104104  float matrix[4][4];
    105  
     105  //glRotatef(90.0f,1.0f,0.0f,0.0f);
    106106  /* translate */
    107107  glTranslatef (this->getAbsCoor ().x,
     
    111111  this->getAbsDir ().matrix (matrix);
    112112  glMultMatrixf((float*)matrix);
    113  
     113  glRotatef(angle,1.0f,0.0f,0.0f);
    114114  glMatrixMode(GL_MODELVIEW);
    115115  this->model->draw();
     
    132132void Player::move (float time)
    133133{
     134 
    134135  Vector accel(0.0, 0.0, 0.0);
     136 
    135137  /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */
    136138  //Placement *pos = getPlacement();
     
    138140  /* calculate the direction in which the craft is heading  */
    139141  Vector direction (1.0, 0.0, 0.0);
     142   
     143 
     144 
    140145  //direction = this->absDirection.apply (direction);
    141146  Vector orthDirection (0.0, 0.0, 1.0);
     147 
    142148  //orthDirection = orthDirection.cross (direction);
    143149
    144   if( bUp) { accel = accel+(direction*acceleration); }
    145   if( bDown) { accel = accel-(direction*acceleration); }
    146   if( bLeft ) { accel = accel - (orthDirection*acceleration); }
    147   if( bRight ) { accel = accel + (orthDirection*acceleration); }
     150  if( bUp) { accel = accel+(direction*acceleration);accelSlipDirection=accel; }
     151  if( bDown) { accel = accel-(direction*acceleration);accelSlipDirection=accel; }
     152  if( bLeft ) {if(angle<0) {accel = accel-(orthDirection*acceleration);}rotate(time);accelSlip=accel; }
     153  if( bRight ) { if(angle>0){accel = accel+(orthDirection*acceleration);}rotate(time);accelSlip=accel;}
    148154  if( bAscend ) { /* not yet implemented but just: (0,0,1)*acceleration */}
    149155  if( bDescend) {/* FIXME */} /* \todo up and down player movement */
     156  if((int)angle!=0&&!bLeft&&!bRight){backRotate(time);accelSlip=accelSlip-slip(time,accelSlip);}
     157  if(!bUp&&!bDown){accelSlipDirection=accelSlipDirection-slip(time,accelSlipDirection);}
    150158
    151159  //Location* l = getLocation();
     
    159167  //l->dist = l->dist + travelSpeed * time;
    160168 
    161   Vector* shift = new Vector (this->travelSpeed * time, 0, 0);
    162   this->shiftCoor (shift);
     169  //Vector* shift = new Vector (this->travelSpeed * time, 0, 0);
     170  Vector shift(this->travelSpeed*time,0,0);
     171 
     172  this->shiftCoor (&shift);
    163173 
    164174  /* this updates the player position on the track - user interaction */
    165175  //l->pos = l->pos + accel*time;
     176 
    166177  Vector move = accel * time;
    167178  this->shiftCoor (&move);
    168 }
     179 
     180}
     181void Player::rotate(float time){
     182    if(bLeft&&angle>-40.0f){
     183        angle=angle-time*200.0f;
     184               
     185    }
     186    if(bRight&&angle<40.0f){
     187        angle=angle+time*200.0f;
     188               
     189    }
     190}
     191
     192void Player::backRotate(float time){
     193    if(angle<0){
     194    angle=angle+3.0f*(exp(angle*.0015f*time));
     195   
     196   
     197    }
     198    if(angle>0){
     199    angle=angle-3.0f*(exp(-angle*.0015f*time));
     200   
     201   
     202    }
     203
     204}
     205//When the sidewords movement is finished, the ship will still slip untill it stands still
     206Vector Player::slip(float time,Vector accel){
     207        Vector move= accel*time;
     208        this->shiftCoor(&move);
     209        return accel*time*3.0f;
     210   
     211}
     212
     213
     214
     215
     216
  • orxonox/branches/shadows/src/player.h

    r3396 r3698  
    3232  virtual void leftWorld();
    3333 
     34 
    3435 private:
    3536  bool bUp, bDown, bLeft, bRight, bAscend, bDescend;
    3637  bool bFire;
     38 
    3739  Vector velocity;
     40  Vector accelSlip;
     41  Vector accelSlipDirection;
    3842  float travelSpeed;
    3943  float acceleration;
     44  float angle;
    4045  GLuint objectList;
    4146 
    4247  void move(float time);
    43  
     48  void rotate(float time);
     49  void backRotate(float time);
     50  Vector slip (float time,Vector accel);
    4451};
    4552
  • orxonox/branches/shadows/src/world.cc

    r3370 r3698  
    2828#include "helper_parent.h"
    2929#include "glmenu_imagescreen.h"
     30#include "skysphere.h"
     31#include "importer/material.h"
    3032
    3133using namespace std;
     
    9294  {20.0, 10.0, 5.0}, {40.0, -10.0, 0.0},
    9395  {60.0, -10.0, 5.0}, {80.0, 10.0, 5.0}};
     96
     97
    9498
    9599
     
    286290            orx->getLocalInput()->bind (myPlayer);
    287291           
     292           
     293            // create skybox
     294            this->skysphere =new Skysphere();
     295                   
     296                   
    288297            // bind camera
    289298            this->localCamera = new Camera(this);
     
    330339            this->pathnodes[5] = Vector(30, 50, 0);
    331340           
    332 
     341           
    333342
    334343
     
    368377
    369378  // initialize debug coord system
     379 
     380 
     381 
     382 
     383   
     384 
     385  // Initializing the Ground, and loading a Texture into it.
     386  Material* boden = new Material("Ground");
     387  boden->setDiffuseMap("../data/pictures/ground.tga");
     388  // Setting the illumination mode otherwise it is flat-shaded.
     389  boden->setIllum(3);
     390 
     391   
    370392  objectList = glGenLists(1);
    371393  glNewList (objectList, GL_COMPILE);
    372394  glLoadIdentity();
    373   glColor3f(1.0,0,0);
     395  //glColor3f(1.0,0,0);
     396 
     397  // Enabling Textures
     398  glEnable(GL_TEXTURE_2D);
     399 
     400  // Selecting the new Ground Material.
     401  boden->select();
     402 
     403 
    374404  glBegin(GL_QUADS);
    375 
     405 
     406 
     407 
    376408  int sizeX = 100;
    377409  int sizeZ = 80;
    378410  float length = 1000;
    379   float width = 200;
     411  float width = 300;
    380412  float widthX = float (length /sizeX);
    381413  float widthZ = float (width /sizeZ);
     
    419451      }
    420452
    421   int snowheight=3;
     453 
    422454  for ( int i = 0; i<sizeX; i+=1)
    423455    for (int j = 0; j<sizeZ;j+=1)
     
    428460        Vector v4 = Vector (widthX*(i),      height[i][j+1]-20,     widthZ*(j+1)-width/2);
    429461        float a[3];
    430         if(height[i][j]<snowheight){
    431           a[0]=0;
    432           a[1]=1.0-height[i][j]/10-.3;
    433           a[2]=0;
    434           glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
    435         }
    436         else{
    437             a[0]=1.0;
    438             a[1]=1.0;
    439             a[2]=1.0;
    440             glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
    441            
    442         }
     462        a[0]=1.0;
     463        a[1]=1.0;
     464        a[2]=1.0;
     465        glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
     466       
    443467        glNormal3f(normal_vectors[i][j].x, normal_vectors[i][j].y, normal_vectors[i][j].z);
     468        glTexCoord2f(0.0f,0.0f);
     469        //glTexCoord2f((float)i/(float)sizeX,(float)j/(float)sizeZ);
    444470        glVertex3f(v1.x, v1.y, v1.z);
    445         if(height[i+1][j]<snowheight){
    446           a[0]=0;
    447           a[1] =1.0-height[i+1][j]/10-.3;
    448           a[2]=0;
    449           glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
    450         }
    451         else{
    452           a[0]=1.0;
    453           a[1]=1.0;
    454           a[2]=1.0;
    455           glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
    456          
    457         }
     471       
     472       
    458473        glNormal3f(normal_vectors[i+1][j].x, normal_vectors[i+1][j].y, normal_vectors[i+1][j].z);
     474        glTexCoord2f(1.0f,0.0f);
     475        //glTexCoord2f((float)(i+1.0)/(float)sizeX,(float)j/(float)sizeZ);
    459476        glVertex3f(v2.x, v2.y, v2.z);
    460         if(height[i+1][j+1]<snowheight){
    461           a[0]=0;
    462           a[1] =1.0-height[i+1][j+1]/10-.3;
    463           a[2]=0;
    464           glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
    465         }
    466         else{
    467           a[0]=1.0;
    468           a[1]=1.0;
    469           a[2]=1.0;
    470           glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
    471          
    472          
    473         }
     477       
    474478        glNormal3f(normal_vectors[i+1][j+1].x, normal_vectors[i+1][j+1].y, normal_vectors[i+1][j+1].z);
     479        glTexCoord2f(1.0f,1.0f);
     480        //glTexCoord2f((float)(i+1.0)/(float)sizeX,(float)(j+1.0)/(float)sizeZ);
    475481        glVertex3f(v3.x, v3.y, v3.z);
    476         if(height[i][j+1]<snowheight){
    477           a[0]=0;
    478           a[1] =1.0-height[i+1][j+1]/10-.3;
    479           a[2]=0;
    480           glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
    481         }
    482         else{
    483           a[0]=1.0;
    484           a[1]=1.0;
    485           a[2]=1.0;
    486           glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
    487         }
     482       
    488483        glNormal3f(normal_vectors[i][j+1].x, normal_vectors[i][j+1].y, normal_vectors[i][j+1].z);
     484        glTexCoord2f(0.0f,1.0f);
     485        //glTexCoord2f((float)(i)/(float)sizeX,(float)(j+1.0)/(float)sizeZ);
    489486        glVertex3f(v4.x, v4.y, v4.z);
    490487       
    491488      }
    492489  glEnd();
    493   /* 
    494   glBegin(GL_LINES);
    495   for( float x = -128.0; x < 128.0; x += 25.0)
    496     {
    497       for( float y = -128.0; y < 128.0; y += 25.0)
    498         {
    499           glColor3f(1,0,0);
    500           glVertex3f(x,y,-128.0);
    501           glVertex3f(x,y,0.0);
    502           glColor3f(0.5,0,0);
    503           glVertex3f(x,y,0.0);
    504           glVertex3f(x,y,128.0);
    505         }
    506     }
    507   for( float y = -128.0; y < 128.0; y += 25.0)
    508     {
    509       for( float z = -128.0; z < 128.0; z += 25.0)
    510         {
    511           glColor3f(0,1,0);
    512           glVertex3f(-128.0,y,z);
    513           glVertex3f(0.0,y,z);
    514           glColor3f(0,0.5,0);
    515           glVertex3f(0.0,y,z);
    516           glVertex3f(128.0,y,z);
    517         }
    518     }
    519   for( float x = -128.0; x < 128.0; x += 25.0)
    520     {
    521       for( float z = -128.0; z < 128.0; z += 25.0)
    522         {
    523           glColor3f(0,0,1);
    524           glVertex3f(x,-128.0,z);
    525           glVertex3f(x,0.0,z);
    526           glColor3f(0,0,0.5);
    527           glVertex3f(x,0.0,z);
    528           glVertex3f(x,128.0,z);
    529         }
    530      
    531     }
    532   */ 
     490 
     491  // Disable Textures Again, for Performance reasons.
     492  //glLoadIdentity();
     493  glDisable(GL_TEXTURE_2D);
     494
     495 
    533496  //draw track
    534497  glBegin(GL_LINES);
     
    541504  glEnd();
    542505 
    543   /*
    544   glBegin(GL_LINE_STRIP);
    545   glColor3f(1.0, 5.0, 1.0);
    546   for( int i = 0; i <= 30; i++)
    547     {
    548       glEvalCoord1f ((GLfloat) i/30.0);
    549     }
    550   glEnd();
    551   */
     506
    552507
    553508  trackManager->drawGraph(.01);
    554509  trackManager->debug(2);
    555510  delete trackManager;
    556  
    557   /*
    558   glBegin(GL_LINES);
    559   float i;
    560   for(i = 0.0; i<1; i+=.01)
    561     {
    562       printf("%f, %f, %f\n",tmpCurve->calcPos(i).x, tmpCurve->calcPos(i).y, tmpCurve->calcPos(i).z);
    563       glVertex3f(tmpCurve->calcPos(i).x, tmpCurve->calcPos(i).y, tmpCurve->calcPos(i).z);
    564     }
    565   glEnd();
    566   */
    567   glEndList();
     511   
     512  glEndList(); 
    568513}
    569514
     
    630575
    631576  // draw debug coord system
     577  //glLoadIdentity();
     578 
    632579  glCallList (objectList);
    633580
     581
     582  //After calling the list, draw the skysphere
     583 
     584  glEnable(GL_TEXTURE_2D);
     585 
     586  skysphere->draw();
     587 
    634588}
    635589
     
    644598void World::update ()
    645599{
     600   
    646601  /*
    647602  //List<WorldEntity> *l;
     
    711666      entity = entities->nextElement();
    712667    }
    713 
     668 
     669  skysphere->updatePosition(localPlayer->absCoordinate.x,localPlayer->absCoordinate.y,localPlayer->absCoordinate.z);
     670 
    714671  //for( int i = 0; i < tracklen; i++) track[i].tick (seconds);
    715672}
  • orxonox/branches/shadows/src/world.h

    r3365 r3698  
    77#define _WORLD_H
    88
     9
    910#include "stdincl.h"
    1011#include "story_entity.h"
     12#include "skysphere.h"
     13class Material;
    1114
    1215
     
    5861  tList<WorldEntity>* entities;
    5962 
     63 
    6064  // base level data
     65 
    6166  TrackManager* trackManager;
    6267  Track* track;
     
    8186
    8287  WorldEntity* localPlayer;
    83  
     88  Skysphere* skysphere;
    8489  PNode* nullParent;
    8590 
Note: See TracChangeset for help on using the changeset viewer.