Changeset 531


Ignore:
Timestamp:
01/12/06 20:40:26 (18 years ago)
Author:
mattausch
Message:
 
Location:
trunk/VUT
Files:
6 edited

Legend:

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

    r530 r531  
    7575        const float yDirRange = mDirBox.Max().y - mDirBox.Min().y; 
    7676 
    77         near = 0.1; // NOTE: what is the best value for near and far plane? 
     77        near = 0.1f; // NOTE: what is the best value for near and far plane? 
    7878        far = 2.0f * Magnitude(sceneBBox.Diagonal()); 
    7979 
    80         left = near / tan(xDirRange * 0.5); 
    81         right = near / tan(xDirRange * 0.5); 
     80        left = near / tan(xDirRange * 0.5f); 
     81        right = near / tan(xDirRange * 0.5f); 
    8282 
    83         bottom = near / tan(yDirRange * 0.5); 
    84         top = near / tan(yDirRange * 0.5); 
     83        bottom = near / tan(yDirRange * 0.5f); 
     84        top = near / tan(yDirRange * 0.5f); 
    8585} 
    8686 
     
    8989         Vector3 directions[4]; 
    9090          
    91          directions[0] = VssRay::GetDirection(dBox.Min().x, dBox.Min().y); 
    92          directions[1] = VssRay::GetDirection(dBox.Max().x, dBox.Min().y); 
    93          directions[2] = VssRay::GetDirection(dBox.Max().x, dBox.Max().y); 
    94          directions[3] = VssRay::GetDirection(dBox.Min().x, dBox.Max().y); 
     91         directions[0] = VssRay::GetDirection(mDirBox.Min().x, mDirBox.Min().y); 
     92         directions[1] = VssRay::GetDirection(mDirBox.Max().x, mDirBox.Min().y); 
     93         directions[2] = VssRay::GetDirection(mDirBox.Max().x, mDirBox.Max().y); 
     94         directions[3] = VssRay::GetDirection(mDirBox.Min().x, mDirBox.Max().y); 
    9595 
    9696        const Vector3 mainDir = directions[0] + directions[1] + directions[2] + directions[3]; 
    9797        return Normalize(mainDir); 
    9898} 
     99 
     100 
     101void BeamSampleStatistics::Print(ostream &app) const 
     102{ 
     103  app << "===== Beam sample statistics ===============\n"; 
     104 
     105  app << "#N_PVSSIZE ( size of pvs )\n" << pvsSize << "\n"; 
     106 
     107  app << "#N_RAYS ( Number of rays )\n" << rays << "\n"; 
     108 
     109  app << "#N_RAYCONTRIBUTIONS ( number of ray constributions )\n" << 
     110    rayContributions << "\n"; 
     111 
     112  app << "#N_RAYLENGHTENTROPY  ( Ray lenght entropy )\n" << 
     113    rayLengthEntropy << "\n"; 
     114 
     115  app << "#N_IMPORTANCE  ( importance )\n" << 
     116    importance << "\n"; 
     117 
     118  app << "#N_CTIME  ( Construction time [s] )\n" 
     119      << Time() << " \n"; 
     120 
     121  app << "===== END OF KdTree statistics ==========\n"; 
     122 
     123} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Beam.h

    r525 r531  
    44#include <vector> 
    55#include "AxisAlignedBox3.h" 
     6#include "Statistics.h" 
    67 
    78using namespace std; 
     
    1011class Intersectable; 
    1112 
     13// the values need for rss tree update computed already inside the glrendererbuffer 
     14// not all of them need to be computed 
     15class BeamSampleStatistics: public StatisticsBase 
     16{ 
     17public: 
     18        enum {COMPUTE_PVS_SIZE, COMPUTE_RAY_CONTRIBUTIONS, COMPUTE_PVS_ENTROPY}; 
     19        int flags; 
     20 
     21        BeamSampleStatistics(): flags(COMPUTE_RAY_CONTRIBUTIONS)  
     22        { 
     23                Reset(); 
     24        } 
     25         
     26        float pvsSize; 
     27        float rays; 
     28        float rayContributions; 
     29        float pvsEntropy; 
     30        float rayLengthEntropy; 
     31        float importance; 
     32         
     33        float weightedRayContribution; 
     34 
     35        void Reset()  
     36        { 
     37                pvsSize = 0; 
     38                rays = 0; 
     39                rayContributions = 0; 
     40                pvsEntropy = 0; 
     41                rayLengthEntropy = 0; 
     42                importance = 0; 
     43        } 
     44 
     45        void Print(ostream &app) const; 
     46 
     47        friend ostream &operator<<(ostream &s, const BeamSampleStatistics &stat)  
     48        { 
     49                stat.Print(s); 
     50                return s; 
     51        }   
     52}; 
     53 
     54   
    1255class Beam { 
    1356   
  • trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.h

    r525 r531  
    1919class Beam; 
    2020 
     21class BeamSampleStatistics; 
     22 
    2123struct PvsRenderStatistics { 
    2224   
     
    136138 
    137139 
    138  
    139   // the values need for rss tree update computed already inside the glrendererbuffer 
    140   // not all of them need to be computed 
    141   struct BeamSampleStatistics { 
    142  
    143         enum {COMPUTE_PVS_SIZE, COMPUTE_RAY_CONTRIBUTIONS, COMPUTE_PVS_ENTROPY}; 
    144         int flags; 
    145  
    146         BeamSampleStatistics():flags(COMPUTE_RAY_CONTRIBUTIONS) {} 
    147          
    148         float pvsSize; 
    149         float rays; 
    150         float rayContributions; 
    151         float pvsEntropy; 
    152         float rayLengthEntropy; 
    153         float importance; 
    154          
    155         float weightedRayContribution; 
    156   }; 
    157    
    158  
    159140  void SampleBeamContributions( 
    160141                                                           Intersectable *sourceObject, 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp

    r530 r531  
    1111#include "ViewCellsManager.h" 
    1212#include "RenderSimulator.h" 
     13#include "Beam.h" 
     14#include "GlRenderer.h" 
    1315 
    1416bool use2dSampling = false; 
     
    347349 
    348350 
    349 void VssPreprocess::VerifyBeamCasting() 
    350 { 
    351  
    352         vector<VssLeaf *> leaves; 
    353         mVssTree->CollectLeaves(leaves); 
     351void VssPreprocessor::TestBeamCasting(VssTree *tree) 
     352{ 
     353 
     354        vector<VssTreeLeaf *> leaves; 
     355        tree->CollectLeaves(leaves); 
    354356 
    355357        for (int i = 0; i < 10; ++i) 
    356358        { 
    357                 const int index = (int)RandomValue(0, (Real)((int)leaf.size() - 1)); 
    358                 VssLeaf *leaf = leaves[index]; 
     359                const int index = (int)RandomValue(0, (Real)((int)leaves.size() - 1)); 
     360                VssTreeLeaf *leaf = leaves[index]; 
    359361 
    360362                Beam beam; 
    361                 AxisAlignedBox3 dirBox = mVssTree->GetDirBBox(leaf); 
    362                 AxisAlignedBox3 box = mVssTree->GetBBox(leaf); 
     363                AxisAlignedBox3 dirBox =tree->GetDirBBox(leaf); 
     364                AxisAlignedBox3 box = tree->GetBBox(leaf); 
    363365                beam.Construct(dirBox, box); 
    364366                Intersectable *sourceObj = mObjects[5]; 
    365367                BeamSampleStatistics stats; 
    366                 mGlRenderer->SampleBeamContributions(sourceObj, 
    367                                                                                         beam, 
    368                                                                                         10000, 
    369                                                                                         stats); 
     368                renderer->SampleBeamContributions(sourceObj, 
     369                                                                                  beam, 
     370                                                                                  10000, 
     371                                                                                  stats); 
    370372 
    371373                Debug << "beam statistics: " << stats << endl; 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.h

    r530 r531  
    105105  void CastRay(const BspTree &tree, const VssRay & vssRay); 
    106106 
    107   float VerifyBeamCasting(Beam &beam); 
     107  void TestBeamCasting(VssTree *tree); 
    108108}; 
    109109 
Note: See TracChangeset for help on using the changeset viewer.