Ignore:
Timestamp:
10/03/08 14:35:07 (16 years ago)
Author:
mattausch
Message:

trying to use smaller fbo

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r2997 r2999  
    274274static CGparameter sMaxDepthParam; 
    275275static CGparameter sMaxDepthParamTex; 
    276 static CGparameter sCurrentPosParamTex; 
    277 static CGparameter sCurrentPosParam; 
     276static CGparameter sEyePosParamTex; 
     277static CGparameter sEyePosParam; 
     278 
     279static CGparameter sTLParam; 
     280static CGparameter sTRParam; 
     281static CGparameter sBRParam; 
     282static CGparameter sBLParam; 
     283 
     284static CGparameter sTLParamTex; 
     285static CGparameter sTRParamTex; 
     286static CGparameter sBRParamTex; 
     287static CGparameter sBLParamTex; 
    278288 
    279289static Matrix4x4 oldViewProjMatrix; 
     
    457467                exit(0); 
    458468        } 
    459  
     469         
     470#if 0 
     471 
     472        int merged = 0; 
     473 
     474        SceneEntity *oldEnt = NULL; 
     475 
     476        cout << "merging entities .. " << endl; 
    460477        SceneEntityContainer::const_iterator sit, sit_end = sceneEntities.end(); 
    461  
    462         int merged = 0; 
    463          
    464         SceneEntity *oldEnt = NULL; 
    465 #if 0 
    466         cout << "merging entities .. " << endl; 
    467478 
    468479        for (sit = sceneEntities.begin(); sit < sit_end; ++ sit) 
     
    498509        cout << "merged " << merged << " of " << (int)sceneEntities.size() << " entities " << endl; 
    499510#endif 
     511 
    500512        // set far plane based on scene extent 
    501513        farDist = 10.0f * Magnitude(bvh->GetBox().Diagonal()); 
     
    599611 
    600612                sMaxDepthParamTex = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "maxDepth"); 
    601                 sCurrentPosParamTex = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "currentPos"); 
     613                sEyePosParamTex = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "eyePos"); 
    602614                RenderState::sTexParam = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "tex"); 
    603615         
    604616                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");  
    605622        } 
    606623        else 
     
    620637 
    621638                sMaxDepthParam = cgGetNamedParameter(RenderState::sCgMrtFragmentProgram, "maxDepth"); 
    622                 sCurrentPosParam = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "currentPos"); 
     639                sEyePosParam = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "eyePos"); 
    623640                 
    624641                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");  
    625647        } 
    626648        else 
     
    646668        fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 
    647669        // 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); 
    649672        // the normals buffer 
    650673        fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 
     
    935958 
    936959 
     960static 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 
    937973void InitDeferredRendering() 
    938974{ 
     
    952988 
    953989        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); 
    9561006 
    9571007        // draw to 3 color buffers 
Note: See TracChangeset for help on using the changeset viewer.