Changeset 2122 for GTP/trunk/Lib/Vis
- Timestamp:
- 02/15/07 19:09:13 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/IVReader/src/IVReader.vcproj
r2119 r2122 73 73 Name="VCCLCompilerTool" 74 74 AdditionalIncludeDirectories=""$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Dependencies\include";"$(OGRE_PATH)\Samples\Common\include";..\include" 75 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;IVREADER_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE1 "75 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;IVREADER_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE1;USE_VERBOSE_PVS" 76 76 RuntimeLibrary="2" 77 77 UsePrecompiledHeader="0" -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp
r2119 r2122 600 600 void OcclusionCullingSceneManager::_renderVisibleObjects() 601 601 { 602 // $$matt temp: Remove this!! 603 if (1) 604 { 605 getDestinationRenderSystem()->_setCullingMode(CULL_NONE); 606 LogManager::getSingleton().logMessage("warning: culling mode"); 607 } 608 602 609 if (mNormalExecution) 603 610 { … … 800 807 if (key == "DelayRenderTransparents") 801 808 { 809 //LoadScene(mFilename, mViewCellsFilename); 802 810 mDelayRenderTransparents = (*static_cast<const bool *>(val)); 803 811 return true; … … 1709 1717 } 1710 1718 1711 SceneNode *node = root->createChildSceneNode("ObjSceneNode");1712 1713 1719 std::stringstream d; 1714 1720 d << "loaded " << filename << " in " << timer->getMilliseconds() * 1e-3 << " secs"; -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreTypeConverter.cpp
r1621 r2122 67 67 GtpVisibilityPreprocessor::VertexIndexContainer::const_iterator 68 68 iit, iit_end = face->mVertexIndices.end(); 69 //GtpVisibilityPreprocessor::VertexIndexContainer::const_reverse_iterator70 // iit, iit_end = face->mVertexIndices.rend();71 69 72 70 for (iit = face->mVertexIndices.begin(); iit != iit_end; ++ iit) … … 78 76 79 77 manual->end(); 80 //mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(manual);81 78 82 79 return manual; -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/Plugin_VisibilitySceneManager.vcproj
r2119 r2122 90 90 OptimizeForWindowsApplication="TRUE" 91 91 AdditionalIncludeDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Dependencies\include";..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\src;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include;..\..\..\Preprocessing\src\Timer;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\ObjReader\include" 92 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_KD_TERRAIN_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE1 "92 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_KD_TERRAIN_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE1;USE_VERBOSE_PVS" 93 93 StringPooling="TRUE" 94 94 RuntimeLibrary="2" -
GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/include/ObjReader.h
r2119 r2122 20 20 Ogre::Entity *CreateEntity(const std::string &name, 21 21 GtpVisibilityPreprocessor::Intersectable *object); 22 22 Ogre::ManualObject *CreateManualObject(const std::string &name, 23 GtpVisibilityPreprocessor::Intersectable *object); 23 24 protected: 24 25 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/src/ObjReader.cpp
r2119 r2122 52 52 53 53 std::stringstream d; 54 d << "successfully loaded " << pvsObjects.size() << " objects ";54 d << "successfully loaded " << pvsObjects.size() << " objects from " << preprocessor->mObjects.size() << " preprocessor objects"; 55 55 56 56 Ogre::LogManager::getSingleton().logMessage(d.str()); … … 60 60 int i = 0; 61 61 for (oit = pvsObjects.begin(); oit != oit_end; ++ oit, ++ i) 62 {Ogre::LogManager::getSingleton().logMessage("r"); 63 const Ogre::String entname = "Object" + i; 64 65 Ogre::Entity *ent = CreateEntity(entname, *oit); 66 67 const Ogre::String nodeName = entname + "/Node"; 68 root->createChildSceneNode(nodeName); 62 { 63 Ogre::LogManager::getSingleton().logMessage("r"); 64 const Ogre::String entname = "Object" + Ogre::StringConverter::toString(i); 65 66 Ogre::ManualObject *ent = CreateEntity(entname, *oit); 67 68 const Ogre::String nodeName = entname + "Node"; 69 Ogre::SceneNode* node = root->createChildSceneNode(nodeName); 70 node->attachObject(ent); 71 72 if (i > 100) 73 break; 69 74 } 70 75 71 76 delete preprocessor; 72 77 73 return false; 78 return true; 79 } 80 81 82 Ogre::ManualObject *ObjReader::CreateManualObject(const std::string &name, 83 GtpVisibilityPreprocessor::Intersectable *object) 84 { 85 using namespace Ogre; 86 //using namespace GtpVisibilityPreprocessor; 87 88 std::string meshName = name + ".mesh"; 89 std::string entityName = name + "Entity"; 90 91 GtpVisibilityPreprocessor::BvhLeaf *bvhObj = 92 static_cast<GtpVisibilityPreprocessor::BvhLeaf *>(object); 93 const int vertexCount = (int)bvhObj->mObjects.size() * 3; 94 95 ManualObject* manual = mSceneManager->createManualObject(entityName); 96 manual->begin("BaseWhiteNoLighting", RenderOperation::OT_LINE_STRIP); 97 98 // create vertices 99 100 GtpVisibilityPreprocessor::ObjectContainer::const_iterator oit, oit_end = bvhObj->mObjects.end(); 101 102 for (oit = bvhObj->mObjects.begin(); oit != oit_end; ++ oit) 103 { 104 GtpVisibilityPreprocessor::TriangleIntersectable *tObj = 105 static_cast<GtpVisibilityPreprocessor::TriangleIntersectable *>(*oit); 106 107 GtpVisibilityPreprocessor::Triangle3 tri = tObj->GetItem(); 108 109 for (int i = 0; i < 3; ++ i) 110 { 111 const GtpVisibilityPreprocessor::Vector3 vtx = tri.mVertices[i]; 112 manual->position(vtx.x, vtx.y, vtx.z); 113 manual->colour(1.0f, 0.0f, 0.0f); 114 } 115 } 116 117 for (int i = 0; i < vertexCount; ++ i) 118 { 119 manual->index(i); 120 } 121 122 return manual; 74 123 } 75 124 … … 79 128 { 80 129 using namespace Ogre; 81 //using namespace GtpVisibilityPreprocessor;82 130 83 131 Entity *entity; … … 86 134 static_cast<GtpVisibilityPreprocessor::BvhLeaf *>(object); 87 135 88 std::string meshName = name + " /Mesh";89 std::string entityName = name + " /Entity";90 91 MeshPtr mesh = MeshManager::getSingleton().createManual(meshName, " ObjGroup");136 std::string meshName = name + ".mesh"; 137 std::string entityName = name + "Entity"; 138 139 MeshPtr mesh = MeshManager::getSingleton().createManual(meshName, "Custom"); 92 140 SubMesh* submesh = mesh->createSubMesh(); 141 142 const int vertexCount = (int)bvhObj->mObjects.size() * 3; 93 143 94 144 // We must create the vertex data, indicating how many vertices there will be … … 96 146 submesh->vertexData = new VertexData(); 97 147 submesh->vertexData->vertexStart = 0; 98 submesh->vertexData->vertexCount = (int)bvhObj->mObjects.size() * 3; 148 submesh->vertexData->vertexCount = vertexCount; 149 150 std::stringstream d; d << "objects: " << bvhObj->mObjects.size() << " vtx: " << submesh->vertexData->vertexCount << endl; 151 Ogre::LogManager::getSingleton().logMessage(d.str()); 99 152 100 153 static const unsigned short source = 0; … … 103 156 VertexDeclaration* declaration = HardwareBufferManager::getSingleton().createVertexDeclaration(); 104 157 105 offset += declaration->addElement(source, offset, VET_FLOAT3, VES_POSITION).getSize();106 // offset += declaration->addElement(source,offset,VET_FLOAT3,VES_NORMAL).getSize();107 // offset += declaration->addElement(source,offset,VET_FLOAT2,VES_TEXTURE_COORDINATES).getSize();158 offset += declaration->addElement(source, offset, VET_FLOAT3, VES_POSITION).getSize(); 159 //offset += declaration->addElement(source, offset, VET_FLOAT3,VES_NORMAL).getSize(); 160 //offset += declaration->addElement(source, offset, VET_FLOAT2,VES_TEXTURE_COORDINATES).getSize(); 108 161 109 162 … … 113 166 createVertexBuffer(declaration->getVertexSize(source), 114 167 submesh->vertexData->vertexCount, 115 HardwareBuffer::HBU_STATIC_WRITE_ONLY, 116 false); 168 HardwareBuffer::HBU_STATIC_WRITE_ONLY); 117 169 118 170 // No we get access to the buffer to fill it. During so we record the bounding box. … … 132 184 for (int i = 0; i < 3; ++ i) 133 185 { 134 Vector3 vtx (tri.mVertices[i]);186 Vector3 vtx = Vector3(tri.mVertices[i]); 135 187 136 188 *vdata ++ = vtx.x; … … 138 190 *vdata ++ = vtx.z; 139 191 192 //std::stringstream d; d << vtx; 193 //Ogre::LogManager::getSingleton().logMessage(d.str()); 140 194 aabox.merge(vtx); 141 195 } 142 196 } 143 197 //Ogre::LogManager::getSingleton().logMessage("***"); 144 198 vbuffer->unlock(); 199 200 /*Ogre::RenderOperation rop; 201 submesh->_getRenderOperation(rop); 202 rop.useIndexes = false; 203 */ 204 ////// 205 //-- Creates the index data 206 207 submesh->vertexData->vertexBufferBinding->setBinding(source, vbuffer); 208 209 submesh->indexData->indexStart = 0; 210 // we use an index for every vertex 211 submesh->indexData->indexCount = vertexCount; 212 submesh->indexData->indexBuffer = 213 HardwareBufferManager::getSingleton(). 214 createIndexBuffer(HardwareIndexBuffer::IT_16BIT, 215 submesh->indexData->indexCount, 216 HardwareBuffer::HBU_STATIC_WRITE_ONLY); 217 submesh->operationType = RenderOperation::OT_LINE_STRIP; 218 //uint16* idata = static_cast<uint16*>(submesh->indexData->indexBuffer->lock(HardwareBuffer::HBL_DISCARD)); 219 unsigned short* idata = static_cast<unsigned short*>(submesh->indexData->indexBuffer->lock(HardwareBuffer::HBL_DISCARD)); 220 221 for (int j = 0; j < vertexCount; ++ j) 222 { 223 *idata = j; 224 ++ idata; 225 } 226 227 submesh->indexData->indexBuffer->unlock(); 228 229 submesh->setMaterialName("BaseWhiteNoLighting"); 145 230 146 231 // We must indicate the bounding box 147 232 mesh->_setBounds(aabox); 148 149 mesh->_setBoundingSphereRadius((aabox.getMaximum()-aabox.getMinimum()).length()/2.0); 233 mesh->_setBoundingSphereRadius((aabox.getMaximum() - aabox.getMinimum()).length() / 2.0); 150 234 mesh->load(); 151 235 mesh->touch(); 236 152 237 // Create an entity with the mesh 153 entity = mSceneManager->createEntity(meshName, entityName); 238 entity = mSceneManager->createEntity(entityName, meshName); 239 240 //entity->setRenderQueueGroup(Ogre::RENDER_QUEUE_MAIN); 154 241 155 242 return entity; 243 #endif 156 244 } -
GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/src/ObjReader.vcproj
r2119 r2122 73 73 Name="VCCLCompilerTool" 74 74 AdditionalIncludeDirectories=""$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Dependencies\include";"$(OGRE_PATH)\Samples\Common\include";..\include;..\..\..\Preprocessing\src" 75 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;OBJREADER_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE1 "75 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;OBJREADER_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE1;USE_VERBOSE_PVS" 76 76 RuntimeLibrary="2" 77 77 UsePrecompiledHeader="0" -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2119 r2122 1647 1647 { 1648 1648 ObjectsParser parser; 1649 Debug << "here322 " << filename << endl; 1649 1650 1650 const bool success = parser.ParseObjects(filename, 1651 1651 pvsObjects, … … 1658 1658 1659 1659 // hack: no bvh object could be found => take preprocessor objects 1660 if (!pvsObjects.empty()) 1661 { 1660 if (pvsObjects.empty()) 1661 { 1662 Debug << "here81 no objects" << endl; 1662 1663 pvsObjects = preprocessorObjects; 1663 1664 } -
GTP/trunk/Lib/Vis/Preprocessing/src/PvsDefinitions.h
r2117 r2122 10 10 #ifdef USE_HASH_PVS 11 11 12 #include "HashPvs.h"12 #include "HashPvs.h" 13 13 14 #define PVS_TYPE 014 #define PVS_TYPE 0 15 15 16 namespace GtpVisibilityPreprocessor { 17 typedef HashPvs<Intersectable *, PvsData> DefaultPvs; 18 typedef HashPvsIterator<Intersectable *, PvsData> ObjectPvsIterator; 19 } 16 namespace GtpVisibilityPreprocessor { 17 typedef HashPvs<Intersectable *, PvsData> DefaultPvs; 18 typedef HashPvsIterator<Intersectable *, PvsData> ObjectPvsIterator; 19 } 20 #else 21 #ifdef USE_BIT_PVS 20 22 21 #endif 23 #include "BitVectorPvs.h" 22 24 23 #ifdef USE_VERBOSE_PVS 25 #define PVS_TYPE 2 24 26 25 #include "Pvs.h" 27 namespace GtpVisibilityPreprocessor { 28 typedef BitVectorPvs<Intersectable *, PvsData> DefaultPvs; 29 typedef BitVectorPvsIterator<Intersectable *, PvsData> ObjectPvsIterator; 30 } 26 31 27 #define PVS_TYPE 1 32 #else 28 33 29 namespace GtpVisibilityPreprocessor { 30 typedef VerbosePvs<Intersectable *, PvsData> DefaultPvs; 31 typedef PvsIterator<Intersectable *, PvsData> ObjectPvsIterator; 32 } 33 #endif 34 //#ifdef USE_VERBOSE_PVS 35 #include "Pvs.h" 34 36 37 #define PVS_TYPE 1 35 38 36 #ifdef USE_BIT_PVS 37 38 #include "BitVectorPvs.h" 39 40 #define PVS_TYPE 2 41 42 namespace GtpVisibilityPreprocessor { 43 typedef BitVectorPvs<Intersectable *, PvsData> DefaultPvs; 44 typedef BitVectorPvsIterator<Intersectable *, PvsData> ObjectPvsIterator; 45 } 46 39 namespace GtpVisibilityPreprocessor { 40 typedef VerbosePvs<Intersectable *, PvsData> DefaultPvs; 41 typedef PvsIterator<Intersectable *, PvsData> ObjectPvsIterator; 42 } 43 #endif 47 44 #endif 48 45 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2120 r2122 1018 1018 1019 1019 1020 ViewCellsManager *ViewCellsManager::LoadViewCells(const string &filename, 1021 ObjectContainer &pvsObjects, 1022 bool finalizeViewCells, 1023 BoundingBoxConverter *bconverter) 1024 1025 { 1026 ObjectContainer preprocessorObjects; 1027 1028 return LoadViewCells(filename, 1029 pvsObjects, 1030 preprocessorObjects, 1031 finalizeViewCells, 1032 bconverter); 1033 } 1020 1034 1021 1035
Note: See TracChangeset
for help on using the changeset viewer.