- Timestamp:
- 10/23/06 23:26:11 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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,
Note: See TracChangeset
for help on using the changeset viewer.