Changeset 2999 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
- Timestamp:
- 10/03/08 14:35:07 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r2997 r2999 274 274 static CGparameter sMaxDepthParam; 275 275 static CGparameter sMaxDepthParamTex; 276 static CGparameter sCurrentPosParamTex; 277 static CGparameter sCurrentPosParam; 276 static CGparameter sEyePosParamTex; 277 static CGparameter sEyePosParam; 278 279 static CGparameter sTLParam; 280 static CGparameter sTRParam; 281 static CGparameter sBRParam; 282 static CGparameter sBLParam; 283 284 static CGparameter sTLParamTex; 285 static CGparameter sTRParamTex; 286 static CGparameter sBRParamTex; 287 static CGparameter sBLParamTex; 278 288 279 289 static Matrix4x4 oldViewProjMatrix; … … 457 467 exit(0); 458 468 } 459 469 470 #if 0 471 472 int merged = 0; 473 474 SceneEntity *oldEnt = NULL; 475 476 cout << "merging entities .. " << endl; 460 477 SceneEntityContainer::const_iterator sit, sit_end = sceneEntities.end(); 461 462 int merged = 0;463 464 SceneEntity *oldEnt = NULL;465 #if 0466 cout << "merging entities .. " << endl;467 478 468 479 for (sit = sceneEntities.begin(); sit < sit_end; ++ sit) … … 498 509 cout << "merged " << merged << " of " << (int)sceneEntities.size() << " entities " << endl; 499 510 #endif 511 500 512 // set far plane based on scene extent 501 513 farDist = 10.0f * Magnitude(bvh->GetBox().Diagonal()); … … 599 611 600 612 sMaxDepthParamTex = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "maxDepth"); 601 s CurrentPosParamTex = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "currentPos");613 sEyePosParamTex = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "eyePos"); 602 614 RenderState::sTexParam = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "tex"); 603 615 604 616 cgGLSetParameter1f(sMaxDepthParamTex, MAX_DEPTH_CONST / farDist); 617 618 sTLParamTex = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "tl"); 619 sTRParamTex = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "tr"); 620 sBRParamTex = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "br"); 621 sBLParamTex = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "bl"); 605 622 } 606 623 else … … 620 637 621 638 sMaxDepthParam = cgGetNamedParameter(RenderState::sCgMrtFragmentProgram, "maxDepth"); 622 s CurrentPosParam = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "currentPos");639 sEyePosParam = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "eyePos"); 623 640 624 641 cgGLSetParameter1f(sMaxDepthParam, MAX_DEPTH_CONST / farDist); 642 643 sTLParam = cgGetNamedParameter(RenderState::sCgMrtFragmentProgram, "tl"); 644 sTRParam = cgGetNamedParameter(RenderState::sCgMrtFragmentProgram, "tr"); 645 sBRParam = cgGetNamedParameter(RenderState::sCgMrtFragmentProgram, "br"); 646 sBLParam = cgGetNamedParameter(RenderState::sCgMrtFragmentProgram, "bl"); 625 647 } 626 648 else … … 646 668 fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 647 669 // the positions buffer 648 fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 670 //fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 671 fbo->AddColorBuffer(ColorBufferObject::BUFFER_LUMINANCE_ALPHA, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 649 672 // the normals buffer 650 673 fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); … … 935 958 936 959 960 static void ComputeViewVectors(Vector3 &tl, Vector3 &tr, Vector3 &bl, Vector3 &br) 961 { 962 Vector3 ftl, ftr, fbl, fbr, ntl, ntr, nbl, nbr; 963 964 camera->ComputePoints(ftl, ftr, fbl, fbr, ntl, ntr, nbl, nbr); 965 966 bl = Normalize(nbl - fbl); 967 br = Normalize(nbr - fbr); 968 tl = Normalize(ntl - ftl); 969 tr = Normalize(ntr - ftr); 970 } 971 972 937 973 void InitDeferredRendering() 938 974 { … … 952 988 953 989 const Vector3 pos = camera->GetPosition(); 954 cgGLSetParameter3f(sCurrentPosParam, pos.x, pos.y, pos.z); 955 cgGLSetParameter3f(sCurrentPosParamTex, pos.x, pos.y, pos.z); 990 991 cgGLSetParameter3f(sEyePosParam, pos.x, pos.y, pos.z); 992 cgGLSetParameter3f(sEyePosParamTex, pos.x, pos.y, pos.z); 993 994 Vector3 tl, tr, bl, br; 995 ComputeViewVectors(tl, tr, bl, br); 996 997 cgGLSetParameter3f(sBLParam, bl.x, bl.y, bl.z); 998 cgGLSetParameter3f(sBRParam, br.x, br.y, br.z); 999 cgGLSetParameter3f(sTLParam, tl.x, tl.y, tl.z); 1000 cgGLSetParameter3f(sTRParam, tr.x, tr.y, tr.z); 1001 1002 cgGLSetParameter3f(sBLParamTex, bl.x, bl.y, bl.z); 1003 cgGLSetParameter3f(sBRParamTex, br.x, br.y, br.z); 1004 cgGLSetParameter3f(sTLParamTex, tl.x, tl.y, tl.z); 1005 cgGLSetParameter3f(sTRParamTex, tr.x, tr.y, tr.z); 956 1006 957 1007 // draw to 3 color buffers
Note: See TracChangeset
for help on using the changeset viewer.