Changeset 2189


Ignore:
Timestamp:
03/05/07 18:05:16 (17 years ago)
Author:
szirmay
Message:
 
Location:
GTP/trunk/Lib/Illum/IllumModule
Files:
4 added
8 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Illum/IllumModule/IllumModule/include/SharedRuns.h

    r1722 r2189  
    3737        ILLUMRUN_FOCUSING_MAP, 
    3838        ILLUMRUN_LIGHTVOLUME_MAP, 
    39         ILLUMRUN_PHASE_TEXTURE 
     39        ILLUMRUN_PHASE_TEXTURE, 
     40        ILLUMRUN_PM_ENTRYPOINTMAP, 
     41        ILLUMRUN_PM_WEIGHTMAP 
    4042}; 
    4143 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/OgreIlluminationManager.h

    r2185 r2189  
    8484        unsigned int focusingMapSize; 
    8585        unsigned int shadowMapSize; 
     86        float areaLightRadius; 
    8687        bool useLISPSM; 
    8788        bool useVSM; 
     
    347348                this->pathMapEntryPoints.push_back(p); 
    348349        } 
     350        std::vector<PathMapEntryPoint>& getPathMapEntryPoints() 
     351        { 
     352                return pathMapEntryPoints; 
     353        } 
    349354        void addPathMapClusterLength(unsigned int l) 
    350355        { 
    351356                this->pathMapClusterLengths.push_back(l); 
    352357        } 
     358        unsigned int getPathMapClusterLengthsSize() 
     359        { 
     360                return this->pathMapClusterLengths.size(); 
     361        } 
     362        unsigned int getPathMapClusterLength(unsigned int index) 
     363        { 
     364                return pathMapClusterLengths.at(index); 
     365        } 
     366        float getAreaLightRadius(){return areaLightRadius;} 
     367        void setAreaLigtRadius(float radius){areaLightRadius = radius;} 
    353368}; 
    354369 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgrePathMapRenderTechnique.h

    r2185 r2189  
    5555         
    5656protected:       
    57          
     57        Pass* pathMapPass; 
    5858        PathMapClusters* clusters;       
    5959}; 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/scripts/OgreIllumModule.7.10.vcproj

    r2185 r2189  
    205205                                </File> 
    206206                                <File 
     207                                        RelativePath="..\src\RenderingRuns\OgrePMEntryPointMapRenderingRun.cpp"> 
     208                                </File> 
     209                                <File 
     210                                        RelativePath="..\src\RenderingRuns\OgrePMWeightComputeRenderingRun.cpp"> 
     211                                </File> 
     212                                <File 
    207213                                        RelativePath="..\src\RenderingRuns\OgreReducedCubeMapRenderingRun.cpp"> 
    208214                                </File> 
     
    305311                                </File> 
    306312                                <File 
     313                                        RelativePath="..\include\RenderingRuns\OgrePMEntryPointMapRenderingRun.h"> 
     314                                </File> 
     315                                <File 
     316                                        RelativePath="..\include\RenderingRuns\OgrePMWeightComputeRenderingRun.h"> 
     317                                </File> 
     318                                <File 
    307319                                        RelativePath="..\include\RenderingRuns\OgreReducedCubeMapRenderingRun.h"> 
    308320                                </File> 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/OgreIlluminationManager.cpp

    r2185 r2189  
    33#include "OgreBillboardParticleRenderer.h" 
    44#include "SpriteParticleRenderer.h" 
     5#include "OgrePMEntryPointMapRenderingRun.h" 
     6#include "OgrePMWeightComputeRenderingRun.h" 
    57 
    68OgreIlluminationManager* OgreIlluminationManager::instance = NULL; 
     
    8587        blurSM = false; 
    8688        focusingSM = true; 
    87         shadowMapMaterialName = "GameTools/ShadowMapDepth"; 
     89        shadowMapMaterialName = "GTP/Basic/Distance_NormalizedCCW"; 
     90        areaLightRadius = 0.1; 
    8891 
    8992        for(int i = 0; i < RUN_TYPE_COUNT; i++) 
     
    193196                OgreRenderable* rend = 0;        
    194197                OgreTechniqueGroup* group = 0; 
    195          
     198 
    196199                for(unsigned int t = 0 ; t < mat->getNumTechniques() ; t++) 
    197200                { 
     
    203206 
    204207                                std::vector<IllumTechniqueParams*>& techniques = pass->getIllumTechniques(); 
    205                                 std::vector<IllumTechniqueParams*>::iterator i = techniques.begin();  
    206                                 std::vector<IllumTechniqueParams*>::iterator iend = techniques.end(); 
    207                                  
    208                                 while( i != iend) 
     208                                if( techniques.size() > 0) 
    209209                                { 
    210                                         IllumTechniqueParams* params = *i; 
    211                                          
    212210                                        if(rend == 0) 
    213211                                        { 
     
    226224                                                sharedruns->updateBounds(); 
    227225                                        } 
    228                                          
     226                                        String newMaterialName = mat->getName() + rend->getName() + "_clone"; 
     227                                        Material* newMat = mat->clone(newMaterialName).getPointer(); 
     228                                        mat = newMat; 
     229                                        rend->setMaterialName(newMaterialName); 
     230                                        break; 
     231                                } 
     232                        } 
     233                } 
     234 
     235         
     236                for(unsigned int t = 0 ; t < mat->getNumTechniques() ; t++) 
     237                { 
     238                        Technique* tech = mat->getTechnique(t); 
     239 
     240                        for(unsigned int p = 0; p< tech->getNumPasses(); p++) 
     241                        { 
     242                                Pass* pass = tech->getPass(p); 
     243 
     244                                std::vector<IllumTechniqueParams*>& techniques = pass->getIllumTechniques(); 
     245                                std::vector<IllumTechniqueParams*>::iterator i = techniques.begin();  
     246                                std::vector<IllumTechniqueParams*>::iterator iend = techniques.end(); 
     247                                 
     248                                while( i != iend) 
     249                                { 
     250                                        IllumTechniqueParams* params = *i; 
    229251                                        createTechnique(params, pass, rend, sharedruns);  
    230252 
     
    545567                } 
    546568                break; 
     569                case ILLUMRUN_PM_ENTRYPOINTMAP: 
     570                if(globalSharedRuns.getRun(ILLUMRUN_PM_ENTRYPOINTMAP) == 0) 
     571                { 
     572                        OgrePMEntryPointMapRenderingRun* run  = new OgrePMEntryPointMapRenderingRun( 
     573                                "PM_ENTRYPOINT_MAP"); 
     574                        globalSharedRuns.addRun(ILLUMRUN_PM_ENTRYPOINTMAP, run);                         
     575                } 
     576                break; 
    547577        } 
    548578} 
     
    614644                }                
    615645                break; 
     646                case ILLUMRUN_PM_WEIGHTMAP: 
     647                if(runs->getRun(ILLUMRUN_PM_WEIGHTMAP) == 0) 
     648                { 
     649                        SceneManager* sm = Root::getSingleton()._getCurrentSceneManager(); 
     650                        OgrePMWeightComputeRenderingRun* run  = new OgrePMWeightComputeRenderingRun(                             
     651                                lightName + "PM_WEIGHT_MAP", 
     652                                lightName); 
     653                        runs->addRun(ILLUMRUN_PM_WEIGHTMAP, run);                        
     654                }                
     655                break; 
    616656        }        
    617657} 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreDepthShadowRecieverRenderTechnique.cpp

    r2180 r2189  
    6666                 
    6767                TextureUnitState* st = newpass->createTextureUnitState();                
    68                 st->setTextureFiltering(TFO_ANISOTROPIC); 
     68                st->setTextureFiltering(TFO_NONE); 
    6969                st->setTextureAddressingMode(TextureUnitState::TAM_BORDER); 
    7070                st->setTextureBorderColour(ColourValue::White); 
  • 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 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderingRuns/OgreDepthShadowMapRenderingRun.cpp

    r2182 r2189  
    315315                                depthMapCamera->setFOVy(lightangle); 
    316316                                depthMapCamera->setAspectRatio(1); 
    317                                 depthMapCamera->setNearClipDistance(0.1); 
     317                                depthMapCamera->setNearClipDistance(OgreIlluminationManager::getSingleton().getAreaLightRadius()); 
    318318                                depthMapCamera->setFarClipDistance(1.0); 
    319319                        } 
Note: See TracChangeset for help on using the changeset viewer.