Changeset 2334 for GTP/trunk/App/Demos/Illum/Ogre/src/Moria
- Timestamp:
- 04/24/07 14:05:42 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/src/Moria/include/Moria.h
r2329 r2334 25 25 #include "OgreIlluminationManager.h" 26 26 #include "SceneSerializer.h" 27 28 AnimationState* mAnimState; 27 29 28 30 … … 49 51 bool frameStarted(const FrameEvent& evt) 50 52 { 51 /* light->setDirection(mCamera->getDirection()); 52 light->setPosition(mCamera->getPosition()); 53 mainLightNode->setPosition(mCamera->getPosition());*/ 54 bool result = ExampleFrameListener::frameStarted(evt); 55 framecount++; 53 float thisTime = (float) Root::getSingleton().getTimer()->getMilliseconds() / 2000.0f; 54 55 mainLightNode->setPosition(Vector3(10*cos(thisTime), 7, 10 * sin(thisTime)) + Vector3(5, 0, 5)); 56 Vector3 pos = light->getDerivedPosition(); 57 pos.normalise(); 58 pos *= -1; 59 //light->setDirection( pos); 60 61 framecount++; 56 62 57 return result; 63 mAnimState->addTime(evt.timeSinceLastFrame * 0.5); 64 65 return ExampleFrameListener::frameStarted(evt); 58 66 } 59 67 … … 82 90 ResourceGroupManager::getSingleton().initialiseResourceGroup("PostProc"); 83 91 ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_Particles"); 84 ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_Moria"); 85 ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_EnvMap"); 86 ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_Caustic"); 92 ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_PathMap"); 93 ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_Moria"); 94 //ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_EnvMap"); 95 //ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_Caustic"); 87 96 } 88 97 … … 108 117 void chooseSceneManager() 109 118 { 110 //mSceneMgr = mRoot->createSceneManager("OctreeSceneManager");111 mSceneMgr = mRoot->createSceneManager("OcclusionCullingSceneManager");119 mSceneMgr = mRoot->createSceneManager("OctreeSceneManager"); 120 //mSceneMgr = mRoot->createSceneManager("OcclusionCullingSceneManager"); 112 121 } 113 122 … … 115 124 { 116 125 std::string occlusion_cfg("OcclusionCulling.cfg"); 117 mSceneMgr->setWorldGeometry(occlusion_cfg);126 //mSceneMgr->setWorldGeometry(occlusion_cfg); 118 127 119 128 //createPostproc(); … … 122 131 OgreIlluminationManager::getSingleton().setMainViewport(mWindow->getViewport(0)); 123 132 OgreIlluminationManager::getSingleton().setFocusingSM(false); 124 OgreIlluminationManager::getSingleton().setShadowMapSize( 512);133 OgreIlluminationManager::getSingleton().setShadowMapSize(128); 125 134 OgreIlluminationManager::getSingleton().setBlurShadowMap(true); 126 OgreIlluminationManager::getSingleton().setShadowMapMaterialName("GTP/Basic/Distance_Normalized");//GameTools/ShadowMapDistance 127 OgreIlluminationManager::getSingleton().setUseLISPSM(false); 135 OgreIlluminationManager::getSingleton().setShadowMapMaterialName(Light::LT_SPOTLIGHT, "GTP/Basic/Distance_Normalized");//GameTools/ShadowMapDistance 136 OgreIlluminationManager::getSingleton().setShadowMapMaterialName(Light::LT_POINT, "GTP/Basic/Distance_Normalized"); 137 OgreIlluminationManager::getSingleton().setUseLISPSM(false); 138 OgreIlluminationManager::getSingleton().joinSharedRuns(false); 128 139 129 140 Root::getSingleton()._setCurrentSceneManager(mSceneMgr); … … 133 144 mCamera->setFOVy(Radian(Degree(80))); 134 145 mCamera->setNearClipDistance(0.01); 135 mCamera->setFarClipDistance(1 000);146 mCamera->setFarClipDistance(150); 136 147 // Set ambient light 137 148 mSceneMgr->setAmbientLight(ColourValue(0.1, 0.1, 0.1)); … … 145 156 inputStream = ResourceGroupManager::getSingleton().openResource("moria.level"); //towers2.level 146 157 s.parseScript(inputStream, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); 147 158 s.parseEntryPoints("prmEntryPoints.text"); 159 /* 148 160 ParticleSystem* pSys1 = mSceneMgr->createParticleSystem("psys1", "GTP/Moria/Smoke_Large"); 149 161 pSys1->setKeepParticlesInLocalSpace(false); 150 162 SceneNode *pSysNode = rootNode->createChildSceneNode("psys1"); 151 163 pSysNode->attachObject(pSys1); 152 pSysNode->setPosition(-40,-1,-15); 164 pSysNode->setPosition(-40,-1,-15);*/ 153 165 154 166 /*Entity* object = mSceneMgr->createEntity("object", "head.mesh"); … … 163 175 //createPlane("p","groundmaterial",Vector3(0,-0.3,0),Vector2(150,150)); 164 176 165 Light*mainLight = mSceneMgr->createLight("MainLight");166 mainLight->setType(Light::LT_ SPOTLIGHT);177 mainLight = mSceneMgr->createLight("MainLight"); 178 mainLight->setType(Light::LT_POINT); 167 179 mainLight->setCastShadows(true); 168 180 mainLight->setDiffuseColour(ColourValue::White); … … 170 182 mainLightNode = rootNode->createChildSceneNode(); 171 183 172 mainLightNode->setPosition(-20,10,0); 173 mainLight->setPosition(-20,10,0); 174 mainLight->setPowerScale(5); 175 mainLight->setDirection(-1,-0.2, -1); 184 mainLightNode->setPosition(15,10,15); 185 mainLight->setPowerScale(30); 186 //mainLight->setDirection(1,0, 0); 176 187 mainLightNode->attachObject(mainLight); 177 mainLight->setSpotlightRange(Degree(0),Degree(90)); 178 mainLight->setAttenuation(40.0, 0, 1, 0); 179 188 //mainLight->setSpotlightRange(Degree(0),Degree(120)); 189 mainLight->setAttenuation(40.0, 0, 3, 0); 190 191 Vector4 v = mainLight->getAs4DVector(); 192 193 BillboardSet* bbs = mSceneMgr->createBillboardSet("bb", 1); 194 bbs->setDefaultDimensions(0.3, 0.3); 195 bbs->createBillboard(Vector3::ZERO, ColourValue::White); 196 bbs->setMaterialName("Flare"); 197 mainLightNode->attachObject(bbs); 198 199 Entity* ent = mSceneMgr->createEntity("troll", "troll.mesh"); 200 // Add entity to the scene node 201 SceneNode *trollNode = mSceneMgr->getRootSceneNode()->createChildSceneNode( Vector3(5,0,5)); 202 trollNode->attachObject(ent); 203 trollNode->setScale(0.1,0.1,0.1); 204 mAnimState = ent->getAnimationState("stand"); 205 mAnimState->setEnabled(true); 206 180 207 OgreIlluminationManager::getSingleton().initTechniques(); 181 208 }
Note: See TracChangeset
for help on using the changeset viewer.