Changeset 1193


Ignore:
Timestamp:
08/09/06 18:35:42 (18 years ago)
Author:
mattausch
Message:

bug fixed

Location:
GTP/trunk/Lib/Vis
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp

    r1146 r1193  
    455455        getRenderQueue()->clear(); // finally clear render queue 
    456456        if (0) OGRE_DELETE(mRenderQueue); // HACK: should rather only be cleared ... 
    457  
    458457        if (0) WriteLog(); // write out stats 
    459458} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Intersectable.h

    r1184 r1193  
    3434  /// kd leaves that this intersectable belongs to 
    3535  //set<KdLeaf *> mKdLeaves; 
    36 VssRayContainer mVssRays; 
     36  VssRayContainer mVssRays; 
     37 
    3738  /// # of object references 
    3839  int mReferences; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp

    r1189 r1193  
    793793         
    794794                // if this a valid split => subdivide this node further 
    795                 if (splitFurther) //-- continue subdivision 
     795 
     796                if (splitFurther) 
    796797                { 
    797798                        newNode = SubdivideNode(splitPlane, tData, tFrontData, tBackData, coincident); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.cpp

    r1189 r1193  
    6060{ 
    6161        MailablePvsData *vdata = obj->mViewCellPvs.Find(vc); 
    62  
     62//return false; 
    6363        if (vdata) 
    6464        { 
    65                 //Debug << "sumpdf: " << vdata->mSumPdf << endl; 
    6665                // more than one view cell sees this object inside different kd cells 
    6766                if (!checkOnlyMailed || !vdata->Mailed()) 
     
    6968                        if (checkOnlyMailed) 
    7069                                vdata->Mail(); 
    71  
     70                        //Debug << "sumpdf: " << vdata->mSumPdf << endl; 
    7271                        if (vdata->mSumPdf > 1.5f)  
    7372                                return true; 
     
    32183217        FilterRays(back, *tData.mRays, *backData.mRays); 
    32193218 
     3219        ++ mOspStats.splits[splitPlane.mAxis]; 
    32203220 
    32213221        //-- eval view cells pvs 
     
    34673467        const float minBox = box.Min(axis); 
    34683468        const float maxBox = box.Max(axis); 
     3469        Debug << "min: " << minBox << " max: " << maxBox << endl; 
    34693470 
    34703471        const float sizeBox = maxBox - minBox; 
     
    34733474        float maxBand = minBox + (1.0f - mSplitBorder) * (maxBox - minBox); 
    34743475 
     3476        const float viewSpaceVol = mVspTree->GetBoundingBox().GetVolume(); 
     3477 
    34753478        //-- sort so we can use a sweep 
    34763479        SortSplitCandidates(tData, axis, minBand, maxBand); 
    34773480 
    3478         float totalVol = 0;//PrepareHeuristics(tData); 
     3481        float totalVol = 0; 
    34793482        float voll = 0; 
    34803483        float volr = totalVol; 
    34813484 
    34823485        ViewCellContainer touchedViewCells; 
     3486         
    34833487        const float totalRenderCost = PrepareHeuristics(tData, touchedViewCells); 
    34843488        float renderCost = totalRenderCost; 
     
    34913495 
    34923496        float sum = (float)totalVol * sizeBox; 
     3497 
     3498 
     3499        Debug << "here82 render cost: " << renderCost / viewSpaceVol << endl; 
    34933500 
    34943501        ///////////////////////////////// 
     
    35113518 
    35123519        debugVol = 0; 
    3513         const float viewSpaceVol = mVspTree->GetBoundingBox().GetVolume(); 
     3520 
    35143521 
    35153522 
     
    35173524        // the sweep heuristics 
    35183525 
    3519         Intersectable::NewMail(); 
    3520         ViewCell::NewMail(); 
    3521                  
     3526         
    35223527        //-- traverse through events and find best split plane 
    35233528         
    35243529        vector<SortableEntry>::const_iterator ci, ci_end = mSplitCandidates->end(); 
     3530        //minRenderCost = RandomValue(0,viewSpaceVol); 
    35253531 
    35263532        for (ci = mSplitCandidates->begin(); ci != ci_end; ++ ci) 
     
    35353541 
    35363542                // Note: sufficient to compare size of bounding boxes of front and back side? 
    3537  
    35383543                if (((*ci).mPos >= minBand) && ((*ci).mPos <= maxBand)) 
    35393544                { 
    35403545                        float currentPos; 
    3541                          
     3546                        Debug << "here29 : " << minRenderCost / viewSpaceVol << endl; 
     3547 
    35423548                        // HACK: current positition is BETWEEN visibility events 
    3543                         if (1 && ((*ci).mType == SortableEntry::BOX_INTERSECT) && ((ci + 1) != ci_end)) 
     3549                        if (1 && /*((*ci).mType == SortableEntry::BOX_INTERSECT) &&*/ ((ci + 1) != ci_end)) 
    35443550                                currentPos = ((*ci).mPos + (*(ci + 1)).mPos) * 0.5f; 
    35453551                        else 
     
    35493555                        { 
    35503556                                splitPlaneFound = true; 
    3551                                 Debug << "pos: " << position << endl; 
    35523557                                minRenderCost = renderCost; 
    35533558                                position = currentPos; 
    3554                         } 
    3555                 } 
    3556         } 
    3557          
     3559                                Debug << "pos: " << position << endl; 
     3560                        } 
     3561                } 
     3562        } 
     3563//splitPlaneFound = true; 
    35583564        if (splitPlaneFound) 
    35593565        { 
    3560                 ratio = totalRenderCost / minRenderCost; 
     3566                ratio = minRenderCost / totalRenderCost; 
    35613567        } 
    35623568 
     
    36763682                                                                ViewCellContainer &touchedViewCells) 
    36773683{ 
    3678  
    36793684        // collect view cells and set mail + counter 
    36803685        ViewCellContainer viewCells; 
     
    37543759                                                  float &renderCost) 
    37553760{ 
     3761        //Debug << "add contri to obj: " << obj->mMailbox - Intersectable::sMailId << endl; 
    37563762        obj->Mail(2); // set as belonging to both leafs 
    37573763 
     
    37613767        { 
    37623768                ViewCell *vc = *vit; 
     3769                //Debug << "here30 vc mail " << vc->mMailbox - ViewCell::sMailId << endl; 
    37633770 
    37643771                // if obj not previously associated with this view cell => increase render cost 
    3765                 if (vc->Mailed(1) &&  
    3766                         !ViewCellHasMultipleReferences(obj, vc, false)) 
    3767                 { 
     3772                if (vc->Mailed(1) && !ViewCellHasMultipleReferences(obj, vc, false)) 
     3773                {        
     3774                        //Debug << "add to rendercost: " << vc->GetVolume() / mVspTree->GetBoundingBox().GetVolume() << endl; 
    37683775                        renderCost += vc->GetVolume(); 
    37693776                } 
     
    37773784                                                                float &renderCost) 
    37783785{ 
     3786        //Debug << "subtract contri from obj: " << obj->mMailbox - Intersectable::sMailId << endl; 
    37793787    obj->Mail(1); // set as belonging to back leaf 
    37803788        ViewCellContainer::const_iterator vit, vit_end = touchedViewCells.end(); 
    3781          
     3789         
    37823790        for (vit = touchedViewCells.begin(); vit != vit_end; ++ vit) 
    37833791        { 
    37843792                ViewCell *vc = *vit; 
     3793 
     3794                //Debug << "here6 " << vc->mMailbox - ViewCell::sMailId << endl; 
    37853795 
    37863796                // if obj was previously associated with this view cell but is not now  
    37873797                // => decrease render cost 
    3788                 if (vc->Mailed() &&  
    3789                         !ViewCellHasMultipleReferences(obj, vc, false)) 
    3790                 { 
     3798                if (vc->Mailed() &&     !ViewCellHasMultipleReferences(obj, vc, false)) 
     3799                { 
     3800                        //Debug << "subtract from rendercost: " << vc->GetVolume() / mVspTree->GetBoundingBox().GetVolume() << endl; 
    37913801                        renderCost -= vc->GetVolume(); 
    37923802                } 
     
    38033813        mVspTree->GetViewCells(VssRay(ray), viewCells); 
    38043814 
    3805         /// classify view cells and compute volume contri accordingly 
    3806         /// possible view cell classifications: 
    3807         /// view cell mailed => view cell can be seen from left child node 
    3808         /// view cell counter > 0 view cell can be seen from right child node 
    3809         /// combined: view cell volume belongs to both nodes 
     3815        // classify view cells and compute volume contri accordingly 
     3816        // possible view cell classifications: 
     3817        // view cell mailed => view cell can be seen from left child node 
     3818        // view cell counter > 0 view cell can be seen from right child node 
     3819        // combined: view cell volume belongs to both nodes 
    38103820        ViewCellContainer::const_iterator vit, vit_end = viewCells.end(); 
    38113821         
     
    38213831                                                                           float &renderCost) 
    38223832{ 
    3823         // view cells can also be seen from left child node 
     3833        //Debug << "**************" << endl; 
     3834        //Debug << "vc contri: " << renderCost / mVspTree->GetBoundingBox().GetVolume() << " " << viewCell->mMailbox - ViewCell::sMailId << " counter: " << viewCell->mCounter << endl; 
     3835 
    38243836        const float vol = viewCell->GetVolume(); 
    38253837 
    38263838        if (viewCell->Mailed()) 
    38273839        { 
    3828                 viewCell->NewMail(2); // view cell can be seen from both nodes 
     3840                viewCell->Mail(2); // view cell can be seen from both nodes 
    38293841 
    38303842        // we now see view cell from both nodes => add contri 
     
    38363848 
    38373849                        // was render cost already added? 
    3838                         if (!ViewCellHasMultipleReferences(obj, viewCell, false) || 
     3850                        if (!ViewCellHasMultipleReferences(obj, viewCell, false) && 
    38393851                                obj->Mailed(1)) 
    38403852                        { 
    3841                                 renderCost += viewCell->GetVolume(); 
     3853                                //Debug << "obj mail 1!! " << vol / mVspTree->GetBoundingBox().GetVolume() << endl; 
     3854                                renderCost += vol; 
    38423855                        } 
    38433856                } 
     
    38463859        if (-- viewCell->mCounter == 0) 
    38473860        { 
    3848                 ViewCell::NewMail(1); // view cell can be seen from back node only 
     3861                viewCell->Mail(1); // view cell can be seen from back node only 
    38493862 
    38503863                //MailablePvsData::NewMail(); 
     
    38563869 
    38573870                        // can render cost be be reduced? 
    3858                         if (!ViewCellHasMultipleReferences(obj, viewCell, false) || 
    3859                                 obj->Mailed()) 
    3860                         { 
    3861                                 renderCost -= viewCell->GetVolume(); 
    3862                         } 
    3863                 } 
    3864         } 
     3871                        if (!ViewCellHasMultipleReferences(obj, viewCell, false) &&     obj->Mailed()) 
     3872                        { 
     3873                                renderCost -= vol; 
     3874                        } 
     3875                } 
     3876        } 
     3877        //Debug << "new rc: " << renderCost / mVspTree->GetBoundingBox().GetVolume() << " counter2: " << viewCell->mCounter << endl; 
     3878        //Debug << "**************"<<endl; 
    38653879} 
    38663880 
Note: See TracChangeset for help on using the changeset viewer.