Changeset 411 for trunk


Ignore:
Timestamp:
11/15/05 01:32:10 (19 years ago)
Author:
mattausch
Message:

worked on view space partition kd tree

Location:
trunk/VUT
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env

    r410 r411  
    6767ViewCells { 
    6868        #hierarchy kdTree 
     69        hierarchy vspTree 
    6970        hierarchy bspTree 
    7071        # hierarchy sceneDependent 
     
    201202        epsilon         1e-6 
    202203 
    203         maxDepth        40 
    204         minPvs          1 
    205         minRays         50 
    206         minSize         0.00001 
    207         maxCostRatio    0.95 
    208         maxRayContribution 0.05 
     204        Construction { 
     205                samples 100000 
     206        } 
     207         
     208        Termination { 
     209                maxDepth        40 
     210                minPvs          1 
     211                minRays         50 
     212                minSize         0.00001 
     213                maxCostRatio    0.95 
     214                maxRayContribution 0.05 
     215        } 
    209216         
    210217        maxTotalMemory  400 
     
    212219 
    213220        splitType regular 
    214 #       splitType heuristics 
    215221 
    216222        numberOfEndPointDomains 10000 
    217223        ct_div_ci       0.0 
    218         randomize       false 
    219  
    220         refDirBoxMaxSize        0.1 
    221 } 
     224} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Environment.cpp

    r409 r411  
    13361336 
    13371337 
    1338         RegisterOption("VspKdTree.maxDepth", optInt, "kd_depth=", "12"); 
    1339   RegisterOption("VspKdTree.minPvs", optInt, "kd_minpvs=", "1"); 
    1340   RegisterOption("VspKdTree.minRays", optInt, "kd_minrays=", "10"); 
    1341         RegisterOption("VspKdTree.maxCostRatio", optFloat, "maxcost=", "0.95"); 
    1342         RegisterOption("VspKdTree.maxRayContribution", optFloat, "maxraycontrib=", "0.5"); 
    1343  
    1344         RegisterOption("VspKdTree.epsilon", optFloat, "kd_eps=", "1e-6"); 
    1345   RegisterOption("VspKdTree.ct_div_ci", optFloat, "kd_ctdivci=", "1.0"); 
    1346   RegisterOption("VspKdTree.randomize", optBool, "randomize", "false"); 
    1347   RegisterOption("VspKdTree.splitType", optString, "split=", "queries"); 
    1348   RegisterOption("VspKdTree.numberOfEndPointDomains", optInt, "endpoints=", "10000"); 
    1349  
    1350   RegisterOption("VspKdTree.minSize", optFloat, "minsize=", "0.001"); 
    1351  
    1352   RegisterOption("VspKdTree.maxTotalMemory", optFloat, "mem=", "60.0"); 
    1353   RegisterOption("VspKdTree.maxStaticMemory", optFloat, "statmem=", "8.0"); 
    1354  
    1355   RegisterOption("VspKdTree.queryType", optString, "qtype=", "static"); 
    1356  
    1357   RegisterOption("VspKdTree.queryPosWeight", optFloat, "qposweight=", "0.0"); 
    1358   RegisterOption("VspKdTree.useRefDirSplits", optBool, "refdir", "false"); 
    1359   RegisterOption("VspKdTree.refDirAngle", optFloat, "refangle=", "10"); 
    1360   RegisterOption("VspKdTree.refDirBoxMaxSize", optFloat, "refboxsize=", "0.1"); 
    1361   RegisterOption("VspKdTree.accessTimeThreshold", optInt, "accesstime=", "1000"); 
    1362   RegisterOption("VspKdTree.minCollapseDepth", optInt, "colldepth=", "4"); 
    1363  
    1364         RegisterOption("VssTree.maxDepth", optInt, "kd_depth=", "12"); 
     1338  RegisterOption("VspKdTree.Construction.Samples", 
     1339                 optInt, 
     1340                 "-vsp_construction_samples=", 
     1341                 "100000"); 
     1342 
     1343  RegisterOption("VspKdTree.Termination.maxDepth",  
     1344                optInt,  
     1345                "vsp_depth=", "30"); 
     1346 
     1347  RegisterOption("VspKdTree.Termination.minPvs",  
     1348          optInt,  
     1349          "vsp_minpvs=",  
     1350          "1"); 
     1351 
     1352  RegisterOption("VspKdTree.Termination.minRays",  
     1353          optInt,  
     1354          "vsp_minrays=",  
     1355          "10"); 
     1356 
     1357  RegisterOption("VspKdTree.maxCostRatio",  
     1358          optFloat,  
     1359          "vsp_maxcost=",  
     1360          "0.95"); 
     1361 
     1362  RegisterOption("VspKdTree.maxRayContribution",  
     1363          optFloat,  
     1364          "vsp_max_ray_contrib=",  
     1365          "0.5"); 
     1366 
     1367  RegisterOption("VspKdTree.epsilon",  
     1368          optFloat,  
     1369          "kd_eps=",  
     1370          "1e-6"); 
     1371 
     1372  RegisterOption("VspKdTree.ct_div_ci",  
     1373          optFloat,  
     1374          "vsp_ctdivci=", "1.0"); 
     1375   
     1376  RegisterOption("VspKdTree.splitType",  
     1377          optString,  
     1378          "split=",  
     1379          "queries"); 
     1380 
     1381  RegisterOption("VspKdTree.numberOfEndPointDomains",  
     1382          optInt,  
     1383          "endpoints=",  
     1384          "10000"); 
     1385 
     1386  RegisterOption("VspKdTree.minSize",  
     1387          optFloat,  
     1388          "minsize=",  
     1389          "0.001"); 
     1390 
     1391  RegisterOption("VspKdTree.maxTotalMemory",  
     1392          optFloat,  
     1393          "vsp_max_total_mem=",  
     1394          "60.0"); 
     1395 
     1396  RegisterOption("VspKdTree.maxStaticMemory",  
     1397          optFloat,  
     1398          "vsp_max_static_mem=",  
     1399          "8.0"); 
     1400 
     1401  RegisterOption("VspKdTree.queryType",  
     1402          optString,  
     1403          "qtype=",  
     1404          "static"); 
     1405 
     1406  RegisterOption("VspKdTree.queryPosWeight",  
     1407                optFloat,  
     1408                "qposweight=",  
     1409                "0.0"); 
     1410   
     1411  RegisterOption("VspKdTree.accessTimeThreshold",  
     1412          optInt,  
     1413          "accesstime=",  
     1414          "1000"); 
     1415 
     1416  RegisterOption("VspKdTree.minCollapseDepth",  
     1417          optInt,  
     1418          "vsp_min_colldepth=",  
     1419          "4"); 
     1420   
     1421  RegisterOption("VssTree.maxDepth", optInt, "kd_depth=", "12"); 
    13651422  RegisterOption("VssTree.minPvs", optInt, "kd_minpvs=", "1"); 
    13661423  RegisterOption("VssTree.minRays", optInt, "kd_minrays=", "10"); 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp

    r410 r411  
    6262        { 
    6363                ViewCell::sHierarchy = ViewCell::KD; 
     64        } 
     65        else if (strcmp(viewCellsStr, "vspTree") == 0) 
     66        { 
     67                ViewCell::sHierarchy = ViewCell::VSP; 
    6468        } 
    6569        else if (strcmp(viewCellsStr, "sceneDependent") == 0) 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.h

    r409 r411  
    99#include "ViewCellBsp.h" 
    1010#include "ViewCell.h" 
     11#include "VspKdTree.h" 
    1112 
    1213class RenderSimulator; 
     
    119120 
    120121  RenderSimulator *mRenderSimulator; 
     122 
     123  /** Kd tree inducing a coarse partition of view space that are the building 
     124          blocks for view cells. 
     125  */ 
     126  VspKdTree *mVspKdTree; 
    121127}; 
    122128 
  • trunk/VUT/GtpVisibilityPreprocessor/src/RenderSimulator.h

    r409 r411  
    3030{ 
    3131public: 
    32         BspViewCellRenderSimulator(float objRenderCost, float vcOverhead, float moveSpeed, BspTree *bspTree); 
     32        BspViewCellRenderSimulator(float objRenderCost,  
     33                                                           float vcOverhead,  
     34                                                           float moveSpeed,  
     35                                                           BspTree *bspTree); 
    3336 
    3437        Real SimulateRendering(); 
     
    4750{ 
    4851public: 
    49         KdViewCellRenderSimulator(float objRenderCost, float vcOverhead, float moveSpeed, KdTree *kdTree); 
     52        KdViewCellRenderSimulator(float objRenderCost,  
     53                                                          float vcOverhead,  
     54                                                          float moveSpeed,  
     55                                                          KdTree *kdTree); 
    5056        Real SimulateRendering(); 
    5157 
  • trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp

    r410 r411  
    99#include "RenderSimulator.h" 
    1010 
    11 SamplingPreprocessor::SamplingPreprocessor(): mPass(0), mSampleRays(NULL) 
     11SamplingPreprocessor::SamplingPreprocessor(): mPass(0) 
    1212{ 
    1313  // this should increase coherence of the samples 
     
    1515  environment->GetIntValue("Sampling.totalSamples", mTotalSamples); 
    1616  environment->GetIntValue("BspTree.Construction.samples", mBspConstructionSamples); 
     17  environment->GetIntValue("VspTree.Construction.samples", mVspConstructionSamples); 
     18 
    1719  environment->GetIntValue("ViewCells.PostProcessing.samples", mPostProcessSamples); 
    1820  environment->GetIntValue("BspTree.Visualization.samples", mVisualizationSamples); 
     
    2527{ 
    2628        CLEAR_CONTAINER(mSampleRays); 
     29        CLEAR_CONTAINER(mVspSampleRays); 
    2730} 
    2831 
     
    198201                } 
    199202        } 
    200         else 
    201                 { 
    202                         if (ray.kdLeaves.size()) { 
    203                                 Intersectable *terminator = 
    204                                         ray.intersections.size() ? ray.intersections[0].mObject: NULL; 
    205  
    206                                 sampleContributions += AddNodeSamples(ray, 
    207                                                                                                                                                                                         object, 
    208                                                                                                                                                                                         terminator); 
    209                         } 
    210                 } 
     203        else { 
     204                if (ray.kdLeaves.size()) { 
     205                        Intersectable *terminator = 
     206                                ray.intersections.size() ? ray.intersections[0].mObject: NULL; 
     207 
     208                        sampleContributions += AddNodeSamples(ray, 
     209                                                                                                                                                                                object, 
     210                                                                                                                                                                                terminator); 
     211                } 
     212        } 
    211213         
    212214        return sampleContributions; 
     
    482484                                                //mVspKdTree->Construct(mSampleRays, mBoundingBox); 
    483485                                        } 
    484                                         /*else if (ViewCell::sHierarchy == ViewCell::VSPKD) 
     486                                        else if (ViewCell::sHierarchy == ViewCell::VSP) 
    485487                                        { 
    486                                                 ProcessVspKdViewCells(ray, 
    487                                                                                           reverseSample ? NULL : object, 
    488                                                                                           faceIndex, 
    489                                                                                           passContributingSamples, 
    490                                                                                           passSampleContributions); 
    491                                         }*/ 
     488                                                ProcessVspViewCells(ray, 
     489                                                                                        reverseSample ? NULL : object, 
     490                                                                                        faceIndex, 
     491                                                                                        passContributingSamples, 
     492                                                                                        passSampleContributions); 
     493                                        } 
    492494                                } 
    493495                        } else { 
     
    709711} 
    710712 
     713 
     714void SamplingPreprocessor::ProcessVspViewCells(const Ray &ray, 
     715                                               Intersectable *object, 
     716                                                                                           const int faceIndex, 
     717                                                                                           int &contributingSamples, 
     718                                                                                           int &sampleContributions) 
     719{ 
     720        // save rays for bsp tree construction 
     721        if (!mVspKdTree) 
     722        { 
     723                if ((int)mVspSampleRays.size() < mVspConstructionSamples) 
     724                { 
     725                        MeshInstance *mi = dynamic_cast<MeshInstance *>(object); 
     726                         
     727                        VssRay *sRay = new VssRay(ray); 
     728                        mVspSampleRays.push_back(sRay); 
     729                 
     730                        // also add origin to sample 
     731                        sRay->mOriginObject = object; 
     732                } 
     733                else 
     734                { 
     735                        // construct VSP tree using the collected samples 
     736                        cout << "building VSP tree from " << (int)mVspSampleRays.size() << " samples " << endl; 
     737                        mVspKdTree->Construct(mVspSampleRays); 
     738                 
     739                        // add contributions of saved samples to PVS 
     740                        //contributingSamples += mBspTree->GetStat().contributingSamples; 
     741                        //sampleContributions += mBspTree->GetStat().sampleContributions; 
     742 
     743                        // throw away samples because BSP leaves not stored in order  
     744                        // Need ordered rays for post processing => collect new rays 
     745                        //CLEAR_CONTAINER(mVspSampleRays); 
     746                } 
     747        } 
     748        // save rays for post processing 
     749        /*else if (((int)mVspSampleRays.size() < mPostProcessSamples) || 
     750                         ((int)mVspSampleRays.size() < mVisualizationSamples)) 
     751        { 
     752                mVspSampleRays.push_back(new Ray(ray)); 
     753        }*/ 
     754} 
     755 
    711756void SamplingPreprocessor::ProcessBspViewCells(const Ray &ray, 
    712757                                               Intersectable *object, 
  • trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.h

    r409 r411  
    66 
    77#include "Preprocessor.h" 
    8  
     8#include "VssRay.h" 
    99 
    1010/** Sampling based visibility preprocessing. The implementation is based on heuristical 
     
    1414                 
    1515  SamplingPreprocessor(); 
    16  
    1716  ~SamplingPreprocessor(); 
    1817 
    1918  virtual bool ComputeVisibility(); 
    2019 
     20 
    2121protected: 
    22         int mPass; 
    23  
    24   int mSamplesPerPass; 
    25   int mTotalSamples; 
    26   int mKdPvsDepth; 
    27   ofstream mStats; 
    28   ObjectContainer mObjects; 
    29   RayContainer mSampleRays; 
    30   int mBspConstructionSamples; 
    31   int mPostProcessSamples; 
    32   int mVisualizationSamples; 
    33  
    3422  void 
    3523  SetupRay(Ray &ray,  
     
    8169                                                         int &sampleContributions); 
    8270 
     71        void ProcessVspViewCells(const Ray &ray, 
     72                                                         Intersectable *object, 
     73                                                         const int faceIndex, 
     74                                                         int &contributingSamples, 
     75                                                         int &sampleContributions); 
     76 
    8377        /** Adds objects samples to bsp view cells. 
    8478        */ 
     
    9892        */ 
    9993        int PostprocessViewCells(const RayContainer &rays); 
     94 
     95protected: 
     96        int mPass; 
     97        int mSamplesPerPass; 
     98        int mTotalSamples; 
     99        int mKdPvsDepth; 
     100        ofstream mStats; 
     101        ObjectContainer mObjects; 
     102 
     103        RayContainer mSampleRays; 
     104        VssRayContainer mVspSampleRays; 
     105        int mBspConstructionSamples; 
     106        int mVspConstructionSamples; 
     107 
     108    int mPostProcessSamples; 
     109        int mVisualizationSamples; 
     110 
    100111}; 
    101112 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.h

    r372 r411  
    3535        */ 
    3636        static void DeriveViewCells(const ObjectContainer &objects,  
    37                                                                                                                         ViewCellContainer &viewCells,  
    38                                                                                                                         const int maxViewCells); 
     37                                                                ViewCellContainer &viewCells,  
     38                                                                const int maxViewCells); 
    3939 
    4040         
     
    6262 
    6363        /// view cells types 
    64         enum HierarchyType {BSP, KD}; 
     64        enum HierarchyType {BSP, KD, VSP}; 
    6565 
    6666        /** Generates view cells of type specified by view cells type. 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp

    r410 r411  
    113113mPlane(plane), mFront(NULL), mBack(NULL) 
    114114{} 
     115 
     116BspInterior::~BspInterior()  
     117{  
     118        DEL_PTR(mFront);  
     119        DEL_PTR(mBack); 
     120} 
    115121 
    116122bool BspInterior::IsLeaf() const 
     
    375381BspTree::~BspTree() 
    376382{ 
    377         std::stack<BspNode *> tStack; 
    378  
    379         tStack.push(mRoot); 
    380  
    381         while (!tStack.empty()) 
    382         { 
    383                 BspNode *node = tStack.top(); 
    384  
    385             tStack.pop(); 
    386          
    387                 if (!node->IsLeaf()) 
    388                 { 
    389                         BspInterior *interior = dynamic_cast<BspInterior *>(node); 
    390  
    391                         // push the children on the stack (there are always two children) 
    392                         tStack.push(interior->GetBack()); 
    393                         tStack.push(interior->GetFront()); 
    394                 } 
    395  
    396                 DEL_PTR(node); 
    397         } 
     383        DEL_PTR(mRoot); 
    398384} 
    399385 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h

    r409 r411  
    244244        */ 
    245245        BspInterior(const Plane3 &plane); 
     246        ~BspInterior(); 
    246247        /** @return false since it is an interior node  
    247248        */ 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.cpp

    r410 r411  
    608608         
    609609        float sum = rr*sizeBox; 
    610         float minSum = 1e20; 
     610        float minSum = 1e20f; 
    611611         
    612612        Intersectable::NewMail(); 
     
    706706        splitCandidates->clear(); 
    707707   
    708         int requestedSize = 2*(node->rays.size()); 
     708        int requestedSize = 2 * (int)(node->rays.size()); 
    709709        // creates a sorted split candidates array 
    710710        if (splitCandidates->capacity() > 500000 && 
     
    756756 
    757757        if ((int)(leaf->rays.size()) > stat.maxRayRefs) 
    758                 stat.maxRayRefs = leaf->rays.size(); 
     758                stat.maxRayRefs = (int)leaf->rays.size(); 
    759759} 
    760760 
     
    899899         
    900900        // update stats 
    901         stat.rayRefs -= leaf->rays.size(); 
     901        stat.rayRefs -= (int)leaf->rays.size(); 
    902902        stat.rayRefs += raysBack + raysFront; 
    903903 
     
    10571057                                if (removeAllScheduledRays)  
    10581058                                { 
    1059                                         int tail = leaf->rays.size() - 1; 
     1059                                        int tail = (int)leaf->rays.size() - 1; 
    10601060 
    10611061                                        for (int i=0; i < (int)(leaf->rays.size()); ++ i)  
     
    14351435                        VspKdTreeLeaf *leaf = (VspKdTreeLeaf *)node; 
    14361436                        float c = leaf->GetAvgRayContribution(); 
    1437                         int num = (c*ratioPerLeaf + 0.5); 
     1437                        int num = (int)(c*ratioPerLeaf + 0.5); 
    14381438                        //                      cout<<num<<" "; 
    14391439 
     
    14571457        } 
    14581458 
    1459         return rays.size(); 
     1459        return (int)rays.size(); 
    14601460} 
    14611461 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.h

    r410 r411  
    104104 
    105105 
    106 // -------------------------------------------------------------- 
    107 // For sorting rays 
    108 // -------------------------------------------------------------- 
    109 struct  SortableEntry 
    110 { 
    111   enum EType { 
    112     ERayMin, 
    113     ERayMax 
    114   }; 
    115  
    116   int type; 
    117   float value; 
    118   void *data; 
    119    
    120   SortableEntry() {} 
    121   SortableEntry(const int t, const float v, void *d):type(t), 
    122                                                                                                                                                                                                                  value(v), 
    123                                                                                                                                                                                                                  data(d) {} 
    124          
    125   friend bool operator<(const SortableEntry &a, const SortableEntry &b) { 
    126     return a.value < b.value; 
    127   } 
    128 }; 
    129  
    130  
    131106class VspKdTreeInterior; 
    132107 
     
    158133#if USE_FIXEDPOINT_T 
    159134#define FIXEDPOINT_ONE 0x7FFE 
    160                                                                                                 //                        mMaxT(0xFFFF) 
    161                                                                                                                                                         mMaxT(FIXEDPOINT_ONE) 
     135        // mMaxT(0xFFFF) 
     136                mMaxT(FIXEDPOINT_ONE) 
    162137#else 
    163138                mMaxT(1.0f) 
     
    166141         
    167142        RayInfo(VssRay *r, 
    168                                                                                 const float _min, 
    169                                                                                 const float _max 
    170                                                                                 ):mRay(r) { 
     143                        const float _min, 
     144                        const float _max 
     145                        ):mRay(r)  
     146        { 
    171147                SetMinT(_min); 
    172148                SetMaxT(_max); 
     
    174150         
    175151        RayInfo(VssRay *r, 
    176                                                                                 const short _min, 
    177                                                                                 const float _max 
    178                                                                                 ):mRay(r), mMinT(_min) { 
     152                        const short _min, 
     153                        const float _max):mRay(r), mMinT(_min)  
     154        { 
    179155                SetMaxT(_max); 
    180156        } 
    181157         
    182158        RayInfo(VssRay *r, 
    183                                                                                 const float _min, 
    184                                                                                 const short _max 
    185                                                                                 ):mRay(r), mMaxT(_max) { 
     159                        const float _min, 
     160                        const short _max): 
     161        mRay(r), mMaxT(_max)  
     162        { 
    186163                SetMinT(_min); 
    187164        } 
     
    223200 
    224201 
    225   int ComputeRayIntersection(const float axis, 
    226                                                                                                                  const float position, 
    227                                                                                                                  float &t 
    228                                                                                                                  ) const { 
    229                  
     202        int ComputeRayIntersection(const int axis, const float position, float &t) const  
     203        {                
    230204                // intersect the ray with the plane 
    231     float denom = mRay->GetDir(axis); 
     205                float denom = mRay->GetDir(axis); 
    232206     
    233     if (fabs(denom) < 1e-20) 
    234       //if (denom == 0.0f) 
    235       return (mRay->GetOrigin(axis) > position) ? 1 : -1; 
     207                if (fabs(denom) < 1e-20) 
     208                        //if (denom == 0.0f) 
     209                        return (mRay->GetOrigin(axis) > position) ? 1 : -1; 
    236210     
    237     t = (position - mRay->GetOrigin(axis))/denom; 
    238  
    239     if (t < GetMinT()) 
    240       return (denom > 0) ? 1 : -1; 
    241  
    242     if (t > GetMaxT()) 
    243       return (denom > 0) ? -1 : 1; 
     211                t = (position - mRay->GetOrigin(axis))/denom; 
     212 
     213                if (t < GetMinT()) 
     214                        return (denom > 0) ? 1 : -1; 
     215 
     216                if (t > GetMaxT()) 
     217                        return (denom > 0) ? -1 : 1; 
    244218 
    245219                return 0; 
     
    250224 
    251225 
    252         typedef vector<RayInfo> RayInfoContainer; 
    253          
    254   enum { EInterior, ELeaf }; 
     226typedef vector<RayInfo> RayInfoContainer; 
     227 
     228enum {EInterior, ELeaf}; 
    255229 
    256230  ///////////////////////////////// 
     
    294268// KD-tree node - interior node 
    295269// -------------------------------------------------------------- 
    296 class VspKdTreeInterior : 
    297   public VspKdTreeNode 
     270class VspKdTreeInterior: public VspKdTreeNode 
    298271{ 
    299272public: 
     
    340313  virtual int Type() const  { return EInterior; } 
    341314   
    342   virtual ~VspKdTreeInterior() { 
    343     if (back) 
    344       delete back; 
    345     if (front) 
    346       delete front; 
    347   } 
    348    
    349   virtual void Print(ostream &s) const { 
    350     if (axis == 0) 
    351       s<<"x "; 
    352     else 
    353       if (axis == 1) 
    354         s<<"y "; 
    355       else 
    356         s<<"z "; 
    357     s<<position<<" "; 
    358     back->Print(s); 
    359     front->Print(s); 
    360   } 
    361  
    362    
    363          
    364   int ComputeRayIntersection(const RayInfo &rayData, 
    365                                                                                                                  float &t 
    366                                                                                                                  ) { 
    367                 return rayData.ComputeRayIntersection(axis, position, t); 
     315  virtual ~VspKdTreeInterior() 
     316  { 
     317          DEL_PTR(back); 
     318          DEL_PTR(front); 
     319  } 
     320   
     321  virtual void Print(ostream &s) const  
     322  { 
     323          if (axis == 0) 
     324                  s << "x "; 
     325          else 
     326                  if (axis == 1) 
     327                          s << "y "; 
     328                  else 
     329                          s << "z "; 
     330          s << position << " "; 
     331          back->Print(s); 
     332          front->Print(s); 
     333  } 
     334         
     335  int ComputeRayIntersection(const RayInfo &rayData, float &t)  
     336  { 
     337          return rayData.ComputeRayIntersection(axis, position, t); 
    368338  } 
    369339 
     
    465435class VspKdTree 
    466436{ 
     437        // -------------------------------------------------------------- 
     438        // For sorting rays 
     439        // ------------------------------------------------------------- 
     440        struct SortableEntry 
     441        { 
     442                enum EType  
     443                { 
     444                        ERayMin, 
     445                        ERayMax 
     446                }; 
     447 
     448                int type; 
     449                float value; 
     450                void *data; 
     451   
     452                SortableEntry() {} 
     453                SortableEntry(const int t, const float v, void *d):type(t), 
     454                                          value(v), data(d)  
     455                { 
     456                } 
     457                 
     458                friend bool operator<(const SortableEntry &a, const SortableEntry &b)  
     459                { 
     460                        return a.value < b.value; 
     461                } 
     462        }; 
     463 
    467464        struct TraversalData 
    468465        {   
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssRay.h

    r410 r411  
    6161  } 
    6262         
    63         VccRay(const Ray &ray): 
    64   VccRay(ray.GetLoc(), ray.Extrap(ray.intersections[0].mT),  ray.intersections[0].mObject, ray.sourceObject.mObject) 
    65   {} 
     63        VssRay(const Ray &ray) 
     64                :mOrigin(ray.GetLoc()),  
     65                mTermination(ray.Extrap(ray.intersections[0].mT)), 
     66                mOriginObject(ray.sourceObject.mObject), 
     67                mTerminationObject(ray.intersections[0].mObject), 
     68                mRefCount(0), 
     69                mFlags(0), 
     70                mMailbox(-1) 
     71        {} 
     72 
    6673  void Precompute() { 
    6774    mFlags = 0; 
Note: See TracChangeset for help on using the changeset viewer.