| 665 | } |
| 666 | |
| 667 | void PhysXSampleApplication::onRender() |
| 668 | { |
| 669 | Renderer* renderer = getRenderer(); |
| 670 | if(renderer) |
| 671 | { |
| 672 | mCamera.BuildFrustum(); |
| 673 | #if 0 |
| 674 | PxScene* mScene = &mSample->getActiveScene(); |
| 675 | if(mScene) |
| 676 | { |
| 677 | const PxVec3* frustumVerts = mCamera.getFrustumVerts(); |
| 678 | PxBounds3 cameraBounds(frustumVerts[0], frustumVerts[0]); |
| 679 | for(PxU32 i=0;i<8;i++) |
| 680 | cameraBounds.include(frustumVerts[i]); |
| 681 | mScene->setVisualizationCullingBox(cameraBounds); |
| 682 | } |
| 683 | #endif |
| 684 | renderer->clearBuffers(); |
| 685 | |
| 686 | if(mDrawScreenQuad) |
| 687 | { |
| 688 | ScreenQuad sq; |
| 689 | sq.mLeftUpColor = mScreenQuadTopColor; |
| 690 | sq.mRightUpColor = mScreenQuadTopColor; |
| 691 | sq.mLeftDownColor = mScreenQuadBottomColor; |
| 692 | sq.mRightDownColor = mScreenQuadBottomColor; |
| 693 | |
| 694 | renderer->drawScreenQuad(sq); |
| 695 | } |
| 696 | |
| 697 | for(PxU32 i=0; i<mLights.size(); i++) |
| 698 | { |
| 699 | renderer->queueLightForRender(*mLights[i]); |
| 700 | } |
| 701 | |
| 702 | { |
| 703 | PxVec3 camPos( mCamera.getPos() ); |
| 704 | PxVec3 camDir = mCamera.getViewDir(); |
| 705 | PxVec3 camUp = PxVec3( 0, 1, 0 ); |
| 706 | PxVec3 camTarget = camPos + camDir * 50.0f; |
| 707 | PxPvdSceneClient* pvdClient = mSample->getActiveScene().getScenePvdClient(); |
| 708 | if(pvdClient) |
| 709 | pvdClient->updateCamera( "SampleCamera", camPos, camUp, camTarget ); |
| 710 | } |
| 711 | // main scene render |
| 712 | { |
| 713 | mSample->render(); |
| 714 | renderer->render(mCamera.getViewMatrix(), mCamera.getProjMatrix()); |
| 715 | } |
| 716 | |
| 717 | // render debug lines and points with a small depth bias to avoid z-fighting |
| 718 | { |
| 719 | mSample->getDebugRenderer()->queueForRenderLine(); |
| 720 | mSample->getDebugRenderer()->queueForRenderPoint(); |
| 721 | |
| 722 | // modify entry(3,3) of the projection matrix according to |
| 723 | // http://www.terathon.com/gdc07_lengyel.pdf |
| 724 | // this applies a small constant depth bias in NDC |
nothing calls this directly
no test coverage detected