Changeset 2397


Ignore:
Timestamp:
05/28/07 16:30:37 (17 years ago)
Author:
szirmay
Message:
 
Location:
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule
Files:
14 edited

Legend:

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

    r2379 r2397  
    7777        */ 
    7878        void createTechnique(IllumTechniqueParams* params, Pass* pass, OgreRenderable* rend, OgreSharedRuns* sRuns); 
     79        bool needMaterialCopyForTechnique(IllumTechniqueParams* params); 
    7980        /** 
    8081                @brief A helper function to find the renderable object attached to a particle system (ONLY BILLBOARDSETS ARE SUPPORTED). 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/OgreRenderTechnique.h

    r2320 r2397  
    4646                //inherited 
    4747                virtual OgreRenderTechnique* asOgreRenderTechnique(){return this;} 
    48                                  
     48                                 
    4949        protected: 
    5050                /** 
     
    112112                                                                                OgreRenderable* parentRenderable, 
    113113                                                                                OgreTechniqueGroup* parentTechniqueGroup) = 0; 
     114 
     115        virtual bool needMaterialCopy(IllumTechniqueParams* params){return false;} 
    114116        /** 
    115117                @brief parses parameters from the material file. 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreCausticReceiverRenderTechnique.h

    r2366 r2397  
    117117                                                                                OgreTechniqueGroup* parentTechniqueGroup); 
    118118 
     119        virtual bool needMaterialCopy(IllumTechniqueParams* params){return true;} 
    119120 
    120121        int maxcasters; 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreCubeMapRenderTechnique.h

    r2355 r2397  
    135135 
    136136        void resetParams(); 
    137          
     137        virtual bool needMaterialCopy(IllumTechniqueParams* params){return true;} 
     138 
    138139        unsigned long startFrame; 
    139140        unsigned long cubeMapUpdateInterval; 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreDepthShadowReceiverRenderTechnique.h

    r2366 r2397  
    6969                                                        bool createNewPasses, 
    7070                                                        int startTextureUnitID, 
     71                                                        bool nearestLightsFromCamera, 
    7172                                                        Pass* pass, 
    7273                                                        OgreRenderable* parentRenderable, 
     
    144145        bool createNewPasses; 
    145146        int startTextureUnitID; 
     147        bool nearestLightsFromCamera; 
    146148}; 
    147149 
     
    160162                                                                                OgreTechniqueGroup* parentTechniqueGroup); 
    161163 
     164        virtual bool needMaterialCopy(IllumTechniqueParams* params); 
    162165 
    163166        int maxlights; 
     
    176179        bool createNewPasses; 
    177180        int startTextureUnitID; 
     181        bool nearestLightsFromCamera; 
    178182}; 
    179183 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreHierarchicalParticleSystemTechnique.h

    r2320 r2397  
    123123                                                                                OgreTechniqueGroup* parentTechniqueGroup); 
    124124 
     125        virtual bool needMaterialCopy(IllumTechniqueParams* params){return true;} 
    125126 
    126127        unsigned long impostorUpdateInterval; 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreIllumVolumeRenderTechnique.h

    r2320 r2397  
    9696                                                                                OgreTechniqueGroup* parentTechniqueGroup); 
    9797 
     98        virtual bool needMaterialCopy(IllumTechniqueParams* params){return true;} 
    9899 
    99100        String materialName; 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgrePathMapRenderTechnique.h

    r2366 r2397  
    9191                                                                                OgreTechniqueGroup* parentTechniqueGroup); 
    9292 
     93        virtual bool needMaterialCopy(IllumTechniqueParams* params){return true;} 
     94 
    9395        SceneBlendFactor passBlendingSRC; 
    9496        SceneBlendFactor passBlendingDEST; 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreSBBRenderTechnique.h

    r2320 r2397  
    3434        */ 
    3535        OgreSBBRenderTechnique( unsigned char depthTexID, 
     36                                                        bool bindTexture, 
    3637                                                        Pass* pass, 
    3738                                                        OgreRenderable* parentRenderable, 
     
    5859        */ 
    5960        unsigned char depthTexID; 
    60  
     61        bool bindTexture; 
    6162        bool lastVisibility; 
    6263         
     
    7980 
    8081        unsigned char depthTexID; 
    81  
     82        bool bindTexture; 
    8283}; 
    8384 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/OgreIlluminationManager.cpp

    r2379 r2397  
    312312                OgreTechniqueGroup* group = 0; 
    313313 
     314                bool materialCopied = false; 
    314315                for(unsigned int t = 0 ; t < mat->getNumTechniques() ; t++) 
    315316                { 
     
    323324                                if( techniques.size() > 0) 
    324325                                { 
     326                                        bool needMaterialCopy = false; 
     327 
     328                                        std::vector<IllumTechniqueParams*>::iterator it = techniques.begin(); 
     329                                        std::vector<IllumTechniqueParams*>::iterator itend = techniques.end(); 
     330                                        while(it!=itend) 
     331                                        { 
     332                                                needMaterialCopy = needMaterialCopy || needMaterialCopyForTechnique(*it); 
     333                                                it++; 
     334                                        } 
     335 
    325336                                        if(rend == 0) 
    326337                                        { 
     
    339350                                                sharedruns->updateBounds(); 
    340351                                        } 
    341                                         String newMaterialName = mat->getName() + "_clone_" + rend->getName(); 
    342                                         Material* newMat = mat->clone(newMaterialName).getPointer(); 
    343                                         rend->setMaterialName(newMaterialName); 
    344                                         mat = sube->getMaterial().getPointer(); 
    345                                         break; 
     352 
     353                                        if(needMaterialCopy) 
     354                                        { 
     355                                                String newMaterialName = mat->getName() + "_clone_" + rend->getName(); 
     356                                                Material* newMat = mat->clone(newMaterialName).getPointer(); 
     357                                                rend->setMaterialName(newMaterialName); 
     358                                                mat = sube->getMaterial().getPointer(); 
     359                                                materialCopied = true; 
     360                                        } 
     361                                         
     362                                        if(materialCopied) 
     363                                                break; 
    346364                                } 
    347365                        } 
     
    495513        } 
    496514} 
     515 
     516bool OgreIlluminationManager::needMaterialCopyForTechnique(IllumTechniqueParams* params) 
     517{ 
     518        std::list<RenderTechniqueFactory*>::iterator it = techniqueFactories.begin(); 
     519        std::list<RenderTechniqueFactory*>::iterator itend = techniqueFactories.end(); 
     520                         
     521        while(it != itend) 
     522        { 
     523                RenderTechniqueFactory* factory = *it; 
     524                 
     525                if(factory->isType(params->getTypeName())) 
     526                        return factory->needMaterialCopy(params); 
     527 
     528                it++; 
     529        } 
     530} 
     531 
    497532void OgreIlluminationManager::preAllUpdates() 
    498533{ 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreDepthShadowReceiverRenderTechnique.cpp

    r2372 r2397  
    1919                                                                                                SceneBlendFactor passBlendingDEST, 
    2020                                                                                                bool createNewPasses, 
    21                                                                                                 int startTextureUnitID,                                                  
     21                                                                                                int startTextureUnitID, 
     22                                                                                                bool nearestLightsFromCamera, 
    2223                                                                                                Pass* pass, 
    2324                                                                                                OgreRenderable* parentRenderable, 
     
    4243        this->createNewPasses = createNewPasses; 
    4344        this->startTextureUnitID = startTextureUnitID; 
     45 
     46        this->nearestLightsFromCamera = nearestLightsFromCamera; 
    4447                                                         
    4548        if(createNewPasses) 
     
    8689{ 
    8790        LightList lights; 
     91        Vector3 center = OgreIlluminationManager::getSingleton().getMainCamera()->getWorldPosition(); 
     92        if(!nearestLightsFromCamera) 
     93                center = ((OgreSharedRuns*) sharedRuns)->getRootPosition(); 
    8894        Root::getSingleton()._getCurrentSceneManager()->_populateLightList( 
    89                                                 ((OgreSharedRuns*) sharedRuns)->getRootPosition(), 
     95                                                        center, 
    9096                                                        100000.0, 
    9197                                                        lights); 
     
    336342                f->startTextureUnitID =  StringConverter::parseInt(params); 
    337343        } 
     344        void parseNearestFromCamera(String& params, RenderTechniqueFactory* factory) 
     345        { 
     346                OgreDepthShadowReceiverRenderTechniqueFactory* f = (OgreDepthShadowReceiverRenderTechniqueFactory*) factory; 
     347                f->nearestLightsFromCamera = StringConverter::parseBool(params); 
     348        } 
    338349} 
    339350 
     
    358369        this->attributeParsers.insert(AttribParserList::value_type("new_passes", (ILLUM_ATTRIBUTE_PARSER) parseCreateNewPasses)); 
    359370        this->attributeParsers.insert(AttribParserList::value_type("start_tex_id", (ILLUM_ATTRIBUTE_PARSER) parseStartTexID));   
     371        this->attributeParsers.insert(AttribParserList::value_type("nearest_from_camera", (ILLUM_ATTRIBUTE_PARSER) parseNearestFromCamera));     
    360372} 
    361373 
     
    382394        createNewPasses = true; 
    383395        startTextureUnitID = 0; 
     396        nearestLightsFromCamera = true; 
    384397         
    385398        parseParams(params); 
     
    401414                                                                                                createNewPasses, 
    402415                                                                                                startTextureUnitID, 
     416                                                                                                nearestLightsFromCamera, 
    403417                                                                                                pass, 
    404418                                                                                                parentRenderable, 
     
    408422} 
    409423 
     424bool OgreDepthShadowReceiverRenderTechniqueFactory::needMaterialCopy(IllumTechniqueParams* params) 
     425{ 
     426        nearestLightsFromCamera = true; 
     427        parseParams(params); 
     428        if(nearestLightsFromCamera) 
     429                return false; 
     430        else 
     431                 return true; 
     432} 
     433 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreHierarchicalParticleSystemTechnique.cpp

    r1425 r2397  
    3434        this->useVParam = useVParam; 
    3535        this->useFParam = useFParam; 
    36          
     36                 
    3737        //create the Particle system 
    3838        childPSysName = parentOgreRenderable->getName() + "_small_PSYS"; 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgrePathMapRenderTechnique.cpp

    r2366 r2397  
    2323 
    2424        this->clusters = OgreIlluminationManager::getSingleton().getPathMapClusters(parentRenderable->getName()); 
    25          
    2625        Pass* passToSet = pass; 
    2726 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreSBBRenderTechnique.cpp

    r2379 r2397  
    66 
    77OgreSBBRenderTechnique::OgreSBBRenderTechnique( unsigned char depthTexID, 
     8                                                                                           bool bindTexture, 
    89                                                                                                Pass* pass, 
    910                                                                                                OgreRenderable* parentRenderable, 
     
    1415{ 
    1516        this->depthTexID = depthTexID; 
     17        this->bindTexture = bindTexture; 
    1618         
    1719        OgreIlluminationManager::getSingleton().createGlobalRun(ILLUMRUN_SCENE_CAMERA_DEPTH);    
     
    2527        OgreIlluminationManager::getSingleton().addUpdateListener(this); 
    2628         
     29        if(bindTexture) 
    2730        pass->getTextureUnitState(depthTexID)->setTextureName(run->getDepthTextureName()); 
    2831         
     
    7073                f->depthTexID =  StringConverter::parseUnsignedInt(params); 
    7174        } 
     75        void parseBindTexture(String& params, RenderTechniqueFactory* factory) 
     76        { 
     77                OgreSBBRenderTechniqueFactory* f = (OgreSBBRenderTechniqueFactory*) factory; 
     78                f->bindTexture =  StringConverter::parseBool(params); 
     79        } 
    7280} 
    7381 
     
    8088        //register parsers 
    8189        this->attributeParsers.insert(AttribParserList::value_type("texture_unit_id", (ILLUM_ATTRIBUTE_PARSER) parseDepthTexID)); 
     90        this->attributeParsers.insert(AttribParserList::value_type("bind_texture", (ILLUM_ATTRIBUTE_PARSER) parseBindTexture)); 
    8291} 
    8392 
     
    9099        //reset parameters 
    91100        depthTexID = 1; 
    92          
     101        bindTexture = true; 
     102 
    93103        parseParams(params); 
    94104 
    95105        OgreSBBRenderTechnique* result = new OgreSBBRenderTechnique( 
    96106                                                                                                depthTexID, 
     107                                                                                                bindTexture, 
    97108                                                                                                pass, 
    98109                                                                                                parentRenderable, 
Note: See TracChangeset for help on using the changeset viewer.