Changeset 2892 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
- Timestamp:
- 09/01/08 18:33:14 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r2891 r2892 94 94 static int winWidth = 1024; 95 95 static int winHeight = 768; 96 97 //static int winWidth = 512; 98 //static int winHeight = 512; 99 100 96 101 static float winAspectRatio = 1.0f; 97 102 … … 107 112 static int texHeight = 768; 108 113 109 //static int texWidth = 512;110 //static int texHeight = 384;111 112 //static int texWidth = 2048;113 //static int texHeight = 2048;114 114 115 115 int renderedObjects = 0; … … 175 175 176 176 static Matrix4x4 matProjectionView = IdentityMatrix(); 177 static Matrix4x4 matViewing = IdentityMatrix(); 177 178 178 179 ShadowMapping *shadowMapping = NULL; … … 434 435 ShadowMapping::Init(sCgContext); 435 436 436 //deferredShader = new DeferredShader(texWidth, texHeight);437 //ssaoShader = new SsaoShader(texWidth, texHeight, camera, myfar / 10.0f);438 439 437 440 438 // initialize the render traverser … … 448 446 449 447 shadowMapping = new ShadowMapping(bvh->GetBox(), 512); 450 shadowMapping->ComputeShadowMap(light, traverser); 451 448 452 449 // frame time is restarted every frame 453 450 frameTimer.Start(); … … 795 792 camera->SetupCameraView(); 796 793 797 // set lights 798 GLfloat position[] = {0.8f, -1.0f, 0.7f, 0.0f}; 799 glLightfv(GL_LIGHT0, GL_POSITION, position); 800 801 GLfloat position1[] = {-0.5f, 0.5f, 0.4f, 0.0f}; 802 glLightfv(GL_LIGHT1, GL_POSITION, position1); 803 804 794 805 795 ///////////////// 806 796 807 Matrix4x4 mat Viewing, matProjection;797 Matrix4x4 matProjection; 808 798 809 799 camera->GetModelViewMatrix(matViewing); … … 876 866 } 877 867 878 879 //shadowMapping->ComputeShadowMap(light, traverser);880 881 882 883 868 // render without shading 884 869 switch (renderType) … … 918 903 case RenderState::DEFERRED: 919 904 905 shadowMapping->ComputeShadowMap(light, traverser); 906 920 907 if (!fbo) InitFBO(); 921 908 … … 958 945 SetupEyeView(); 959 946 960 // actually render the scene geometry using one of the specified algorithms 947 // set up lights 948 GLfloat position[] = {0.8f, -1.0f, 0.7f, 0.0f}; 949 glLightfv(GL_LIGHT0, GL_POSITION, position); 950 951 GLfloat position1[] = {-0.5f, 0.5f, 0.4f, 0.0f}; 952 glLightfv(GL_LIGHT1, GL_POSITION, position1); 953 954 // actually render the scene geometry using the specified algorithm 961 955 traverser->RenderScene(); 962 963 956 964 957 … … 999 992 { 1000 993 if (!ssaoShader) ssaoShader = new SsaoShader(texWidth, texHeight, camera, myfar / 10.0f); 1001 //DEL_PTR(deferredShader);1002 994 ssaoShader->Render(fbo, oldViewProjMatrix, ssaoExpFactor); 1003 995 … … 1006 998 { 1007 999 if (!deferredShader) deferredShader = new DeferredShader(texWidth, texHeight); 1008 //DEL_PTR(ssaoShader); 1009 deferredShader->Render(fbo); 1000 1001 //deferredShader->Render(fbo); 1002 deferredShader->Render(fbo, matViewing, shadowMapping); 1010 1003 } 1011 1004 } 1012 else 1013 { 1014 /*DEL_PTR(fbo); 1015 DEL_PTR(ssaoShader); 1016 DEL_PTR(deferredShader); 1017 */ 1018 } 1005 1019 1006 1020 1007 /////////// … … 1498 1485 const float offs = box.Size().x * 0.3f; 1499 1486 1500 //Vector3 vizpos = Vector3(box.Min().x, box.Min().y + box.Size().y * 0.5f, box.Min().z + box.Size().z * 50);1501 1487 Vector3 vizpos = Vector3(box.Min().x, box.Min().y - box.Size().y * 0.35f, box.Min().z + box.Size().z * 50); 1502 1488 1503 1489 visCamera->SetPosition(vizpos); 1504 1490 visCamera->ResetPitchAndYaw(); 1505 //visCamera->Pitch(M_PI); 1506 1491 1507 1492 glPushAttrib(GL_VIEWPORT_BIT); 1508 1493 glViewport(winWidth - winWidth / 3, winHeight - winHeight / 3, winWidth / 3, winHeight / 3);
Note: See TracChangeset
for help on using the changeset viewer.