Changeset 1139


Ignore:
Timestamp:
07/18/06 13:26:02 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/IVReader/scripts/IVReader.vcproj

    r343 r1139  
    2020                                Name="VCCLCompilerTool" 
    2121                                Optimization="0" 
     22                                AdditionalIncludeDirectories=""$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Dependencies\include";"$(OGRE_PATH)\Samples\Common\include";..\include" 
    2223                                PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;IVREADER_EXPORTS" 
    2324                                MinimalRebuild="TRUE" 
    2425                                BasicRuntimeChecks="3" 
    2526                                RuntimeLibrary="1" 
    26                                 UsePrecompiledHeader="3" 
     27                                UsePrecompiledHeader="0" 
    2728                                WarningLevel="3" 
    2829                                Detect64BitPortabilityProblems="TRUE" 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/IVReader/src/ivmanualmeshloader.cpp

    r870 r1139  
    6262        return data->boundingBox; 
    6363} 
     64 
    6465 
    6566void IVManualMeshLoader::loadResource(Ogre::Resource *resource) 
     
    153154 
    154155} 
    155  
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/IVReader/src/ivnode.cpp

    r187 r1139  
    77        typ = IV_STRING; 
    88} 
     9 
     10 
    911IVField::~IVField() 
    1012{ 
     
    1416} 
    1517 
     18 
    1619IVNode::IVNode() 
    1720{ 
     
    2023        fields = NULL; 
    2124} 
     25 
    2226 
    2327IVNode::IVNode(const char *s) 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp

    r1134 r1139  
    22122212                                        "0.99"); 
    22132213 
    2214         RegisterOption("VspTree.pvsCountMethod", 
    2215                                         optInt, 
    2216                                         "vsp_pvs_count_method=", 
    2217                                         "1"); 
     2214        RegisterOption("VspTree.useKdPvs", 
     2215                                        optBool, 
     2216                                        "vsp_pvs_use_kd_pvs=", 
     2217                                        "true"); 
    22182218 
    22192219         
     
    23072307                        "osp_construction_render_cost_decrease_weight=", 
    23082308                        "0.99"); 
    2309  
    2310         RegisterOption("OspTree.Construction.useEqualWeightForHeuristics", 
    2311                 optBool, 
    2312                 "osp_construction_use_equal_weight_for_heuristics=", 
    2313                 "false"); 
    23142309 
    23152310 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp

    r1121 r1139  
    33#include "VspOspTree.h" 
    44#include "KdTree.h" 
     5#include "KdIntersectable.h" 
    56 
    67 
     
    7273} 
    7374 
     75void Exporter::ExportKdIntersectable(const KdIntersectable &kdObj) 
     76{ 
     77        KdNode *node = kdObj.GetNode(); 
     78         
     79        Intersectable::NewMail(); 
     80 
     81        if (node->IsLeaf()) 
     82        { 
     83                KdLeaf *leaf = dynamic_cast<KdLeaf *>(node); 
     84                 
     85                ObjectContainer::const_iterator oit, oit_end = leaf->mObjects.end(); 
     86 
     87                for (oit = leaf->mObjects.begin(); oit != oit_end; ++ oit) 
     88                {        
     89                        Intersectable *obj = *oit; 
     90         
     91                        if (!obj->Mailed()) 
     92                        { 
     93                                ExportIntersectable(obj); 
     94                                obj->Mail();                                     
     95                        }                                
     96                } 
     97        } 
    7498} 
     99 
     100 
     101} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.h

    r1121 r1139  
    2828class Beam; 
    2929class OspTree; 
     30class KdIntersectable; 
    3031 
    3132 
     
    146147 
    147148  virtual void ExportViewpoint(const Vector3 &point, const Vector3 &direction) = 0; 
     149 
     150  void ExportKdIntersectable(const KdIntersectable &kdObj); 
    148151}; 
    149152  
  • GTP/trunk/Lib/Vis/Preprocessing/src/KdIntersectable.h

    r1138 r1139  
    5252         
    5353 
     54        /** Pointer to kd leaf object that was hit during ray casting. 
     55        */ 
     56        Intersectable *mHitObject; 
     57 
    5458protected: 
    5559         
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp

    r1135 r1139  
    260260 
    261261 
    262 bool ViewCell::AddKdPvsSample(KdLeaf *sample, 
    263                                                           const float pdf,  
    264                                                           float &contribution) 
    265 { 
    266         const bool result = mKdPvs.AddSample(sample, pdf, contribution); 
    267         return result; 
    268 } 
    269262 
    270263/************************************************************************/ 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h

    r1133 r1139  
    191191        bool AddPvsSample(Intersectable *sample, const float pdf, float &contribution); 
    192192   
    193         bool AddKdPvsSample(KdLeaf *sample, const float pdf, float &contribution); 
    194193 
    195194        /// Rays piercing this view cell. 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1138 r1139  
    1818#include "GlRenderer.h" 
    1919#include "ResourceManager.h" 
     20#include "KdIntersectable.h" 
    2021 
    2122 
     
    54675468                {        
    54685469                        //-- export pvs 
    5469                         ObjectPvsMap::const_iterator oit, 
    5470                                 oit_end = pvs.mEntries.end(); 
     5470                        ObjectPvsMap::const_iterator oit, oit_end = pvs.mEntries.end(); 
    54715471 
    54725472                        Intersectable::NewMail(); 
     
    54825482                        for (oit = pvs.mEntries.begin(); oit != oit_end; ++ oit) 
    54835483                        {        
    5484                                 // export "original" pvs 
    54855484                                Intersectable *obj = (*oit).first; 
    54865485 
    5487                                 if (1 && !obj->Mailed()) 
     5486                                if (!obj->Mailed()) 
    54885487                                { 
    54895488                                        exporter->ExportIntersectable(obj); 
     
    54915490                                }                                        
    54925491                                 
    5493                                 // TODO matt§§ 
    5494                                 // export kd pvs 
    5495                                 KdLeaf *kdleaf = 0; 
    5496  
    5497                                 if (!kdleaf->Mailed()) 
     5492                                // export "original" pvs 
     5493                                m.mDiffuseColor = RgbColor(0, 0, 1); 
     5494                                exporter->SetForcedMaterial(m); 
     5495 
     5496                                if ((*oit).first->Type() == Intersectable::KD_INTERSECTABLE) 
    54985497                                { 
    5499                                         kdleaf->Mail(); 
    5500                                         kdLeaves.push_back(kdleaf); 
     5498                                        KdIntersectable *kdObj = dynamic_cast<KdIntersectable *>(obj); 
     5499                                        Intersectable *hitObj = kdObj->mHitObject; 
     5500                                 
     5501                                        if (!hitObj->Mailed()) 
     5502                                        { 
     5503                                                exporter->ExportIntersectable(hitObj); 
     5504                                                hitObj->Mail(); 
     5505                                        }        
    55015506                                } 
    5502                         } 
    5503  
    5504                         m.mDiffuseColor = RgbColor(0, 0, 1); 
    5505                         exporter->SetForcedMaterial(m); 
    5506  
    5507                         //-- export kd node pvs 
    5508                         Intersectable::NewMail(); 
    5509  
    5510                         vector<KdLeaf *>::const_iterator kdit, kdit_end = kdLeaves.end(); 
    5511  
    5512                         for (kdit = kdLeaves.begin(); kdit != kdit_end; ++ kdit) 
    5513                         { 
    5514                                 KdLeaf *kdleaf = *kdit; 
    5515  
    5516                                 //-- export kd node 
    5517                                  
    5518                                 ObjectContainer::const_iterator oit, oit_end = kdleaf->mObjects.end(); 
    5519  
    5520                 for (oit = kdleaf->mObjects.begin(); oit != oit_end; ++ oit) 
    5521                                 {        
    5522                                         Intersectable *obj = *oit; 
    5523  
    5524                                         if (!obj->Mailed()) 
    5525                                         { 
    5526                                                 exporter->ExportIntersectable(obj); 
    5527                                                 obj->Mail();                                     
    5528                                         }                                
    5529                                 } 
    5530                         } 
     5507                        }                
    55315508                } 
    55325509         
  • GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.cpp

    r1121 r1139  
    1414#include "RssTree.h" 
    1515#include "Beam.h" 
     16#include "KdIntersectable.h" 
     17 
    1618 
    1719namespace GtpVisibilityPreprocessor { 
     
    171173                break; 
    172174        case Intersectable::VIEW_CELL: 
    173                 ExportViewCell((ViewCell *)object); 
     175                ExportViewCell(dynamic_cast<ViewCell *>(object)); 
    174176                break; 
     177        case Intersectable::KD_INTERSECTABLE: 
     178                ExportKdIntersectable(*(dynamic_cast<KdIntersectable *>(object))); 
    175179        default: 
    176180                cerr << "Sorry the export for object not yet defined" << endl; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.cpp

    r1138 r1139  
    1717#include "Beam.h" 
    1818#include "KdTree.h" 
     19#include "KdIntersectable.h" 
    1920 
    2021 
     
    363364        Environment::GetSingleton()->GetBoolValue("VspTree.simulateOctree", mCirculatingAxis); 
    364365         
    365         Environment::GetSingleton()->GetIntValue("VspTree.pvsCountMethod", mPvsCountMethod); 
     366        Environment::GetSingleton()->GetBoolValue("VspTree.useKdPvs", mUseKdPvs); 
    366367 
    367368        char subdivisionStatsLog[100]; 
     
    399400        Debug << "maxband: " << mMaxBand << endl; 
    400401 
    401         if (mPvsCountMethod == 0) 
     402        if (!mUseKdPvs) 
    402403                Debug << "pvs count method: per object" << endl; 
    403404        else 
     
    871872                if (obj)  
    872873                { 
     874                        Intersectable *entry; 
     875 
     876                        // potentially visible kd cells 
     877                        if (mUseKdPvs) 
     878                        { 
     879                                KdLeaf *leaf = mOspTree->GetLeaf(ray->mTermination, ray->mTerminationNode); 
     880                                KdIntersectable *kdObj = new KdIntersectable(leaf); 
     881 
     882                                entry = kdObj; 
     883                        } 
     884                        else 
     885                                entry = obj; 
     886 
    873887                        if (vc->AddPvsSample(obj, ray->mPdf, contribution)) 
    874888                        { 
     
    877891 
    878892                        sc += contribution; 
     893                } 
     894 
     895                obj = ray->mOriginObject; 
     896 
     897                if (obj)  
     898                { 
     899                        Intersectable *entry; 
    879900 
    880901                        // potentially visible kd cells 
    881                         KdLeaf *leaf =  
    882                                 mOspTree->GetLeaf(ray->mTermination, ray->mTerminationNode); 
    883                         float kdcontri; 
    884                         vc->AddKdPvsSample(leaf, 1, kdcontri); 
    885                 } 
    886  
    887                 obj = ray->mOriginObject; 
    888  
    889                 if (obj)  
    890                 { 
     902                        if (mUseKdPvs) 
     903                        { 
     904                                KdLeaf *leaf = mOspTree->GetLeaf(ray->mOrigin, ray->mOriginNode); 
     905                                KdIntersectable *kdObj = new KdIntersectable(leaf); 
     906 
     907                                entry = kdObj;                           
     908                        } 
     909                        else 
     910                                entry = obj; 
     911 
    891912                        if (vc->AddPvsSample(obj, ray->mPdf, contribution)) 
    892913                        { 
     
    895916 
    896917                        sc += contribution; 
    897          
    898                         // potentially visible kd cells 
    899                         const bool origin = true; 
    900                         KdLeaf *leaf = 
    901                                 mOspTree->GetLeaf(ray->mOrigin, ray->mOriginNode); 
    902                         float kdcontri; 
    903                         vc->AddKdPvsSample(leaf, 1, kdcontri); 
    904918                } 
    905919 
     
    10421056                if (oObject) 
    10431057                { 
    1044                         if (mPvsCountMethod == PER_OBJECT) 
     1058                        if (!mUseKdPvs) 
    10451059                        { 
    10461060                                if (!oObject->Mailed()) 
     
    10661080                if (tObject) 
    10671081                { 
    1068                         if (mPvsCountMethod == PER_OBJECT) 
     1082                        if (!mUseKdPvs) 
    10691083                        { 
    10701084                                if (!tObject->Mailed()) 
     
    11521166        if (oObject) 
    11531167        {        
    1154                 if (mPvsCountMethod == PER_OBJECT) 
     1168                if (!mUseKdPvs) 
    11551169                { 
    11561170                        if (ci.type == SortableEntry::ERayMin) 
     
    11881202        if (tObject) 
    11891203        {        
    1190                 if (mPvsCountMethod == PER_OBJECT) 
     1204                if (!mUseKdPvs) 
    11911205                { 
    11921206                        if (ci.type == SortableEntry::ERayMin) 
     
    26222636OspTree::OspTree(): 
    26232637mRoot(NULL), 
    2624 mTimeStamp(1), 
    2625 mUseEqualWeightForHeuristics(false) 
     2638mTimeStamp(1) 
    26262639{ 
    26272640        bool randomize = false; 
     
    26642677        Environment::GetSingleton()->GetFloatValue("OspTree.Construction.renderCostDecreaseWeight", mRenderCostDecreaseWeight); 
    26652678         
    2666         Environment::GetSingleton()->GetBoolValue("OspTree.Construction.useEqualWeightForHeuristics", mUseEqualWeightForHeuristics); 
    2667  
    26682679 
    26692680        //-- debug output 
     
    34303441        ObjectContainer::const_iterator oit, oit_end = leaf->mObjects.end(); 
    34313442 
    3432         //TODO §§matt: have to evaluate view cell volume on left and right cell 
     3443        // evaluate reverse pvs and view cell volume on left and right cell 
    34333444        for (oit = leaf->mObjects.begin(); oit != oit_end; ++ oit) 
    34343445        { 
     
    40574068        // makes no sense otherwise because only one kd cell available 
    40584069        // during view space partition 
    4059         const int savedCountMethod = mVspTree.mPvsCountMethod; 
    4060         mVspTree.mPvsCountMethod = VspTree::PER_OBJECT; 
     4070        const bool savedCountMethod = mVspTree.mUseKdPvs; 
     4071        mVspTree.mUseKdPvs = false; 
    40614072 
    40624073        mTQueue.Push(PrepareVsp(sampleRays, forcedViewSpace, *viewSpaceRays)); 
     
    41374148        cout << "finished in " << TimeDiff(startTime, GetTime())*1e-3 << " secs" << endl; 
    41384149 
    4139         mVspTree.mPvsCountMethod = savedCountMethod; 
     4150        mVspTree.mUseKdPvs = savedCountMethod; 
    41404151} 
    41414152 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.h

    r1138 r1139  
    10181018protected: 
    10191019 
    1020         int mPvsCountMethod; 
     1020        bool mUseKdPvs; 
    10211021 
    10221022        enum {PER_OBJECT, PER_KDLEAF}; 
     
    16841684        float mEpsilon; 
    16851685 
    1686  
    1687         bool mUseEqualWeightForHeuristics; 
    1688  
    16891686        /// subdivision stats output file 
    16901687        ofstream  mSubdivisionStats; 
Note: See TracChangeset for help on using the changeset viewer.