Changeset 2189 for GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src
- Timestamp:
- 03/05/07 18:05:16 (18 years ago)
- Location:
- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/OgreIlluminationManager.cpp
r2185 r2189 3 3 #include "OgreBillboardParticleRenderer.h" 4 4 #include "SpriteParticleRenderer.h" 5 #include "OgrePMEntryPointMapRenderingRun.h" 6 #include "OgrePMWeightComputeRenderingRun.h" 5 7 6 8 OgreIlluminationManager* OgreIlluminationManager::instance = NULL; … … 85 87 blurSM = false; 86 88 focusingSM = true; 87 shadowMapMaterialName = "GameTools/ShadowMapDepth"; 89 shadowMapMaterialName = "GTP/Basic/Distance_NormalizedCCW"; 90 areaLightRadius = 0.1; 88 91 89 92 for(int i = 0; i < RUN_TYPE_COUNT; i++) … … 193 196 OgreRenderable* rend = 0; 194 197 OgreTechniqueGroup* group = 0; 195 198 196 199 for(unsigned int t = 0 ; t < mat->getNumTechniques() ; t++) 197 200 { … … 203 206 204 207 std::vector<IllumTechniqueParams*>& techniques = pass->getIllumTechniques(); 205 std::vector<IllumTechniqueParams*>::iterator i = techniques.begin(); 206 std::vector<IllumTechniqueParams*>::iterator iend = techniques.end(); 207 208 while( i != iend) 208 if( techniques.size() > 0) 209 209 { 210 IllumTechniqueParams* params = *i;211 212 210 if(rend == 0) 213 211 { … … 226 224 sharedruns->updateBounds(); 227 225 } 228 226 String newMaterialName = mat->getName() + rend->getName() + "_clone"; 227 Material* newMat = mat->clone(newMaterialName).getPointer(); 228 mat = newMat; 229 rend->setMaterialName(newMaterialName); 230 break; 231 } 232 } 233 } 234 235 236 for(unsigned int t = 0 ; t < mat->getNumTechniques() ; t++) 237 { 238 Technique* tech = mat->getTechnique(t); 239 240 for(unsigned int p = 0; p< tech->getNumPasses(); p++) 241 { 242 Pass* pass = tech->getPass(p); 243 244 std::vector<IllumTechniqueParams*>& techniques = pass->getIllumTechniques(); 245 std::vector<IllumTechniqueParams*>::iterator i = techniques.begin(); 246 std::vector<IllumTechniqueParams*>::iterator iend = techniques.end(); 247 248 while( i != iend) 249 { 250 IllumTechniqueParams* params = *i; 229 251 createTechnique(params, pass, rend, sharedruns); 230 252 … … 545 567 } 546 568 break; 569 case ILLUMRUN_PM_ENTRYPOINTMAP: 570 if(globalSharedRuns.getRun(ILLUMRUN_PM_ENTRYPOINTMAP) == 0) 571 { 572 OgrePMEntryPointMapRenderingRun* run = new OgrePMEntryPointMapRenderingRun( 573 "PM_ENTRYPOINT_MAP"); 574 globalSharedRuns.addRun(ILLUMRUN_PM_ENTRYPOINTMAP, run); 575 } 576 break; 547 577 } 548 578 } … … 614 644 } 615 645 break; 646 case ILLUMRUN_PM_WEIGHTMAP: 647 if(runs->getRun(ILLUMRUN_PM_WEIGHTMAP) == 0) 648 { 649 SceneManager* sm = Root::getSingleton()._getCurrentSceneManager(); 650 OgrePMWeightComputeRenderingRun* run = new OgrePMWeightComputeRenderingRun( 651 lightName + "PM_WEIGHT_MAP", 652 lightName); 653 runs->addRun(ILLUMRUN_PM_WEIGHTMAP, run); 654 } 655 break; 616 656 } 617 657 } -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreDepthShadowRecieverRenderTechnique.cpp
r2180 r2189 66 66 67 67 TextureUnitState* st = newpass->createTextureUnitState(); 68 st->setTextureFiltering(TFO_ ANISOTROPIC);68 st->setTextureFiltering(TFO_NONE); 69 69 st->setTextureAddressingMode(TextureUnitState::TAM_BORDER); 70 70 st->setTextureBorderColour(ColourValue::White); -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgrePathMapRenderTechnique.cpp
r2185 r2189 2 2 #include "OgreTechniqueGroup.h" 3 3 #include "OgreIlluminationManager.h" 4 #include "OgrePMWeightComputeRenderingRun.h" 5 4 6 5 7 … … 10 12 :RenderTechnique( parentRenderable, parentTechniqueGroup), 11 13 OgreRenderTechnique(pass, parentRenderable, parentTechniqueGroup) 12 { 14 { 13 15 this->clusters = OgreIlluminationManager::getSingleton().getPathMapClusters(parentRenderable->getName()); 14 16 … … 26 28 } 27 29 28 Pass* newpass = techn->createPass();30 Pass* newpass = pathMapPass = techn->createPass(); 29 31 30 32 newpass->setVertexProgram("GTP/PathMap_VS"); … … 46 48 47 49 float halfPixel[2] = {0.5 / prmxres, 0.5 / prmyres}; 48 Fparams->setNamedConstant("prmAtlasTiles",prmnt,2);49 Fparams->setNamedConstant("atlasHalfPixel", halfPixel, 2);50 50 Vector4 pathMapParameters(prmnt[0],prmnt[1],halfPixel[0],halfPixel[1]); 51 Fparams->setNamedConstant("prmAtlasTilesHalfPixel",pathMapParameters); 52 51 53 TextureUnitState* st = newpass->createTextureUnitState(); 52 54 st->setTextureFiltering(TFO_BILINEAR); … … 54 56 st->setTextureBorderColour(ColourValue::Blue); 55 57 st->setTextureName(clusters->pathMapTextureFilename); 56 58 57 59 //newpass->setSceneBlending(SBT_MODULATE); 58 60 newpass->setSceneBlending(SBF_ONE, SBF_ZERO); 61 newpass->setDepthBias(1); 62 59 63 60 newpass->setDepthBias(1);64 61 65 } 62 66 … … 68 72 void OgrePathMapRenderTechnique::update(unsigned long frameNum) 69 73 { 70 //TODO set weights 74 LightList lights; 75 SceneManager* sm = Root::getSingleton()._getCurrentSceneManager(); 76 sm->_populateLightList(Vector3(0,0,0), 1000, lights); //TODO 77 //TODO set weights 78 PathMapClusters* clusters = OgreIlluminationManager::getSingleton().getPathMapClusters(parentOgreRenderable->getName()); 79 float *actualWeights = new float[clusters->count];//TODO = 0 80 for(int i = 0 ; i < 1; i++) 81 { 82 String lightName = lights.at(0)->getName(); 83 OgreIlluminationManager::getSingleton().createPerLightRun(lightName, ILLUMRUN_PM_WEIGHTMAP); 84 OgreIlluminationManager::getSingleton().updatePerLightRun(lightName, ILLUMRUN_PM_WEIGHTMAP, frameNum); 85 OgrePMWeightComputeRenderingRun* PMWeightRun = (OgrePMWeightComputeRenderingRun*) 86 OgreIlluminationManager::getSingleton().getPerLightRun(lightName, ILLUMRUN_PM_WEIGHTMAP)->asOgreRenderingRun(); 87 88 float* weights = PMWeightRun->getWeights(); 89 90 for(int j = 0; j< clusters->count; j++) 91 actualWeights[j] = weights[clusters->clusters[j]]; 92 93 } 94 95 GpuProgramParameters* Fparams = pathMapPass->getFragmentProgramParameters().getPointer(); 96 Fparams->setNamedConstant("weights", actualWeights, clusters->count); 71 97 } 72 98 -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderingRuns/OgreDepthShadowMapRenderingRun.cpp
r2182 r2189 315 315 depthMapCamera->setFOVy(lightangle); 316 316 depthMapCamera->setAspectRatio(1); 317 depthMapCamera->setNearClipDistance( 0.1);317 depthMapCamera->setNearClipDistance(OgreIlluminationManager::getSingleton().getAreaLightRadius()); 318 318 depthMapCamera->setFarClipDistance(1.0); 319 319 }
Note: See TracChangeset
for help on using the changeset viewer.