Ignore:
Timestamp:
12/04/05 20:19:50 (19 years ago)
Author:
bittner
Message:

non-functional merged version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp

    r444 r446  
    1111#include "VspKdTree.h" 
    1212#include "VssTree.h" 
     13#include "RssTree.h" 
    1314 
    1415X3dExporter::X3dExporter(const string filename):Exporter(filename) 
     
    871872} 
    872873 
     874 
     875bool 
     876X3dExporter::ExportRssTree2(const RssTree &tree, 
     877                                                        const Vector3 direction 
     878                                                        ) 
     879{ 
     880  stack<RssTreeNode *> tStack; 
     881   
     882   
     883  mUseForcedMaterial = true; 
     884 
     885  Vector3 dirParam; 
     886 
     887  dirParam.x = VssRay::GetDirParam(0, Normalize(direction)); 
     888  dirParam.y = VssRay::GetDirParam(1, Normalize(direction)); 
     889 
     890  float maxImportance = 0.0f; 
     891  tStack.push(tree.GetRoot()); 
     892  while (!tStack.empty()) { 
     893         
     894        RssTreeNode *node = tStack.top(); 
     895    tStack.pop(); 
     896         
     897    if (!node->IsLeaf()) { 
     898      RssTreeInterior *interior = (RssTreeInterior *)node; 
     899          if (interior->axis < 3) { 
     900                tStack.push(interior->front); 
     901                tStack.push(interior->back); 
     902          } else { 
     903                if (dirParam[interior->axis-3] < interior->position) 
     904                  tStack.push(interior->back); 
     905                else 
     906                  tStack.push(interior->front); 
     907          } 
     908    } else { 
     909          RssTreeLeaf *leaf = (RssTreeLeaf *)node; 
     910          if (tree.ValidLeaf(leaf)) { 
     911                float i = leaf->GetImportance(); 
     912                if (i > maxImportance) 
     913                  maxImportance = i; 
     914          } 
     915        } 
     916  } 
     917 
     918  tStack.push(tree.GetRoot()); 
     919  while (!tStack.empty()) { 
     920 
     921        RssTreeNode *node = tStack.top(); 
     922    tStack.pop(); 
     923         
     924                         
     925    if (!node->IsLeaf()) { 
     926      RssTreeInterior *interior = (RssTreeInterior *)node; 
     927          if (interior->axis < 3) { 
     928                tStack.push(interior->front); 
     929                tStack.push(interior->back); 
     930          } else { 
     931                if (dirParam[interior->axis-3] < interior->position) 
     932                  tStack.push(interior->back); 
     933                else 
     934                  tStack.push(interior->front); 
     935          } 
     936    } else { 
     937          RssTreeLeaf *leaf = (RssTreeLeaf *)node; 
     938          if (tree.ValidLeaf(leaf)) { 
     939                AxisAlignedBox3 box; 
     940                box = tree.GetShrankedBBox(leaf); 
     941                Mesh *mesh = new Mesh; 
     942                AddBoxToMesh(box, mesh); 
     943                 
     944                // get 4 corners of the ray directions 
     945                 
     946                mForcedMaterial.mDiffuseColor.b = 1.0f; 
     947                mForcedMaterial.mDiffuseColor.r = leaf->GetImportance()/maxImportance; 
     948                mForcedMaterial.mDiffuseColor.g = 1.0f - mForcedMaterial.mDiffuseColor.r; 
     949                 
     950                ExportMesh(mesh); 
     951                delete mesh; 
     952          } 
     953        } 
     954  } 
     955 
     956  mUseForcedMaterial = false; 
     957 
     958  return true; 
     959} 
     960 
    873961bool 
    874962X3dExporter::ExportBspTreeRayDensity(const BspTree &tree) 
     
    11501238 
    11511239 
    1152 void X3dExporter::ExportGeometry(const ObjectContainer &objects) 
    1153 { 
    1154         for (int j = 0; j < objects.size(); ++ j) 
    1155                 ExportIntersectable(objects[j]); 
    1156 } 
    1157  
    1158  
     1240void 
     1241X3dExporter::ExportGeometry(const ObjectContainer &objects) 
     1242{ 
     1243   
     1244  ObjectContainer::const_iterator oi = objects.begin(); 
     1245  for (; oi != objects.end(); oi++) { 
     1246    // export the transform... 
     1247    ExportIntersectable(*oi); 
     1248  } 
     1249   
     1250} 
Note: See TracChangeset for help on using the changeset viewer.