Ignore:
Timestamp:
08/28/06 18:42:33 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r1288 r1291  
    4141        int n = 200; 
    4242 
    43         if (0){ 
    44         // form grid of boxes 
    45         for (int i = 0; i < n; ++ i) 
    46         { 
    47                 for (int j = 0; j < n; ++ j) 
     43        if (0) 
     44        { 
     45                // form grid of boxes 
     46                for (int i = 0; i < n; ++ i) 
    4847                { 
    49                         const Vector3 scale2((float)j * 0.8f / n + 0.1f,  0.05f, (float)i * 0.8f  / (float)n + 0.1f); 
    50                  
    51                         const Vector3 pt2 = sceneBox.Min() + scale2 * (sceneBox.Max() - sceneBox.Min()); 
    52                  
    53                         const Vector3 boxSize = sceneBox.Size() * Vector3(0.0025f, 0.01f, 0.0025f); 
    54                         AxisAlignedBox3 box(pt2, pt2 + boxSize); 
     48                        for (int j = 0; j < n; ++ j) 
     49                        { 
     50                                const Vector3 scale2((float)j * 0.8f / n + 0.1f,  0.05f, (float)i * 0.8f  / (float)n + 0.1f); 
     51 
     52                                const Vector3 pt2 = sceneBox.Min() + scale2 * (sceneBox.Max() - sceneBox.Min()); 
     53 
     54                                const Vector3 boxSize = sceneBox.Size() * Vector3(0.0025f, 0.01f, 0.0025f); 
     55                                AxisAlignedBox3 box(pt2, pt2 + boxSize); 
     56                                Mesh *mesh = CreateMeshFromBox(box); 
     57 
     58                                mesh->Preprocess(); 
     59 
     60                                MeshInstance *mi = new MeshInstance(mesh); 
     61                                scene->mRoot->mGeometry.push_back(mi); 
     62                        } 
     63                } 
     64 
     65                for (int i = 0; i < n; ++ i) 
     66                { 
     67                        for (int j = 0; j < n; ++ j) 
     68                        { 
     69                                const Vector3 scale2(0.15f, (float)j * 0.8f / n + 0.1f, (float)i * 0.8f  / (float)n + 0.1f); 
     70 
     71                                Vector3 pt2 = sceneBox.Min() + scale2 * (sceneBox.Max() - sceneBox.Min()); 
     72 
     73                                Vector3 boxSize = sceneBox.Size() * Vector3(0.0025f, 0.01f, 0.0025f); 
     74                                AxisAlignedBox3 box(pt2, pt2 + boxSize); 
     75                                Mesh *mesh = CreateMeshFromBox(box); 
     76 
     77                                mesh->Preprocess(); 
     78 
     79                                MeshInstance *mi = new MeshInstance(mesh); 
     80                                scene->mRoot->mGeometry.push_back(mi); 
     81                        } 
     82                } 
     83 
     84                for (int i = 0; i < n; ++ i) 
     85                { 
     86                        const Vector3 scale2(2, 0.2f, (float)i * 0.8f  / (float)n + 0.1f); 
     87 
     88                        Vector3 pt2 = sceneBox.Min() + scale2 * (sceneBox.Max() - sceneBox.Min()); 
     89 
     90                        //Vector3 boxSize = sceneBox.Size() * Vector3(0.0025, 0.01, 0.0025); 
     91                        Vector3 boxSize = sceneBox.Size() * Vector3(0.005f, 0.02f, 0.005f); 
     92 
     93                        AxisAlignedBox3 box(pt2 + 0.1f, pt2 + boxSize); 
    5594                        Mesh *mesh = CreateMeshFromBox(box); 
    5695 
    5796                        mesh->Preprocess(); 
    58                  
     97 
    5998                        MeshInstance *mi = new MeshInstance(mesh); 
    6099                        scene->mRoot->mGeometry.push_back(mi); 
    61100                } 
    62         } 
    63  
    64         for (int i = 0; i < n; ++ i) 
    65         { 
    66                 for (int j = 0; j < n; ++ j) 
    67                 { 
    68                         const Vector3 scale2(0.15f, (float)j * 0.8f / n + 0.1f, (float)i * 0.8f  / (float)n + 0.1f); 
    69                  
    70                         Vector3 pt2 = sceneBox.Min() + scale2 * (sceneBox.Max() - sceneBox.Min()); 
    71                  
    72                         Vector3 boxSize = sceneBox.Size() * Vector3(0.0025f, 0.01f, 0.0025f); 
    73                         AxisAlignedBox3 box(pt2, pt2 + boxSize); 
    74                         Mesh *mesh = CreateMeshFromBox(box); 
    75  
    76                         mesh->Preprocess(); 
    77                  
    78                         MeshInstance *mi = new MeshInstance(mesh); 
    79                         scene->mRoot->mGeometry.push_back(mi); 
    80                 } 
    81         } 
    82  
    83         for (int i = 0; i < n; ++ i) 
    84         { 
    85                 const Vector3 scale2(2, 0.2f, (float)i * 0.8f  / (float)n + 0.1f); 
    86                  
    87                 Vector3 pt2 = sceneBox.Min() + scale2 * (sceneBox.Max() - sceneBox.Min()); 
    88                  
    89                 //Vector3 boxSize = sceneBox.Size() * Vector3(0.0025, 0.01, 0.0025); 
    90                 Vector3 boxSize = sceneBox.Size() * Vector3(0.005f, 0.02f, 0.005f); 
    91  
    92                 AxisAlignedBox3 box(pt2 + 0.1f, pt2 + boxSize); 
    93                 Mesh *mesh = CreateMeshFromBox(box); 
    94  
    95                 mesh->Preprocess(); 
    96                  
    97                 MeshInstance *mi = new MeshInstance(mesh); 
    98                 scene->mRoot->mGeometry.push_back(mi); 
    99         } 
    100          
    101         scene->mRoot->UpdateBox(); 
    102         } 
    103                  
     101 
     102                scene->mRoot->UpdateBox(); 
     103        } 
     104 
    104105        if (1) 
    105106        { 
     
    111112                Plane3 cuttingPlane(Vector3(1, 0, 0), pt); 
    112113                Mesh *planeMesh = new Mesh(); 
    113                  
     114 
    114115                Polygon3 *poly = sceneBox.CrossSection(cuttingPlane); 
    115116                IncludePolyInMesh(*poly, *planeMesh); 
    116                  
     117 
    117118                planeMesh->Preprocess(); 
    118                  
     119 
    119120                MeshInstance *planeMi = new MeshInstance(planeMesh); 
    120121                scene->mRoot->mGeometry.push_back(planeMi); 
     
    145146        Environment::GetSingleton()->GetBoolValue("Preprocessor.detectEmptyViewSpace", mDetectEmptyViewSpace); 
    146147        Environment::GetSingleton()->GetBoolValue("Preprocessor.exportVisibility", mExportVisibility ); 
    147 //#if GTP_INTERNAL // choose other ray cast method 
    148148        Environment::GetSingleton()->GetIntValue("Preprocessor.rayCastMethod", mRayCastMethod); 
    149 //#endif 
     149 
    150150        char buffer[256]; 
    151151        Environment::GetSingleton()->GetStringValue("Preprocessor.visibilityFile",  buffer); 
     
    163163Preprocessor::~Preprocessor() 
    164164{ 
    165   cout << "cleaning up" << endl; 
    166  
    167   cout << "Deleting view cells manager ... \n"; 
    168   DEL_PTR(mViewCellsManager); 
    169   cout << "done.\n"; 
    170  
    171   cout << "Deleting bsp tree ... \n"; 
    172   DEL_PTR(mBspTree); 
    173   cout << "done.\n"; 
    174  
    175   cout << "Deleting kd tree...\n"; 
    176   DEL_PTR(mKdTree); 
    177   cout << "done.\n"; 
    178   
    179   cout << "Deleting vsp tree...\n"; 
    180   DEL_PTR(mVspTree); 
    181   cout << "done.\n"; 
    182  
    183   cout << "Deleting hierarchy manager...\n"; 
    184   DEL_PTR(mHierarchyManager); 
    185   cout << "done.\n"; 
    186  
    187   cout << "Deleting vspbsp tree...\n"; 
    188   DEL_PTR(mVspBspTree); 
    189   cout << "done.\n"; 
    190  
    191    cout << "Deleting scene graph...\n"; 
    192   DEL_PTR(mSceneGraph); 
    193   cout << "done.\n"; 
    194  
    195   DEL_PTR(mRenderSimulator); 
    196   DEL_PTR(renderer); 
     165        cout << "cleaning up" << endl; 
     166 
     167        cout << "Deleting view cells manager ... \n"; 
     168        DEL_PTR(mViewCellsManager); 
     169        cout << "done.\n"; 
     170 
     171        cout << "Deleting bsp tree ... \n"; 
     172        DEL_PTR(mBspTree); 
     173        cout << "done.\n"; 
     174 
     175        cout << "Deleting kd tree...\n"; 
     176        DEL_PTR(mKdTree); 
     177        cout << "done.\n"; 
     178 
     179        cout << "Deleting vsp tree...\n"; 
     180        DEL_PTR(mVspTree); 
     181        cout << "done.\n"; 
     182 
     183        cout << "Deleting hierarchy manager...\n"; 
     184        DEL_PTR(mHierarchyManager); 
     185        cout << "done.\n"; 
     186 
     187        cout << "Deleting vspbsp tree...\n"; 
     188        DEL_PTR(mVspBspTree); 
     189        cout << "done.\n"; 
     190 
     191        cout << "Deleting scene graph...\n"; 
     192        DEL_PTR(mSceneGraph); 
     193        cout << "done.\n"; 
     194 
     195        DEL_PTR(mRenderSimulator); 
     196        DEL_PTR(renderer); 
    197197} 
    198198 
     
    461461        if (strcmp(name, "osp") == 0) 
    462462        { 
     463                Debug << "hierarchy manager: osp" << endl; 
    463464                // HACK for testing if per kd evaluation works!! 
    464465                const bool ishack = true; 
     
    470471        else if (strcmp(name, "bvh") == 0) 
    471472        { 
     473                Debug << "hierarchy manager: bvh" << endl; 
    472474                hierarchyManager = new HierarchyManager(mVspTree, HierarchyManager::BV_BASED_OBJ_SUBDIV); 
     475        } 
     476        else // only view space partition 
     477        { 
     478                Debug << "hierarchy manager: obj" << endl; 
     479                hierarchyManager = new HierarchyManager(mVspTree, HierarchyManager::NO_OBJ_SUBDIV); 
    473480        } 
    474481 
Note: See TracChangeset for help on using the changeset viewer.