- Timestamp:
- 07/02/07 04:12:36 (18 years ago)
- Location:
- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreCausticReceiverRenderTechnique.cpp
r2366 r2475 15 15 String casterCenterVariableName, 16 16 String attenuationVariableName, 17 bool bindDistanceMap, 17 18 Pass* pass, 18 19 OgreRenderable* parentRenderable, … … 31 32 this->casterCenterVariableName = casterCenterVariableName; 32 33 this->attenuationVariableName = attenuationVariableName; 34 this->bindDistanceMap = bindDistanceMap; 35 bindAttenuation = false; 36 if(attenuationVariableName != "") 37 bindAttenuation = true; 33 38 34 39 if(createNewPasses) … … 66 71 67 72 TextureUnitState* st = newpass->createTextureUnitState(); 68 TextureUnitState* st2 = newpass->createTextureUnitState();69 70 73 st->setTextureFiltering(TFO_BILINEAR); 71 st2->setTextureFiltering(TFO_BILINEAR); 74 if(bindDistanceMap) 75 { 76 TextureUnitState* st2 = newpass->createTextureUnitState(); 77 st2->setTextureFiltering(TFO_BILINEAR); 78 } 72 79 73 80 newpass->setSceneBlending(passBlendingSRC, passBlendingDEST); … … 109 116 110 117 Pass* passToSet = this->pass; 111 int textureUnit = startTextureUnitID + i; 118 int p = bindDistanceMap?i*2:i; 119 int textureUnit = startTextureUnitID + p; 112 120 if(createNewPasses) 113 121 { … … 119 127 passToSet->getTextureUnitState(textureUnit)->setTextureName( 120 128 cauCubeRun->getCausticCubeMapTextureName()); 129 if(bindDistanceMap) 130 { 131 OgreCubeMapRenderingRun* distCubeRun = 132 (OgreCubeMapRenderingRun*) causticCasters.at(i)-> 133 getRun(ILLUMRUN_DISTANCE_CUBEMAP)->asOgreRenderingRun(); 134 if(distCubeRun) 135 passToSet->getTextureUnitState(textureUnit + 1)->setTextureName( 136 distCubeRun->getCubeMapTextureName()); 137 } 121 138 122 139 //set caster position nad caustic attenuation … … 126 143 if(!createNewPasses) 127 144 { 128 centerVarName += String ("[") + StringConverter::toString(i) + String("]");129 attenuationVarName += String ("[") + StringConverter::toString(i) + String("]");145 centerVarName += StringConverter::toString(i+1); 146 attenuationVarName += StringConverter::toString(i+1); 130 147 } 131 148 Fparams->setNamedConstant(centerVarName, 132 149 causticCasters.at(i)->getRootPosition(ILLUMRUN_CAUSTIC_CUBEMAP)); 150 if(bindAttenuation) 133 151 Fparams->setNamedConstant(attenuationVarName, 134 152 cauCubeRun->getAttenuation()); … … 247 265 f->attenuationVariableName = params; 248 266 } 267 268 void parseBindDistanceMap(String& params, RenderTechniqueFactory* factory) 269 { 270 OgreCausticReceiverRenderTechniqueFactory* f = (OgreCausticReceiverRenderTechniqueFactory*) factory; 271 f->bindDistanceMap = StringConverter::parseBool(params); 272 } 249 273 } 250 274 … … 263 287 this->attributeParsers.insert(AttribParserList::value_type("center_var_name", (ILLUM_ATTRIBUTE_PARSER) parseCenterVarName)); 264 288 this->attributeParsers.insert(AttribParserList::value_type("attenuation_var_name", (ILLUM_ATTRIBUTE_PARSER) parseAttenuationVarName)); 289 this->attributeParsers.insert(AttribParserList::value_type("bind_distance_map", (ILLUM_ATTRIBUTE_PARSER) parseBindDistanceMap)); 265 290 } 266 291 … … 280 305 startTextureUnitID = 0; 281 306 casterCenterVariableName = "cubeMapCameraPosition"; 282 String attenuationVariableName = "attenuation"; 307 attenuationVariableName = ""; 308 bindDistanceMap = false; 283 309 284 310 parseParams(params); … … 294 320 casterCenterVariableName, 295 321 attenuationVariableName, 322 bindDistanceMap, 296 323 pass, 297 324 parentRenderable, -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreDepthShadowReceiverRenderTechnique.cpp
r2460 r2475 21 21 int startTextureUnitID, 22 22 bool nearestLightsFromCamera, 23 bool bindToVertexShader, 23 24 Pass* pass, 24 25 OgreRenderable* parentRenderable, … … 28 29 DepthShadowReceiverRenderTechnique(parentRenderable, parentTechniqueGroup) 29 30 { 31 this->bindToVertexShader = bindToVertexShader; 30 32 this->passBlendingSRC = passBlendingSRC; 31 33 this->passBlendingDEST = passBlendingDEST; … … 99 101 Vector3 center = OgreIlluminationManager::getSingleton().getMainCamera()->getWorldPosition(); 100 102 if(!nearestLightsFromCamera) 101 center = ((OgreSharedRuns*) sharedRuns)->getRootPosition(); 103 center = ((OgreSharedRuns*) sharedRuns)->getRootRenderable()->getParentSceneNode()->_getDerivedPosition(); 104 //center = ((OgreSharedRuns*) sharedRuns)->getRootPosition(); 102 105 Root::getSingleton()._getCurrentSceneManager()->_populateLightList( 103 106 center, … … 149 152 GpuProgramParametersSharedPtr fpParams = passToSet->getFragmentProgramParameters(); 150 153 GpuProgramParametersSharedPtr vpParams = passToSet->getVertexProgramParameters(); 154 GpuProgramParametersSharedPtr variableSetParams = fpParams; 155 if(bindToVertexShader) 156 variableSetParams = vpParams; 151 157 152 158 String LightViewProjParamName = lightViewProjParamName; … … 165 171 vpParams->setNamedConstant(LightViewProjParamName, depthRun->getLightViewProjMatrix()); 166 172 else 167 fpParams->setNamedConstant(LightViewProjParamName, depthRun->getLightViewProjMatrix());173 variableSetParams->setNamedConstant(LightViewProjParamName, depthRun->getLightViewProjMatrix()); 168 174 } 169 175 if(setLightViewMatrix) … … 172 178 vpParams->setNamedConstant(LightViewParamName, depthRun->getLightViewMatrix()); 173 179 else 174 fpParams->setNamedConstant(LightViewParamName, depthRun->getLightViewMatrix());180 variableSetParams->setNamedConstant(LightViewParamName, depthRun->getLightViewMatrix()); 175 181 } 176 182 if(setLightProjFarPlane) … … 347 353 f->nearestLightsFromCamera = StringConverter::parseBool(params); 348 354 } 355 void parseBindToVertexShader(String& params, RenderTechniqueFactory* factory) 356 { 357 OgreDepthShadowReceiverRenderTechniqueFactory* f = (OgreDepthShadowReceiverRenderTechniqueFactory*) factory; 358 f->bindToVertexShader = StringConverter::parseBool(params); 359 } 349 360 } 350 361 … … 370 381 this->attributeParsers.insert(AttribParserList::value_type("start_tex_id", (ILLUM_ATTRIBUTE_PARSER) parseStartTexID)); 371 382 this->attributeParsers.insert(AttribParserList::value_type("nearest_from_camera", (ILLUM_ATTRIBUTE_PARSER) parseNearestFromCamera)); 383 this->attributeParsers.insert(AttribParserList::value_type("bind_to_vertex_shader", (ILLUM_ATTRIBUTE_PARSER) parseBindToVertexShader)); 372 384 } 373 385 … … 394 406 createNewPasses = true; 395 407 startTextureUnitID = 0; 396 nearestLightsFromCamera = true; 397 408 nearestLightsFromCamera = false; 409 bindToVertexShader = false; 410 398 411 parseParams(params); 399 412 … … 415 428 startTextureUnitID, 416 429 nearestLightsFromCamera, 430 bindToVertexShader, 417 431 pass, 418 432 parentRenderable, -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgrePathMapRenderTechnique.cpp
r2460 r2475 144 144 LightList lights; 145 145 SceneManager* sm = Root::getSingleton()._getCurrentSceneManager(); 146 sm->_populateLightList(OgreIlluminationManager::getSingleton().getMainCamera()->get Position(), 1000, lights);146 sm->_populateLightList(OgreIlluminationManager::getSingleton().getMainCamera()->getWorldPosition(), 1000, lights); 147 147 148 148 int found = 0; 149 for(int i = 0 ; found < 5&& i < lights.size(); i++)149 for(int i = 0 ; found < 2 && i < lights.size(); i++) 150 150 { 151 151 if(lights.at(i)->isAttached())
Note: See TracChangeset
for help on using the changeset viewer.