Changeset 2397 for GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule
- Timestamp:
- 05/28/07 16:30:37 (18 years ago)
- Location:
- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/OgreIlluminationManager.h
r2379 r2397 77 77 */ 78 78 void createTechnique(IllumTechniqueParams* params, Pass* pass, OgreRenderable* rend, OgreSharedRuns* sRuns); 79 bool needMaterialCopyForTechnique(IllumTechniqueParams* params); 79 80 /** 80 81 @brief A helper function to find the renderable object attached to a particle system (ONLY BILLBOARDSETS ARE SUPPORTED). -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/OgreRenderTechnique.h
r2320 r2397 46 46 //inherited 47 47 virtual OgreRenderTechnique* asOgreRenderTechnique(){return this;} 48 48 49 49 protected: 50 50 /** … … 112 112 OgreRenderable* parentRenderable, 113 113 OgreTechniqueGroup* parentTechniqueGroup) = 0; 114 115 virtual bool needMaterialCopy(IllumTechniqueParams* params){return false;} 114 116 /** 115 117 @brief parses parameters from the material file. -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreCausticReceiverRenderTechnique.h
r2366 r2397 117 117 OgreTechniqueGroup* parentTechniqueGroup); 118 118 119 virtual bool needMaterialCopy(IllumTechniqueParams* params){return true;} 119 120 120 121 int maxcasters; -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreCubeMapRenderTechnique.h
r2355 r2397 135 135 136 136 void resetParams(); 137 137 virtual bool needMaterialCopy(IllumTechniqueParams* params){return true;} 138 138 139 unsigned long startFrame; 139 140 unsigned long cubeMapUpdateInterval; -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreDepthShadowReceiverRenderTechnique.h
r2366 r2397 69 69 bool createNewPasses, 70 70 int startTextureUnitID, 71 bool nearestLightsFromCamera, 71 72 Pass* pass, 72 73 OgreRenderable* parentRenderable, … … 144 145 bool createNewPasses; 145 146 int startTextureUnitID; 147 bool nearestLightsFromCamera; 146 148 }; 147 149 … … 160 162 OgreTechniqueGroup* parentTechniqueGroup); 161 163 164 virtual bool needMaterialCopy(IllumTechniqueParams* params); 162 165 163 166 int maxlights; … … 176 179 bool createNewPasses; 177 180 int startTextureUnitID; 181 bool nearestLightsFromCamera; 178 182 }; 179 183 -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreHierarchicalParticleSystemTechnique.h
r2320 r2397 123 123 OgreTechniqueGroup* parentTechniqueGroup); 124 124 125 virtual bool needMaterialCopy(IllumTechniqueParams* params){return true;} 125 126 126 127 unsigned long impostorUpdateInterval; -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreIllumVolumeRenderTechnique.h
r2320 r2397 96 96 OgreTechniqueGroup* parentTechniqueGroup); 97 97 98 virtual bool needMaterialCopy(IllumTechniqueParams* params){return true;} 98 99 99 100 String materialName; -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgrePathMapRenderTechnique.h
r2366 r2397 91 91 OgreTechniqueGroup* parentTechniqueGroup); 92 92 93 virtual bool needMaterialCopy(IllumTechniqueParams* params){return true;} 94 93 95 SceneBlendFactor passBlendingSRC; 94 96 SceneBlendFactor passBlendingDEST; -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreSBBRenderTechnique.h
r2320 r2397 34 34 */ 35 35 OgreSBBRenderTechnique( unsigned char depthTexID, 36 bool bindTexture, 36 37 Pass* pass, 37 38 OgreRenderable* parentRenderable, … … 58 59 */ 59 60 unsigned char depthTexID; 60 61 bool bindTexture; 61 62 bool lastVisibility; 62 63 … … 79 80 80 81 unsigned char depthTexID; 81 82 bool bindTexture; 82 83 }; 83 84 -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/OgreIlluminationManager.cpp
r2379 r2397 312 312 OgreTechniqueGroup* group = 0; 313 313 314 bool materialCopied = false; 314 315 for(unsigned int t = 0 ; t < mat->getNumTechniques() ; t++) 315 316 { … … 323 324 if( techniques.size() > 0) 324 325 { 326 bool needMaterialCopy = false; 327 328 std::vector<IllumTechniqueParams*>::iterator it = techniques.begin(); 329 std::vector<IllumTechniqueParams*>::iterator itend = techniques.end(); 330 while(it!=itend) 331 { 332 needMaterialCopy = needMaterialCopy || needMaterialCopyForTechnique(*it); 333 it++; 334 } 335 325 336 if(rend == 0) 326 337 { … … 339 350 sharedruns->updateBounds(); 340 351 } 341 String newMaterialName = mat->getName() + "_clone_" + rend->getName(); 342 Material* newMat = mat->clone(newMaterialName).getPointer(); 343 rend->setMaterialName(newMaterialName); 344 mat = sube->getMaterial().getPointer(); 345 break; 352 353 if(needMaterialCopy) 354 { 355 String newMaterialName = mat->getName() + "_clone_" + rend->getName(); 356 Material* newMat = mat->clone(newMaterialName).getPointer(); 357 rend->setMaterialName(newMaterialName); 358 mat = sube->getMaterial().getPointer(); 359 materialCopied = true; 360 } 361 362 if(materialCopied) 363 break; 346 364 } 347 365 } … … 495 513 } 496 514 } 515 516 bool OgreIlluminationManager::needMaterialCopyForTechnique(IllumTechniqueParams* params) 517 { 518 std::list<RenderTechniqueFactory*>::iterator it = techniqueFactories.begin(); 519 std::list<RenderTechniqueFactory*>::iterator itend = techniqueFactories.end(); 520 521 while(it != itend) 522 { 523 RenderTechniqueFactory* factory = *it; 524 525 if(factory->isType(params->getTypeName())) 526 return factory->needMaterialCopy(params); 527 528 it++; 529 } 530 } 531 497 532 void OgreIlluminationManager::preAllUpdates() 498 533 { -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreDepthShadowReceiverRenderTechnique.cpp
r2372 r2397 19 19 SceneBlendFactor passBlendingDEST, 20 20 bool createNewPasses, 21 int startTextureUnitID, 21 int startTextureUnitID, 22 bool nearestLightsFromCamera, 22 23 Pass* pass, 23 24 OgreRenderable* parentRenderable, … … 42 43 this->createNewPasses = createNewPasses; 43 44 this->startTextureUnitID = startTextureUnitID; 45 46 this->nearestLightsFromCamera = nearestLightsFromCamera; 44 47 45 48 if(createNewPasses) … … 86 89 { 87 90 LightList lights; 91 Vector3 center = OgreIlluminationManager::getSingleton().getMainCamera()->getWorldPosition(); 92 if(!nearestLightsFromCamera) 93 center = ((OgreSharedRuns*) sharedRuns)->getRootPosition(); 88 94 Root::getSingleton()._getCurrentSceneManager()->_populateLightList( 89 ((OgreSharedRuns*) sharedRuns)->getRootPosition(),95 center, 90 96 100000.0, 91 97 lights); … … 336 342 f->startTextureUnitID = StringConverter::parseInt(params); 337 343 } 344 void parseNearestFromCamera(String& params, RenderTechniqueFactory* factory) 345 { 346 OgreDepthShadowReceiverRenderTechniqueFactory* f = (OgreDepthShadowReceiverRenderTechniqueFactory*) factory; 347 f->nearestLightsFromCamera = StringConverter::parseBool(params); 348 } 338 349 } 339 350 … … 358 369 this->attributeParsers.insert(AttribParserList::value_type("new_passes", (ILLUM_ATTRIBUTE_PARSER) parseCreateNewPasses)); 359 370 this->attributeParsers.insert(AttribParserList::value_type("start_tex_id", (ILLUM_ATTRIBUTE_PARSER) parseStartTexID)); 371 this->attributeParsers.insert(AttribParserList::value_type("nearest_from_camera", (ILLUM_ATTRIBUTE_PARSER) parseNearestFromCamera)); 360 372 } 361 373 … … 382 394 createNewPasses = true; 383 395 startTextureUnitID = 0; 396 nearestLightsFromCamera = true; 384 397 385 398 parseParams(params); … … 401 414 createNewPasses, 402 415 startTextureUnitID, 416 nearestLightsFromCamera, 403 417 pass, 404 418 parentRenderable, … … 408 422 } 409 423 424 bool OgreDepthShadowReceiverRenderTechniqueFactory::needMaterialCopy(IllumTechniqueParams* params) 425 { 426 nearestLightsFromCamera = true; 427 parseParams(params); 428 if(nearestLightsFromCamera) 429 return false; 430 else 431 return true; 432 } 433 -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreHierarchicalParticleSystemTechnique.cpp
r1425 r2397 34 34 this->useVParam = useVParam; 35 35 this->useFParam = useFParam; 36 36 37 37 //create the Particle system 38 38 childPSysName = parentOgreRenderable->getName() + "_small_PSYS"; -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgrePathMapRenderTechnique.cpp
r2366 r2397 23 23 24 24 this->clusters = OgreIlluminationManager::getSingleton().getPathMapClusters(parentRenderable->getName()); 25 26 25 Pass* passToSet = pass; 27 26 -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreSBBRenderTechnique.cpp
r2379 r2397 6 6 7 7 OgreSBBRenderTechnique::OgreSBBRenderTechnique( unsigned char depthTexID, 8 bool bindTexture, 8 9 Pass* pass, 9 10 OgreRenderable* parentRenderable, … … 14 15 { 15 16 this->depthTexID = depthTexID; 17 this->bindTexture = bindTexture; 16 18 17 19 OgreIlluminationManager::getSingleton().createGlobalRun(ILLUMRUN_SCENE_CAMERA_DEPTH); … … 25 27 OgreIlluminationManager::getSingleton().addUpdateListener(this); 26 28 29 if(bindTexture) 27 30 pass->getTextureUnitState(depthTexID)->setTextureName(run->getDepthTextureName()); 28 31 … … 70 73 f->depthTexID = StringConverter::parseUnsignedInt(params); 71 74 } 75 void parseBindTexture(String& params, RenderTechniqueFactory* factory) 76 { 77 OgreSBBRenderTechniqueFactory* f = (OgreSBBRenderTechniqueFactory*) factory; 78 f->bindTexture = StringConverter::parseBool(params); 79 } 72 80 } 73 81 … … 80 88 //register parsers 81 89 this->attributeParsers.insert(AttribParserList::value_type("texture_unit_id", (ILLUM_ATTRIBUTE_PARSER) parseDepthTexID)); 90 this->attributeParsers.insert(AttribParserList::value_type("bind_texture", (ILLUM_ATTRIBUTE_PARSER) parseBindTexture)); 82 91 } 83 92 … … 90 99 //reset parameters 91 100 depthTexID = 1; 92 101 bindTexture = true; 102 93 103 parseParams(params); 94 104 95 105 OgreSBBRenderTechnique* result = new OgreSBBRenderTechnique( 96 106 depthTexID, 107 bindTexture, 97 108 pass, 98 109 parentRenderable,
Note: See TracChangeset
for help on using the changeset viewer.