Ignore:
Timestamp:
03/05/07 18:05:16 (17 years ago)
Author:
szirmay
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgrePathMapRenderTechnique.cpp

    r2185 r2189  
    22#include "OgreTechniqueGroup.h" 
    33#include "OgreIlluminationManager.h" 
     4#include "OgrePMWeightComputeRenderingRun.h" 
     5 
    46 
    57 
     
    1012                                                        :RenderTechnique( parentRenderable, parentTechniqueGroup), 
    1113                                                        OgreRenderTechnique(pass, parentRenderable, parentTechniqueGroup) 
    12 {                
     14{        
    1315        this->clusters = OgreIlluminationManager::getSingleton().getPathMapClusters(parentRenderable->getName()); 
    1416         
     
    2628        } 
    2729         
    28         Pass* newpass = techn->createPass(); 
     30        Pass* newpass = pathMapPass = techn->createPass(); 
    2931         
    3032        newpass->setVertexProgram("GTP/PathMap_VS"); 
     
    4648 
    4749        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                 
    5153        TextureUnitState* st = newpass->createTextureUnitState();                
    5254        st->setTextureFiltering(TFO_BILINEAR); 
     
    5456        st->setTextureBorderColour(ColourValue::Blue); 
    5557        st->setTextureName(clusters->pathMapTextureFilename); 
    56  
     58         
    5759        //newpass->setSceneBlending(SBT_MODULATE); 
    5860        newpass->setSceneBlending(SBF_ONE, SBF_ZERO); 
     61        newpass->setDepthBias(1); 
     62         
    5963 
    60         newpass->setDepthBias(1); 
     64         
    6165} 
    6266 
     
    6872void OgrePathMapRenderTechnique::update(unsigned long frameNum) 
    6973{        
    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); 
    7197} 
    7298 
Note: See TracChangeset for help on using the changeset viewer.