Changeset 3274


Ignore:
Timestamp:
01/13/09 16:40:27 (15 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/MainApp.vcproj

    r3272 r3274  
    155155                                IgnoreAllDefaultLibraries="false" 
    156156                                IgnoreDefaultLibraryNames="LIBCMT" 
    157                                 GenerateDebugInformation="true" 
     157                                GenerateDebugInformation="false" 
    158158                                SubSystem="1" 
    159159                                LargeAddressAware="2" 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/VisibilitySolutionConverter/VisibilitySolutionConverter.cpp

    r3273 r3274  
    538538                        const int idx = 3 * mGlobalTriangleIds[j]; 
    539539 
    540                         //cout << "idx: " << mGlobalTriangleIds[j] << " j " << j << " " << vertices.size() / 3 << endl; 
     540                        //cout << "idx: " << 3 * mGlobalTriangleIds[j] << " j " << j << " " << vertices.size()<< endl; 
    541541                        for (int k = 0; k < 3; ++ k) 
    542542                        { 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env

    r3273 r3274  
    77# misc stuff 
    88 
    9 filename=vienna_full_hp 
    10 bvhname=vienna_full_hp 
     9#filename=vienna_full_hp 
     10#bvhname=vienna_full_hp 
    1111#filename=newvienna 
    1212#bvhname=newvienna 
    13 #filename=procedural_pompeii_area6_hires/pompeii_full 
     13filename=procedural_pompeii_area6_hires/pompeii_full 
    1414#filename=procedural_pompeii_area6_hires/pompeii_part 
    1515#filename=city 
     16#bvhname=city 
    1617useLODs=1 
    1718# shadow map size 
     
    3839maxBatchSize=50 
    3940# triangles per bvh leaf (influences hierarchy depth vs. occlusion power) 
    40 trianglesPerVirtualLeaf=300 
     41#trianglesPerVirtualLeaf=300 
     42trianglesPerVirtualLeaf=0 
    4143# max depth for searching for nodes for tight bounds 
    4244maxDepthForTestingChildren=3 
     
    5355 
    5456# initial camera position 
    55 camPosition=483.398f 242.364f 186.078f 
     57#camPosition=483.398f 242.364f 186.078f 
    5658# pompeii view point 
    57 #camPosition=1300.0f -2500.0f 10.0f 
     59camPosition=1300.0f -2500.0f 10.0f 
    5860 
    5961# initial camera orientation 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp

    r3271 r3274  
    355355 
    356356 
     357int Bvh::CountNumVirtualNodes(BvhNode *node) const 
     358{ 
     359        int numNodes = 0; 
     360 
     361        stack<BvhNode *> tStack; 
     362 
     363        tStack.push(node); 
     364 
     365        while (!tStack.empty()) 
     366        { 
     367                BvhNode *node = tStack.top(); 
     368                tStack.pop(); 
     369 
     370                ++ numNodes; 
     371 
     372                if (!node->IsVirtualLeaf()) 
     373                { 
     374                        BvhInterior *interior = static_cast<BvhInterior *>(node); 
     375 
     376                        tStack.push(interior->mFront); 
     377                        tStack.push(interior->mBack); 
     378                } 
     379        } 
     380 
     381        return numNodes; 
     382} 
     383 
     384 
    357385void Bvh::CollectNodes(BvhNode *node, BvhNodeContainer &nodes) 
    358386{ 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.h

    r3267 r3274  
    359359        */ 
    360360        inline int GetNumNodes() const; 
    361         /** Counts the number of bvh nodes under this node 
     361        /** Counts the number of nodes in this subtree 
    362362        */ 
    363363        int CountNumNodes(BvhNode *node) const; 
     364        /** Counts the number of virtual nodes in this subtree 
     365        */ 
     366        int CountNumVirtualNodes(BvhNode *node) const; 
     367 
    364368        /** Returns number of bvh leaves. 
    365369        */ 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhExporter.cpp

    r3273 r3274  
    2222        int buffer[4]; 
    2323 
    24         if (node->IsLeaf())  
     24        if (node->IsVirtualLeaf())  
    2525        { 
    2626                BvhLeaf *leaf = (BvhLeaf*)node; 
     
    5555                                                                                        int &last) 
    5656{ 
    57         if (!node->IsLeaf()) 
     57        if (!node->IsVirtualLeaf()) 
    5858        { 
    5959                int m; 
     
    9494         buffer[3] = 0; // construction method 
    9595         buffer[4] = 1; // termination leaves 
    96          buffer[5] = bvh->CountNumNodes(bvh->GetStaticRoot()); 
     96         buffer[5] = bvh->CountNumVirtualNodes(bvh->GetStaticRoot()); 
    9797 
    9898         int first = 0, last; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.cpp

    r3259 r3274  
    4040        if (delData) 
    4141        { 
    42                 DEL_ARRAY_PTR(mVertices); 
     42                //DEL_ARRAY_PTR(mVertices); 
    4343                DEL_ARRAY_PTR(mNormals); 
    4444                DEL_ARRAY_PTR(mTexCoords); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ObjExporter.cpp

    r3273 r3274  
    33#include "Shape.h" 
    44#include "Geometry.h" 
     5#include "Transform3.h" 
    56 
    67 
     
    2021 
    2122 
    22 int ObjExporter::WriteGeometry(Geometry *geom, ofstream &ostream) 
     23int ObjExporter::WriteGeometry(Geometry *geom, ofstream &ostream, Transform3 *trafo) 
    2324{ 
    2425        int numVertices; 
     
    3031        for (int i = 0; i < numVertices; ++ i) 
    3132        { 
    32                 Vector3 v = vertices[i]; 
     33                Vector3 v = trafo->GetMatrix() * vertices[i]; 
     34 
    3335                sprintf(str, "v %f %f %f\n", v.x, v.z, -v.y); 
    3436                ostream << str; 
     
    7577                 for (int i = 0; i < geometrySize; ++ i) 
    7678                 { 
     79                         Transform3 *trafo = entities[i]->GetTransform(); 
     80 
    7781                         ShapeContainer::iterator sit, send; 
    7882                         entities[i]->GetLODLevel(0, sit, send); 
     
    8993                                 } 
    9094 
    91                                  numVertices += WriteGeometry(geom, ostream); 
     95                                 numVertices += WriteGeometry(geom, ostream, trafo); 
    9296                         } 
    9397                 } 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ObjExporter.h

    r3261 r3274  
    2121public: 
    2222 
    23         int WriteGeometry(Geometry *geom, std::ofstream &ostream); 
     23        int WriteGeometry(Geometry *geom, std::ofstream &ostream, Transform3 *trafo); 
    2424}; 
    2525 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp

    r3272 r3274  
    382382        } 
    383383 
    384         //const bool delGeometry = true; 
    385         const bool delGeometry = false; 
     384        const bool delGeometry = true; 
     385        //const bool delGeometry = false; 
    386386        return new Geometry(vertices, normals, texcoords, vertexCount, delGeometry, NULL);//tangents); 
    387387} 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3273 r3274  
    600600        AxisAlignedBox3 pompeiiBox = SceneEntity::ComputeBoundingBox(staticObjects); 
    601601 
    602         cout << "here34 " << pompeiiBox << endl; 
    603          
    604 #if 0 
     602#if 1 
    605603        // todo: dispose texture 
    606604        Texture *floorTex = new Texture(model_path + "stairs.c.01.tif"); 
     
    726724 
    727725 
    728         ObjExporter().Export(model_path + "myvienna.obj", bvh); 
    729         BvhExporter().Export(model_path + "myvienna.bv", bvh); 
     726        ObjExporter().Export(model_path + "mypompeii.obj", bvh); 
     727        BvhExporter().Export(model_path + "mypompeii.bv", bvh); 
    730728 
    731729 
Note: See TracChangeset for help on using the changeset viewer.