Changeset 2218 for GTP/trunk/Lib/Illum
- Timestamp:
- 03/09/07 10:32:11 (18 years ago)
- Location:
- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgrePathMapRenderTechnique.cpp
r2200 r2218 50 50 Vector4 pathMapParameters(prmnt[0],prmnt[1],halfPixel[0],halfPixel[1]); 51 51 Fparams->setNamedConstant("prmAtlasTilesHalfPixel",pathMapParameters); 52 unsigned int clustercount = OgreIlluminationManager::getSingleton().getPathMapClusterLengthsSize(); 52 53 unsigned int clustercount = OgreIlluminationManager::getSingleton().getPathMapClusterLengthsSize(); 53 54 Fparams->setNamedConstant("allClusterCount", (float) clustercount); 54 55 PathMapClusters* clusters = OgreIlluminationManager::getSingleton().getPathMapClusters(parentOgreRenderable->getName()); … … 74 75 st->setTextureBorderColour(ColourValue::Blue); 75 76 76 //newpass->setSceneBlending(SBT_MODULATE);77 newpass->setSceneBlending(SBF_ONE, SBF_ZERO);77 newpass->setSceneBlending(SBT_MODULATE); 78 //newpass->setSceneBlending(SBF_ONE, SBF_ZERO); 78 79 newpass->setDepthBias(1); 79 80 … … 90 91 { 91 92 PathMapClusters* clusters = OgreIlluminationManager::getSingleton().getPathMapClusters(parentOgreRenderable->getName()); 92 int width = clusters->count / 4;93 int width = clusters->count; 93 94 TexturePtr texPtr = Ogre::TextureManager::getSingleton().createManual(this->parentOgreRenderable->getName() + "_PMWeightIndexTexture", 94 95 "default", 95 TEX_TYPE_ 1D,96 TEX_TYPE_2D, 96 97 width, 97 98 1, 98 99 0, 99 100 0, 100 PF_FLOAT32_R GBA,101 PF_FLOAT32_R, 101 102 TU_DYNAMIC_WRITE_ONLY); 102 103 weightIndexTexture = texPtr.getPointer(); 103 104 104 float *weightIndices = new float[ clusters->count];105 PixelBox lockBox(width, 1, 1, PF_FLOAT32_R GBA, weightIndices);105 float *weightIndices = new float[width]; 106 PixelBox lockBox(width, 1, 1, PF_FLOAT32_R, weightIndices); 106 107 for(int j = 0; j< clusters->count; j++) 107 108 weightIndices[j] = clusters->clusters[j]; … … 116 117 sm->_populateLightList(Vector3(0,0,0), 1000, lights); //TODO 117 118 //TODO set weights 118 119 119 /* 120 unsigned int entryPointCount = OgreIlluminationManager::getSingleton().getPathMapEntryPoints().size(); 121 PathMapClusters* clusters = OgreIlluminationManager::getSingleton().getPathMapClusters(parentOgreRenderable->getName()); 122 int weightTextureWidth = clusters->count / 4; 123 */ 120 124 for(int i = 0 ; i < 1; i++) 121 125 { … … 126 130 OgreIlluminationManager::getSingleton().getPerLightRun(lightName, ILLUMRUN_PM_WEIGHTMAP)->asOgreRenderingRun(); 127 131 128 TextureUnitState* st =pathMapPass->getTextureUnitState(2); 129 st->setTextureName(PMWeightRun->getPMWeightTetureName()); 132 TextureUnitState* st = pathMapPass->getTextureUnitState(2); 133 st->setTextureName(PMWeightRun->getPMWeightTetureName()); 134 135 /* 136 TexturePtr tex = TextureManager::getSingleton().getByName(PMWeightRun->getPMWeightTetureName()); 137 float *allClusterWeights = new float[entryPointCount]; 138 PixelBox lockBox(entryPointCount, 1, 1, PF_FLOAT32_R, allClusterWeights); 139 tex->getBuffer()->blitToMemory(lockBox); 140 141 float *weightIndices = new float[clusters->count]; 142 for(int j = 0; j< clusters->count; j++) 143 weightIndices[j] = allClusterWeights[clusters->clusters[j]]; 144 145 PixelBox lockBox2(weightTextureWidth, 1, 1, PF_FLOAT32_RGBA, weightIndices); 146 weightIndexTexture->getBuffer()->blitFromMemory(lockBox2); 147 148 TextureUnitState* st = pathMapPass->getTextureUnitState(1); 149 st->setTextureName(weightIndexTexture->getName()); */ 130 150 } 131 151 } -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderingRuns/OgrePMWeightComputeRenderingRun.cpp
r2214 r2218 2 2 #include "OgreIlluminationManager.h" 3 3 #include "OgrePMEntryPointMapRenderingRun.h" 4 #include "OgreDepthShadowMapRenderingRun.h" 4 5 5 6 OgrePMWeightComputeRenderingRun::OgrePMWeightComputeRenderingRun(String name, String LightName) … … 74 75 if(light->getType() == Light::LT_SPOTLIGHT) 75 76 { 77 OgreIlluminationManager::getSingleton().createPerLightRun(light->getName(), ILLUMRUN_DEPTH_SHADOWMAP); 78 OgreIlluminationManager::getSingleton().updatePerLightRun(light->getName(), ILLUMRUN_DEPTH_SHADOWMAP, frameNum); 79 OgreDepthShadowMapRenderingRun* SMrun = (OgreDepthShadowMapRenderingRun*) OgreIlluminationManager::getSingleton() 80 .getPerLightRun(light->getName(), ILLUMRUN_DEPTH_SHADOWMAP)->asOgreRenderingRun(); 81 76 82 MaterialPtr mat = MaterialManager::getSingleton().getByName("GTP/PathMap_ComputeWeights"); 77 78 83 GpuProgramParameters* Fparams = mat->getTechnique(0)->getPass(0)->getFragmentProgramParameters().getPointer(); 79 84 … … 82 87 // Radian lightAngle = light->getSpotlightOuterAngle(); 83 88 84 //Fparams->setNamedConstant("lightTransform", lightMatrix);85 89 Fparams->setNamedConstant("nRadionColumns", col); 86 90 Fparams->setNamedConstant("lightPos", lightPos); 87 91 Fparams->setNamedConstant("lightDir", lightDir); 92 Fparams->setNamedConstant("lightViewProj", SMrun->getLightViewProjMatrix()); 93 Fparams->setNamedConstant("lightFarPlane", SMrun->getLightFarPlane()); 88 94 89 95 mat->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName( 90 96 PMEPrun->getEntryPointTextureName()); 97 mat->getTechnique(0)->getPass(0)->getTextureUnitState(1)->setTextureName( 98 SMrun->getDepthMapTextureName()); 91 99 92 100 RenderTarget* rt = allWeightsTexture->getBuffer().getPointer()->getRenderTarget(); 93 101 renderFullscreenQuad(mat->getName(), rt); 94 102 95 rt->writeContentsToFile("allweights.bmp");103 // rt->writeContentsToFile("allweights.bmp"); 96 104 // rt->writeContentsToFile("allweights.dds"); 97 105 98 float* allweights = new float[entryPointCnt / 4096 * 4096];106 /* float* allweights = new float[entryPointCnt / 4096 * 4096]; 99 107 PixelBox lockBox(entryPointCnt / 4096, 4096, 1, PF_FLOAT32_R, allweights); 100 108 allWeightsTexture->getBuffer()->blitToMemory(lockBox); … … 126 134 } 127 135 128 delete[] allweights; 136 delete[] allweights;*/ 129 137 130 138 ///////////////// … … 153 161 //rt->writeContentsToFile("weights.bmp"); 154 162 //rt->writeContentsToFile("weights.dds"); 155 163 /* 156 164 float* weights = new float[clustercount]; 157 165 PixelBox lockBox(clustercount, 1, 1, PF_FLOAT32_R, weights); 158 allWeightsTexture->getBuffer()->blitToMemory(lockBox);166 weightTexture->getBuffer()->blitToMemory(lockBox); 159 167 160 delete[] weights; 168 delete[] weights;*/ 161 169 } 162 170
Note: See TracChangeset
for help on using the changeset viewer.