Changeset 141
- Timestamp:
- 06/21/05 11:18:09 (20 years ago)
- Location:
- trunk/VUT
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibility/include/VisibilityInfo.h
r135 r141 17 17 18 18 float GetVisibility() const {return mVisibility;} 19 void SetVisibility(float vis) { mVisibility = vis;} 20 bool operator<(const NodeInfo& rhs) const {return mNode < rhs.mNode;} 21 //bool operator>(const NodeInfo& rhs) const {return mNode > rhs.mNode;} 22 //bool operator==(const NodeInfo& rhs) const {return mNode == rhs.mNode;} 19 23 20 24 protected: 25 21 26 /** pointer to the scene node */ 22 27 HierarchyNode *mNode; … … 35 40 36 41 float GetVisibility() const {return mVisibility;} 42 void SetVisibility(float vis) { mVisibility = vis;} 37 43 44 bool operator<(const MeshInfo& rhs) const {return mMesh < rhs.mMesh;} 45 //bool operator>(const MeshInfo& rhs) const {return mMesh > rhs.mMesh;} 46 //bool operator==(const MeshInfo& rhs) const {return mMesh == rhs.mMesh;} 47 38 48 protected: 49 39 50 /** Pointer to the mesh. 40 51 */ … … 48 59 49 60 //TODO: this define shall be replaced by template typedef 50 #define InfoContainer std::vector 61 //#define InfoContainer std::vector 62 #define InfoContainer std::set 51 63 }; 52 64 -
trunk/VUT/GtpVisibility/src/DummyQueryManager.cpp
r65 r141 14 14 ) 15 15 { 16 visibleNodes->push_back(NodeInfo(mHierarchyInterface->GetSceneRoot(), 1.0f));16 visibleNodes->insert(NodeInfo(mHierarchyInterface->GetSceneRoot(), 1.0f)); 17 17 18 18 // HierarchyInterface::MeshIterator *mi = … … 33 33 ) 34 34 { 35 visibleNodes->push_back(NodeInfo(mHierarchyInterface->GetSceneRoot(), 1.0f));35 visibleNodes->insert(NodeInfo(mHierarchyInterface->GetSceneRoot(), 1.0f)); 36 36 37 37 // HierarchyInterface::MeshIterator *mi = -
trunk/VUT/Ogre/src/OgrePlatformQueryManager.cpp
r140 r141 105 105 //---- collect results 106 106 unsigned int visiblePixels = 0; 107 std::pair<InfoContainer<GtpVisibility::NodeInfo>::iterator, bool> insertNode; 108 std::pair<InfoContainer<GtpVisibility::MeshInfo>::iterator, bool> insertGeom; 107 109 108 110 GtpVisibility::QueryList::iterator visQueryIt, projQueryIt; … … 116 118 (*visQueryIt)->GetQueryResult(visiblePixels, true); 117 119 118 119 120 float vis = (float)visiblePixels; 121 bool isVisible = visiblePixels > 0; 120 122 121 123 if (relativeVisibility) … … 132 134 ++visQueryIt; 133 135 134 // leavenodes with visibilty 0 in queue:136 // nodes with visibilty 0 in queue: 135 137 // happens if node is intersected by near plane 136 visibleNodes->push_back(GtpVisibility::NodeInfo(*nodeIt, vis)); 138 if (isVisible) 139 { 140 insertNode = visibleNodes->insert(GtpVisibility::NodeInfo(*nodeIt, vis)); 141 142 if (!insertNode.second) // element already in list 143 { 144 //LogManager::getSingleton().logMessage("element already in list"); 145 (*insertNode.first).SetVisibility((*insertNode.first).GetVisibility() + vis); 146 147 if (relativeVisibility) // relative visibility between zero and one 148 { 149 (*insertNode.first).SetVisibility((*insertNode.first).GetVisibility() * 0.5); 150 } 151 } 152 } 137 153 } 138 154 … … 164 180 // geometry maybe occluded 165 181 if (isVisible) 166 { 167 visibleGeometry->push_back(GtpVisibility::MeshInfo(*geometryIt, vis)); 182 { 183 insertGeom = visibleGeometry->insert(GtpVisibility::MeshInfo(*geometryIt, vis)); 184 if (!insertGeom.second) // element already in list 185 { 186 //LogManager::getSingleton().logMessage("element already in list"); 187 (*insertGeom.first).SetVisibility((*insertGeom.first).GetVisibility() + vis); 188 189 if (relativeVisibility) // relative visibility between zero and one 190 { 191 (*insertGeom.first).SetVisibility((*insertGeom.first).GetVisibility() * 0.5); 192 } 193 } 168 194 } 169 195 } … … 179 205 Camera *cam = sm->createCamera("PointQueryCam"); 180 206 181 Camera *oldCam = mViewport->getCamera(); 207 //save old camera 208 Camera *savedCam = mViewport->getCamera(); 209 210 // --- initialise new camera 182 211 mViewport->setCamera(cam); 183 184 212 cam->setPosition(point); 185 213 214 cam->setNearClipDistance(savedCam->getNearClipDistance()); 215 cam->setFarClipDistance(savedCam->getFarClipDistance()); 216 186 217 // set frustum to 45 degrees so all the scene can be captured with 6 shots 187 //cam->setAspectRatio(1.0);188 //cam->setFOVy(Radian(Math::HALF_PI));189 218 cam->setAspectRatio(1.0); 219 cam->setFOVy(Radian(Math::HALF_PI)); 220 190 221 std::stringstream d; 191 d << "old camera: " + StringConverter::toString( oldCam->getDerivedPosition()) +192 " " + "O: " + StringConverter::toString( oldCam->getDerivedOrientation());222 d << "old camera: " + StringConverter::toString(savedCam->getDerivedPosition()) + 223 " " + "O: " + StringConverter::toString(savedCam->getDerivedOrientation()); 193 224 LogManager::getSingleton().logMessage(d.str()); 194 225 … … 201 232 202 233 // Print camera details 203 //mViewport->getTarget()->setDebugText("P: " + StringConverter::toString(cam->getDerivedPosition()) + 204 // " " + "O: " + StringConverter::toString(cam->getDerivedOrientation())); 205 206 std::stringstream d; 234 std::stringstream d; 207 235 d << "Point query camera: " + StringConverter::toString(cam->getDerivedPosition()) + 208 236 " " + "O: " + StringConverter::toString(cam->getDerivedOrientation()); … … 211 239 ComputeCameraVisibility(*cam, visibleNodes, visibleGeometry, relativeVisibility); 212 240 213 mViewport->getTarget()->update(); 214 241 //mViewport->getTarget()->update(); for(int j=0; j<10000000; j++) printf("HAAHHAHAHAHAH"); 242 243 // permute directions 215 244 Vector3 dir(0,0,0); 216 245 dir[i/2] = sign; 217 246 218 247 cam->setDirection(dir); 219 220 for(int j=0; j<10000000; j++) printf("HAAHHAHAHAHAH");221 222 // four shots around y axis, two around x axis223 //Vector3 axis = i < 4 ? Vector3::UNIT_Y : Vector3::UNIT_X;224 //Radian angle = i < 5 ?225 //cam->rotate(axis, Radian(Math::HALF_PI));226 248 } 227 249 228 250 229 251 // reset camera 230 mViewport->setCamera( oldCam);252 mViewport->setCamera(savedCam); 231 253 } 232 254 //----------------------------------------------------------------------- -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r139 r141 609 609 mLeavePassesInQueue = 0; 610 610 611 /*if (mShadowTechnique == SHADOWTYPE_STENCIL_ADDITIVE)611 if (mShadowTechnique == SHADOWTYPE_STENCIL_ADDITIVE) 612 612 { 613 613 mShadowTechnique = SHADOWTYPE_NONE; … … 615 615 if (!mUseDepthPass) 616 616 { 617 // TODO: remove this 617 // TODO: remove this because should be processed in first pass 618 618 mLeavePassesInQueue |= RenderPriorityGroup::SOLID_PASSES_NOSHADOW; 619 619 … … 633 633 } 634 634 } 635 */635 636 636 if (mDelayRenderTransparents && (!mUseDepthPass)) 637 637 { 638 638 mLeavePassesInQueue |= RenderPriorityGroup::TRANSPARENT_PASSES; 639 639 } 640 std::stringstream d; d << "leave passes in queue: " << mLeavePassesInQueue; 641 LogManager::getSingleton().logMessage(d.str()); 640 //std::stringstream d; d << "leave passes in queue: " << mLeavePassesInQueue;LogManager::getSingleton().logMessage(d.str()); 642 641 643 642 // possible two cameras (one for culling, one for rendering) -
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp
r140 r141 373 373 float averageGeometryVis = 0; 374 374 375 for (int i=0; i < visibleGeometry.size(); ++i) 376 { 377 averageGeometryVis += visibleGeometry[i].GetVisibility(); 378 379 std::stringstream d; d << "Geometry visibility: " << visibleGeometry[i].GetVisibility(); 375 InfoContainer<GtpVisibility::MeshInfo>::iterator geomIt, geomIt_end = visibleGeometry.end(); 376 377 for (geomIt = visibleGeometry.begin(); geomIt != geomIt_end; ++geomIt) 378 { 379 averageGeometryVis += (*geomIt).GetVisibility(); 380 381 std::stringstream d; d << "Geometry visibility: " << (*geomIt).GetVisibility(); 380 382 LogManager::getSingleton().logMessage(d.str()); 381 383 } 382 for (int i=0; i < visibleNodes.size(); ++i) 383 { 384 averageNodeVis += visibleNodes[i].GetVisibility(); 385 386 std::stringstream d; d << "Node visibility: " << visibleNodes[i].GetVisibility(); 384 385 InfoContainer<GtpVisibility::NodeInfo>::iterator nodesIt, nodesIt_end = visibleNodes.end(); 386 387 for (nodesIt = visibleNodes.begin(); nodesIt != nodesIt_end; ++nodesIt) 388 { 389 averageNodeVis += (*nodesIt).GetVisibility(); 390 391 std::stringstream d; d << "Node visibility: " << (*nodesIt).GetVisibility(); 387 392 LogManager::getSingleton().logMessage(d.str()); 388 393 } 389 394 390 averageNodeVis /= (float)visibleNodes.size(); 391 averageGeometryVis /= (float)visibleGeometry.size(); 395 if ((int)visibleNodes.size()) 396 averageNodeVis /= (float)visibleNodes.size(); 397 if ((int)visibleGeometry.size()) 398 averageGeometryVis /= (float)visibleGeometry.size(); 392 399 393 400 char str[100]; … … 437 444 Vector3(camPos.x, 5000.0f, camPos.z), Vector3::NEGATIVE_UNIT_Y)) 438 445 { 439 const int overTerrain = 200;440 mCamNode->setPosition(camPos.x, queryResult.y + overTerrain, camPos.z);446 const int terrainOffs = 10; 447 mCamNode->setPosition(camPos.x, queryResult.y + terrainOffs, camPos.z); 441 448 } 442 449 }
Note: See TracChangeset
for help on using the changeset viewer.