- Timestamp:
- 03/07/07 17:34:13 (18 years ago)
- Location:
- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreCausticCasterRenderTechnique.cpp
r2027 r2200 30 30 this->blurCauCubeMap = blurCauCubeMap; 31 31 32 String newMaterialName = causticMapMaterialName + parentRenderable->getName() + "_clone";32 String newMaterialName = causticMapMaterialName + "_clone_" + parentRenderable->getName(); 33 33 Material* mat = (Material*) MaterialManager::getSingleton().getByName(causticMapMaterialName).getPointer(); 34 34 Material* newMat = mat->clone(newMaterialName).getPointer(); -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgrePathMapRenderTechnique.cpp
r2189 r2200 50 50 Vector4 pathMapParameters(prmnt[0],prmnt[1],halfPixel[0],halfPixel[1]); 51 51 Fparams->setNamedConstant("prmAtlasTilesHalfPixel",pathMapParameters); 52 52 unsigned int clustercount = OgreIlluminationManager::getSingleton().getPathMapClusterLengthsSize(); 53 Fparams->setNamedConstant("allClusterCount", (float) clustercount); 54 PathMapClusters* clusters = OgreIlluminationManager::getSingleton().getPathMapClusters(parentOgreRenderable->getName()); 55 Fparams->setNamedConstant("clusterCount", (float) clusters->count); 56 53 57 TextureUnitState* st = newpass->createTextureUnitState(); 54 58 st->setTextureFiltering(TFO_BILINEAR); 55 59 st->setTextureAddressingMode(TextureUnitState::TAM_BORDER); 60 st->setTextureBorderColour(ColourValue::Green); 61 st->setTextureName(clusters->pathMapTextureFilename); 62 63 createWeightIndexTexture(); 64 65 st = newpass->createTextureUnitState(); 66 st->setTextureFiltering(TFO_NONE); 67 st->setTextureAddressingMode(TextureUnitState::TAM_BORDER); 68 st->setTextureBorderColour(ColourValue::Red); 69 st->setTextureName(weightIndexTexture->getName()); 70 71 st = newpass->createTextureUnitState(); 72 st->setTextureFiltering(TFO_NONE); 73 st->setTextureAddressingMode(TextureUnitState::TAM_BORDER); 56 74 st->setTextureBorderColour(ColourValue::Blue); 57 st->setTextureName(clusters->pathMapTextureFilename);58 75 59 76 //newpass->setSceneBlending(SBT_MODULATE); … … 70 87 } 71 88 89 void OgrePathMapRenderTechnique::createWeightIndexTexture() 90 { 91 PathMapClusters* clusters = OgreIlluminationManager::getSingleton().getPathMapClusters(parentOgreRenderable->getName()); 92 int width = clusters->count / 4; 93 TexturePtr texPtr = Ogre::TextureManager::getSingleton().createManual(this->parentOgreRenderable->getName() + "_PMWeightIndexTexture", 94 "default", 95 TEX_TYPE_1D, 96 width, 97 1, 98 0, 99 0, 100 PF_FLOAT32_RGBA, 101 TU_DYNAMIC_WRITE_ONLY); 102 weightIndexTexture = texPtr.getPointer(); 103 104 float *weightIndices = new float[clusters->count]; 105 PixelBox lockBox(width, 1, 1, PF_FLOAT32_RGBA, weightIndices); 106 for(int j = 0; j< clusters->count; j++) 107 weightIndices[j] = clusters->clusters[j]; 108 weightIndexTexture->getBuffer()->blitFromMemory(lockBox); 109 delete[] weightIndices; 110 } 111 72 112 void OgrePathMapRenderTechnique::update(unsigned long frameNum) 73 113 { … … 76 116 sm->_populateLightList(Vector3(0,0,0), 1000, lights); //TODO 77 117 //TODO set weights 78 PathMapClusters* clusters = OgreIlluminationManager::getSingleton().getPathMapClusters(parentOgreRenderable->getName());79 float *actualWeights = new float[clusters->count];//TODO = 0118 119 80 120 for(int i = 0 ; i < 1; i++) 81 121 { … … 86 126 OgreIlluminationManager::getSingleton().getPerLightRun(lightName, ILLUMRUN_PM_WEIGHTMAP)->asOgreRenderingRun(); 87 127 88 float* weights = PMWeightRun->getWeights(); 89 90 for(int j = 0; j< clusters->count; j++) 91 actualWeights[j] = weights[clusters->clusters[j]]; 92 128 TextureUnitState* st =pathMapPass->getTextureUnitState(2); 129 st->setTextureName(PMWeightRun->getPMWeightTetureName()); 93 130 } 94 95 GpuProgramParameters* Fparams = pathMapPass->getFragmentProgramParameters().getPointer();96 Fparams->setNamedConstant("weights", actualWeights, clusters->count);97 131 } 98 132
Note: See TracChangeset
for help on using the changeset viewer.