Changeset 2299


Ignore:
Timestamp:
03/29/07 13:27:53 (17 years ago)
Author:
szirmay
Message:
 
Location:
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule
Files:
7 edited

Legend:

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

    r2285 r2299  
    9494        */ 
    9595        bool blurCauCubeMap; 
    96          
     96                 
    9797        //inherited 
    9898        void photonMapRunChanged(RenderingRun* run); 
     
    137137        bool useDistance; 
    138138        bool useTriangles; 
    139         bool blurCauCubeMap; 
     139        bool blurCauCubeMap;     
    140140}; 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreCausticReceiverRenderTechnique.h

    r2285 r2299  
    3838                @param causticFragmentProgram   the fragment program to be used in the caustic gathering passes. 
    3939                                                                                It should have one pass and the caustic cubemap of a caster will be bound to the first sampler unit.  
     40                @param passBlendingSRC                          source blend factor of the new passes 
     41                @param passBlendingDEST                         destination blend factor of the new passes 
    4042                @param pass                                             the pass after which caustic gathering passes should be added 
    4143                @param parentRenderable                 the object to operate on 
     
    4648                                                        String causticVertexProgram, 
    4749                                                        String causticFragmentProgram, 
     50                                                        SceneBlendFactor passBlendingSRC, 
     51                                                        SceneBlendFactor passBlendingDEST, 
    4852                                                        Pass* pass, 
    4953                                                        OgreRenderable* parentRenderable, 
     
    8185        */ 
    8286        std::vector<OgreSharedRuns*> causticCasters; 
    83          
     87        /** 
     88                @brief source blend factor of the new passes 
     89        */ 
     90        SceneBlendFactor passBlendingSRC; 
     91        /** 
     92                @brief destination blend factor of the new passes 
     93        */ 
     94        SceneBlendFactor passBlendingDEST; 
    8495}; 
    8596 
     
    102113        String causticVertexProgram; 
    103114        String causticFragmentProgram; 
    104  
     115        SceneBlendFactor passBlendingSRC; 
     116        SceneBlendFactor passBlendingDEST; 
    105117}; 
    106118 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreDepthShadowReceiverRenderTechnique.h

    r2285 r2299  
    4747                @param lightViewParamName       the name of the gpu program parameter the light space view matrix should be bound to 
    4848                @param lightFarPlaneParamName   the name of the gpu program parameter the light space projection far plane should be bound to 
     49                @param passBlendingSRC                          source blend factor of the new passes 
     50                @param passBlendingDEST                         destination blend factor of the new passes 
    4951                @param pass                                             the pass after which shadowing passes should be added 
    5052                @param parentRenderable                 the object to operate on 
     
    6365                                                        String lightViewParamName, 
    6466                                                        String lightFarPlaneParamName, 
     67                                                        SceneBlendFactor passBlendingSRC, 
     68                                                        SceneBlendFactor passBlendingDEST, 
    6569                                                        Pass* pass, 
    6670                                                        OgreRenderable* parentRenderable, 
     
    128132        */ 
    129133        String WorldParamName; 
    130                                                                                                  
     134        /** 
     135                @brief source blend factor of the new passes 
     136        */ 
     137        SceneBlendFactor passBlendingSRC; 
     138        /** 
     139                @brief destination blend factor of the new passes 
     140        */ 
     141        SceneBlendFactor passBlendingDEST;                                                                                       
    131142}; 
    132143 
     
    157168        String WorldViewProjParamName; 
    158169        String WorldParamName; 
     170        SceneBlendFactor passBlendingSRC; 
     171        SceneBlendFactor passBlendingDEST; 
    159172}; 
    160173 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgrePathMapRenderTechnique.h

    r2240 r2299  
    2525                @brief Constructor. 
    2626 
     27                @param passBlendingSRC                  source blend factor of the new pass 
     28                @param passBlendingDEST                 destination blend factor of the new pass 
    2729                @param pass                                             the pass after which shadowing passes should be added 
    2830                @param parentRenderable                 the object to operate on 
    2931                @param parentTechniqueGroup             the TechniqueGroup this RenderedTechnique is attached to 
    3032        */ 
    31         OgrePathMapRenderTechnique(Pass* pass, 
     33        OgrePathMapRenderTechnique( 
     34                                                        SceneBlendFactor passBlendingSRC, 
     35                                                        SceneBlendFactor passBlendingDEST, 
     36                                                        Pass* pass, 
    3237                                                        OgreRenderable* parentRenderable, 
    3338                                                        OgreTechniqueGroup* parentTechniqueGroup 
     
    5863        */ 
    5964        void createWeightIndexTexture(); 
     65        /** 
     66                @brief source blend factor of the new pass 
     67        */ 
     68        SceneBlendFactor passBlendingSRC; 
     69        /** 
     70                @brief destination blend factor of the new pass 
     71        */ 
     72        SceneBlendFactor passBlendingDEST; 
    6073}; 
    6174 
     
    7386                                                                                OgreRenderable* parentRenderable, 
    7487                                                                                OgreTechniqueGroup* parentTechniqueGroup); 
     88 
     89        SceneBlendFactor passBlendingSRC; 
     90        SceneBlendFactor passBlendingDEST; 
    7591}; 
    7692 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreCausticReceiverRenderTechnique.cpp

    r2285 r2299  
    99                                                                                                String causticVertexProgram, 
    1010                                                                                                String causticFragmentProgram, 
     11                                                                                                SceneBlendFactor passBlendingSRC, 
     12                                                                                                SceneBlendFactor passBlendingDEST, 
    1113                                                                                                Pass* pass, 
    1214                                                                                                OgreRenderable* parentRenderable, 
     
    1618                                                        CausticReceiverRenderTechnique(parentRenderable, parentTechniqueGroup) 
    1719{ 
     20        this->passBlendingSRC = passBlendingSRC; 
     21        this->passBlendingDEST = passBlendingDEST; 
    1822        this->maxcasters = maxcasters; 
    1923        this->causticVertexProgram = causticVertexProgram; 
     
    5761                st2->setTextureFiltering(TFO_BILINEAR); 
    5862 
    59                 newpass->setSceneBlending(SBF_DEST_COLOUR, SBF_ONE); 
    60                 //newpass->setSceneBlending(SBF_ONE, SBF_ZERO); 
    61                 newpass->setDepthBias(1); 
    62                 //newpass->setSceneBlending(SBT_ADD); 
     63                newpass->setSceneBlending(passBlendingSRC, passBlendingDEST); 
     64                newpass->setDepthBias(1);                
    6365                 
    6466                techn->movePass(lastpass, index);                        
     
    138140        } 
    139141         
     142        SceneBlendFactor convertBlendFactor(const String& param) 
     143    { 
     144        if (param == "one") 
     145            return SBF_ONE; 
     146        else if (param == "zero") 
     147            return SBF_ZERO; 
     148        else if (param == "dest_colour") 
     149            return SBF_DEST_COLOUR; 
     150        else if (param == "src_colour") 
     151            return SBF_SOURCE_COLOUR; 
     152        else if (param == "one_minus_dest_colour") 
     153            return SBF_ONE_MINUS_DEST_COLOUR; 
     154        else if (param == "one_minus_src_colour") 
     155            return SBF_ONE_MINUS_SOURCE_COLOUR; 
     156        else if (param == "dest_alpha") 
     157            return SBF_DEST_ALPHA; 
     158        else if (param == "src_alpha") 
     159            return SBF_SOURCE_ALPHA; 
     160        else if (param == "one_minus_dest_alpha") 
     161            return SBF_ONE_MINUS_DEST_ALPHA; 
     162        else if (param == "one_minus_src_alpha") 
     163            return SBF_ONE_MINUS_SOURCE_ALPHA;        
     164    } 
     165 
     166        void parsePassBlending(String& params, RenderTechniqueFactory* factory) 
     167        { 
     168                OgreCausticReceiverRenderTechniqueFactory* f = (OgreCausticReceiverRenderTechniqueFactory*) factory; 
     169                StringVector vecparams = StringUtil::split(params, " \t"); 
     170                if(vecparams.size() == 1) 
     171                { 
     172                        if (vecparams[0] == "none") 
     173                        { 
     174                f->passBlendingSRC =  SBF_ONE; 
     175                                f->passBlendingDEST = SBF_ZERO; 
     176                        } 
     177                        if (vecparams[0] == "add") 
     178                        { 
     179                f->passBlendingSRC =  SBF_ONE; 
     180                                f->passBlendingDEST = SBF_ONE; 
     181                        } 
     182            else if (vecparams[0] == "modulate") 
     183            { 
     184                                f->passBlendingSRC =  SBF_DEST_COLOUR; 
     185                                f->passBlendingDEST = SBF_ZERO; 
     186                        } 
     187                        else if (vecparams[0] == "colour_blend") 
     188                        { 
     189                                f->passBlendingSRC =  SBF_SOURCE_COLOUR; 
     190                                f->passBlendingDEST = SBF_ONE_MINUS_SOURCE_COLOUR; 
     191                        } 
     192            else if (vecparams[0] == "alpha_blend") 
     193            { 
     194                f->passBlendingSRC =  SBF_SOURCE_ALPHA; 
     195                                f->passBlendingDEST = SBF_ONE_MINUS_SOURCE_ALPHA; 
     196                        }             
     197                } 
     198                else if (vecparams.size() == 2) 
     199                { 
     200                  f->passBlendingSRC =  convertBlendFactor(vecparams[0]); 
     201                  f->passBlendingDEST = convertBlendFactor(vecparams[1]) ; 
     202                }                
     203        }        
    140204} 
    141205OgreCausticReceiverRenderTechniqueFactory::OgreCausticReceiverRenderTechniqueFactory() 
     
    148212        this->attributeParsers.insert(AttribParserList::value_type("vertex_program_name", (ILLUM_ATTRIBUTE_PARSER) parseVertexProgram)); 
    149213        this->attributeParsers.insert(AttribParserList::value_type("fragment_program_name", (ILLUM_ATTRIBUTE_PARSER) parseFragmentProgram)); 
     214        this->attributeParsers.insert(AttribParserList::value_type("pass_blending", (ILLUM_ATTRIBUTE_PARSER) parsePassBlending)); 
    150215         
    151216} 
     
    161226        causticVertexProgram = "GTP/Basic/Shaded_VS"; 
    162227        causticFragmentProgram = "GTP/Caustic/GatherCaustic_Cube_PS"; 
     228        passBlendingSRC = SBF_DEST_COLOUR; 
     229        passBlendingDEST = SBF_ONE; 
    163230 
    164231        parseParams(params); 
     
    168235                                                                                                causticVertexProgram, 
    169236                                                                                                causticFragmentProgram, 
     237                                                                                                passBlendingSRC, 
     238                                                                                                passBlendingDEST, 
    170239                                                                                                pass, 
    171240                                                                                                parentRenderable, 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreDepthShadowReceiverRenderTechnique.cpp

    r2297 r2299  
    1616                                                                                                String lightViewParamName, 
    1717                                                                                                String lightFarPlaneParamName, 
     18                                                                                                SceneBlendFactor passBlendingSRC, 
     19                                                                                                SceneBlendFactor passBlendingDEST, 
    1820                                                                                                Pass* pass, 
    1921                                                                                                OgreRenderable* parentRenderable, 
     
    2325                                                        DepthShadowReceiverRenderTechnique(parentRenderable, parentTechniqueGroup) 
    2426{ 
     27        this->passBlendingSRC = passBlendingSRC; 
     28        this->passBlendingDEST = passBlendingDEST; 
    2529        this->maxlights = maxlights; 
    2630        this->shadowVertexProgram = shadowVertexProgram ; 
     
    7074                st->setTextureBorderColour(ColourValue::White); 
    7175 
    72                 newpass->setSceneBlending(SBT_MODULATE); 
    73                 //newpass->setSceneBlending(SBF_ONE, SBF_ZERO); 
    74  
     76                newpass->setSceneBlending(passBlendingSRC, passBlendingDEST); 
     77                 
    7578                newpass->setDepthBias(1); 
    7679                techn->movePass(lastpass, index);                        
     
    219222                f->lightFarPlaneParamName =  params; 
    220223        } 
     224 
     225        SceneBlendFactor convertBlendFactor(const String& param) 
     226    { 
     227        if (param == "one") 
     228            return SBF_ONE; 
     229        else if (param == "zero") 
     230            return SBF_ZERO; 
     231        else if (param == "dest_colour") 
     232            return SBF_DEST_COLOUR; 
     233        else if (param == "src_colour") 
     234            return SBF_SOURCE_COLOUR; 
     235        else if (param == "one_minus_dest_colour") 
     236            return SBF_ONE_MINUS_DEST_COLOUR; 
     237        else if (param == "one_minus_src_colour") 
     238            return SBF_ONE_MINUS_SOURCE_COLOUR; 
     239        else if (param == "dest_alpha") 
     240            return SBF_DEST_ALPHA; 
     241        else if (param == "src_alpha") 
     242            return SBF_SOURCE_ALPHA; 
     243        else if (param == "one_minus_dest_alpha") 
     244            return SBF_ONE_MINUS_DEST_ALPHA; 
     245        else if (param == "one_minus_src_alpha") 
     246            return SBF_ONE_MINUS_SOURCE_ALPHA;        
     247    } 
     248 
     249        void parsePassBlending(String& params, RenderTechniqueFactory* factory) 
     250        { 
     251                OgreDepthShadowReceiverRenderTechniqueFactory* f = (OgreDepthShadowReceiverRenderTechniqueFactory*) factory; 
     252                StringVector vecparams = StringUtil::split(params, " \t"); 
     253                if(vecparams.size() == 1) 
     254                { 
     255                        if (vecparams[0] == "none") 
     256                        { 
     257                f->passBlendingSRC =  SBF_ONE; 
     258                                f->passBlendingDEST = SBF_ZERO; 
     259                        } 
     260                        if (vecparams[0] == "add") 
     261                        { 
     262                f->passBlendingSRC =  SBF_ONE; 
     263                                f->passBlendingDEST = SBF_ONE; 
     264                        } 
     265            else if (vecparams[0] == "modulate") 
     266            { 
     267                                f->passBlendingSRC =  SBF_DEST_COLOUR; 
     268                                f->passBlendingDEST = SBF_ZERO; 
     269                        } 
     270                        else if (vecparams[0] == "colour_blend") 
     271                        { 
     272                                f->passBlendingSRC =  SBF_SOURCE_COLOUR; 
     273                                f->passBlendingDEST = SBF_ONE_MINUS_SOURCE_COLOUR; 
     274                        } 
     275            else if (vecparams[0] == "alpha_blend") 
     276            { 
     277                f->passBlendingSRC =  SBF_SOURCE_ALPHA; 
     278                                f->passBlendingDEST = SBF_ONE_MINUS_SOURCE_ALPHA; 
     279                        }             
     280                } 
     281                else if (vecparams.size() == 2) 
     282                { 
     283                  f->passBlendingSRC =  convertBlendFactor(vecparams[0]); 
     284                  f->passBlendingDEST = convertBlendFactor(vecparams[1]) ; 
     285                }                
     286        }        
    221287} 
    222288 
     
    238304        this->attributeParsers.insert(AttribParserList::value_type("world_param_name", (ILLUM_ATTRIBUTE_PARSER) parseWorldParamName)); 
    239305        this->attributeParsers.insert(AttribParserList::value_type("light_farplane_param_name", (ILLUM_ATTRIBUTE_PARSER) parseLightFarPlaneParamName)); 
     306        this->attributeParsers.insert(AttribParserList::value_type("pass_blending", (ILLUM_ATTRIBUTE_PARSER) parsePassBlending)); 
    240307} 
    241308 
     
    258325        WorldViewProjParamName = "WorldViewProj"; 
    259326        WorldParamName = "World"; 
     327        passBlendingSRC = SBF_DEST_COLOUR; 
     328        passBlendingDEST = SBF_ZERO; 
    260329 
    261330        parseParams(params); 
     
    273342                                                                                                lightViewParamName, 
    274343                                                                                                lightFarPlaneParamName, 
     344                                                                                                passBlendingSRC, 
     345                                                                                                passBlendingDEST, 
    275346                                                                                                pass, 
    276347                                                                                                parentRenderable, 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgrePathMapRenderTechnique.cpp

    r2249 r2299  
    77 
    88OgrePathMapRenderTechnique::OgrePathMapRenderTechnique(                                                                                  
     9                                                                                                SceneBlendFactor passBlendingSRC, 
     10                                                                                                SceneBlendFactor passBlendingDEST, 
    911                                                                                                Pass* pass, 
    1012                                                                                                OgreRenderable* parentRenderable, 
     
    1315                                                        OgreRenderTechnique(pass, parentRenderable, parentTechniqueGroup) 
    1416{        
     17        this->passBlendingSRC = passBlendingSRC; 
     18        this->passBlendingDEST = passBlendingDEST; 
     19 
    1520        this->clusters = OgreIlluminationManager::getSingleton().getPathMapClusters(parentRenderable->getName()); 
    1621         
     
    8186        st->setTextureName(pass->getTextureUnitState(0)->getTextureName()); 
    8287         
    83         //newpass->setSceneBlending(SBT_MODULATE); 
    84         newpass->setSceneBlending(SBT_ADD); 
    85         //newpass->setSceneBlending(SBF_ONE, SBF_ZERO); 
     88        newpass->setSceneBlending(passBlendingSRC, passBlendingDEST); 
    8689        newpass->setDepthBias(1); 
    87          
    88  
    89          
    9090} 
    9191 
     
    158158} 
    159159 
     160namespace PathMapParsers 
     161{ 
     162        SceneBlendFactor convertBlendFactor(const String& param) 
     163    { 
     164        if (param == "one") 
     165            return SBF_ONE; 
     166        else if (param == "zero") 
     167            return SBF_ZERO; 
     168        else if (param == "dest_colour") 
     169            return SBF_DEST_COLOUR; 
     170        else if (param == "src_colour") 
     171            return SBF_SOURCE_COLOUR; 
     172        else if (param == "one_minus_dest_colour") 
     173            return SBF_ONE_MINUS_DEST_COLOUR; 
     174        else if (param == "one_minus_src_colour") 
     175            return SBF_ONE_MINUS_SOURCE_COLOUR; 
     176        else if (param == "dest_alpha") 
     177            return SBF_DEST_ALPHA; 
     178        else if (param == "src_alpha") 
     179            return SBF_SOURCE_ALPHA; 
     180        else if (param == "one_minus_dest_alpha") 
     181            return SBF_ONE_MINUS_DEST_ALPHA; 
     182        else if (param == "one_minus_src_alpha") 
     183            return SBF_ONE_MINUS_SOURCE_ALPHA;        
     184    } 
     185 
     186        void parsePassBlending(String& params, RenderTechniqueFactory* factory) 
     187        { 
     188                OgrePathMapRenderTechniqueFactory* f = (OgrePathMapRenderTechniqueFactory*) factory; 
     189                StringVector vecparams = StringUtil::split(params, " \t"); 
     190                if(vecparams.size() == 1) 
     191                { 
     192                        if (vecparams[0] == "none") 
     193                        { 
     194                f->passBlendingSRC =  SBF_ONE; 
     195                                f->passBlendingDEST = SBF_ZERO; 
     196                        } 
     197                        if (vecparams[0] == "add") 
     198                        { 
     199                f->passBlendingSRC =  SBF_ONE; 
     200                                f->passBlendingDEST = SBF_ONE; 
     201                        } 
     202            else if (vecparams[0] == "modulate") 
     203            { 
     204                                f->passBlendingSRC =  SBF_DEST_COLOUR; 
     205                                f->passBlendingDEST = SBF_ZERO; 
     206                        } 
     207                        else if (vecparams[0] == "colour_blend") 
     208                        { 
     209                                f->passBlendingSRC =  SBF_SOURCE_COLOUR; 
     210                                f->passBlendingDEST = SBF_ONE_MINUS_SOURCE_COLOUR; 
     211                        } 
     212            else if (vecparams[0] == "alpha_blend") 
     213            { 
     214                f->passBlendingSRC =  SBF_SOURCE_ALPHA; 
     215                                f->passBlendingDEST = SBF_ONE_MINUS_SOURCE_ALPHA; 
     216                        }             
     217                } 
     218                else if (vecparams.size() == 2) 
     219                { 
     220                  f->passBlendingSRC =  convertBlendFactor(vecparams[0]); 
     221                  f->passBlendingDEST = convertBlendFactor(vecparams[1]) ; 
     222                }                
     223        }        
     224} 
     225 
    160226OgrePathMapRenderTechniqueFactory::OgrePathMapRenderTechniqueFactory() 
    161227{ 
    162228        typeName = "PathMap"; 
     229        using namespace PathMapParsers; 
     230        this->attributeParsers.insert(AttribParserList::value_type("pass_blending", (ILLUM_ATTRIBUTE_PARSER) parsePassBlending)); 
    163231} 
    164232 
     
    169237                                                                                OgreTechniqueGroup* parentTechniqueGroup) 
    170238{        
     239        passBlendingSRC = SBF_ONE; 
     240        passBlendingDEST = SBF_ONE; 
     241 
    171242        parseParams(params); 
    172243 
    173244        OgrePathMapRenderTechnique* result = new OgrePathMapRenderTechnique( 
     245                                                                                                passBlendingSRC, 
     246                                                                                                passBlendingDEST, 
    174247                                                                                                pass, 
    175248                                                                                                parentRenderable, 
Note: See TracChangeset for help on using the changeset viewer.