Ignore:
Timestamp:
12/13/06 16:36:34 (18 years ago)
Author:
szirmay
Message:
 
File:
1 edited

Legend:

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

    r1725 r1886  
    1717                                                                                                                String environmentMaterial, 
    1818                                                                                                                int layer, 
     19                                                                                                                bool getMinMax, 
     20                                                                                                                bool attachToTexUnit, 
     21                                                                                                                String minVariableName, 
     22                                                                                                                String maxVariableName, 
    1923                                                                                                                Pass* pass, 
    2024                                                                                                                OgreRenderable* parentRenderable, 
     
    2529                                                        RenderTechnique(parentRenderable, parentTechniqueGroup)  
    2630{        
     31        this->minVariableName = minVariableName; 
     32        this->maxVariableName = maxVariableName; 
     33        this->attachToTexUnit = attachToTexUnit; 
     34        this->getMinMax = getMinMax; 
     35 
    2736        this->texID = texID; 
    2837        this->selfMaterial = selfMaterial; 
     
    5059        String cubemapname = cuberun->getCubeMapTextureName(); 
    5160         
    52         pass->getTextureUnitState(texID)->setTextureName(cubemapname); 
     61        if(attachToTexUnit) 
     62                pass->getTextureUnitState(texID)->setTextureName(cubemapname); 
     63        if(getMinMax) 
     64        { 
     65                if(minVariableName != "") 
     66                        pass->getFragmentProgramParameters()->setNamedConstant(minVariableName, cuberun->getMin()); 
     67                if(maxVariableName != "") 
     68                        pass->getFragmentProgramParameters()->setNamedConstant(maxVariableName, cuberun->getMax()); 
     69        } 
    5370} 
    5471 
     
    6986                                                                                                selfMaterial, 
    7087                                                                                                environmentMaterial, 
     88                                                                                                getMinMax, 
    7189                                                                                                cubemapLayer); 
    7290} 
     
    169187                f->environmentMaterial =  params; 
    170188        } 
     189 
     190        void parseMinVarName(String& params, RenderTechniqueFactory* factory) 
     191        { 
     192                OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 
     193                f->minVariableName =  params; 
     194        } 
     195        void parseMaxVarName(String& params, RenderTechniqueFactory* factory) 
     196        { 
     197                OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 
     198                f->maxVariableName =  params; 
     199        } 
     200 
    171201        void parseLayer(String& params, RenderTechniqueFactory* factory) 
    172202        { 
    173203                OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 
    174204                f->layer =  StringConverter::parseInt(params); 
     205        } 
     206 
     207        void parseGetMinMax(String& params, RenderTechniqueFactory* factory) 
     208        { 
     209                OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 
     210                f->getMinMax =  StringConverter::parseBool(params); 
     211        } 
     212 
     213        void parseAttachTexUnit(String& params, RenderTechniqueFactory* factory) 
     214        { 
     215                OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 
     216                f->attachToTexUnit =  StringConverter::parseBool(params); 
    175217        } 
    176218 
     
    196238        this->attributeParsers.insert(AttribParserList::value_type("env_material", (ILLUM_ATTRIBUTE_PARSER) parseEnvMaterial)); 
    197239        this->attributeParsers.insert(AttribParserList::value_type("layer", (ILLUM_ATTRIBUTE_PARSER) parseLayer)); 
     240        this->attributeParsers.insert(AttribParserList::value_type("get_minmax", (ILLUM_ATTRIBUTE_PARSER) parseGetMinMax)); 
     241        this->attributeParsers.insert(AttribParserList::value_type("attach_to_texture_unit", (ILLUM_ATTRIBUTE_PARSER) parseAttachTexUnit)); 
     242        this->attributeParsers.insert(AttribParserList::value_type("min_var_name", (ILLUM_ATTRIBUTE_PARSER) parseMinVarName)); 
     243        this->attributeParsers.insert(AttribParserList::value_type("max_var_name", (ILLUM_ATTRIBUTE_PARSER) parseMaxVarName)); 
    198244 
    199245} 
     
    215261        environmentMaterial = ""; 
    216262        layer = 0; 
     263        getMinMax = false; 
     264        attachToTexUnit = true; 
     265        minVariableName = ""; 
     266        maxVariableName = ""; 
     267 
    217268} 
    218269 
     
    241292                                                                                                environmentMaterial, 
    242293                                                                                                layer, 
     294                                                                                                getMinMax, 
     295                                                                                                attachToTexUnit, 
     296                                                                                                minVariableName, 
     297                                                                                                maxVariableName, 
    243298                                                                                                pass, 
    244299                                                                                                parentRenderable, 
Note: See TracChangeset for help on using the changeset viewer.