Changeset 3698 in orxonox.OLD for orxonox/branches/shadows/src
- Timestamp:
- Mar 31, 2005, 9:04:45 PM (20 years ago)
- Location:
- orxonox/branches/shadows/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/shadows/src/Makefile.am
r3680 r3698 38 38 curve.cc \ 39 39 glmenu_imagescreen.cc\ 40 shadow.cc 40 shadow.cc \ 41 skysphere.cc 41 42 42 43 … … 80 81 curve.h \ 81 82 glmenu_imagescreen.h \ 82 debug.h83 83 debug.h \ 84 shadow.h 84 debug.h \ 85 shadow.h \ 86 skysphere.h 85 87 86 88 -
orxonox/branches/shadows/src/Makefile.in
r3680 r3698 64 64 base_object.$(OBJEXT) helper_parent.$(OBJEXT) \ 65 65 track_manager.$(OBJEXT) matrix.$(OBJEXT) curve.$(OBJEXT) \ 66 glmenu_imagescreen.$(OBJEXT) shadow.$(OBJEXT) 66 glmenu_imagescreen.$(OBJEXT) shadow.$(OBJEXT) \ 67 skysphere.$(OBJEXT) 67 68 orxonox_OBJECTS = $(am_orxonox_OBJECTS) 68 69 orxonox_LDADD = $(LDADD) … … 86 87 @AMDEP_TRUE@ ./$(DEPDIR)/orxonox.Po ./$(DEPDIR)/p_node.Po \ 87 88 @AMDEP_TRUE@ ./$(DEPDIR)/player.Po ./$(DEPDIR)/shadow.Po \ 89 @AMDEP_TRUE@ ./$(DEPDIR)/skysphere.Po \ 88 90 @AMDEP_TRUE@ ./$(DEPDIR)/story_entity.Po ./$(DEPDIR)/texture.Po \ 89 91 @AMDEP_TRUE@ ./$(DEPDIR)/track.Po ./$(DEPDIR)/track_manager.Po \ … … 240 242 curve.cc \ 241 243 glmenu_imagescreen.cc\ 242 shadow.cc 244 shadow.cc \ 245 skysphere.cc 243 246 244 247 noinst_HEADERS = ability.h \ … … 281 284 curve.h \ 282 285 glmenu_imagescreen.h \ 283 debug.h 286 debug.h \ 287 debug.h \ 288 shadow.h \ 289 skysphere.h 284 290 285 291 EXTRA_DIST = orxonox.conf … … 309 315 esac; \ 310 316 done; \ 311 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- gnusrc/Makefile'; \317 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ 312 318 cd $(top_srcdir) && \ 313 $(AUTOMAKE) -- gnusrc/Makefile319 $(AUTOMAKE) --foreign src/Makefile 314 320 .PRECIOUS: Makefile 315 321 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status … … 387 393 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/player.Po@am__quote@ 388 394 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shadow.Po@am__quote@ 395 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skysphere.Po@am__quote@ 389 396 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/story_entity.Po@am__quote@ 390 397 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture.Po@am__quote@ … … 749 756 uninstall-binPROGRAMS uninstall-info-am 750 757 751 debug.h \752 shadow.h753 758 754 759 # uncomment the following if orxonox requires the math library -
orxonox/branches/shadows/src/camera.cc
r3365 r3698 171 171 { 172 172 //FIXME: camera should be made via relative coordinates 173 Vector* cameraOffset = new Vector (- 10, 5, 0);173 Vector* cameraOffset = new Vector (-22, 10, 0); 174 174 this->setRelCoor (cameraOffset); 175 175 } -
orxonox/branches/shadows/src/console/Makefile.in
r3680 r3698 195 195 esac; \ 196 196 done; \ 197 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- gnusrc/console/Makefile'; \197 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/console/Makefile'; \ 198 198 cd $(top_srcdir) && \ 199 $(AUTOMAKE) -- gnusrc/console/Makefile199 $(AUTOMAKE) --foreign src/console/Makefile 200 200 .PRECIOUS: Makefile 201 201 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
orxonox/branches/shadows/src/gui/Makefile.in
r3680 r3698 222 222 esac; \ 223 223 done; \ 224 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- gnusrc/gui/Makefile'; \224 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/gui/Makefile'; \ 225 225 cd $(top_srcdir) && \ 226 $(AUTOMAKE) -- gnusrc/gui/Makefile226 $(AUTOMAKE) --foreign src/gui/Makefile 227 227 .PRECIOUS: Makefile 228 228 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
orxonox/branches/shadows/src/importer/Makefile.in
r3680 r3698 207 207 esac; \ 208 208 done; \ 209 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- gnusrc/importer/Makefile'; \209 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/importer/Makefile'; \ 210 210 cd $(top_srcdir) && \ 211 $(AUTOMAKE) -- gnusrc/importer/Makefile211 $(AUTOMAKE) --foreign src/importer/Makefile 212 212 .PRECIOUS: Makefile 213 213 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
orxonox/branches/shadows/src/player.cc
r3396 r3698 66 66 bUp = bDown = bLeft = bRight = bAscend = bDescend = false; 67 67 bFire = false; 68 acceleration = 10.0;68 acceleration = 20.0; 69 69 setCollision(new CollisionCluster(1.0, Vector(0,0,0))); 70 70 } … … 103 103 glLoadIdentity(); 104 104 float matrix[4][4]; 105 105 //glRotatef(90.0f,1.0f,0.0f,0.0f); 106 106 /* translate */ 107 107 glTranslatef (this->getAbsCoor ().x, … … 111 111 this->getAbsDir ().matrix (matrix); 112 112 glMultMatrixf((float*)matrix); 113 113 glRotatef(angle,1.0f,0.0f,0.0f); 114 114 glMatrixMode(GL_MODELVIEW); 115 115 this->model->draw(); … … 132 132 void Player::move (float time) 133 133 { 134 134 135 Vector accel(0.0, 0.0, 0.0); 136 135 137 /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */ 136 138 //Placement *pos = getPlacement(); … … 138 140 /* calculate the direction in which the craft is heading */ 139 141 Vector direction (1.0, 0.0, 0.0); 142 143 144 140 145 //direction = this->absDirection.apply (direction); 141 146 Vector orthDirection (0.0, 0.0, 1.0); 147 142 148 //orthDirection = orthDirection.cross (direction); 143 149 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;} 148 154 if( bAscend ) { /* not yet implemented but just: (0,0,1)*acceleration */} 149 155 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);} 150 158 151 159 //Location* l = getLocation(); … … 159 167 //l->dist = l->dist + travelSpeed * time; 160 168 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); 163 173 164 174 /* this updates the player position on the track - user interaction */ 165 175 //l->pos = l->pos + accel*time; 176 166 177 Vector move = accel * time; 167 178 this->shiftCoor (&move); 168 } 179 180 } 181 void 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 192 void 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 206 Vector 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 32 32 virtual void leftWorld(); 33 33 34 34 35 private: 35 36 bool bUp, bDown, bLeft, bRight, bAscend, bDescend; 36 37 bool bFire; 38 37 39 Vector velocity; 40 Vector accelSlip; 41 Vector accelSlipDirection; 38 42 float travelSpeed; 39 43 float acceleration; 44 float angle; 40 45 GLuint objectList; 41 46 42 47 void move(float time); 43 48 void rotate(float time); 49 void backRotate(float time); 50 Vector slip (float time,Vector accel); 44 51 }; 45 52 -
orxonox/branches/shadows/src/world.cc
r3370 r3698 28 28 #include "helper_parent.h" 29 29 #include "glmenu_imagescreen.h" 30 #include "skysphere.h" 31 #include "importer/material.h" 30 32 31 33 using namespace std; … … 92 94 {20.0, 10.0, 5.0}, {40.0, -10.0, 0.0}, 93 95 {60.0, -10.0, 5.0}, {80.0, 10.0, 5.0}}; 96 97 94 98 95 99 … … 286 290 orx->getLocalInput()->bind (myPlayer); 287 291 292 293 // create skybox 294 this->skysphere =new Skysphere(); 295 296 288 297 // bind camera 289 298 this->localCamera = new Camera(this); … … 330 339 this->pathnodes[5] = Vector(30, 50, 0); 331 340 332 341 333 342 334 343 … … 368 377 369 378 // 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 370 392 objectList = glGenLists(1); 371 393 glNewList (objectList, GL_COMPILE); 372 394 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 374 404 glBegin(GL_QUADS); 375 405 406 407 376 408 int sizeX = 100; 377 409 int sizeZ = 80; 378 410 float length = 1000; 379 float width = 200;411 float width = 300; 380 412 float widthX = float (length /sizeX); 381 413 float widthZ = float (width /sizeZ); … … 419 451 } 420 452 421 int snowheight=3;453 422 454 for ( int i = 0; i<sizeX; i+=1) 423 455 for (int j = 0; j<sizeZ;j+=1) … … 428 460 Vector v4 = Vector (widthX*(i), height[i][j+1]-20, widthZ*(j+1)-width/2); 429 461 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 443 467 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); 444 470 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 458 473 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); 459 476 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 474 478 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); 475 481 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 488 483 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); 489 486 glVertex3f(v4.x, v4.y, v4.z); 490 487 491 488 } 492 489 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 533 496 //draw track 534 497 glBegin(GL_LINES); … … 541 504 glEnd(); 542 505 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 552 507 553 508 trackManager->drawGraph(.01); 554 509 trackManager->debug(2); 555 510 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(); 568 513 } 569 514 … … 630 575 631 576 // draw debug coord system 577 //glLoadIdentity(); 578 632 579 glCallList (objectList); 633 580 581 582 //After calling the list, draw the skysphere 583 584 glEnable(GL_TEXTURE_2D); 585 586 skysphere->draw(); 587 634 588 } 635 589 … … 644 598 void World::update () 645 599 { 600 646 601 /* 647 602 //List<WorldEntity> *l; … … 711 666 entity = entities->nextElement(); 712 667 } 713 668 669 skysphere->updatePosition(localPlayer->absCoordinate.x,localPlayer->absCoordinate.y,localPlayer->absCoordinate.z); 670 714 671 //for( int i = 0; i < tracklen; i++) track[i].tick (seconds); 715 672 } -
orxonox/branches/shadows/src/world.h
r3365 r3698 7 7 #define _WORLD_H 8 8 9 9 10 #include "stdincl.h" 10 11 #include "story_entity.h" 12 #include "skysphere.h" 13 class Material; 11 14 12 15 … … 58 61 tList<WorldEntity>* entities; 59 62 63 60 64 // base level data 65 61 66 TrackManager* trackManager; 62 67 Track* track; … … 81 86 82 87 WorldEntity* localPlayer; 83 88 Skysphere* skysphere; 84 89 PNode* nullParent; 85 90
Note: See TracChangeset
for help on using the changeset viewer.