Changeset 1670 for GTP/trunk/Lib/Illum
- Timestamp:
- 10/23/06 23:26:11 (18 years ago)
- Location:
- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/OgreIlluminationManager.h
r1639 r1670 74 74 bool blurSM; 75 75 bool focusingSM; 76 String shadowMapMaterialName; 76 77 unsigned int phaseTextureSize; 77 78 std::map<RenderingRunType,float> maxRads; … … 315 316 void setFocusingSM(bool use){focusingSM = use;} 316 317 void setBlurShadowMap(bool use){blurSM = use;} 318 void setShadowMapMaterialName(String name){shadowMapMaterialName = name;} 317 319 }; 318 320 -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreDepthShadowRecieverRenderTechnique.h
r836 r1670 47 47 String shadowVertexProgram, 48 48 String shadowFragmentProgram, 49 bool setLightViewMatrix, 50 bool setLightViewProjMatrix, 51 bool setLightProjFarPlane, 52 String lightViewProjParamName, 53 String lightViewParamName, 54 String lightFarPlaneParamName, 49 55 Pass* pass, 50 56 OgreRenderable* parentRenderable, … … 79 85 @breif new passes created by this technique 80 86 */ 81 std::vector<Pass*> passes; 87 std::vector<Pass*> passes; 88 bool setLightViewMatrix; 89 bool setLightViewProjMatrix; 90 bool setLightProjFarPlane; 91 String lightViewProjParamName; 92 String lightViewParamName; 93 String lightFarPlaneParamName; 82 94 }; 83 95 … … 98 110 String shadowVertexProgram; 99 111 String shadowFragmentProgram; 112 bool setLightViewMatrix; 113 bool setLightViewProjMatrix; 114 bool setLightProjFarPlane; 115 String lightViewProjParamName; 116 String lightViewParamName; 117 String lightFarPlaneParamName; 100 118 101 119 }; -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderingRuns/OgreDepthShadowMapRenderingRun.h
r1628 r1670 56 56 */ 57 57 Matrix4 getLightViewProjMatrix(); 58 Real getLightFarPlane(){return lightFarPlane;} 58 59 59 60 protected: … … 84 85 Texture* depthMapTexture; 85 86 Texture* blurredDepthMapTexture; 87 Real lightFarPlane; 86 88 87 89 //inherited -
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.