Ignore:
Timestamp:
03/09/07 10:32:11 (17 years ago)
Author:
szirmay
Message:
 
File:
1 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} 
Note: See TracChangeset for help on using the changeset viewer.