- Timestamp:
- 06/22/05 10:05:06 (20 years ago)
- Location:
- trunk/VUT
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibility/include/VisibilityInfo.h
r144 r145 9 9 namespace GtpVisibility { 10 10 11 /** Class storing the visibility information of a scene node.11 /** Class storing visibility information. 12 12 */ 13 class NodeInfo13 class VisibilityInfo 14 14 { 15 15 public: 16 NodeInfo(HierarchyNode *node, const int projectedPixels, const int visiblePixels): 17 mNode(node)//, mProjectedPixels(projectedPixels), mVisiblePixels(visiblePixels) 18 {} 16 VisibilityInfo(const int visiblePixels, const int projectedPixels); 19 17 20 int GetVisiblePixels() const {return mVisiblePixels;}21 int GetProjectedPixels() const {return mProjectedPixels;}18 int GetVisiblePixels() const; 19 int GetProjectedPixels() const; 22 20 23 void SetVisiblePixels(int vis) {mVisiblePixels = vis;} 24 void SetProjectedPixels(int vis) {mProjectedPixels = vis;} 21 void SetVisiblePixels(int vis); 22 void SetProjectedPixels(int vis); 23 24 /** Computes ratio of visible to projected pixels. */ 25 float ComputeRelativeVisibility(); 25 26 26 void SetNode(HierarchyNode *node) {mNode = node;} 27 HierarchyNode *GetNode() const {return mNode;} 27 /** Adds visibility to current visibility information. 28 */ 29 void AddVisibility(const VisibilityInfo &info); 28 30 29 float ComputeRelativeVisibility() { float result = mVisiblePixels; if (mProjectedPixels) result /= (float)mProjectedPixels; return result;} 31 32 protected: 33 /** number of visible pixels. */ 34 int mVisiblePixels; 35 /** number of projected pixels */ 36 int mProjectedPixels; 37 }; 38 /** Class storing the visibility information of a hierarchy node. 39 */ 40 class NodeInfo: public VisibilityInfo 41 { 42 public: 43 NodeInfo(HierarchyNode *node, const int visiblePixels, const int projectedPixels); 44 45 void SetNode(HierarchyNode *node); 46 HierarchyNode *GetNode() const; 30 47 //bool operator<(const NodeInfo& rhs) const {return mNode < rhs.mNode;} 31 48 32 49 protected: 33 50 34 /** pointer to the scene node */ 51 /** Pointer to the hierarchy nnode. 52 */ 35 53 HierarchyNode *mNode; 36 37 int mVisiblePixels;38 int mProjectedPixels;39 54 }; 40 55 41 56 /** Class storing the visibility information of a mesh. 42 57 */ 43 class MeshInfo 58 class MeshInfo: public VisibilityInfo 44 59 { 45 60 public: 46 MeshInfo(Mesh *mesh, const int projectedPixels, const int visiblePixels): 47 mMesh(mesh), mProjectedPixels(projectedPixels), mVisiblePixels(visiblePixels) 48 {} 61 MeshInfo(Mesh *mesh, const int visiblePixels, const int projectedPixels); 49 62 50 int GetVisiblePixels() const {return mVisiblePixels;}51 int GetProjectedPixels() const {return mProjectedPixels;}63 Mesh *GetMesh() const; 64 void SetMesh(Mesh *mesh); 52 65 53 void SetVisiblePixels(float vis) { mVisiblePixels = vis;} 54 void SetProjectedPixels(float vis) { mProjectedPixels = vis;} 55 56 Mesh *GetMesh() const {return mMesh;} 57 void SetMesh(Mesh *mesh) {mMesh = mesh;} 58 59 bool operator<(const MeshInfo& rhs) const {return mMesh < rhs.mMesh;} 60 //bool operator>(const MeshInfo& rhs) const {return mMesh > rhs.mMesh;} 66 //bool operator<(const MeshInfo& rhs) const {return mMesh < rhs.mMesh;} 61 67 //bool operator==(const MeshInfo& rhs) const {return mMesh == rhs.mMesh;} 62 68 … … 66 72 */ 67 73 Mesh *mMesh; 68 69 int mVisiblePixels;70 int mProjectedPixels;71 74 }; 72 75 -
trunk/VUT/Ogre/src/OgrePlatformQueryManager.cpp
r144 r145 130 130 ++visQueryIt; 131 131 132 // nodes with visibilty 0 in queue: 133 // happens if node is intersected by near plane 132 // node with visibilty 0 in queue (e.g., if node is intersected by near plane) 134 133 if (visiblePixels > 0) 135 134 { … … 161 160 if (visiblePixels > 0) 162 161 { 163 visibleGeometry->push_back(GtpVisibility::MeshInfo(*geometryIt, 164 visiblePixels,projectedPixels));162 visibleGeometry->push_back(GtpVisibility::MeshInfo(*geometryIt, visiblePixels, 163 projectedPixels)); 165 164 } 166 165 } … … 209 208 cam->setAspectRatio(1.0); 210 209 cam->setFOVy(Radian(Math::HALF_PI)); 211 212 std::stringstream d;213 d << "old camera: " + StringConverter::toString(savedCam->getDerivedPosition()) +214 " " + "O: " + StringConverter::toString(savedCam->getDerivedOrientation());215 LogManager::getSingleton().logMessage(d.str());216 210 217 211 int sign = -1; … … 230 224 ComputeCameraVisibility(*cam, visibleNodes, visibleGeometry, relativeVisibility); 231 225 232 //mViewport->getTarget()->update(); for(int j=0; j<10000000; j++) printf(" HAAHHAHAHAHAH");226 //mViewport->getTarget()->update(); for(int j=0; j<10000000; j++) printf("wait"); 233 227 234 228 // permute directions … … 254 248 255 249 for (visibleNodesIt = visibleNodes->begin(); visibleNodesIt != visibleNodesIt_end; 256 ++visibleNodesIt) ;250 ++visibleNodesIt) 257 251 { 258 252 if (!nodeInfo || (nodeInfo->GetNode() != (*visibleNodesIt).GetNode())) … … 260 254 nodeInfo = &(*visibleNodesIt); 261 255 } 262 else 263 { 264 // add visibility 265 nodeInfo->SetVisiblePixels(nodeInfo->GetVisiblePixels() + 266 (*visibleNodesIt).GetVisiblePixels()); 267 268 nodeInfo->SetProjectedPixels(nodeInfo->GetProjectedPixels() + 269 (*visibleNodesIt).GetProjectedPixels()); 256 else // add visibility 257 { 258 nodeInfo->AddVisibility(*visibleNodesIt); 270 259 } 271 260 … … 283 272 GtpVisibility::MeshInfo *geomInfo = NULL; 284 273 274 int i=0; 285 275 for (visibleGeomIt = visibleGeometry->begin(); visibleGeomIt != visibleGeomIt_end; 286 ++visibleGeomIt) ;276 ++visibleGeomIt) 287 277 { 288 278 if (!geomInfo || (geomInfo->GetMesh() != (*visibleGeomIt).GetMesh())) … … 290 280 geomInfo = &(*visibleGeomIt); 291 281 } 292 else // info points to equal mesh 293 { 294 // add visibility 295 geomInfo->SetVisiblePixels(geomInfo->GetVisiblePixels() + 296 (*visibleGeomIt).GetVisiblePixels()); 297 298 geomInfo->SetProjectedPixels(nodeInfo->GetProjectedPixels() + 299 (*visibleNodesIt).GetProjectedPixels()); 282 else // info points to same mesh, just add visibility 283 { 284 geomInfo->AddVisibility(*visibleGeomIt); 300 285 } 301 286 } -
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp
r144 r145 377 377 for (geomIt = visibleGeometry.begin(); geomIt != geomIt_end; ++geomIt) 378 378 { 379 averageGeometryVis += (*geomIt).GetVisiblePixels(); 380 381 std::stringstream d; d << "Geometry visibility: " << (*geomIt).GetVisiblePixels(); 379 float vis = relativeVisibility ? 380 (*geomIt).ComputeRelativeVisibility() : (float)(*geomIt).GetVisiblePixels(); 381 382 averageGeometryVis += vis; 383 384 std::stringstream d; d << "Geometry visibility: " << vis; 382 385 LogManager::getSingleton().logMessage(d.str()); 383 386 } … … 387 390 for (nodesIt = visibleNodes.begin(); nodesIt != nodesIt_end; ++nodesIt) 388 391 { 389 averageNodeVis += (*nodesIt).GetVisiblePixels(); 390 391 std::stringstream d; d << "Node visibility: " << (*nodesIt).GetVisiblePixels(); 392 float vis = relativeVisibility ? 393 (*nodesIt).ComputeRelativeVisibility() : (float)(*nodesIt).GetVisiblePixels(); 394 395 averageNodeVis += vis; 396 397 std::stringstream d; d << "Node visibility: " << vis; 392 398 LogManager::getSingleton().logMessage(d.str()); 393 399 } 394 400 395 if ( (int)visibleNodes.size())401 if (visibleNodes.size()) 396 402 averageNodeVis /= (float)visibleNodes.size(); 397 if ( (int)visibleGeometry.size())403 if (visibleGeometry.size()) 398 404 averageGeometryVis /= (float)visibleGeometry.size(); 399 405 -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
r144 r145 18 18 /* TestCullingTerrainApplication implementation */ 19 19 /*******************************************************/ 20 20 TestCullingTerrainApplication::TestCullingTerrainApplication(): 21 mTerrainContentGenerator(NULL) 22 { 23 } 21 24 //----------------------------------------------------------------------- 22 25 TestCullingTerrainApplication::~TestCullingTerrainApplication() … … 69 72 bool TestCullingTerrainApplication::setup() 70 73 { 71 bool result= ExampleApplication::setup();72 73 if ( mWindow)74 bool carryOn = ExampleApplication::setup(); 75 76 if (carryOn) 74 77 createRenderTargetListener(); 75 78 76 return result;79 return carryOn; 77 80 } 78 81 //----------------------------------------------------------------------- -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h
r139 r145 28 28 { 29 29 public: 30 TestCullingTerrainApplication(); 30 31 ~TestCullingTerrainApplication(); 31 32
Note: See TracChangeset
for help on using the changeset viewer.