Changeset 2218


Ignore:
Timestamp:
03/09/07 10:32:11 (17 years ago)
Author:
szirmay
Message:
 
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  
    5050        Vector4 pathMapParameters(prmnt[0],prmnt[1],halfPixel[0],halfPixel[1]); 
    5151        Fparams->setNamedConstant("prmAtlasTilesHalfPixel",pathMapParameters); 
    52     unsigned int clustercount = OgreIlluminationManager::getSingleton().getPathMapClusterLengthsSize(); 
     52     
     53        unsigned int clustercount = OgreIlluminationManager::getSingleton().getPathMapClusterLengthsSize(); 
    5354        Fparams->setNamedConstant("allClusterCount", (float) clustercount); 
    5455        PathMapClusters* clusters = OgreIlluminationManager::getSingleton().getPathMapClusters(parentOgreRenderable->getName()); 
     
    7475        st->setTextureBorderColour(ColourValue::Blue); 
    7576         
    76         //newpass->setSceneBlending(SBT_MODULATE); 
    77         newpass->setSceneBlending(SBF_ONE, SBF_ZERO); 
     77        newpass->setSceneBlending(SBT_MODULATE); 
     78        //newpass->setSceneBlending(SBF_ONE, SBF_ZERO); 
    7879        newpass->setDepthBias(1); 
    7980         
     
    9091{ 
    9192        PathMapClusters* clusters = OgreIlluminationManager::getSingleton().getPathMapClusters(parentOgreRenderable->getName()); 
    92         int width = clusters->count / 4; 
     93        int width = clusters->count; 
    9394        TexturePtr texPtr = Ogre::TextureManager::getSingleton().createManual(this->parentOgreRenderable->getName() + "_PMWeightIndexTexture",  
    9495                                                                                                                                                "default", 
    95                                                                                                                                                 TEX_TYPE_1D, 
     96                                                                                                                                                TEX_TYPE_2D, 
    9697                                                                                                                                                width, 
    9798                                                                                                                                                1, 
    9899                                                                                                                                                0, 
    99100                                                                                                                                                0, 
    100                                                                                                                                                 PF_FLOAT32_RGBA, 
     101                                                                                                                                                PF_FLOAT32_R, 
    101102                                                                                                                                                TU_DYNAMIC_WRITE_ONLY); 
    102103        weightIndexTexture = texPtr.getPointer(); 
    103104 
    104         float *weightIndices = new float[clusters->count]; 
    105         PixelBox lockBox(width, 1, 1, PF_FLOAT32_RGBA, weightIndices); 
     105        float *weightIndices = new float[width]; 
     106        PixelBox lockBox(width, 1, 1, PF_FLOAT32_R, weightIndices); 
    106107        for(int j = 0; j< clusters->count; j++) 
    107108                        weightIndices[j] = clusters->clusters[j]; 
     
    116117        sm->_populateLightList(Vector3(0,0,0), 1000, lights); //TODO 
    117118//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        */ 
    120124        for(int i = 0 ; i < 1; i++) 
    121125        { 
     
    126130                        OgreIlluminationManager::getSingleton().getPerLightRun(lightName, ILLUMRUN_PM_WEIGHTMAP)->asOgreRenderingRun(); 
    127131 
    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());      */                       
    130150        } 
    131151} 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderingRuns/OgrePMWeightComputeRenderingRun.cpp

    r2214 r2218  
    22#include "OgreIlluminationManager.h" 
    33#include "OgrePMEntryPointMapRenderingRun.h" 
     4#include "OgreDepthShadowMapRenderingRun.h" 
    45 
    56OgrePMWeightComputeRenderingRun::OgrePMWeightComputeRenderingRun(String name, String LightName) 
     
    7475        if(light->getType() == Light::LT_SPOTLIGHT) 
    7576        { 
     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                 
    7682                MaterialPtr mat = MaterialManager::getSingleton().getByName("GTP/PathMap_ComputeWeights"); 
    77  
    7883                GpuProgramParameters* Fparams = mat->getTechnique(0)->getPass(0)->getFragmentProgramParameters().getPointer(); 
    7984                         
     
    8287                //      Radian lightAngle = light->getSpotlightOuterAngle(); 
    8388                         
    84                         //Fparams->setNamedConstant("lightTransform", lightMatrix); 
    8589                        Fparams->setNamedConstant("nRadionColumns", col); 
    8690                        Fparams->setNamedConstant("lightPos", lightPos); 
    8791                        Fparams->setNamedConstant("lightDir", lightDir); 
     92                        Fparams->setNamedConstant("lightViewProj", SMrun->getLightViewProjMatrix()); 
     93                        Fparams->setNamedConstant("lightFarPlane", SMrun->getLightFarPlane()); 
    8894                         
    8995                        mat->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName( 
    9096                                                PMEPrun->getEntryPointTextureName()); 
     97                        mat->getTechnique(0)->getPass(0)->getTextureUnitState(1)->setTextureName( 
     98                                                SMrun->getDepthMapTextureName()); 
    9199                                 
    92100                        RenderTarget* rt = allWeightsTexture->getBuffer().getPointer()->getRenderTarget(); 
    93101                        renderFullscreenQuad(mat->getName(), rt); 
    94102 
    95                         rt->writeContentsToFile("allweights.bmp"); 
     103                //      rt->writeContentsToFile("allweights.bmp"); 
    96104                //      rt->writeContentsToFile("allweights.dds"); 
    97105                         
    98                         float* allweights = new float[entryPointCnt / 4096 * 4096]; 
     106                /*      float* allweights = new float[entryPointCnt / 4096 * 4096]; 
    99107                        PixelBox lockBox(entryPointCnt / 4096, 4096, 1, PF_FLOAT32_R, allweights); 
    100108                        allWeightsTexture->getBuffer()->blitToMemory(lockBox); 
     
    126134                        } 
    127135 
    128                         delete[] allweights; 
     136                        delete[] allweights;*/ 
    129137 
    130138///////////////// 
     
    153161        //rt->writeContentsToFile("weights.bmp");        
    154162        //rt->writeContentsToFile("weights.dds"); 
    155  
     163/* 
    156164        float* weights = new float[clustercount]; 
    157165        PixelBox lockBox(clustercount, 1, 1, PF_FLOAT32_R, weights); 
    158         allWeightsTexture->getBuffer()->blitToMemory(lockBox); 
     166        weightTexture->getBuffer()->blitToMemory(lockBox); 
    159167 
    160         delete[] weights; 
     168        delete[] weights;*/ 
    161169} 
    162170 
Note: See TracChangeset for help on using the changeset viewer.