Ignore:
Timestamp:
08/27/06 23:39:50 (18 years ago)
Author:
mattausch
Message:

implemented bv hierarchy

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp

    r1233 r1287  
    44#include "KdTree.h" 
    55#include "KdIntersectable.h" 
     6#include "BvHierarchy.h" 
    67 
    78 
     
    6768                } 
    6869 
    69                 ExportGeometry(leaf->mObjects);  
     70                if (0) ExportGeometry(leaf->mObjects);   
    7071        } 
    7172 
     
    102103 
    103104 
     105bool Exporter::ExportBvHierarchy(const BvHierarchy &bvHierarchy,  
     106                                                                 const int maxPvs) 
     107{ 
     108        vector<BvhLeaf *> leaves; 
     109        bvHierarchy.CollectLeaves(leaves); 
     110 
     111        mUseForcedMaterial = true; 
     112 
     113        vector<BvhLeaf *>::const_iterator it, it_end = leaves.end(); 
     114 
     115        Material white;  
     116        white.mDiffuseColor.r = 1; 
     117        white.mDiffuseColor.g = 1; 
     118        white.mDiffuseColor.b = 1; 
     119        int objSize = 0; 
     120 
     121        for (it = leaves.begin(); it != it_end; ++ it) 
     122        { 
     123                BvhLeaf *leaf = *it; 
     124 
     125                SetWireframe(); 
     126                SetForcedMaterial(white); 
     127                ExportBox(leaf->GetBoundingBox()); 
     128                 
     129                SetFilled(); 
     130 
     131                if (maxPvs) // color code pvs 
     132                { 
     133                        mForcedMaterial.mDiffuseColor.b = 1.0f; 
     134                        const float importance = (float)leaf->mObjects.size() / (float)maxPvs; 
     135 
     136                        mForcedMaterial.mDiffuseColor.r = importance; 
     137                        mForcedMaterial.mDiffuseColor.g = 1.0f - mForcedMaterial.mDiffuseColor.r; 
     138                } 
     139                else 
     140                { 
     141                        SetForcedMaterial(RandomMaterial()); 
     142                } 
     143 
     144                if (1)  
     145                { 
     146                        SetFilled(); 
     147                        ExportGeometry(leaf->mObjects); 
     148                        objSize += leaf->mObjects.size(); 
     149                } 
     150        } 
     151 
     152        return true; 
    104153} 
     154 
     155 
     156} 
Note: See TracChangeset for help on using the changeset viewer.