- Timestamp:
- 08/24/06 14:17:44 (18 years ago)
- Location:
- GTP/trunk
- Files:
-
- 14 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTree.h
r1220 r1273 56 56 57 57 // scene options 58 String mSceneFiles;58 //String mSceneFiles; 59 59 Real mRotationRadius; 60 60 int mModelSpacing; … … 87 87 88 88 void createMaterials(void); 89 void createSimpleScene(void); 89 90 private: 90 91 std::string cat(std::string name, int x, int z) -
GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTreeAppListener.h
r1258 r1273 49 49 #define VIZ_VIEWPORT_Z_ORDER 10 50 50 51 #define TERRAIN_SCENE "terrain" 52 51 53 using namespace Ogre; 52 54 … … 80 82 { 81 83 SM_KDT, 84 SM_KTE, 82 85 SM_OCM, 83 86 SM_OCT, 87 SM_TER, 84 88 SM_GEN, 85 89 SM_SIZE, … … 121 125 } 122 126 127 String mSceneFiles; 123 128 String mDemoInfileName; 124 129 String mDemoOutfileName; … … 272 277 Degree mRotScale; 273 278 Radian mDeathAngle; 279 // for terrain 280 RaySceneQuery *mRaySceneQuery; 274 281 275 282 // just to stop toggles flipping too fast -
GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTree.cpp
r1258 r1273 181 181 cfDeath.load("testKdTree.cfg"); 182 182 183 m SceneFiles = cfDeath.getSetting("scene");183 mOptions.mSceneFiles = cfDeath.getSetting("scene"); 184 184 185 185 tmp = cfDeath.getSetting("shadows"); … … 236 236 createMaterials(); 237 237 238 // load simple scene (planes & robots) 239 if (mOptions.mSceneFiles == "") 240 { 241 createSimpleScene(); 242 } 243 // load terrain, but only if terrainscenemanager selected 244 else if (mOptions.mSceneFiles == TERRAIN_SCENE) 245 { 246 Plane waterPlane; 247 248 // Set ambient light 249 mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5)); 250 251 // Create a light 252 Light* l = mSceneMgr->createLight("MainLight"); 253 // Accept default settings: point light, white diffuse, just set position 254 // NB I could attach the light to a SceneNode if I wanted it to move automatically with 255 // other objects, but I don't 256 l->setPosition(20,80,50); 257 258 // Fog 259 // NB it's VERY important to set this before calling setWorldGeometry 260 // because the vertex program picked will be different 261 //ColourValue fadeColour(0.93, 0.86, 0.76); 262 //mSceneMgr->setFog( FOG_LINEAR, fadeColour, .001, 500, 1000); 263 //mWindow->getViewport(0)->setBackgroundColour(fadeColour); 264 mWindow->getViewport(0)->setBackgroundColour(ColourValue::Blue); 265 266 std::string terrain_cfg("terrain.cfg"); 267 268 mSceneMgr -> setWorldGeometry( terrain_cfg ); 269 270 // Define the required skyplane 271 Plane plane; 272 // 5000 world units from the camera 273 plane.d = 5000; 274 // Above the camera, facing down 275 plane.normal = -Vector3::UNIT_Y; 276 277 // add one robot 278 //Entity *robot = mSceneMgr->createEntity("TheRobot","robot.mesh"); 279 //SceneNode *node = mSceneMgr->getRootSceneNode()->createChildSceneNode("TheRobotNode"); 280 //node->attachObject(robot); 281 // add stuff minus gound plane 282 mSelectEntities &= ~ENT_PLN; 283 createSimpleScene(); 284 285 // Set a nice viewpoint 286 mCamNode->setPosition(707,2500,528); 287 mCamNode->setOrientation(Quaternion(-0.3486, 0.0122, 0.9365, 0.0329)); 288 } 289 // load scene from file 290 else 291 { 292 // don't load the other stuff 293 loadScene(mOptions.mSceneFiles); 294 // top view 295 mTopCam->setPosition(Vector3(1232, 3990, -1477)); 296 // walkthrough view 297 mCamNode->setPosition(Vector3(827.885, 184.435, -524.984)); 298 mCamNode->setOrientation(Quaternion(0.98935, 0.0348082, -0.141246, 0.00496945)); 299 300 mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox", 5000, true); 301 } 302 } 303 304 void KdTreeApp::createSimpleScene() 305 { 238 306 Entity *deaths; 239 307 SceneNode *nodes; … … 245 313 Real planeSixth = mPlaneDim / 6; 246 314 247 // load scene from file 248 if (mSceneFiles != "") 249 { 250 // don't load the other stuff 251 loadScene(mSceneFiles); 252 // top view 253 mTopCam->setPosition(Vector3(1232, 3990, -1477)); 254 // walkthrough view 255 mCamNode->setPosition(Vector3(827.885, 184.435, -524.984)); 256 mCamNode->setOrientation(Quaternion(0.98935, 0.0348082, -0.141246, 0.00496945)); 257 258 mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox", 5000, true); 259 } 260 else 261 { 262 mCamNode->setPosition(Vector3(1280,600,1666)); 263 mCamNode->setOrientation(Quaternion(0.936893, -0.124586, 0.323813, 0.04306)); 264 //mCamera->lookAt(Vector3(-20,30,10)); 265 266 SceneNode *anchor = mSceneMgr->getRootSceneNode()->createChildSceneNode("AnchorNode"); 267 //SceneNode *grndan = anchor->createChildSceneNode("GroundAnchor"); 268 SceneNode *grndan = mSceneMgr->getRootSceneNode(); 269 270 if (mSelectEntities & ENT_GRID) 315 mCamNode->setPosition(Vector3(1280,600,1666)); 316 mCamNode->setOrientation(Quaternion(0.936893, -0.124586, 0.323813, 0.04306)); 317 318 SceneNode *anchor = mSceneMgr->getRootSceneNode()->createChildSceneNode("AnchorNode"); 319 //SceneNode *grndan = anchor->createChildSceneNode("GroundAnchor"); 320 SceneNode *grndan = mSceneMgr->getRootSceneNode(); 321 322 if (mSelectEntities & ENT_GRID) 323 { 324 for (j = 0, z = -(mModelCount / 2 * mModelSpacing); j < mModelCount; j++, z += mModelSpacing) 271 325 { 272 for ( j = 0, z = -(mModelCount / 2 * mModelSpacing); j < mModelCount; j++, z += mModelSpacing)326 for (i = 0, x = -(mModelCount / 2 * mModelSpacing); i < mModelCount; i++, x += mModelSpacing) 273 327 { 274 for (i = 0, x = -(mModelCount / 2 * mModelSpacing); i < mModelCount; i++, x += mModelSpacing) 275 { 276 deaths = mSceneMgr->createEntity(cat(entName, i, j).c_str(),"robot.mesh"); 277 if (mShadowsEnabled) 278 deaths->setCastShadows(true); 279 nodes = /*mSceneMgr->getRootSceneNode()*/anchor->createChildSceneNode(cat(nodeName, i, j).c_str(), Vector3(x, 0 , z)); 280 nodes->attachObject(deaths); 281 } 282 } 283 } 284 285 if (mSelectEntities & ENT_RND) 286 { 287 entName = "randomdeath"; 288 nodeName = "RandomDeathNode"; 289 for (i = 0; i < mRandomCount; i++) 290 { 291 Vector3 pos( 292 Math::RangeRandom(-planeHalf,-planeSixth), 293 0, 294 Math::RangeRandom(-planeThreeEights, planeThreeEights)); 295 deaths = mSceneMgr->createEntity(cat(entName,666,i),"robot.mesh"); 328 deaths = mSceneMgr->createEntity(cat(entName, i, j).c_str(),"robot.mesh"); 296 329 if (mShadowsEnabled) 297 330 deaths->setCastShadows(true); 298 nodes = /*mSceneMgr->getRootSceneNode()*/anchor->createChildSceneNode(cat(nodeName,666,i), pos, 299 Quaternion(Radian(Math::RangeRandom(-Math::PI, Math::PI)), Vector3::UNIT_Y)); 331 nodes = /*mSceneMgr->getRootSceneNode()*/anchor->createChildSceneNode(cat(nodeName, i, j).c_str(), Vector3(x, 0 , z)); 300 332 nodes->attachObject(deaths); 301 333 } 302 334 } 303 304 if (mSelectEntities & ENT_SPC) 335 } 336 337 if (mSelectEntities & ENT_RND) 338 { 339 entName = "randomdeath"; 340 nodeName = "RandomDeathNode"; 341 for (i = 0; i < mRandomCount; i++) 305 342 { 306 entName = "randomspaceship"; 307 nodeName = "RandomSpaceshipNode"; 308 for (i = 0; i < mRandomCount; i++) 309 { 310 Vector3 pos( 311 //Math::RangeRandom(-planeHalf,-planeSixth), 312 Math::RangeRandom(planeSixth,planeHalf), 313 Math::RangeRandom(planeHalf * 0.1, planeHalf), 314 Math::RangeRandom(-planeThreeEights, planeThreeEights)); 315 deaths = mSceneMgr->createEntity(cat(entName,666,i),"razor.mesh"); 316 if (mShadowsEnabled) 317 deaths->setCastShadows(true); 318 nodes = /*mSceneMgr->getRootSceneNode()*/anchor->createChildSceneNode(cat(nodeName,666,i), pos, 319 Quaternion(Radian(Math::RangeRandom(-Math::PI, Math::PI)), Vector3::UNIT_Y)); 320 nodes->attachObject(deaths); 321 } 343 Vector3 pos( 344 Math::RangeRandom(-planeHalf,-planeSixth), 345 0, 346 Math::RangeRandom(-planeThreeEights, planeThreeEights)); 347 deaths = mSceneMgr->createEntity(cat(entName,666,i),"robot.mesh"); 348 if (mShadowsEnabled) 349 deaths->setCastShadows(true); 350 nodes = /*mSceneMgr->getRootSceneNode()*/anchor->createChildSceneNode(cat(nodeName,666,i), pos, 351 Quaternion(Radian(Math::RangeRandom(-Math::PI, Math::PI)), Vector3::UNIT_Y)); 352 nodes->attachObject(deaths); 322 353 } 323 324 if (mSelectEntities & ENT_MOV) 354 } 355 356 if (mSelectEntities & ENT_SPC) 357 { 358 entName = "randomspaceship"; 359 nodeName = "RandomSpaceshipNode"; 360 for (i = 0; i < mRandomCount; i++) 325 361 { 326 Entity *movingDeath = mSceneMgr->createEntity("movingDeath","robot.mesh"); 362 Vector3 pos( 363 //Math::RangeRandom(-planeHalf,-planeSixth), 364 Math::RangeRandom(planeSixth,planeHalf), 365 Math::RangeRandom(planeHalf * 0.1, planeHalf), 366 Math::RangeRandom(-planeThreeEights, planeThreeEights)); 367 deaths = mSceneMgr->createEntity(cat(entName,666,i),"razor.mesh"); 327 368 if (mShadowsEnabled) 328 movingDeath->setCastShadows( true ); 329 330 SceneNode *deathPivotNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("deathPivotNode"); 331 mMoveNode = deathPivotNode->createChildSceneNode("movingNode", Vector3(0, 0, mRotationRadius)/*, 332 Quaternion(Radian(Math::HALF_PI), Vector3::UNIT_Y)*/); 333 mMoveNode->attachObject(movingDeath); 334 335 Entity *ent_ball = mSceneMgr->createEntity("ball","sphere.mesh"); 336 SceneNode *node_pivot = mMoveNode->createChildSceneNode("pivotNode"); 337 SceneNode *node_ball = node_pivot->createChildSceneNode("orbitNode", Vector3(120, 40, 0)); 338 node_ball->attachObject(ent_ball); 339 node_ball->scale(0.1, 0.1, 0.1); 340 341 342 //mFollowCam->setAutoTracking(true, mMoveNode); 369 deaths->setCastShadows(true); 370 nodes = /*mSceneMgr->getRootSceneNode()*/anchor->createChildSceneNode(cat(nodeName,666,i), pos, 371 Quaternion(Radian(Math::RangeRandom(-Math::PI, Math::PI)), Vector3::UNIT_Y)); 372 nodes->attachObject(deaths); 343 373 } 344 345 if (mSelectEntities & ENT_PLN) 346 { 347 Plane ground(Vector3::UNIT_Y, 0); 348 MeshManager::getSingleton().createPlane("ground", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, 349 ground, mPlaneDim * 4 / 3, mPlaneDim, 20, 20, true, 1, 20, 20, Vector3::UNIT_Z); 350 Entity *ent_ground = mSceneMgr->createEntity("GroundEntity", "ground"); 351 ent_ground->setCastShadows(false); 352 ent_ground->setMaterialName("Examples/RustySteel");//("Examples/Rockwall"); 353 SceneNode *node_ground = /*mSceneMgr->getRootSceneNode()*/grndan->createChildSceneNode("GroundNode", Vector3(0, 0, 0)); 354 node_ground->attachObject(ent_ground); 355 356 //MeshManager::getSingleton().createPlane("ground2", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, 357 // ground, mPlaneDim/2, mPlaneDim, 10, 20, true, 1, 10, 20, Vector3::UNIT_Z); 358 //ent_ground = mSceneMgr->createEntity("GroundEntity2", "ground2"); 359 //ent_ground->setCastShadows(false); 360 //ent_ground->setMaterialName("Examples/RustySteel"); 361 //node_ground = /*mSceneMgr->getRootSceneNode()*/grndan->createChildSceneNode("GroundNode2", Vector3(-mPlaneDim/4, 0, 0)); 362 //node_ground->attachObject(ent_ground); 363 } 364 365 // Lights 366 mSceneMgr->setAmbientLight(ColourValue(0.1,0.1,0.1)); 367 Light *light = mSceneMgr->createLight("light"); 374 } 375 376 if (mSelectEntities & ENT_MOV) 377 { 378 Entity *movingDeath = mSceneMgr->createEntity("movingDeath","robot.mesh"); 368 379 if (mShadowsEnabled) 369 { 370 mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE); 371 light->setType(Light::LT_POINT); 372 light->setPosition(Vector3(x, 300, z + 200)); 373 } 374 else 375 { 376 light->setType(Light::LT_DIRECTIONAL); 377 light->setDirection(-1,-1,-1); 378 } 379 light->setDiffuseColour(ColourValue::White); 380 light->setSpecularColour(ColourValue(1, 1, 0.2)); 381 382 // Skybox 383 mSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox", mPlaneDim * 2); 384 } 385 386 /* Some math tests 387 Plane planeX(Vector3::UNIT_X, Vector3(10,10,10)); 388 Plane planeY(Vector3::UNIT_Y, Vector3(10,10,10)); 389 Plane planeZ(Vector3::UNIT_Z, Vector3(10,10,10)); 390 Vector3 vect(20,20,20); 391 Vector3 interX = planeX.projectVector(vect); 392 Vector3 interY = planeY.projectVector(vect); 393 Vector3 interZ = planeZ.projectVector(vect); 394 std::stringstream ssX, ssY, ssZ; 395 ssX << "The intersection of " << planeX << " and " << vect << " is at: " << interX; 396 ssY << "The intersection of " << planeY << " and " << vect << " is at: " << interY; 397 ssZ << "The intersection of " << planeZ << " and " << vect << " is at: " << interZ; 398 LogManager::getSingleton().logMessage(ssX.str()); 399 LogManager::getSingleton().logMessage(ssY.str()); 400 LogManager::getSingleton().logMessage(ssZ.str()); 401 */ 380 movingDeath->setCastShadows( true ); 381 382 SceneNode *deathPivotNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("deathPivotNode"); 383 mMoveNode = deathPivotNode->createChildSceneNode("movingNode", Vector3(0, 0, mRotationRadius)/*, 384 Quaternion(Radian(Math::HALF_PI), Vector3::UNIT_Y)*/); 385 mMoveNode->attachObject(movingDeath); 386 387 Entity *ent_ball = mSceneMgr->createEntity("ball","sphere.mesh"); 388 SceneNode *node_pivot = mMoveNode->createChildSceneNode("pivotNode"); 389 SceneNode *node_ball = node_pivot->createChildSceneNode("orbitNode", Vector3(120, 40, 0)); 390 node_ball->attachObject(ent_ball); 391 node_ball->scale(0.1, 0.1, 0.1); 392 393 394 //mFollowCam->setAutoTracking(true, mMoveNode); 395 } 396 397 if (mSelectEntities & ENT_PLN) 398 { 399 Plane ground(Vector3::UNIT_Y, 0); 400 MeshManager::getSingleton().createPlane("ground", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, 401 ground, mPlaneDim * 4 / 3, mPlaneDim, 20, 20, true, 1, 20, 20, Vector3::UNIT_Z); 402 Entity *ent_ground = mSceneMgr->createEntity("GroundEntity", "ground"); 403 ent_ground->setCastShadows(false); 404 ent_ground->setMaterialName("Examples/RustySteel");//("Examples/Rockwall"); 405 SceneNode *node_ground = /*mSceneMgr->getRootSceneNode()*/grndan->createChildSceneNode("GroundNode", Vector3(0, 0, 0)); 406 node_ground->attachObject(ent_ground); 407 408 //MeshManager::getSingleton().createPlane("ground2", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, 409 // ground, mPlaneDim/2, mPlaneDim, 10, 20, true, 1, 10, 20, Vector3::UNIT_Z); 410 //ent_ground = mSceneMgr->createEntity("GroundEntity2", "ground2"); 411 //ent_ground->setCastShadows(false); 412 //ent_ground->setMaterialName("Examples/RustySteel"); 413 //node_ground = /*mSceneMgr->getRootSceneNode()*/grndan->createChildSceneNode("GroundNode2", Vector3(-mPlaneDim/4, 0, 0)); 414 //node_ground->attachObject(ent_ground); 415 } 416 417 // Lights 418 mSceneMgr->setAmbientLight(ColourValue(0.1,0.1,0.1)); 419 Light *light = mSceneMgr->createLight("light"); 420 if (mShadowsEnabled) 421 { 422 mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE); 423 light->setType(Light::LT_POINT); 424 light->setPosition(Vector3(x, 300, z + 200)); 425 } 426 else 427 { 428 light->setType(Light::LT_DIRECTIONAL); 429 light->setDirection(-1,-1,-1); 430 } 431 light->setDiffuseColour(ColourValue::White); 432 light->setSpecularColour(ColourValue(1, 1, 0.2)); 433 434 // Skybox 435 mSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox", mPlaneDim * 2); 402 436 } 403 437 … … 418 452 "MySceneManager"); 419 453 // set params for kdtree scene manager 420 if (mOptions.mSceneManager == KdTreeAppListener::SM_KDT) 454 if (mOptions.mSceneManager == KdTreeAppListener::SM_KDT || 455 mOptions.mSceneManager == KdTreeAppListener::SM_KTE) 421 456 { 422 457 mSceneMgr->setOption("BuildMethod", &mOptions.mBuildMethod); … … 530 565 531 566 // create play button 532 mat = MaterialManager::getSingleton().create("KdTree/DemoPlayButton", "General"); 567 mat = MaterialManager::getSingleton().getByName("KdTree/DemoPlayButton"); 568 if (mat.isNull()) 569 mat = MaterialManager::getSingleton().create("KdTree/DemoPlayButton", "General"); 533 570 mat->setLightingEnabled(false); 534 571 tech = mat->getTechnique(0); … … 540 577 541 578 // create record button 542 mat = MaterialManager::getSingleton().create("KdTree/DemoRecordButton", "General"); 579 mat = MaterialManager::getSingleton().getByName("KdTree/DemoRecordButton"); 580 if (mat.isNull()) 581 mat = MaterialManager::getSingleton().create("KdTree/DemoRecordButton", "General"); 543 582 mat->setLightingEnabled(false); 544 583 tech = mat->getTechnique(0); -
GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTreeAppListener.cpp
r1265 r1273 18 18 const String KdTreeAppListener::BUILDMETHOD[] = { "RE", "PQ" }; 19 19 const String KdTreeAppListener::BUILDMETHODCAPTION[] = { "Recursive", "Priority Queue" }; 20 const String KdTreeAppListener::SCENEMANAGER[] = { "KDT", " OCM", "OCT", "GEN" };20 const String KdTreeAppListener::SCENEMANAGER[] = { "KDT", "KTE", "OCM", "OCT", "TER", "GEN" }; 21 21 const String KdTreeAppListener::SCENEMANAGERNAME[] = 22 22 { 23 23 "KdTreeSceneManager", 24 "KdTreeTerrainSceneManager", 24 25 "OcclusionCullingSceneManager", 25 26 "OctreeSceneManager", 27 "TerrainSceneManager", 26 28 "DefaultSceneManager" 27 29 }; … … 128 130 mRotScale(0.0f), 129 131 mDeathAngle(0.0f), 132 mRaySceneQuery(0), 130 133 // just to stop toggles flipping too fast 131 134 mTimeUntilNextToggle(0.0f), … … 159 162 mTopCam = sm->getCamera("TopCam"); 160 163 mCamNode = sm->getSceneNode("PlayerCamNode"); 164 165 mRaySceneQuery = mSceneMgr->createRayQuery(Ray(mCamNode->getPosition(), Vector3::NEGATIVE_UNIT_Y)); 161 166 162 167 mDebugOverlay = OverlayManager::getSingleton().getByName("Core/DebugOverlay"); … … 404 409 if (mSceneMgr->getTypeName() == "OctreeSceneManager") 405 410 mSceneMgr->setOption("ShowOctree", &show); 406 else if (mSceneMgr->getTypeName() == "KdTreeSceneManager") 411 else if ( 412 mSceneMgr->getTypeName() == "KdTreeSceneManager" || 413 mSceneMgr->getTypeName() == "KdTreeTerrainSceneManager") 407 414 mSceneMgr->setOption("ShowKdTree", &show); 408 415 … … 965 972 if (!mFreeMove) 966 973 { 967 Vector3 pos = mCamNode->getPosition(); 968 RaySceneQuery * rsquery = mSceneMgr->createRayQuery(Ray(pos, Vector3::NEGATIVE_UNIT_Y)); 969 RaySceneQueryResult& rsresult = rsquery->execute(); 970 971 RaySceneQueryResult::iterator it = rsresult.begin(); 972 RaySceneQueryResult::iterator end = rsresult.end(); 973 974 while (it != end && it->movable) 975 { 976 if (it->movable->getName() != "PlayerCam") 974 if (mOptions.mSceneFiles == TERRAIN_SCENE) 975 { 976 static Vector3 pos; 977 static Ray updateRay; 978 pos = mCamNode->getPosition(); 979 updateRay.setOrigin(pos); 980 updateRay.setDirection(Vector3::NEGATIVE_UNIT_Y); 981 mRaySceneQuery->setRay(updateRay); 982 RaySceneQueryResult& qryResult = mRaySceneQuery->execute(); 983 RaySceneQueryResult::iterator i = qryResult.begin(); 984 if (i != qryResult.end() && i->worldFragment) 977 985 { 978 mCamNode->setPosition(pos.x, it->movable->getWorldBoundingBox().getCenter().y + 2, pos.z);979 break;986 SceneQuery::WorldFragment* wf = i->worldFragment; 987 mCamNode->setPosition(pos.x, wf->singleIntersection.y + 10, pos.z); 980 988 } 981 it++; 982 } 983 OGRE_DELETE(rsquery); 989 } 990 else 991 { 992 static Vector3 pos; 993 static Ray updateRay; 994 pos = mCamNode->getPosition(); 995 updateRay.setOrigin(pos); 996 updateRay.setDirection(Vector3::NEGATIVE_UNIT_Y); 997 mRaySceneQuery->setRay(updateRay); 998 RaySceneQueryResult& qryResult = mRaySceneQuery->execute(); 999 RaySceneQueryResult::iterator i = qryResult.begin(); 1000 while (i != qryResult.end() && i->movable) 1001 { 1002 if (i->movable->getName() != "PlayerCam") 1003 { 1004 MovableObject *mov = i->movable; 1005 mCamNode->setPosition(pos.x, mov->getWorldBoundingBox().getCenter().y + 2, pos.z); 1006 break; 1007 } 1008 i++; 1009 } 1010 } 984 1011 } 985 1012 } -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeSceneManager.h
r1258 r1273 13 13 #include <OgreSceneManager.h> 14 14 #include <VisibilityManager.h> 15 16 #include <OgreTerrainPrerequisites.h>17 #include <OgreTerrainRenderable.h>18 #include <OgreTerrainPageSource.h>19 #include <OgreIteratorWrappers.h>20 15 21 16 #include "OgreKdTree.h" -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp
r1264 r1273 13 13 #include <OgreLogManager.h> 14 14 #include <OgreStringConverter.h> 15 16 #include <OgreTerrainPage.h>17 #include <OgreTerrainVertexProgram.h>18 #include <OgreHeightmapTerrainPageSource.h>19 15 20 16 #include "OgreKdTreeSceneManager.h" … … 293 289 } 294 290 // options for CHC 295 if (strKey == "UseDepthPass")291 else if (strKey == "UseDepthPass") 296 292 { 297 293 mUseDepthPass = (*static_cast<const bool *>(pValue)); 298 294 return true; 299 295 } 300 if (strKey == "PrepareVisualization")296 else if (strKey == "PrepareVisualization") 301 297 { 302 298 mShowVisualization = (*static_cast<const bool *>(pValue)); 303 299 return true; 304 300 } 305 if (strKey == "RenderNodesForViz")301 else if (strKey == "RenderNodesForViz") 306 302 { 307 303 mRenderNodesForViz = (*static_cast<const bool *>(pValue)); 308 304 return true; 309 305 } 310 if (strKey == "RenderNodesContentForViz")306 else if (strKey == "RenderNodesContentForViz") 311 307 { 312 308 mRenderNodesContentForViz = (*static_cast<const bool *>(pValue)); 313 309 return true; 314 310 } 315 if (strKey == "SkyBoxEnabled")311 else if (strKey == "SkyBoxEnabled") 316 312 { 317 313 mSkyBoxEnabled = (*static_cast<const bool *>(pValue)); 318 314 return true; 319 315 } 320 if (strKey == "SkyPlaneEnabled")316 else if (strKey == "SkyPlaneEnabled") 321 317 { 322 318 mSkyPlaneEnabled = (*static_cast<const bool *>(pValue)); 323 319 return true; 324 320 } 325 if (strKey == "SkyDomeEnabled")321 else if (strKey == "SkyDomeEnabled") 326 322 { 327 323 mSkyDomeEnabled = (*static_cast<const bool *>(pValue)); 328 324 return true; 329 325 } 330 if (strKey == "VisualizeCulledNodes")326 else if (strKey == "VisualizeCulledNodes") 331 327 { 332 328 mVisualizeCulledNodes = (*static_cast<const bool *>(pValue)); 333 329 return true; 334 330 } 335 if (strKey == "DelayRenderTransparents")331 else if (strKey == "DelayRenderTransparents") 336 332 { 337 333 mDelayRenderTransparents = (*static_cast<const bool *>(pValue)); … … 339 335 } 340 336 341 if (strKey == "DepthWrite")337 else if (strKey == "DepthWrite") 342 338 { 343 339 mEnableDepthWrite = (*static_cast<const bool *>(pValue)); 344 340 return true; 345 341 } 346 if (strKey == "UseItemBuffer")342 else if (strKey == "UseItemBuffer") 347 343 { 348 344 mUseItemBuffer = (*static_cast<const bool *>(pValue)); 349 345 return true; 350 346 } 351 if (strKey == "ExecuteVertexProgramForAllPasses")347 else if (strKey == "ExecuteVertexProgramForAllPasses") 352 348 { 353 349 mExecuteVertexProgramForAllPasses = (*static_cast<const bool *>(pValue)); 354 350 return true; 355 351 } 356 if (strKey == "RenderTransparentsForItemBuffer")352 else if (strKey == "RenderTransparentsForItemBuffer") 357 353 { 358 354 mRenderTransparentsForItemBuffer = (*static_cast<const bool *>(pValue)); -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilitySceneManagerDll.cpp
r1264 r1273 24 24 */ 25 25 26 #include <OgreOcclusionCullingSceneManager.h> 27 #include <OgreKdTreeSceneManager.h> 26 #include "OgreOcclusionCullingSceneManager.h" 27 #include "OgreKdTreeSceneManager.h" 28 #include "OgreKdTerrainSceneManager.h" 28 29 #include <OgreRoot.h> 29 30 #include <OgreLogManager.h> … … 40 41 OcclusionCullingSceneManagerFactory *occlusionCullingPlugin; 41 42 KdTreeSceneManagerFactory *kdTreeFactory; 43 KdTerrainSceneManagerFactory *kdTerrainFactory; 42 44 43 45 //----------------------------------------------------------------------- … … 51 53 occlusionCullingPlugin = new OcclusionCullingSceneManagerFactory(visManager); 52 54 kdTreeFactory = new KdTreeSceneManagerFactory(visManager); 53 55 kdTerrainFactory = new KdTerrainSceneManagerFactory(visManager); 54 56 // Construct listener manager singleton 55 57 new TerrainPageSourceListenerManager(); 58 new KdTerrainPageSourceListenerManager(); 56 59 57 60 // Register 58 61 Root::getSingleton().addSceneManagerFactory(occlusionCullingPlugin); 59 62 Root::getSingleton().addSceneManagerFactory(kdTreeFactory); 63 Root::getSingleton().addSceneManagerFactory(kdTerrainFactory); 60 64 } 61 65 //----------------------------------------------------------------------- … … 64 68 Root::getSingleton().removeSceneManagerFactory(occlusionCullingPlugin); 65 69 Root::getSingleton().removeSceneManagerFactory(kdTreeFactory); 66 70 Root::getSingleton().removeSceneManagerFactory(kdTerrainFactory); 67 71 // destroy listener manager 68 72 delete TerrainPageSourceListenerManager::getSingletonPtr(); 73 delete KdTerrainPageSourceListenerManager::getSingletonPtr(); 69 74 } 70 75 //----------------------------------------------------------------------- … … 75 80 delete occlusionCullingPlugin; 76 81 delete kdTreeFactory; 82 delete kdTerrainFactory; 77 83 78 84 delete visManager; -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/Plugin_VisibilitySceneManager.vcproj
r1239 r1273 21 21 Optimization="0" 22 22 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" 23 PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PLUGIN_ OCCLUSIONCULLINGSCENEMANAGER_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE"23 PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PLUGIN_KD_TERRAIN_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE" 24 24 MinimalRebuild="TRUE" 25 25 BasicRuntimeChecks="3" … … 74 74 OutputDirectory="..\lib\$(ConfigurationName)" 75 75 IntermediateDirectory="..\obj\$(ConfigurationName)" 76 ConfigurationType="2" 77 CharacterSet="2" 78 WholeProgramOptimization="TRUE"> 79 <Tool 80 Name="VCCLCompilerTool" 81 Optimization="3" 82 GlobalOptimizations="TRUE" 83 InlineFunctionExpansion="2" 84 EnableIntrinsicFunctions="TRUE" 85 ImproveFloatingPointConsistency="TRUE" 86 FavorSizeOrSpeed="1" 87 OmitFramePointers="TRUE" 88 EnableFiberSafeOptimizations="TRUE" 89 OptimizeForProcessor="2" 90 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" 91 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_KD_TERRAIN_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE" 92 StringPooling="TRUE" 93 RuntimeLibrary="2" 94 BufferSecurityCheck="FALSE" 95 EnableFunctionLevelLinking="TRUE" 96 RuntimeTypeInfo="TRUE" 97 UsePrecompiledHeader="0" 98 WarningLevel="3" 99 Detect64BitPortabilityProblems="TRUE" 100 DebugInformationFormat="3"/> 101 <Tool 102 Name="VCCustomBuildTool"/> 103 <Tool 104 Name="VCLinkerTool" 105 IgnoreImportLibrary="TRUE" 106 AdditionalDependencies="OgreMain.lib CEGUIBase.lib OgreGUIRenderer.lib Plugin_OctreeSceneManager.lib GtpVisibility.lib zdll.lib zziplib.lib Preprocessor.lib xerces-c_2.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib glew32.lib glew32s.lib" 107 OutputFile="$(OutDir)/Plugin_VisibilitySceneManager.dll" 108 Version="0.99" 109 LinkIncremental="1" 110 SuppressStartupBanner="TRUE" 111 AdditionalLibraryDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib";"$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)";"..\..\..\Preprocessing\lib\$(ConfigurationName)";..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\Preprocessing\src\GL;..\..\..\..\..\..\..\NonGTP\Zlib\lib;"..\..\lib\$(ConfigurationName)"" 112 ModuleDefinitionFile="..\misc\OgreVisibilitySceneManager.def" 113 GenerateDebugInformation="TRUE" 114 SubSystem="2" 115 OptimizeReferences="2" 116 EnableCOMDATFolding="2" 117 ImportLibrary="$(OutDir)/Plugin_VisibilitySceneManager.lib" 118 TargetMachine="1"/> 119 <Tool 120 Name="VCMIDLTool"/> 121 <Tool 122 Name="VCPostBuildEventTool" 123 CommandLine="copy $(OutDir)\$(TargetFileName) $(OGRE_PATH)\Samples\Common\bin\$(ConfigurationName)"/> 124 <Tool 125 Name="VCPreBuildEventTool"/> 126 <Tool 127 Name="VCPreLinkEventTool"/> 128 <Tool 129 Name="VCResourceCompilerTool"/> 130 <Tool 131 Name="VCWebServiceProxyGeneratorTool"/> 132 <Tool 133 Name="VCXMLDataGeneratorTool"/> 134 <Tool 135 Name="VCWebDeploymentTool"/> 136 <Tool 137 Name="VCManagedWrapperGeneratorTool"/> 138 <Tool 139 Name="VCAuxiliaryManagedWrapperGeneratorTool"/> 140 </Configuration> 141 <Configuration 142 Name="mlrt|Win32" 143 OutputDirectory="$(ConfigurationName)" 144 IntermediateDirectory="$(ConfigurationName)" 76 145 ConfigurationType="2" 77 146 CharacterSet="2" … … 104 173 Name="VCLinkerTool" 105 174 IgnoreImportLibrary="TRUE" 106 AdditionalDependencies="OgreMain.lib CEGUIBase.lib OgreGUIRenderer.lib Plugin_OctreeSceneManager.lib GtpVisibility.lib zdll.lib zziplib.lib Preprocessor.lib xerces-c_2.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib glew32.lib glew32s.lib"175 AdditionalDependencies="OgreMain.lib CEGUIBase.lib OgreGUIRenderer.lib Plugin_OctreeSceneManager.lib GtpVisibility.lib zdll.lib zziplib.lib Preprocessor.lib xerces-c_2.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib cg.lib cgGL.lib glew32.lib glew32s.lib" 107 176 OutputFile="$(OutDir)/Plugin_VisibilitySceneManager.dll" 108 177 Version="0.99" 109 178 LinkIncremental="1" 110 179 SuppressStartupBanner="TRUE" 111 AdditionalLibraryDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib";" $(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)";"..\..\..\Preprocessing\lib\$(ConfigurationName)";..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\Preprocessing\src\GL;..\..\..\..\..\..\..\NonGTP\Zlib\lib;"..\..\lib\$(ConfigurationName)""180 AdditionalLibraryDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib";"..\..\GtpVisibility\lib\$(ConfigurationName)";"..\..\lib\$(ConfigurationName)";"..\lib\$(ConfigurationName)";"$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)";"..\..\..\Preprocessing\lib\$(ConfigurationName)";..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\Preprocessing\src\GL;"$(CG_LIB_PATH)";..\..\..\..\..\..\..\NonGTP\Zlib\lib" 112 181 ModuleDefinitionFile="..\misc\OgreVisibilitySceneManager.def" 113 182 GenerateDebugInformation="TRUE" … … 140 209 </Configuration> 141 210 <Configuration 142 Name=" mlrt|Win32"211 Name="Release_Internal|Win32" 143 212 OutputDirectory="$(ConfigurationName)" 144 213 IntermediateDirectory="$(ConfigurationName)" … … 209 278 </Configuration> 210 279 <Configuration 211 Name="Release _Internal|Win32"280 Name="Release Internal|Win32" 212 281 OutputDirectory="$(ConfigurationName)" 213 282 IntermediateDirectory="$(ConfigurationName)" … … 277 346 Name="VCAuxiliaryManagedWrapperGeneratorTool"/> 278 347 </Configuration> 279 <Configuration280 Name="Release Internal|Win32"281 OutputDirectory="$(ConfigurationName)"282 IntermediateDirectory="$(ConfigurationName)"283 ConfigurationType="2"284 CharacterSet="2"285 WholeProgramOptimization="TRUE">286 <Tool287 Name="VCCLCompilerTool"288 Optimization="3"289 GlobalOptimizations="TRUE"290 InlineFunctionExpansion="2"291 EnableIntrinsicFunctions="TRUE"292 ImproveFloatingPointConsistency="TRUE"293 FavorSizeOrSpeed="1"294 OmitFramePointers="TRUE"295 EnableFiberSafeOptimizations="TRUE"296 OptimizeForProcessor="2"297 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"298 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GTP_VISIBILITY_MODIFIED_OGRE"299 StringPooling="TRUE"300 RuntimeLibrary="2"301 BufferSecurityCheck="FALSE"302 EnableFunctionLevelLinking="TRUE"303 RuntimeTypeInfo="TRUE"304 UsePrecompiledHeader="0"305 WarningLevel="3"306 Detect64BitPortabilityProblems="TRUE"307 DebugInformationFormat="3"/>308 <Tool309 Name="VCCustomBuildTool"/>310 <Tool311 Name="VCLinkerTool"312 IgnoreImportLibrary="TRUE"313 AdditionalDependencies="OgreMain.lib CEGUIBase.lib OgreGUIRenderer.lib Plugin_OctreeSceneManager.lib GtpVisibility.lib zdll.lib zziplib.lib Preprocessor.lib xerces-c_2.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib cg.lib cgGL.lib glew32.lib glew32s.lib"314 OutputFile="$(OutDir)/Plugin_VisibilitySceneManager.dll"315 Version="0.99"316 LinkIncremental="1"317 SuppressStartupBanner="TRUE"318 AdditionalLibraryDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib";"..\..\GtpVisibility\lib\$(ConfigurationName)";"..\..\lib\$(ConfigurationName)";"..\lib\$(ConfigurationName)";"$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)";"..\..\..\Preprocessing\lib\$(ConfigurationName)";..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\Preprocessing\src\GL;"$(CG_LIB_PATH)";..\..\..\..\..\..\..\NonGTP\Zlib\lib"319 ModuleDefinitionFile="..\misc\OgreVisibilitySceneManager.def"320 GenerateDebugInformation="TRUE"321 SubSystem="2"322 OptimizeReferences="2"323 EnableCOMDATFolding="2"324 ImportLibrary="$(OutDir)/Plugin_VisibilitySceneManager.lib"325 TargetMachine="1"/>326 <Tool327 Name="VCMIDLTool"/>328 <Tool329 Name="VCPostBuildEventTool"330 CommandLine="copy $(OutDir)\$(TargetFileName) $(OGRE_PATH)\Samples\Common\bin\$(ConfigurationName)"/>331 <Tool332 Name="VCPreBuildEventTool"/>333 <Tool334 Name="VCPreLinkEventTool"/>335 <Tool336 Name="VCResourceCompilerTool"/>337 <Tool338 Name="VCWebServiceProxyGeneratorTool"/>339 <Tool340 Name="VCXMLDataGeneratorTool"/>341 <Tool342 Name="VCWebDeploymentTool"/>343 <Tool344 Name="VCManagedWrapperGeneratorTool"/>345 <Tool346 Name="VCAuxiliaryManagedWrapperGeneratorTool"/>347 </Configuration>348 348 </Configurations> 349 349 <References> … … 355 355 <Filter 356 356 Name="Header Files" 357 Filter=" ">357 Filter="h;hpp;hxx;hm;inl;inc"> 358 358 <File 359 359 RelativePath="..\include\OgreOcclusionCullingSceneManager.h"> … … 368 368 <Filter 369 369 Name="Source Files" 370 Filter=" ">370 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"> 371 371 <File 372 372 RelativePath="..\src\OgreOcclusionCullingSceneManager.cpp"> … … 472 472 <Filter 473 473 Name="Header Files" 474 Filter=" ">474 Filter="h;hpp;hxx;hm;inl;inc"> 475 475 <File 476 476 RelativePath="..\include\OgreKdRenderable.h"> … … 494 494 <Filter 495 495 Name="Source Files" 496 Filter=" ">496 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"> 497 497 <File 498 498 RelativePath="..\src\OgreKdTree.cpp"> … … 509 509 <File 510 510 RelativePath="..\src\OgreKdTreeSceneNode.cpp"> 511 </File> 512 </Filter> 513 </Filter> 514 <Filter 515 Name="KdTreeTerrainSceneManager" 516 Filter=""> 517 <Filter 518 Name="Header Files" 519 Filter="h;hpp;hxx;hm;inl;inc"> 520 <File 521 RelativePath="..\include\OgreKdHeightmapTerrainPageSource.h"> 522 </File> 523 <File 524 RelativePath="..\include\OgreKdTerrainPage.h"> 525 </File> 526 <File 527 RelativePath="..\include\OgreKdTerrainPageSource.h"> 528 </File> 529 <File 530 RelativePath="..\include\OgreKdTerrainPrerequisites.h"> 531 </File> 532 <File 533 RelativePath="..\include\OgreKdTerrainRenderable.h"> 534 </File> 535 <File 536 RelativePath="..\include\OgreKdTerrainSceneManager.h"> 537 </File> 538 <File 539 RelativePath="..\include\OgreKdTerrainVertexProgram.h"> 540 </File> 541 </Filter> 542 <Filter 543 Name="Source Files" 544 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"> 545 <File 546 RelativePath=".\OgreKdHeightmapTerrainPageSource.cpp"> 547 </File> 548 <File 549 RelativePath=".\OgreKdTerrainPage.cpp"> 550 </File> 551 <File 552 RelativePath=".\OgreKdTerrainPageSource.cpp"> 553 </File> 554 <File 555 RelativePath=".\OgreKdTerrainRenderable.cpp"> 556 </File> 557 <File 558 RelativePath=".\OgreKdTerrainSceneManager.cpp"> 559 </File> 560 <File 561 RelativePath=".\OgreKdTerrainVertexProgram.cpp"> 511 562 </File> 512 563 </Filter>
Note: See TracChangeset
for help on using the changeset viewer.