Ignore:
Timestamp:
01/12/06 18:31:26 (18 years ago)
Author:
mattausch
Message:

started test function for beam

Location:
trunk/VUT/GtpVisibilityPreprocessor/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/Beam.cpp

    r526 r530  
    8989         Vector3 directions[4]; 
    9090          
    91         /* directions[0] = VssRay::GetDirection(dBox.Min().x, dBox.Min().y); 
     91        directions[0] = VssRay::GetDirection(dBox.Min().x, dBox.Min().y); 
    9292         directions[1] = VssRay::GetDirection(dBox.Max().x, dBox.Min().y); 
    9393         directions[2] = VssRay::GetDirection(dBox.Max().x, dBox.Max().y); 
    9494         directions[3] = VssRay::GetDirection(dBox.Min().x, dBox.Max().y); 
    95 */ 
     95 
    9696        const Vector3 mainDir = directions[0] + directions[1] + directions[2] + directions[3]; 
    9797        return Normalize(mainDir); 
  • trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.cpp

    r529 r530  
    88 
    99#include <GL/glext.h> 
    10  
    11  
    1210#include <Cg/cg.h> 
    1311#include <Cg/cgGL.h> 
     
    1513static CGcontext sCgContext = NULL; 
    1614static CGprogram sCgFragmentProgram = NULL; 
    17 //static CGprofile sCgFragmentProfile;// = CG_PROFILE_FP30; 
    18  
    19 //static CGparameter sCgKdParam = NULL; 
    20 //static CGparameter sCgModelViewProjParam = NULL; 
    21 static CGprofile sCgFragmentProfile = CG_PROFILE_FP30; 
     15static CGprofile sCgFragmentProfile; 
    2216 
    2317GLuint depthMap; 
     
    163157                                                                                           CG_SOURCE, "../src/dual_depth.cg", 
    164158                                                                                           sCgFragmentProfile, 
    165                                                                                            NULL,  
     159                                                                                           "dual_depth",  
    166160                                                                                           NULL); 
    167161} 
     
    588582        glShadeModel(GL_FLAT); 
    589583        glDisable(GL_LIGHTING); 
    590         // needed to kill fragments 
     584        // needed to kill the fragments for the front buffer 
    591585        glEnable(GL_ALPHA_TEST); 
    592586        glAlphaFunc(GL_GREATER, 0); 
     
    812806                          viewPoint.x, viewPoint.y, viewPoint.z,  
    813807                          up.x, up.y, up.z); 
    814 } 
     808}                          
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp

    r527 r530  
    347347 
    348348 
     349void VssPreprocess::VerifyBeamCasting() 
     350{ 
     351 
     352        vector<VssLeaf *> leaves; 
     353        mVssTree->CollectLeaves(leaves); 
     354 
     355        for (int i = 0; i < 10; ++i) 
     356        { 
     357                const int index = (int)RandomValue(0, (Real)((int)leaf.size() - 1)); 
     358                VssLeaf *leaf = leaves[index]; 
     359 
     360                Beam beam; 
     361                AxisAlignedBox3 dirBox = mVssTree->GetDirBBox(leaf); 
     362                AxisAlignedBox3 box = mVssTree->GetBBox(leaf); 
     363                beam.Construct(dirBox, box); 
     364                Intersectable *sourceObj = mObjects[5]; 
     365                BeamSampleStatistics stats; 
     366                mGlRenderer->SampleBeamContributions(sourceObj, 
     367                                                                                         beam, 
     368                                                                                         10000, 
     369                                                                                         stats); 
     370 
     371                Debug << "beam statistics: " << stats << endl; 
     372 
     373 
     374        } 
     375 
     376} 
     377 
    349378float 
    350379VssPreprocessor::GetAvgPvsSize(VssTree *tree, 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.h

    r517 r530  
    104104   
    105105  void CastRay(const BspTree &tree, const VssRay & vssRay); 
     106 
     107  float VerifyBeamCasting(Beam &beam); 
    106108}; 
    107109 
  • trunk/VUT/GtpVisibilityPreprocessor/src/dual_depth.cg

    r528 r530  
    33        float4 position  : POSITION;    //screen position 
    44        float4 color0    : COLOR0; 
    5         float4 color1    : COLOR1;              //lighting 
    6         float2 texcoord0 : TEXCOORD0; 
    7         float4 depthTexCoord: TEXCOORD1; 
    8         float3 normal    : TEXCOORD2; 
     5        float4 depthTexCoord: TEXCOORD0; 
    96}; 
    107 
     
    1512}; 
    1613 
    17  
    18 pixel main(fragment IN,    
    19            uniform sampler2D shadowMap: TEXUNIT1, 
    20            uniform float doTexturing) 
     14pixel dual_depth(fragment IN, 
     15                             const uniform sampler2D depthMap) 
    2116{ 
    2217        pixel OUT; 
     18 
     19        // the depth buffer     has to be compared to the current depth 
     20        float4 depth = tex2D(depthMap, IN.depthTexCoord.xy); 
     21        float test = IN.depthTexCoord.z / IN.depthTexCoord.w; 
    2322         
    24         float4 col = IN.color0; 
    25          
    26         // the depth buffer      
    27         float4 depth = tex2Dproj(shadowMap, IN.depthTexCoord); 
    28         float test = IN.depthTexCoord.z / IN.depthTexCoord.w; 
    2923        // reject by alpha test 
    30         //if (test < depth.x) 
    31         //      OUT.color[4] = 0; 
    32                  
    33         //OUT.color = localcolor * shadow * IN.color1; 
     24        if (test < depth.x) 
     25                OUT.color.w = 0; 
    3426 
    3527        return OUT; 
Note: See TracChangeset for help on using the changeset viewer.