Changeset 1187 for GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src
- Timestamp:
- 08/08/06 18:25:06 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTree.cpp
r1165 r1187 122 122 mTopCam->setPosition(Vector3(1232, 3990, -1477)); 123 123 // walkthrough view 124 mCamera->setPosition(Vector3(1102.56, 181.845, -350.305)); 125 mCamera->setOrientation(Quaternion(-0.977321, -0.117497, -0.174903, 0.0210273)); 124 mCamNode->setPosition(Vector3(1102.56, 181.845, -350.305)); 125 //mCamNode->setOrientation(Quaternion(-0.977321, -0.117497, -0.174903, 0.0210273)); 126 127 mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox", 5000, true); 126 128 } 127 129 else 128 130 { 131 mCamNode->setPosition(Vector3(1280,600,1666)); 132 mCamNode->setOrientation(Quaternion(0.936893, -0.124586, 0.323813, 0.04306)); 133 //mCamera->lookAt(Vector3(-20,30,10)); 134 129 135 SceneNode *anchor = mSceneMgr->getRootSceneNode()->createChildSceneNode("AnchorNode"); 130 136 //SceneNode *grndan = anchor->createChildSceneNode("GroundAnchor"); … … 244 250 245 251 // Skybox 246 // mSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox", mPlaneDim * 2); 247 252 mSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox", mPlaneDim * 2); 248 253 } 249 254 … … 271 276 mFrameListener->showDebugOverlay( true ); 272 277 mRoot->addFrameListener(mFrameListener); 278 mWindow->addListener(new KdTreeAppRenderTargetListener(mSceneMgr)); 273 279 } 274 280 … … 283 289 // Create the camera 284 290 mCamera = mSceneMgr->createCamera("PlayerCam"); 291 mCamera->setNearClipDistance(1); 292 293 mCamNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("PlayerCamNode", Vector3(0,0,0)); 294 mCamNode->attachObject(mCamera); 295 285 296 286 297 // Position it at 500 in Z direction 287 298 //mCamera->setPosition(Vector3(0,50,500)); 288 299 //mCamera->setPosition(Vector3(500,256,666)); 289 mCamera->setPosition(Vector3(1280,600,1666));300 //mCamera->setPosition(Vector3(1280,600,1666)); 290 301 // Look back along -Z 291 302 //mCamera->lookAt(Vector3(0,50,-300)); 292 mCamera->lookAt(Vector3(-20,30,10)); 293 mCamera->setNearClipDistance(5); 294 295 mFollowCam = mSceneMgr->createCamera("FollowCam"); 296 mFollowCam->setPosition(Vector3(800,150,800)); 297 mFollowCam->setNearClipDistance(5); 298 mFollowCam->setFOVy(Angle(15)); 303 //mCamera->lookAt(Vector3(-20,30,10)); 304 305 //mFollowCam = mSceneMgr->createCamera("FollowCam"); 306 //mFollowCam->setPosition(Vector3(800,150,800)); 307 //mFollowCam->setNearClipDistance(5); 308 //mFollowCam->setFOVy(Angle(15)); 299 309 300 310 mTopCam = mSceneMgr->createCamera("TopCam"); … … 303 313 mTopCam->pitch(Radian(-Math::HALF_PI)); 304 314 mTopCam->setCullingFrustum(mCamera); 305 //mTopCam->setProjectionType(PT_ORTHOGRAPHIC); 306 //mTopCam->lookAt(Vector3(0,0,0)); 315 mTopCam->setNearClipDistance(1); 316 317 // infinite far plane? 318 if (mRoot->getRenderSystem()->getCapabilities()->hasCapability(RSC_INFINITE_FAR_PLANE)) 319 { 320 mTopCam->setFarClipDistance(0); 321 mCamera->setFarClipDistance(0); 322 } 323 else 324 { 325 mTopCam->setFarClipDistance(20000); 326 mCamera->setFarClipDistance(20000); 327 } 307 328 } 308 329 … … 445 466 return false; 446 467 } 468 469 /**********************************************************************/ 470 /* VisualizationRenderTargetListener implementation */ 471 /**********************************************************************/ 472 473 474 //----------------------------------------------------------------------- 475 KdTreeAppRenderTargetListener::KdTreeAppRenderTargetListener(SceneManager *sceneMgr) 476 :RenderTargetListener(), mSceneMgr(sceneMgr) 477 { 478 } 479 //----------------------------------------------------------------------- 480 void KdTreeAppRenderTargetListener::preViewportUpdate(const RenderTargetViewportEvent &evt) 481 { 482 // visualization viewport 483 const bool showViz = evt.source->getZOrder() == VIZ_VIEWPORT_Z_ORDER; 484 const bool nShowViz = !showViz; 485 486 mSavedShadowTechnique = mSceneMgr->getShadowTechnique(); 487 mSavedAmbientLight = mSceneMgr->getAmbientLight(); 488 489 // -- ambient light must be full for visualization, shadows disabled 490 if (showViz) 491 { 492 mSceneMgr->setAmbientLight(ColourValue(1, 1, 1)); 493 mSceneMgr->setShadowTechnique(SHADOWTYPE_NONE); 494 } 495 496 mSceneMgr->setOption("PrepareVisualization", &showViz); 497 mSceneMgr->setOption("SkyBoxEnabled", &nShowViz); 498 //mSceneMgr->setOption("SkyPlaneEnabled", &showViz); 499 500 RenderTargetListener::preViewportUpdate(evt); 501 } 502 //----------------------------------------------------------------------- 503 void KdTreeAppRenderTargetListener::postRenderTargetUpdate(const RenderTargetEvent &evt) 504 { 505 // reset values 506 mSceneMgr->setShadowTechnique(mSavedShadowTechnique); 507 mSceneMgr->setAmbientLight(mSavedAmbientLight); 508 509 RenderTargetListener::postRenderTargetUpdate(evt); 510 }
Note: See TracChangeset
for help on using the changeset viewer.