Changeset 10355 in orxonox.OLD for branches/ODE/src/world_entities/space_ships
- Timestamp:
- Jan 24, 2007, 8:48:26 PM (18 years ago)
- Location:
- branches/ODE
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/ODE/src/world_entities/space_ships/hover.cc
r10114 r10355 33 33 34 34 #include "debug.h" 35 #include "bsp_entity.h" 36 #include "terrain.h" 37 #include "state.h" 38 #include "camera.h" 35 39 36 40 … … 214 218 215 219 registerVar( new SynchronizeableFloat( &rotation, &rotation, "rotation", PERMISSION_OWNER ) ); 220 221 //this->subscribeReaction(CoRe::CREngine::CR_PHYSICS_FULL_WALK, BspEntity::staticClassID()); 222 this->subscribeReaction(CoRe::CREngine::CR_PHYSICS_FULL_WALK, WorldEntity::staticClassID()); 216 223 } 217 224 … … 353 360 354 361 void Hover::draw() const 355 { 362 { 356 363 Vector tmpRot; 357 364 WorldEntity::draw(); … … 401 408 glRotatef(this->rotorCycle, 0,1,0); 402 409 this->getModel(5)->draw(); 410 403 411 glPopMatrix (); 412 413 glPushMatrix(); 414 glTranslatef (this->getAbsCoor ().x, 415 this->getAbsCoor ().y-2.0, 416 this->getAbsCoor ().z); 417 418 /* glBegin(GL_QUADS); 419 glColor4f(0.9,0.9,0.2,0.33); 420 glNormal3f( 0.0f, 1.0f, 0.0f); // Normal Pointing Up 421 glTexCoord2f(0.0f, 1.0f); glVertex3f(-10.0f, - 2.0f, -1.00f); // Point 1 (Top) 422 glTexCoord2f(0.0f, 0.0f); glVertex3f(-10.0f, -2.0f, 10.0f); // Point 2 (Top) 423 glTexCoord2f(1.0f, 0.0f); glVertex3f( 10.0f, -2.0f, 10.0f); // Point 3 (Top) 424 glTexCoord2f(1.0f, 1.0f); glVertex3f( 10.0f, -2.0f, -10.0f); // Point 4 (Top) 425 glEnd(); */ 426 427 //this->getModel(0)->draw(); 428 // glMatrixMode(GL_MODELVIEW); 429 430 // Vector tmpRot = this->getAbsDir().getSpacialAxis(); 431 // glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 432 433 Vector a = Vector(0.0,0.0,-10.0); 434 435 436 // drawDebugCube( &a); 437 // Experiment 438 439 440 441 glPushAttrib( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT | GL_POLYGON_BIT | GL_STENCIL_BUFFER_BIT ); 442 glDepthMask(GL_FALSE); 443 //glClear( GL_STENCIL_BUFFER_BIT); 444 glDisable(GL_TEXTURE_2D); 445 glActiveTextureARB(GL_TEXTURE0_ARB); 446 glDisable(GL_TEXTURE_2D); 447 // drawDebugCube( &a); 448 449 450 //glEnable(GL_CULL_FACE); 451 glEnable(GL_STENCIL_TEST); 452 //glEnable(GL_POLYGON_OFFSET_FILL); 453 //glPolygonOffset(0.0f, 100.0f); 454 //drawDebugCube( &a); 455 456 457 458 glDisable( GL_LIGHTING ); // Turn Off Lighting 459 glDepthMask( GL_FALSE ); // Turn Off Writing To The Depth-Buffer 460 //glDepthFunc( GL_LEQUAL ); 461 glEnable( GL_STENCIL_TEST ); // Turn On Stencil Buffer Testing 462 //glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE ); // Don't Draw Into The Colour Buffer 463 //glStencilFunc( GL_ALWAYS, 1, 0xFFFFFFFFL ); 464 465 466 glColorMask(0, 0, 0, 0); 467 glStencilFunc(GL_ALWAYS, 1, 0xffffffff); 468 469 // First Pass. Increase Stencil Value In The Shadow 470 471 glFrontFace( GL_CCW ); 472 glStencilOp( GL_KEEP, GL_KEEP, GL_INCR ); 473 //doShadowPass( object, lightPosition ); 474 //drawDebugCube(&(State::getCamera()->getAbsCoor() + State::getCamera()->getAbsDirV()*3.0f) ); 475 drawDebugCube( &a); 476 this->getModel(0)->draw(); 477 //WorldEntity::draw(); 478 479 // Second Pass. Decrease Stencil Value In The Shadow 480 glFrontFace( GL_CW ); 481 glStencilOp( GL_KEEP, GL_KEEP, GL_DECR ); 482 //doShadowPass( object, lightPosition ); 483 //drawDebugCube(&(State::getCamera()->getAbsCoor() ) ); 484 drawDebugCube( &a); 485 this->getModel(0)->draw(); 486 //WorldEntity::draw(); 487 488 glFrontFace( GL_CCW ); 489 490 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 491 glDepthMask(GL_TRUE); 492 493 494 glColor4f( 0.0f, 0.9f, 0.0f, 0.4f ); 495 glDisable(GL_POLYGON_OFFSET_FILL); 496 glDisable(GL_DEPTH_TEST); 497 glDisable(GL_CULL_FACE); 498 //glEnable( GL_BLEND ); 499 //glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); 500 //glStencilFunc( GL_NOTEQUAL, 0, 0xffffffff ); 501 //glStencilOp( GL_KEEP, GL_KEEP, GL_KEEP ); 502 ////glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); 503 504 glPushMatrix(); 505 glLoadIdentity(); 506 glBegin( GL_TRIANGLE_STRIP ); 507 glVertex3f( -1.1f, 1.1f, -5.5f ); 508 glVertex3f( -1.1f, -1.1f, -5.5f ); 509 glVertex3f( 1.1f, 1.1f, -5.5f ); 510 glVertex3f( 1.1f, -1.1f, -5.5f ); 511 glEnd(); 512 glPopMatrix (); 513 514 /* 515 glPushMatrix(); 516 glLoadIdentity(); 517 glMatrixMode(GL_PROJECTION); 518 glPushMatrix(); 519 glLoadIdentity(); 520 glOrtho(0, 1, 1, 0, 0, 1); 521 522 523 glColor4f(0.0f, 0.0f, 0.0f, 0.4f); 524 glBegin(GL_QUADS); 525 glVertex2i(0, 0); 526 glVertex2i(0, 1); 527 glVertex2i(1, 1); 528 glVertex2i(1, 0); 529 glEnd(); 530 531 glEnable(GL_DEPTH_TEST); 532 533 glPopMatrix(); 534 glMatrixMode(GL_MODELVIEW); 535 */ 536 537 glPopAttrib(); 538 glPopMatrix (); 404 539 } 405 540 … … 441 576 } 442 577 } 578 579 void drawDebugCube(const Vector* cam) 580 { 581 glBegin(GL_QUADS); 582 // Front Face 583 glNormal3f( 0.0f, 0.0f, 1.0f); // Normal Pointing Towards Viewer 584 glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -10.0f, 1.0f); // Point 1 (Front) 585 glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -10.0f, 1.0f); // Point 2 (Front) 586 glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 10.0f, 1.0f); // Point 3 (Front) 587 glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 10.0f, 1.0f); // Point 4 (Front) 588 // Back Face 589 glNormal3f( 0.0f, 0.0f,-1.0f); // Normal Pointing Away From Viewer 590 glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -10.0f, -1.0f); // Point 1 (Back) 591 glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 10.0f, -1.0f); // Point 2 (Back) 592 glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 10.0f, -1.0f); // Point 3 (Back) 593 glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -10.0f, -1.0f); // Point 4 (Back) 594 // Top Face 595 glNormal3f( 0.0f, 1.0f, 0.0f); // Normal Pointing Up 596 glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 10.0f, -1.0f); // Point 1 (Top) 597 glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, 10.0f, 1.0f); // Point 2 (Top) 598 glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, 10.0f, 1.0f); // Point 3 (Top) 599 glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 10.0f, -1.0f); // Point 4 (Top) 600 // Bottom Face 601 glNormal3f( 0.0f,-1.0f, 0.0f); // Normal Pointing Down 602 glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -10.0f, -1.0f); // Point 1 (Bottom) 603 glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -10.0f, -1.0f); // Point 2 (Bottom) 604 glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -10.0f, 1.0f); // Point 3 (Bottom) 605 glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -10.0f, 1.0f); // Point 4 (Bottom) 606 // Right face 607 glNormal3f( 1.0f, 0.0f, 0.0f); // Normal Pointing Right 608 glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -10.0f, -1.0f); // Point 1 (Right) 609 glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 10.0f, -1.0f); // Point 2 (Right) 610 glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 10.0f, 1.0f); // Point 3 (Right) 611 glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -10.0f, 1.0f); // Point 4 (Right) 612 // Left Face 613 glNormal3f(-1.0f, 0.0f, 0.0f); // Normal Pointing Left 614 glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -10.0f, -1.0f); // Point 1 (Left) 615 glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -10.0f, 1.0f); // Point 2 (Left) 616 glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 10.0f, 1.0f); // Point 3 (Left) 617 glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 10.0f, -1.0f); // Point 4 (Left) 618 glEnd(); // Done Drawing Quads 619 620 621 glBegin(GL_QUADS); 622 623 return; 624 // Bottom Face. Red, 75% opaque, magnified texture 625 626 //glNormal3f( 0.0f, -1.0f, 0.0f); // Needed for lighting 627 // glColor4f(0.9,0.2,0.2,.75); // Basic polygon color 628 629 //glTexCoord2f(0.800f, 0.800f); 630 glVertex3f(cam->x-5.0f, cam->y-100.0f,cam->z -5.0f); 631 // glTexCoord2f(0.200f, 0.800f); 632 glVertex3f(cam->x+5.0f, cam->y-100.0f,cam->z -5.0f); 633 //glTexCoord2f(0.200f, 0.200f); 634 glVertex3f(cam->x+ 5.0f,cam->y -100.0f,cam->z + 5.0f); 635 //glTexCoord2f(0.800f, 0.200f); 636 glVertex3f(cam->x-5.0f, cam->y-100.0f, cam->z + 5.0f); //OK 637 638 639 // Top face; offset. White, 50% opaque. 640 641 // glNormal3f( 0.0f, 5.0f, 0.0f); glColor4f(0.5,0.5,0.5,.5); 642 643 //glTexCoord2f(0.005f, 5.995f); 644 glVertex3f(cam->x-5.0f, cam->y+ 100.0f, cam->z -5.0f); 645 //glTexCoord2f(0.005f, 0.005f); 646 glVertex3f(cam->x-5.0f, cam->y+ 100.0f, cam->z +5.0f); 647 //glTexCoord2f(5.995f, 0.005f); 648 glVertex3f(cam->x+ 5.0f, cam->y+100.0f, cam->z +5.0f); 649 //glTexCoord2f(5.995f, 5.995f); 650 glVertex3f(cam->x+ 5.0f, cam->y+ 100.0f, cam->z -5.0f); //OKQUAD_STRI 651 652 653 // Far face. Green, 50% opaque, non-uniform texture cooridinates. 654 655 //glNormal3f( 0.0f, 0.0f,-5.0f); glColor4f(0.2,0.9,0.2,.5); 656 657 // glTexCoord2f(0.995f, 0.005f); 658 glVertex3f(cam->x-5.0f, cam->y-100.0f, cam->z -5.0f); 659 // glTexCoord2f(2.995f, 2.995f); 660 glVertex3f(cam->x-5.0f, cam->y+ 100.0f, cam->z -5.0f); 661 // glTexCoord2f(0.005f, 0.995f); 662 glVertex3f(cam->x+ 5.0f,cam->y+ 100.0f, cam->z -5.0f); 663 //glTexCoord2f(0.005f, 0.005f); 664 glVertex3f( cam->x+5.0f,cam->y -100.0f, cam->z -5.0f); 665 666 667 // Right face. Blue; 25% opaque 668 669 // glNormal3f( 5.0f, 0.0f, 0.0f); glColor4f(0.2,0.2,0.9,.25); 670 671 // glTexCoord2f(0.995f, 0.005f); 672 glVertex3f(cam->x+ 5.0f, cam->y -100.0f, cam->z -5.0f); 673 // glTexCoord2f(0.995f, 0.995f); 674 glVertex3f(cam->x+ 5.0f, cam->y+ 100.0f, cam->z -5.0f); 675 // glTexCoord2f(0.005f, 0.995f); 676 glVertex3f(cam->x+ 5.0f, cam->y+ 100.0f, cam->z + 5.0f); 677 // glTexCoord2f(0.005f, 0.005f); 678 glVertex3f(cam->x+ 5.0f, cam->y-100.0f, cam->z +5.0f); 679 680 681 // Front face; offset. Multi-colored, 50% opaque. 682 683 // glNormal3f( 0.0f, 0.0f, 5.0f); 684 685 // glColor4f( 0.9f, 0.2f, 0.2f, 0.5f); 686 // glTexCoord2f( 0.005f, 0.005f); 687 glVertex3f(cam->x-5.0f, cam->y-100.0f, cam->z +5.0f); 688 // glColor4f( 0.2f, 0.9f, 0.2f, 0.5f); 689 // glTexCoord2f( 0.995f, 0.005f); 690 glVertex3f(cam->x+ 5.0f, cam->y-100.0f, cam->z +5.0f); 691 // glColor4f( 0.2f, 0.2f, 0.9f, 0.5f); 692 // glTexCoord2f( 0.995f, 0.995f); 693 glVertex3f( cam->x+5.0f, cam->y+100.0f, cam->z +5.0f); 694 // glColor4f( 0.5f, 0.5f, 0.5f, 0.5f); 695 // glTexCoord2f( 0.005f, 0.995f); g 696 glVertex3f(cam->x-5.0f, cam->y+ 100.0f, cam->z +5.0f); 697 698 699 // Left Face; offset. Yellow, varying levels of opaque. 700 701 // glNormal3f(-5.0f, 0.0f, 0.0f); 702 703 // glColor4f(0.9,0.9,0.2,0.0); 704 // glTexCoord2f(0.005f, 0.005f); 705 glVertex3f(cam->x-5.0f, cam->y-100.0f, cam->z -5.0f); 706 //glColor4f(0.9,0.9,0.2,0.66); 707 // glTexCoord2f(0.995f, 0.005f); 708 glVertex3f(cam->x-5.0f,cam->y -100.0f, cam->z +5.0f); 709 // glColor4f(0.9,0.9,0.2,5.0); 710 // glTexCoord2f(0.995f, 0.995f); 711 glVertex3f(cam->x-5.0f, cam->y+ 100.0f, cam->z +5.0f); 712 // glColor4f(0.9,0.9,0.2,0.33); 713 // glTexCoord2f(0.005f, 0.995f); 714 glVertex3f(cam->x-5.0f, cam->y+ 100.0f, cam->z -5.0f); 715 716 glEnd(); 717 }
Note: See TracChangeset
for help on using the changeset viewer.