Changeset 1521


Ignore:
Timestamp:
09/27/06 17:20:00 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/src/GtpVisibility.vcproj

    r1288 r1521  
    194194                                RuntimeTypeInfo="TRUE" 
    195195                                UsePrecompiledHeader="0" 
     196                                BrowseInformation="1" 
    196197                                WarningLevel="3" 
    197198                                Detect64BitPortabilityProblems="TRUE" 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp

    r1520 r1521  
    77#include "IntersectableWrapper.h" 
    88#include "Plane3.h" 
    9  
     9#include "RayCaster.h" 
    1010 
    1111 
     
    4747        { 
    4848                VssRay *newRay = ReverseSampling(currentRay, hitTriangle, oldRay); 
    49                 HandleRay(*newRay); 
     49                if (!HandleRay(newRay)) 
     50                        delete newRay; 
     51 
    5052                return true; 
    5153        } 
     
    5557 
    5658 
    57 bool GvsPreprocessor::HandleRay(VssRay &vssRay) 
    58 { 
    59         if (mViewCellsManager->ComputeSampleContribution(vssRay, true, false)) 
     59bool GvsPreprocessor::HandleRay(VssRay *vssRay) 
     60{ 
     61        if (mViewCellsManager->ComputeSampleContribution(*vssRay, true, false)) 
    6062        { 
    6163                //cout << "h"; 
    62                 mRayQueue.push(&vssRay); 
     64                mRayQueue.push(vssRay); 
    6365                return true; 
    6466        } 
     
    155157                const Vector3 p = (p1 + p2) * 0.5f; 
    156158                SimpleRay sray(oldRay.mOrigin, p - oldRay.mOrigin); 
    157                 VssRay *newRay = NULL; 
    158                 //VssRay *newRay = CastSingleRay(sray); 
    159                 HandleRay(*newRay); 
    160  
     159         
     160                VssRay *newRay = mRayCaster->CastSingleRay(sray.mOrigin, sray.mDirection, 1, mViewSpaceBox); 
     161                bool addedToQueue = HandleRay(newRay); 
     162                 
    161163                const int s1 = SubdivideEdge(hitTriangle, p1, p, x, *newRay, oldRay); 
    162164                const int s2 = SubdivideEdge(hitTriangle, p, p2, *newRay, y, oldRay); 
    163                                                                    
    164         return s1 + s2; 
     165                return s1 + s2; 
     166                 
     167                if (!addedToQueue) 
     168                        delete newRay; 
    165169        } 
    166170} 
     
    291295        for (vit = samples.begin(); vit != vit_end; ++ vit) 
    292296        { 
    293                 HandleRay(*(*vit)); 
     297                HandleRay(*vit); 
    294298        } 
    295299} 
     
    330334                 
    331335                castSamples += AdaptiveBorderSampling(*ray); 
     336 
     337                delete ray; 
    332338        } 
    333339 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.h

    r1500 r1521  
    7272                b) if triangle was found reverse sampling 
    7373        */ 
    74         bool HandleRay(VssRay &ray); 
     74        bool HandleRay(VssRay *ray); 
    7575 
    7676        /** The adaptive border sampling step. It aims to find neighbouring  
  • GTP/trunk/Lib/Vis/Preprocessing/src/IntelRayCaster.cpp

    r1520 r1521  
    3737                                                        VssRayContainer &vssRays, 
    3838                                                        const AxisAlignedBox3 &box, 
    39                                                         const bool castDoubleRay, 
    40                                                         const int pass 
     39                                                        const bool castDoubleRay 
    4140                                                        ) 
    4241{ 
     
    113112                                                                VssRayContainer &vssRays, 
    114113                                                                const AxisAlignedBox3 &sbox, 
    115                                                                 const bool castDoubleRay, 
    116                                                                 const int pass) 
     114                                                                const bool castDoubleRay) 
    117115{ 
    118116        int i; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/InternalRayCaster.cpp

    r1520 r1521  
    2121 
    2222 
    23 int InternalRayCaster::CastRay( 
    24                                                            const Vector3 &viewPoint, 
     23int InternalRayCaster::CastRay(const Vector3 &viewPoint, 
    2524                                                           const Vector3 &direction, 
    2625                                                           const float probability, 
     
    7675 
    7776 
    78 void InternalRayCaster::CastRays16( 
    79                                                                    const int index, 
     77void InternalRayCaster::CastRays16(const int index, 
    8078                                                                   SimpleRayContainer &rays,  
    8179                                                                   VssRayContainer &vssRays, 
     
    8381                                                                   const bool castDoubleRays) 
    8482{ 
    85         int i; 
    8683        const int num = 16; 
    8784 
     
    9188 
    9289        // no acceleration for ray bundles implemented right now 
    93         for (i=index; i < index + num; i++)  
     90        for (int i=index; i < index + num; i++)  
    9491        { 
    9592                CastRay(rays[i].mOrigin, 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r1520 r1521  
    193193} 
    194194 
    195 int 
    196 SplitFilenames(const string str, vector<string> &filenames) 
     195 
     196GlRendererBuffer *Preprocessor::GetRenderer()  
     197{  
     198        return renderer; 
     199} 
     200 
     201 
     202static int SplitFilenames(const string str, vector<string> &filenames) 
    197203{ 
    198204        int pos = 0; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h

    r1520 r1521  
    4242    viewcell loading/generation and the visibility computation itself. 
    4343*/ 
    44 // matt: remove qt dependencies 
    45 class Preprocessor// : public QObject  
     44class Preprocessor 
    4645{ 
    47   //Q_OBJECT 
    4846        friend class RayCaster; 
    4947        friend class IntelRayCaster; 
     
    6462   
    6563  /** Export all preprocessed data in a XML format understandable by the 
    66       PreprocessingInterface of the GtpVisibilityPreprocessor Module. The file can be compressed depending 
    67       on the environement settings. 
     64      PreprocessingInterface of the GtpVisibilityPreprocessor Module.  
     65          The file can be compressed depending on the environement settings. 
    6866      @return true on successful export 
    6967  */ 
     
    10098  SamplingStrategy *GenerateSamplingStrategy(const int strategyId) const; 
    10199 
    102   bool 
    103   Export( const string filename, 
    104           const bool scene, 
    105           const bool kdtree, 
    106           const bool bsptree 
    107           ); 
    108    
     100  bool Export( 
     101                const string filename,  
     102                const bool scene,  
     103                const bool kdtree,  
     104                const bool bsptree);   
    109105   
    110106  virtual void KdTreeStatistics(ostream &s); 
     
    151147  HierarchyManager *CreateHierarchyManager(const char *name); 
    152148    
    153   GlRendererBuffer *GetRenderer() { return renderer;} 
     149  GlRendererBuffer *GetRenderer(); 
    154150 
    155151  bool InitRayCast(const string externKdTree, const string internKdTree); 
    156152 
    157   int CastRay( 
    158           const Vector3 &viewPoint, 
    159           const Vector3 &direction, 
    160           const float probability, 
    161           VssRayContainer &vssRays, 
    162           const AxisAlignedBox3 &box 
    163           ); 
    164  
    165    
     153    
    166154  //////////////////////////////////////////////// 
    167155 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj

    r1520 r1521  
    225225                                RuntimeTypeInfo="TRUE" 
    226226                                UsePrecompiledHeader="0" 
     227                                BrowseInformation="1" 
    227228                                WarningLevel="2" 
    228229                                Detect64BitPortabilityProblems="TRUE" 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.cpp

    r1520 r1521  
    1414mPreprocessor(preprocessor) 
    1515{ 
     16} 
     17 
     18 
     19RayCaster::~RayCaster() 
     20{ 
     21} 
     22 
     23 
     24VssRay *RayCaster::CastSingleRay(const Vector3 &viewPoint, 
     25                                                                 const Vector3 &direction, 
     26                                                                 const float probability, 
     27                                                                 const AxisAlignedBox3 &box) 
     28{ 
     29        VssRayContainer rays; 
     30        CastRay(viewPoint, direction, probability, rays, box, false); 
     31 
     32        if (!rays.empty()) 
     33                return rays.back(); 
    1634} 
    1735 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.h

    r1520 r1521  
    3131        RayCaster(const Preprocessor &preprocessor); 
    3232 
    33         virtual ~RayCaster() = 0; 
     33        virtual ~RayCaster(); 
    3434 
    3535        virtual int Type() const = 0; 
     36 
     37        /** Wrapper for casting single ray. 
     38        */ 
     39        VssRay *CastSingleRay( 
     40                const Vector3 &viewPoint, 
     41                const Vector3 &direction, 
     42                const float probability, 
     43        const AxisAlignedBox3 &box 
     44                ); 
    3645 
    3746        virtual int CastRay( 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp

    r1486 r1521  
    1414#include "GlRenderer.h" 
    1515#include "Intersectable.h" 
    16 #ifdef GTP_INTERNAL 
    17 #include "ArchModeler2MLRT.hxx" 
    18 #endif 
     16#include "RayCaster.h" 
     17 
    1918 
    2019namespace GtpVisibilityPreprocessor { 
     
    488487                        Vector3 direction = GetDirection(viewpoint, &mViewSpaceBox); 
    489488 
    490                         sampleContributions = CastRay(viewpoint, direction, 1, mVssRays, mViewSpaceBox); 
     489                        sampleContributions = mRayCaster->CastRay(viewpoint, direction, 1, mVssRays, mViewSpaceBox, true); 
    491490 
    492491                        if (sampleContributions) { 
     
    617616 
    618617        for (int i=0; i < rays.size(); i++) 
    619           CastRay(rays[i].mOrigin, rays[i].mDirection, 1, vssRays, mViewSpaceBox); 
     618        { 
     619                mRayCaster->CastRay(rays[i].mOrigin, rays[i].mDirection, 1, vssRays, mViewSpaceBox, true); 
     620        } 
    620621 
    621622        vssTree->AddRays(vssRays); 
Note: See TracChangeset for help on using the changeset viewer.