Changeset 1001 for GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
- Timestamp:
- 06/05/06 23:14:04 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r997 r1001 17 17 #include "BoundingBoxConverter.h" 18 18 #include "GlRenderer.h" 19 19 #include "ResourceManager.h" 20 20 21 21 … … 211 211 else 212 212 DEL_PTR(mViewCellsTree); 213 214 CLEAR_CONTAINER(mMeshContainer);215 213 } 216 214 … … 942 940 mEnvironment->GetIntValue("ViewCells.Evaluation.histoStepSize", histoStepSize); 943 941 944 Debug << "here21 " << histoStepSize << endl;945 942 const int numLeaves = mViewCellsTree->GetNumInitialViewCells(mViewCellsTree->GetRoot()); 946 943 … … 1442 1439 viewCells.push_back(viewCell); 1443 1440 } 1444 //TODO: transformed meshes 1441 else if (object->Type() == Intersectable::TRANSFORMED_MESH_INSTANCE) 1442 { 1443 TransformedMeshInstance *mi = dynamic_cast<TransformedMeshInstance *>(object); 1444 1445 Mesh *mesh = MeshManager::GetSingleton()->CreateResource(); 1446 1447 // copy mesh 1448 *mesh = *mi->GetMesh(); 1449 1450 // transform mesh 1451 Matrix4x4 m; 1452 mi->GetWorldTransform(m); 1453 mesh->ApplyTransformation(m); 1454 1455 // create bb + kd tree 1456 mesh->Preprocess(); 1457 1458 ViewCell *viewCell = GenerateViewCell(mi->GetMesh()); 1459 viewCells.push_back(viewCell); 1460 1461 break; 1462 } 1445 1463 } 1446 1464 } … … 1451 1469 { 1452 1470 // one mesh per view cell 1453 Mesh *mesh = new Mesh();1471 Mesh *mesh = MeshManager::GetSingleton()->CreateResource(); 1454 1472 1455 1473 //-- construct prism … … 1501 1519 // implemented in subclasses 1502 1520 } 1521 1503 1522 1504 1523 // fast way of merging 2 view cells … … 1964 1983 { 1965 1984 if (!(*it)->GetMesh()) 1985 { 1966 1986 CreateMesh(*it); 1987 } 1967 1988 } 1968 1989 } … … 2010 2031 } 2011 2032 2033 2012 2034 static const bool USE_ASCII = true; 2035 2013 2036 2014 2037 bool ViewCellsManager::ExportBoundingBoxes(const string filename, … … 2776 2799 mBspTree->ConstructGeometry(vc, geom); 2777 2800 2778 Mesh *mesh = new Mesh();2801 Mesh *mesh = MeshManager::GetSingleton()->CreateResource(); 2779 2802 2780 2803 IncludeNodeGeomInMesh(geom, *mesh); 2781 2804 vc->SetMesh(mesh); 2782 2783 // put mesh into mesh container so we can savely delete it2784 mMeshContainer.push_back(mesh);2785 2805 } 2786 2806 … … 4712 4732 cout << "starting sampling of render cost ... "; 4713 4733 4714 preprocessor->GetRenderer()->SampleRenderCost(numSamples, samples );4734 preprocessor->GetRenderer()->SampleRenderCost(numSamples, samples, true); 4715 4735 4716 4736 cout << "finished in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; … … 4725 4745 { 4726 4746 RenderCostSample sample = *rit; 4727 4747 4728 4748 ViewCell *vc = GetViewCell(sample.mPosition); 4729 4749 4730 4750 AxisAlignedBox3 box(sample.mPosition - Vector3(1, 1, 1), sample.mPosition + Vector3(1, 1, 1)); 4731 4732 4751 Mesh *hMesh = CreateMeshFromBox(box); 4733 4752 … … 4791 4810 { 4792 4811 // export mesh if available 4793 /* if (vc->GetMesh()) 4812 // TODO: some bug here? 4813 if (0 && vc->GetMesh()) 4794 4814 { 4795 4815 exporter->ExportMesh(vc->GetMesh()); 4796 4816 } 4797 4817 else 4798 { */4818 { 4799 4819 BspNodeGeometry geom; 4800 4820 mVspBspTree->ConstructGeometry(vc, geom); 4801 4821 exporter->ExportPolygons(geom.GetPolys()); 4802 //}4822 } 4803 4823 } 4804 4824 } … … 4814 4834 // compute max height difference 4815 4835 for (int i = 0; i < (int)leaves.size(); ++ i) 4836 { 4816 4837 for (int j = 0; j < (int)leaves.size(); ++ j) 4817 { 4818 BspLeaf *leaf = dynamic_cast<BspViewCell *>(leaves[i])->mLeaf; 4819 4820 if (i != j) 4821 { 4822 BspLeaf *leaf2 =dynamic_cast<BspViewCell *>(leaves[j])->mLeaf; 4823 int dist = mVspBspTree->TreeDistance(leaf, leaf2); 4824 if (dist > maxDist) 4825 maxDist = dist; 4838 { 4839 BspLeaf *leaf = dynamic_cast<BspViewCell *>(leaves[i])->mLeaf; 4840 4841 if (i != j) 4842 { 4843 4844 BspLeaf *leaf2 =dynamic_cast<BspViewCell *>(leaves[j])->mLeaf; 4845 4846 int dist = mVspBspTree->TreeDistance(leaf, leaf2); 4847 4848 if (dist > maxDist) 4849 maxDist = dist; 4850 } 4826 4851 } 4827 4852 } … … 4850 4875 mVspBspTree->ConstructGeometry(vc, geom); 4851 4876 4852 Mesh *mesh = new Mesh();4877 Mesh *mesh = MeshManager::GetSingleton()->CreateResource(); 4853 4878 IncludeNodeGeomInMesh(geom, *mesh); 4854 4879 4855 4880 vc->SetMesh(mesh); 4856 // put mesh into mesh container so we can savely delete it4857 mMeshContainer.push_back(mesh);4858 4881 } 4859 4882
Note: See TracChangeset
for help on using the changeset viewer.