Changeset 1670 for GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src
- Timestamp:
- 10/23/06 23:26:11 (18 years ago)
- Location:
- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/OgreIlluminationManager.cpp
r1639 r1670 86 86 blurSM = false; 87 87 focusingSM = true; 88 88 shadowMapMaterialName = "GameTools/ShadowMapDepth"; 89 89 90 for(int i = 0; i < RUN_TYPE_COUNT; i++) 90 91 { … … 605 606 shadowMapSize, 606 607 shadowMapSize, 607 "GameTools/ShadowMapDepth"//TODO608 shadowMapMaterialName //TODO 608 609 ); 609 610 runs->addRun(ILLUMRUN_DEPTH_SHADOWMAP, run); -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/OgreRenderingRun.cpp
r1647 r1670 1 1 #include "OgreRenderingrun.h" 2 2 #include "OgreIlluminationManager.h" 3 #include "OgreTerrainSceneManager.h"4 3 5 4 MovablePlane* OgreRenderingRun::fullScreenQuad = NULL; … … 163 162 SceneManager* sm = Ogre::Root::getSingleton()._getCurrentSceneManager(); 164 163 165 if(sm->getTypeName() == "TerrainSceneManager")166 {167 terrainMaterial = ((TerrainSceneManager*)sm)->getTerrainMaterial()->getName();168 ((TerrainSceneManager*)sm)->setCustomMaterial(materialName);169 }170 171 164 RenderQueue* rq = sm->getRenderQueue(); 172 165 rq->clear(); … … 187 180 { 188 181 SceneManager* sm = Ogre::Root::getSingleton()._getCurrentSceneManager(); 189 if(sm->getTypeName()== "TerrainSceneManager") 190 ((TerrainSceneManager*)sm)->setCustomMaterial(terrainMaterial); 191 192 182 193 183 std::map<Renderable*, String>::iterator it = visibleObjects.begin(); 194 184 std::map<Renderable*, String>::iterator itend = visibleObjects.end(); -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreDepthShadowRecieverRenderTechnique.cpp
r1628 r1670 8 8 String shadowVertexProgram, 9 9 String shadowFragmentProgram, 10 bool setLightViewMatrix, 11 bool setLightViewProjMatrix, 12 bool setLightProjFarPlane, 13 String lightViewProjParamName, 14 String lightViewParamName, 15 String lightFarPlaneParamName, 10 16 Pass* pass, 11 17 OgreRenderable* parentRenderable, … … 18 24 this->shadowVertexProgram = shadowVertexProgram ; 19 25 this->shadowFragmentProgram = shadowFragmentProgram; 20 26 this->setLightViewMatrix = setLightViewMatrix; 27 this->setLightViewProjMatrix = setLightViewProjMatrix; 28 this->setLightProjFarPlane = setLightProjFarPlane; 29 this->lightViewProjParamName = lightViewProjParamName; 30 this->lightViewParamName = lightViewParamName; 31 this->lightFarPlaneParamName = lightFarPlaneParamName; 21 32 22 33 //insert new passes … … 57 68 newpass->setSceneBlending(SBT_MODULATE); 58 69 //newpass->setSceneBlending(SBF_ONE, SBF_ZERO); 70 59 71 newpass->setDepthBias(1); 60 72 techn->movePass(lastpass, index); … … 108 120 109 121 //fpParams->setNamedConstant("lightViewProj", depthRun->getLightViewProjMatrix()); 110 vpParams->setNamedConstant("lightViewProj", depthRun->getLightViewProjMatrix()); 122 if(setLightViewProjMatrix) 123 vpParams->setNamedConstant(lightViewProjParamName, depthRun->getLightViewProjMatrix()); 124 if(setLightViewMatrix) 125 vpParams->setNamedConstant(lightViewParamName, depthRun->getLightViewMatrix()); 126 if(setLightProjFarPlane) 127 fpParams->setNamedConstant(lightFarPlaneParamName, depthRun->getLightFarPlane()); 128 111 129 112 130 passes.at(i)->setActive(true); … … 139 157 OgreDepthShadowRecieverRenderTechniqueFactory* f = (OgreDepthShadowRecieverRenderTechniqueFactory*) factory; 140 158 f->shadowFragmentProgram = params; 159 } 160 161 void parseSetLightViewProj(String& params, RenderTechniqueFactory* factory) 162 { 163 OgreDepthShadowRecieverRenderTechniqueFactory* f = (OgreDepthShadowRecieverRenderTechniqueFactory*) factory; 164 StringVector vecparams = StringUtil::split(params, " \t"); 165 f->setLightViewProjMatrix = StringConverter::parseBool(vecparams[0]); 166 if(f->setLightViewProjMatrix && vecparams.size() > 1) 167 f->lightViewProjParamName = vecparams[1]; 168 } 169 170 void parseSetLightView(String& params, RenderTechniqueFactory* factory) 171 { 172 OgreDepthShadowRecieverRenderTechniqueFactory* f = (OgreDepthShadowRecieverRenderTechniqueFactory*) factory; 173 StringVector vecparams = StringUtil::split(params, " \t"); 174 f->setLightViewMatrix = StringConverter::parseBool(vecparams[0]); 175 if(f->setLightViewMatrix && vecparams.size() > 1) 176 f->lightViewParamName = vecparams[1]; 177 } 178 179 void parseSetLightFarPlane(String& params, RenderTechniqueFactory* factory) 180 { 181 OgreDepthShadowRecieverRenderTechniqueFactory* f = (OgreDepthShadowRecieverRenderTechniqueFactory*) factory; 182 StringVector vecparams = StringUtil::split(params, " \t"); 183 f->setLightProjFarPlane = StringConverter::parseBool(vecparams[0]); 184 if(f->setLightProjFarPlane && vecparams.size() > 1) 185 f->lightFarPlaneParamName = vecparams[1]; 141 186 } 142 187 } … … 151 196 this->attributeParsers.insert(AttribParserList::value_type("vertex_program_name", (ILLUM_ATTRIBUTE_PARSER) parseVertexProgram)); 152 197 this->attributeParsers.insert(AttribParserList::value_type("fragment_program_name", (ILLUM_ATTRIBUTE_PARSER) parseFragmentProgram)); 198 this->attributeParsers.insert(AttribParserList::value_type("set_light_viewproj", (ILLUM_ATTRIBUTE_PARSER) parseSetLightViewProj)); 199 this->attributeParsers.insert(AttribParserList::value_type("set_light_view", (ILLUM_ATTRIBUTE_PARSER) parseSetLightView)); 200 this->attributeParsers.insert(AttribParserList::value_type("set_light_farplane", (ILLUM_ATTRIBUTE_PARSER) parseSetLightFarPlane)); 153 201 } 154 202 … … 163 211 shadowVertexProgram = "GameTools/ShadowMap/ShadowVS"; 164 212 shadowFragmentProgram = "GameTools/ShadowMap/ShadowPS"; 213 setLightViewMatrix = false; 214 setLightViewProjMatrix = true; 215 setLightProjFarPlane = false; 216 lightViewProjParamName = "lightViewProj"; 217 lightViewParamName = "lightView"; 218 lightFarPlaneParamName = "lightFarPlane"; 165 219 166 220 parseParams(params); … … 170 224 shadowVertexProgram, 171 225 shadowFragmentProgram, 226 setLightViewMatrix , 227 setLightViewProjMatrix, 228 setLightProjFarPlane, 229 lightViewProjParamName, 230 lightViewParamName, 231 lightFarPlaneParamName, 172 232 pass, 173 233 parentRenderable, -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderingRuns/OgreDepthShadowMapRenderingRun.cpp
r1639 r1670 20 20 21 21 this->materialName = materialName; 22 22 lightFarPlane = 0; 23 23 createDepthMap(); 24 24 } … … 320 320 if(!usefocusing) 321 321 { 322 depthMapCamera->setFarClipDistance(light->getAttenuationRange() ); 322 lightFarPlane = light->getAttenuationRange(); 323 depthMapCamera->setFarClipDistance(lightFarPlane); 324 323 325 } 324 326 else … … 336 338 float farP= -1.5 * min.z; 337 339 if(farP < 0.2) farP = 0.2; 338 depthMapCamera->setFarClipDistance(farP); 339 340 depthMapCamera->setFarClipDistance(farP); 341 lightFarPlane = farP; 342 340 343 Vector3 scale = (max - min); 341 344 scale *= 1.5; // just for safety -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderingRuns/OgreSceneCameraDepthRenderingRun.cpp
r1425 r1670 58 58 rt->update(); 59 59 60 //rt->writeContentsToFile("cameraDepth. dds");60 //rt->writeContentsToFile("cameraDepth.bmp"); 61 61 62 62 restoreMaterials();
Note: See TracChangeset
for help on using the changeset viewer.