Changeset 1711


Ignore:
Timestamp:
11/03/06 09:51:53 (18 years ago)
Author:
szirmay
Message:
 
Location:
GTP/trunk/Lib/Illum/IllumModule
Files:
4 added
15 edited

Legend:

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

    r790 r1711  
    11#pragma once 
    2 #include "RenderTechnique.h" 
     2#include "CubeMapRenderTechnique.h" 
    33 
    44/** 
     
    99        This reduced cubemap can easily be convolved in the final shading to acheve special effects like diffuse reflections. 
    1010*/ 
    11 class ConvolvedCubeMapRenderTechnique : virtual public RenderTechnique 
     11class ConvolvedCubeMapRenderTechnique : virtual public CubeMapRenderTechnique 
    1212{ 
    1313public: 
     
    3636                                                        float angleTolerance, 
    3737                                                        bool updateAllFace, 
     38                                                        bool renderSelf, 
    3839                                                        ElementaryRenderable* parentRenderable, 
    3940                                                        TechniqueGroup* parentTechniqueGroup 
     
    5354protected: 
    5455 
    55     /** 
    56                         @brief defines if all cubemap faces should be updated in a frame or only one face per frame 
    57         */ 
    58         bool updateAllFace; 
    59         /** 
    60                         @brief color-cubemap update frequency 
    61         */ 
    62         unsigned long cubeMapUpdateInterval; 
    63         /** 
    64                         @brief color-cubemap resolution 
    65         */ 
    66         unsigned int cubeMapResolution; 
    67         /** 
    68                         @brief color-cubemap resolution 
    69         */ 
    7056        unsigned int reducedCubeMapResolution; 
    71         /** 
    72                 @brief a flag to skip cube face update if object is far away or too small. 
    73  
    74                 @see distTolerance 
    75         */ 
    76         bool useDistCalc; 
    77         /** 
    78                 @brief a flag to skip cube face update the face is neglible. 
    79  
    80                 @see angleTolerance 
    81         */ 
    82         bool useFaceAngleCalc; 
    83         /** 
    84                 @brief A value used in face skip test. 
    85  
    86                 The higher this value gets the more precise, but slower the method will be. 
    87         */ 
    88         float distTolerance; 
    89         /** 
    90                 @brief A value used in face skip test. 
    91  
    92                 The higher this value gets the more precise, but slower the method will be. 
    93         */ 
    94         float angleTolerance; 
    95         /** 
    96                         @brief offset in frame number used during update 
    97         */ 
    98         unsigned long startFrame;        
    99          
    100  
    10157        /** 
    10258                        @brief Called if the changed run is a ColorCubeMapRenderingRun. 
  • GTP/trunk/Lib/Illum/IllumModule/IllumModule/include/RenderTechniques/CubeMapRenderTechnique.h

    r780 r1711  
    3232                                                        float angleTolerance, 
    3333                                                        bool updateAllFace, 
     34                                                        bool renderSelf, 
    3435                                                        ElementaryRenderable* parentRenderable, 
    3536                                                        TechniqueGroup* parentTechniqueGroup 
     
    3738        ~CubeMapRenderTechnique(); 
    3839         
    39         /** 
    40                         @brief Updates the resources in the given frame. 
    41  
    42                         @param frameNum the actual framenumber 
    43         */ 
    44         virtual void update(unsigned long frameNum); 
    45  
    46         //inherited 
    47         void runChanged(RenderingRunType runType, RenderingRun* run); 
    48  
    4940protected: 
    5041        /** 
     
    8778                        @brief offset in frame number used during update 
    8879        */ 
    89         unsigned long startFrame;        
    90          
    91         /** 
    92                         @brief Called if the changed run is a ColorCubeMapRenderingRun. 
    93  
    94                         @param run pointer to the changed ColorCubeMapRenderingRun 
    95         */               
    96         virtual void colorCubeMapRunChanged(RenderingRun* run) = 0; 
    97         /** 
    98                         @brief Creates a ColorCubeMapRenderingRun. 
    99  
    100                         @return the new ColorCubeMapRenderingRun instance. 
    101         */ 
    102         virtual RenderingRun* createColorCubeMapRun() = 0; 
     80        unsigned long startFrame; 
     81        bool renderSelf;                 
    10382}; 
  • GTP/trunk/Lib/Illum/IllumModule/IllumModule/include/RenderTechniques/DistanceCubeMapRenderTechnique.h

    r780 r1711  
    11#pragma once 
    2 #include "RenderTechnique.h" 
     2#include "CubeMapRenderTechnique.h" 
    33 
    44/** 
     
    77        This technique defines that the final rendering of an object needs a cubmap of the distance of the surrounding environment from the cubemap center. 
    88*/ 
    9 class DistanceCubeMapRenderTechnique : virtual public RenderTechnique 
     9class DistanceCubeMapRenderTechnique : virtual public CubeMapRenderTechnique 
    1010{ 
    1111public: 
     
    3232                                                        float angleTolerance, 
    3333                                                        bool updateAllFace, 
     34                                                        bool renderSelf, 
    3435                                                        ElementaryRenderable* parentRenderable, 
    3536                                                        TechniqueGroup* parentTechniqueGroup 
     
    5152protected: 
    5253        /** 
    53                 @brief a flag to skip cube face update if object is far away or too small. 
    54  
    55                 @see distTolerance 
    56         */ 
    57         bool useDistCalc; 
    58         /** 
    59                 @brief a flag to skip cube face update the face is neglible. 
    60  
    61                 @see angleTolerance 
    62         */ 
    63         bool useFaceAngleCalc; 
    64         /** 
    65                 @brief A value used in face skip test. 
    66  
    67                 The higher this value gets the more precise, but slower the method will be. 
    68         */ 
    69         float distTolerance; 
    70         /** 
    71                 @brief A value used in face skip test. 
    72  
    73                 The higher this value gets the more precise, but slower the method will be. 
    74         */ 
    75         float angleTolerance; 
    76         /** 
    77                         @brief defines if all cubemap faces should be updated in a frame or only one face per frame 
    78         */ 
    79     bool updateAllFace; 
    80                                                          
    81         /** 
    82                         @brief color-cubemap update frequency 
    83         */ 
    84         unsigned long cubeMapUpdateInterval; 
    85         /** 
    86                         @brief color-cubemap resolution 
    87         */ 
    88         unsigned int cubeMapResolution; 
    89         /** 
    90                         @brief offset in frame number used during update 
    91         */ 
    92         unsigned long startFrame;        
    93          
    94         /** 
    9554                        @brief Called if the changed run is a ColorCubeMapRenderingRun. 
    9655 
  • GTP/trunk/Lib/Illum/IllumModule/IllumModule/scripts/illummodule.vcproj

    r1681 r1711  
    197197                                </File> 
    198198                                <File 
     199                                        RelativePath="..\src\RenderTechniques\ColorCubeMapRenderTechnique.cpp" 
     200                                        > 
     201                                </File> 
     202                                <File 
    199203                                        RelativePath="..\src\RenderTechniques\ConvolvedCubeMapRenderTechnique.cpp" 
    200204                                        > 
     
    310314                                </File> 
    311315                                <File 
     316                                        RelativePath="..\include\RenderTechniques\ColorCubeMapRenderTechnique.h" 
     317                                        > 
     318                                </File> 
     319                                <File 
    312320                                        RelativePath="..\include\RenderTechniques\ConvolvedCubeMapRenderTechnique.h" 
    313321                                        > 
  • GTP/trunk/Lib/Illum/IllumModule/IllumModule/src/RenderTechniques/ConvolvedCubeMapRenderTechnique.cpp

    r780 r1711  
    1111                                                                                                float angleTolerance, 
    1212                                                                                                bool updateAllFace, 
     13                                                                                                bool renderSelf, 
    1314                                                                                                ElementaryRenderable* parentRenderable, 
    1415                                                                                                TechniqueGroup* parentTechniqueGroup) 
    15                                                         :RenderTechnique( parentRenderable, parentTechniqueGroup) 
     16                                                                                                 
     17                                                                                                :CubeMapRenderTechnique( startFrame, cubeMapUpdateInterval, cubeMapResolution, 
     18                                                                                                                                                                        useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, 
     19                                                                                                                                                                        updateAllFace, renderSelf, 
     20                                                                                                                                                                        parentRenderable, parentTechniqueGroup), 
     21                                                                                                RenderTechnique(parentRenderable, parentTechniqueGroup) 
    1622{ 
    17         this->cubeMapUpdateInterval = cubeMapUpdateInterval; 
    18         this->cubeMapResolution = cubeMapResolution; 
    1923        this->reducedCubeMapResolution = reducedCubeMapResolution; 
    20         this->useDistCalc = useDistCalc; 
    21         this->useFaceAngleCalc = useFaceAngleCalc; 
    22         this->distTolerance = distTolerance; 
    23         this->angleTolerance = angleTolerance; 
    24         this->startFrame = startFrame; 
    25         this->updateAllFace = updateAllFace; 
    2624} 
    2725 
  • GTP/trunk/Lib/Illum/IllumModule/IllumModule/src/RenderTechniques/CubeMapRenderTechnique.cpp

    r780 r1711  
    1010                                                                                                float angleTolerance, 
    1111                                                                                                bool updateAllFace, 
     12                                                                                                bool renderSelf, 
    1213                                                                                                ElementaryRenderable* parentRenderable, 
    1314                                                                                                TechniqueGroup* parentTechniqueGroup) 
     
    2223        this->startFrame = startFrame; 
    2324        this->updateAllFace = updateAllFace;     
     25        this->renderSelf = renderSelf;   
    2426} 
    2527 
     
    2830 
    2931} 
    30  
    31 void CubeMapRenderTechnique::runChanged(RenderingRunType runType, RenderingRun* run) 
    32 { 
    33         if(runType == ILLUMRUN_COLOR_CUBEMAP) 
    34                 colorCubeMapRunChanged(run); 
    35 } 
    36  
    37  void CubeMapRenderTechnique::update(unsigned long frameNum) 
    38 {        
    39                 sharedRuns->updateRun(ILLUMRUN_COLOR_CUBEMAP, frameNum);         
    40 } 
  • GTP/trunk/Lib/Illum/IllumModule/IllumModule/src/RenderTechniques/DistanceCubeMapRenderTechnique.cpp

    r780 r1711  
    1010                                                                                                float angleTolerance, 
    1111                                                                                                bool updateAllFace, 
     12                                                                                                bool renderSelf, 
    1213                                                                                                ElementaryRenderable* parentRenderable, 
    1314                                                                                                TechniqueGroup* parentTechniqueGroup) 
    14                                                         :RenderTechnique( parentRenderable, parentTechniqueGroup) 
     15                                                                                         
     16                                                                                                :CubeMapRenderTechnique( startFrame, cubeMapUpdateInterval, cubeMapResolution, 
     17                                                                                                                                                                        useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, 
     18                                                                                                                                                                        updateAllFace, renderSelf, 
     19                                                                                                                                                                        parentRenderable, parentTechniqueGroup), 
     20                                                                                                 RenderTechnique(parentRenderable, parentTechniqueGroup) 
    1521{ 
    16         this->useDistCalc = useDistCalc; 
    17         this->useFaceAngleCalc = useFaceAngleCalc; 
    18         this->distTolerance = distTolerance; 
    19         this->angleTolerance = angleTolerance; 
    20  
    21         this->cubeMapUpdateInterval = cubeMapUpdateInterval; 
    22         this->cubeMapResolution = cubeMapResolution; 
    23         this->startFrame = startFrame; 
    24         this->updateAllFace = updateAllFace; 
     22         
    2523} 
    2624 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/OgreIlluminationManager.h

    r1670 r1711  
    44#include "OgreTechniqueGroup.h" 
    55#include "OgreRenderable.h" 
    6 #include "OgreCubeMapRenderTechnique.h" 
     6#include "OgreColorCubeMapRenderTechnique.h" 
    77#include "OgreDistanceCubeMapRenderTechnique.h" 
    88#include "OgreConvolvedCubeMapRenderTechnique.h" 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreConvolvedCubeMapRenderTechnique.h

    r836 r1711  
    99 
    1010#include "ConvolvedCubeMapRenderTechnique.h" 
    11 #include "OgreRenderTechnique.h" 
     11#include "OgreCubeMapRenderTechnique.h" 
    1212#include "Ogre.h" 
    1313 
     
    1818*/ 
    1919class OgreConvolvedCubeMapRenderTechnique :     public ConvolvedCubeMapRenderTechnique, 
    20                                                                         public OgreRenderTechnique 
     20                                                                                        public OgreCubeMapRenderTechnique 
    2121{ 
    2222public: 
     
    4343                                                        unsigned int cubeMapResolution, 
    4444                                                        unsigned int reducedCubeMapResolution, 
    45                                                         unsigned char reducedTexID, 
     45                                                        unsigned char texID, 
    4646                                                        bool useDistCalc, 
    4747                                                        bool useFaceAngleCalc, 
     
    4949                                                        float angleTolerance, 
    5050                                                        bool updateAllFace, 
     51                                                        bool renderSelf, 
    5152                                                        Pass* pass, 
    5253                                                        OgreRenderable* parentRenderable, 
     
    6263         
    6364protected:       
    64         /** 
    65                 @brief the id of the texture unit state the resulting cubemap should be bound to 
    66         */ 
    67         unsigned char reducedTexID; 
    6865         
    6966        //inherited 
     
    8077 
    8178 
    82 class OgreConvoledCubeMapRenderTechniqueFactory : public RenderTechniqueFactory 
     79class OgreConvoledCubeMapRenderTechniqueFactory : public OgreCubeMapRenderTechniqueFactory 
    8380{ 
    8481public: 
     
    9289 
    9390 
    94         unsigned long startFrame; 
    95         unsigned long cubeMapUpdateInterval; 
    96         unsigned int cubeMapResolution;                                                                                          
    9791        unsigned int reducedCubeMapResolution; 
    98         unsigned char texID; 
    99         bool useDistCalc; 
    100         bool useFaceAngleCalc; 
    101         float distTolerance; 
    102         float angleTolerance; 
    103         bool updateAllFace; 
    104  
    10592}; 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreCubeMapRenderTechnique.h

    r836 r1711  
    1717        @brief CubeMapRenderTechnique used in an Ogre environment. 
    1818*/ 
    19 class OgreCubeMapRenderTechnique :      public CubeMapRenderTechnique, 
     19class OgreCubeMapRenderTechnique :      virtual public CubeMapRenderTechnique, 
    2020                                                                        public OgreRenderTechnique 
    2121{ 
     
    4747                                                        float angleTolerance, 
    4848                                                        bool updateAllFace, 
     49                                                        bool renderSelf, 
    4950                                                        Pass* pass, 
    5051                                                        OgreRenderable* parentRenderable, 
     
    5556        */ 
    5657        ~OgreCubeMapRenderTechnique(); 
    57          
    58         //inherited 
    59         void update(unsigned long frameNum); 
    60          
     58                 
    6159protected: 
    6260                 
     
    6462                @brief the id of the texture unit state the resulting cubemap should be bound to 
    6563        */ 
    66         unsigned char texID; 
    67          
    68         //inherited 
    69         void colorCubeMapRunChanged(RenderingRun* run); 
    70         //inherited 
    71         RenderingRun* createColorCubeMapRun(); 
    72  
    73          
     64        unsigned char texID;     
    7465}; 
    7566 
    76 class OgreColorCubeMapRenderTechniqueFactory : public RenderTechniqueFactory 
     67class OgreCubeMapRenderTechniqueFactory : public RenderTechniqueFactory 
    7768{ 
    7869public: 
    7970         
    80         OgreColorCubeMapRenderTechniqueFactory(); 
    81  
    82         OgreRenderTechnique* createInstance(IllumTechniqueParams* params, 
    83                                                                                 Pass* pass, 
    84                                                                                 OgreRenderable* parentRenderable, 
    85                                                                                 OgreTechniqueGroup* parentTechniqueGroup); 
    86  
    87  
     71        OgreCubeMapRenderTechniqueFactory(); 
     72         
    8873        unsigned long startFrame; 
    8974        unsigned long cubeMapUpdateInterval; 
     
    9580        float angleTolerance; 
    9681        bool updateAllFace; 
     82        bool renderSelf; 
     83 
     84        void resetParams(); 
    9785 
    9886}; 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreDistanceCubeMapRenderTechnique.h

    r836 r1711  
    99 
    1010#include "DistanceCubeMapRenderTechnique.h" 
    11 #include "OgreRenderTechnique.h" 
     11#include "OgreCubeMapRenderTechnique.h" 
    1212#include "Ogre.h" 
    1313 
     
    1818*/ 
    1919class OgreDistanceCubeMapRenderTechnique :      public DistanceCubeMapRenderTechnique, 
    20                                                                         public OgreRenderTechnique 
     20                                                                                        public OgreCubeMapRenderTechnique 
    2121{ 
    2222public: 
     
    4747                                                        float angleTolerance, 
    4848                                                        bool updateAllFace, 
     49                                                        bool renderSelf, 
    4950                                                        Pass* pass, 
    5051                                                        OgreRenderable* parentRenderable, 
     
    6061         
    6162protected:       
    62         /** 
    63                 @brief the id of the texture unit state the resulting cubemap should be bound to 
    64         */ 
    65         unsigned char texID; 
    66          
     63 
    6764        //inherited 
    6865        void distanceCubeMapRunChanged(RenderingRun* run); 
     
    7673 
    7774 
    78 class OgreDistanceCubeMapRenderTechniqueFactory : public RenderTechniqueFactory 
     75class OgreDistanceCubeMapRenderTechniqueFactory : public OgreCubeMapRenderTechniqueFactory 
    7976{ 
    8077public: 
     
    8582                                                                                Pass* pass, 
    8683                                                                                OgreRenderable* parentRenderable, 
    87                                                                                 OgreTechniqueGroup* parentTechniqueGroup); 
    88  
    89  
    90         unsigned long startFrame; 
    91         unsigned long cubeMapUpdateInterval; 
    92         unsigned int cubeMapResolution;                                                                                          
    93         unsigned char texID; 
    94         bool useDistCalc; 
    95         bool useFaceAngleCalc; 
    96         float distTolerance; 
    97         float angleTolerance; 
    98         bool updateAllFace; 
     84                                                                                OgreTechniqueGroup* parentTechniqueGroup);       
    9985 
    10086}; 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/scripts/OgreIllumModule.vcproj

    r1681 r1711  
    4242                                Optimization="0" 
    4343                                AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;..\include;..\include\RenderingRuns;..\include\RenderTechniques;..\..\IllumModule\include;..\..\IllumModule\include\RenderingRuns;..\..\IllumModule\include\RenderTechniques;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include\&quot;" 
    44                                 PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;GAMETOOLS_ILLUMINATION_MODULE;GTP_VISIBILITY_MODIFIED_OGRE" 
     44                                PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;GAMETOOLS_ILLUMINATION_MODULE" 
    4545                                MinimalRebuild="true" 
    4646                                BasicRuntimeChecks="3" 
     
    115115                                OmitFramePointers="true" 
    116116                                AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;..\include;..\include\RenderingRuns;..\include\RenderTechniques;..\..\IllumModule\include;..\..\IllumModule\include\RenderingRuns;..\..\IllumModule\include\RenderTechniques;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include\&quot;" 
    117                                 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;GAMETOOLS_ILLUMINATION_MODULE;GTP_VISIBILITY_MODIFIED_OGRE" 
     117                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;GAMETOOLS_ILLUMINATION_MODULE" 
    118118                                StringPooling="true" 
    119119                                MinimalRebuild="true" 
     
    201201                                </File> 
    202202                                <File 
     203                                        RelativePath="..\src\RenderTechniques\OgreColorCubeMapRenderTechnique.cpp" 
     204                                        > 
     205                                </File> 
     206                                <File 
    203207                                        RelativePath="..\src\RenderTechniques\OgreConvolvedCubeMapRenderTechnique.cpp" 
    204208                                        > 
     
    327331                                </File> 
    328332                                <File 
     333                                        RelativePath="..\include\RenderTechniques\OgreColorCubeMapRenderTechnique.h" 
     334                                        > 
     335                                </File> 
     336                                <File 
    329337                                        RelativePath="..\include\RenderTechniques\OgreConvolvedCubeMapRenderTechnique.h" 
    330338                                        > 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreConvolvedCubeMapRenderTechnique.cpp

    r874 r1711  
    88                                                                                                                unsigned int cubeMapResolution, 
    99                                                                                                                unsigned int reducedCubeMapResolution, 
    10                                                                                                                 unsigned char reducedTexID, 
     10                                                                                                                unsigned char texID, 
    1111                                                                                                                bool useDistCalc, 
    1212                                                                                                                bool useFaceAngleCalc, 
     
    1414                                                                                                                float angleTolerance, 
    1515                                                                                                                bool updateAllFace, 
     16                                                                                                                bool renderSelf, 
    1617                                                                                                                Pass* pass, 
    1718                                                                                                                OgreRenderable* parentRenderable, 
    1819                                                                                                                OgreTechniqueGroup* parentTechniqueGroup) 
    19                                                         :OgreRenderTechnique( pass, parentRenderable, parentTechniqueGroup), 
    20                                                         ConvolvedCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, reducedCubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, parentRenderable, parentTechniqueGroup), 
     20                                                        : 
     21                                                        OgreCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, texID, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, pass, parentRenderable, parentTechniqueGroup), 
     22                                                        CubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, parentRenderable, parentTechniqueGroup), 
     23                                                        ConvolvedCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, reducedCubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, parentRenderable, parentTechniqueGroup), 
    2124                                                        RenderTechnique(parentRenderable, parentTechniqueGroup)  
    2225{        
    23         this->reducedTexID = reducedTexID; 
    24                  
    2526        if(sharedRuns->getRun(ILLUMRUN_COLOR_CUBEMAP) == 0) 
    2627                sharedRuns->addRun(ILLUMRUN_COLOR_CUBEMAP, createColorCubeMapRun()); 
     
    4950        String cubemapname = cuberun->getReducedCubeMapTextureName(); 
    5051         
    51         pass->getTextureUnitState(reducedTexID)->setTextureName(cubemapname); 
     52        pass->getTextureUnitState(texID)->setTextureName(cubemapname); 
    5253} 
    5354 
     
    9495namespace ConvolvedCubemapParsers 
    9596{ 
    96         void parseStartFrame(String& params, RenderTechniqueFactory* factory) 
    97         { 
    98                 OgreConvoledCubeMapRenderTechniqueFactory* f = (OgreConvoledCubeMapRenderTechniqueFactory*) factory; 
    99                 f->startFrame =  StringConverter::parseUnsignedLong(params); 
    100         } 
    101         void parseCubeMapUpdateInterval(String& params, RenderTechniqueFactory* factory) 
    102         { 
    103                 OgreConvoledCubeMapRenderTechniqueFactory* f = (OgreConvoledCubeMapRenderTechniqueFactory*) factory; 
    104                 f->cubeMapUpdateInterval =  StringConverter::parseUnsignedLong(params); 
    105         } 
    106  
    107         void parseCubeMapResolution(String& params, RenderTechniqueFactory* factory) 
    108         { 
    109                 OgreConvoledCubeMapRenderTechniqueFactory* f = (OgreConvoledCubeMapRenderTechniqueFactory*) factory; 
    110                 f->cubeMapResolution =  StringConverter::parseUnsignedInt(params); 
    111         } 
    112  
    11397        void parseReducedCubeMapResolution(String& params, RenderTechniqueFactory* factory) 
    11498        { 
    11599                OgreConvoledCubeMapRenderTechniqueFactory* f = (OgreConvoledCubeMapRenderTechniqueFactory*) factory; 
    116100                f->reducedCubeMapResolution =  StringConverter::parseUnsignedInt(params); 
    117         } 
    118  
    119         void parseTexID(String& params, RenderTechniqueFactory* factory) 
    120         { 
    121                 OgreConvoledCubeMapRenderTechniqueFactory* f = (OgreConvoledCubeMapRenderTechniqueFactory*) factory; 
    122                 f->texID =  StringConverter::parseUnsignedInt(params); 
    123         } 
    124  
    125         void parseUseDistCalc(String& params, RenderTechniqueFactory* factory) 
    126         { 
    127                 OgreConvoledCubeMapRenderTechniqueFactory* f = (OgreConvoledCubeMapRenderTechniqueFactory*) factory; 
    128                 // format: on/off tolerance(float) 
    129                 StringVector vecparams = StringUtil::split(params, " \t"); 
    130  
    131                 if(StringConverter::parseBool(vecparams[0]))//on 
    132                 { 
    133                         f->useDistCalc = true; 
    134  
    135                         if(vecparams.size()>1) 
    136                         {                        
    137                                 f->distTolerance = StringConverter::parseReal(vecparams[1]); 
    138                         } 
    139                 } 
    140                 else 
    141                 { 
    142                         f->useDistCalc = false; 
    143                 } 
    144         } 
    145  
    146         void parseUseFaceAngleCalc(String& params, RenderTechniqueFactory* factory) 
    147         { 
    148                 OgreConvoledCubeMapRenderTechniqueFactory* f = (OgreConvoledCubeMapRenderTechniqueFactory*) factory; 
    149                 // format: on/off tolerance(float) 
    150                 StringVector vecparams = StringUtil::split(params, " \t"); 
    151  
    152                 if(StringConverter::parseBool(vecparams[0]))//on 
    153                 { 
    154                         f->useFaceAngleCalc = true; 
    155  
    156                         if(vecparams.size()>1) 
    157                         {                        
    158                                 f->angleTolerance = StringConverter::parseReal(vecparams[1]); 
    159                         } 
    160                 } 
    161                 else 
    162                 { 
    163                         f->useFaceAngleCalc = false; 
    164                 } 
    165         } 
    166  
    167         void parseUpdateAllFace(String& params, RenderTechniqueFactory* factory) 
    168         { 
    169                 OgreConvoledCubeMapRenderTechniqueFactory* f = (OgreConvoledCubeMapRenderTechniqueFactory*) factory; 
    170                 f->updateAllFace =  StringConverter::parseBool(params); 
    171         } 
     101        }        
    172102} 
    173103///Technique factory 
     
    177107 
    178108        using namespace ConvolvedCubemapParsers; 
    179         //register parsers 
    180         this->attributeParsers.insert(AttribParserList::value_type("start_frame", (ILLUM_ATTRIBUTE_PARSER) parseStartFrame)); 
    181         this->attributeParsers.insert(AttribParserList::value_type("update_interval", (ILLUM_ATTRIBUTE_PARSER) parseCubeMapUpdateInterval)); 
    182         this->attributeParsers.insert(AttribParserList::value_type("resolution", (ILLUM_ATTRIBUTE_PARSER) parseCubeMapResolution)); 
    183         this->attributeParsers.insert(AttribParserList::value_type("reduced_resolution", (ILLUM_ATTRIBUTE_PARSER) parseReducedCubeMapResolution)); 
    184         this->attributeParsers.insert(AttribParserList::value_type("texture_unit_id", (ILLUM_ATTRIBUTE_PARSER) parseTexID)); 
    185         this->attributeParsers.insert(AttribParserList::value_type("distance_calc", (ILLUM_ATTRIBUTE_PARSER) parseUseDistCalc)); 
    186         this->attributeParsers.insert(AttribParserList::value_type("face_angle_calc", (ILLUM_ATTRIBUTE_PARSER) parseUseFaceAngleCalc)); 
    187         this->attributeParsers.insert(AttribParserList::value_type("update_all_face", (ILLUM_ATTRIBUTE_PARSER) parseUpdateAllFace)); 
    188  
     109        this->attributeParsers.insert(AttribParserList::value_type("reduced_resolution", (ILLUM_ATTRIBUTE_PARSER) parseReducedCubeMapResolution));       
    189110} 
    190111 
     
    195116                                                                                OgreTechniqueGroup* parentTechniqueGroup) 
    196117{        
    197         //reset parameters 
    198         startFrame = 1; 
    199         cubeMapUpdateInterval = 1; 
    200         cubeMapResolution = 256; 
    201118        reducedCubeMapResolution = 8;    
    202         texID = 0; 
    203         useDistCalc = 1; 
    204         useFaceAngleCalc = false; 
    205         distTolerance = 2.0; 
    206         angleTolerance = 2.0; 
    207         updateAllFace = false; 
    208119 
     120        OgreCubeMapRenderTechniqueFactory::resetParams(); 
     121        OgreCubeMapRenderTechniqueFactory::parseParams(params);  
    209122        parseParams(params); 
    210123 
     
    220133                                                                                                angleTolerance, 
    221134                                                                                                updateAllFace, 
     135                                                                                                renderSelf, 
    222136                                                                                                pass, 
    223137                                                                                                parentRenderable, 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreCubeMapRenderTechnique.cpp

    r874 r1711  
    1212                                                                                                                float angleTolerance, 
    1313                                                                                                                bool updateAllFace, 
     14                                                                                                                bool renderSelf, 
    1415                                                                                                                Pass* pass, 
    1516                                                                                                                OgreRenderable* parentRenderable, 
    1617                                                                                                                OgreTechniqueGroup* parentTechniqueGroup) 
    1718                                                        :OgreRenderTechnique( pass, parentRenderable, parentTechniqueGroup), 
    18                                                         CubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, parentRenderable, parentTechniqueGroup), 
     19                                                        CubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, parentRenderable, parentTechniqueGroup), 
    1920                                                        RenderTechnique(parentRenderable, parentTechniqueGroup)  
    2021{        
    21         this->texID = texID; 
    22          
    23         if(sharedRuns->getRun(ILLUMRUN_COLOR_CUBEMAP) == 0) 
    24                 sharedRuns->addRun(ILLUMRUN_COLOR_CUBEMAP, createColorCubeMapRun()); 
    25          
    26         colorCubeMapRunChanged(sharedRuns->getRun(ILLUMRUN_COLOR_CUBEMAP)); 
     22        this->texID = texID;     
    2723} 
    2824 
     
    3329} 
    3430 
    35 void OgreCubeMapRenderTechnique::update(unsigned long frameNum) 
    36 { 
    37         CubeMapRenderTechnique::update(frameNum); 
    38         /* 
    39         GpuProgramParametersSharedPtr fpParams = pass->getFragmentProgramParameters(); 
    40         Vector3 center = ((OgreSharedRuns*) sharedRuns)->getRootPosition(); 
    41         fpParams->setNamedConstant("lastCenter",center);  
    42         pass->setFragmentProgramParameters(fpParams); */ 
    43          
    44 } 
    45  
    46 void OgreCubeMapRenderTechnique::colorCubeMapRunChanged(RenderingRun* run) 
    47 { 
    48         OgreColorCubeMapRenderingRun* cuberun =(OgreColorCubeMapRenderingRun*) (run->asOgreRenderingRun()); 
    49         String cubemapname = cuberun->getColorCubeMapTextureName(); 
    50          
    51         pass->getTextureUnitState(texID)->setTextureName(cubemapname); 
    52 } 
    53  
    54 RenderingRun* OgreCubeMapRenderTechnique::createColorCubeMapRun() 
    55 { 
    56         return new OgreColorCubeMapRenderingRun( (OgreSharedRuns*) parentTechniqueGroup->getSharedRuns(),  
    57                                                                                                 parentOgreRenderable->getName()  + "_COLORCUBEMAP", 
    58                                                                                                 startFrame, 
    59                                                                                                 cubeMapUpdateInterval, 
    60                                                                                                 cubeMapResolution, 
    61                                                                                                 useDistCalc, 
    62                                                                                                 useFaceAngleCalc, 
    63                                                                                                 distTolerance, 
    64                                                                                                 angleTolerance, 
    65                                                                                                 updateAllFace); 
    66 } 
    67  
    6831///Technique Parsers 
    69 namespace ColorCubemapParsers 
     32namespace CubemapParsers 
    7033{ 
    7134        void parseStartFrame(String& params, RenderTechniqueFactory* factory) 
    7235        { 
    73                 OgreColorCubeMapRenderTechniqueFactory* f = (OgreColorCubeMapRenderTechniqueFactory*) factory; 
     36                OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 
    7437                f->startFrame =  StringConverter::parseUnsignedLong(params); 
    7538        } 
    7639        void parseCubeMapUpdateInterval(String& params, RenderTechniqueFactory* factory) 
    7740        { 
    78                 OgreColorCubeMapRenderTechniqueFactory* f = (OgreColorCubeMapRenderTechniqueFactory*) factory; 
     41                OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 
    7942                f->cubeMapUpdateInterval =  StringConverter::parseUnsignedLong(params); 
    8043        } 
     
    8245        void parseCubeMapResolution(String& params, RenderTechniqueFactory* factory) 
    8346        { 
    84                 OgreColorCubeMapRenderTechniqueFactory* f = (OgreColorCubeMapRenderTechniqueFactory*) factory; 
     47                OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 
    8548                f->cubeMapResolution =  StringConverter::parseUnsignedInt(params); 
    8649        } 
     
    8851        void parseTexID(String& params, RenderTechniqueFactory* factory) 
    8952        { 
    90                 OgreColorCubeMapRenderTechniqueFactory* f = (OgreColorCubeMapRenderTechniqueFactory*) factory; 
     53                OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 
    9154                f->texID =  StringConverter::parseUnsignedInt(params); 
    9255        } 
     
    9457        void parseUseDistCalc(String& params, RenderTechniqueFactory* factory) 
    9558        { 
    96                 OgreColorCubeMapRenderTechniqueFactory* f = (OgreColorCubeMapRenderTechniqueFactory*) factory; 
     59                OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 
    9760                // format: on/off tolerance(float) 
    9861                StringVector vecparams = StringUtil::split(params, " \t"); 
     
    11578        void parseUseFaceAngleCalc(String& params, RenderTechniqueFactory* factory) 
    11679        { 
    117                 OgreColorCubeMapRenderTechniqueFactory* f = (OgreColorCubeMapRenderTechniqueFactory*) factory; 
     80                OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 
    11881                // format: on/off tolerance(float) 
    11982                StringVector vecparams = StringUtil::split(params, " \t"); 
     
    13699        void parseUpdateAllFace(String& params, RenderTechniqueFactory* factory) 
    137100        { 
    138                 OgreColorCubeMapRenderTechniqueFactory* f = (OgreColorCubeMapRenderTechniqueFactory*) factory; 
     101                OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 
    139102                f->updateAllFace =  StringConverter::parseBool(params); 
     103        } 
     104 
     105        void parseRenderSelf(String& params, RenderTechniqueFactory* factory) 
     106        { 
     107                OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 
     108                f->renderSelf =  StringConverter::parseBool(params); 
    140109        } 
    141110} 
    142111///Technique factory 
    143 OgreColorCubeMapRenderTechniqueFactory::OgreColorCubeMapRenderTechniqueFactory() 
     112OgreCubeMapRenderTechniqueFactory::OgreCubeMapRenderTechniqueFactory() 
    144113{ 
    145         typeName = "ColorCubeMap"; 
    146  
    147         using namespace ColorCubemapParsers; 
     114         
     115        using namespace CubemapParsers; 
    148116 
    149117        //register parsers 
     
    155123        this->attributeParsers.insert(AttribParserList::value_type("face_angle_calc", (ILLUM_ATTRIBUTE_PARSER) parseUseFaceAngleCalc)); 
    156124        this->attributeParsers.insert(AttribParserList::value_type("update_all_face", (ILLUM_ATTRIBUTE_PARSER) parseUpdateAllFace)); 
     125        this->attributeParsers.insert(AttribParserList::value_type("render_self", (ILLUM_ATTRIBUTE_PARSER) parseUpdateAllFace)); 
    157126 
    158127} 
    159128 
    160 OgreRenderTechnique* OgreColorCubeMapRenderTechniqueFactory::createInstance(  
    161                                                                                 IllumTechniqueParams* params, 
    162                                                                                 Pass* pass, 
    163                                                                                 OgreRenderable* parentRenderable, 
    164                                                                                 OgreTechniqueGroup* parentTechniqueGroup) 
    165 {        
    166         //reset parameters 
     129void OgreCubeMapRenderTechniqueFactory::resetParams() 
     130{ 
    167131        startFrame = 1; 
    168132        cubeMapUpdateInterval = 1; 
     
    174138        angleTolerance = 2.0; 
    175139        updateAllFace = false; 
    176  
    177         parseParams(params); 
    178  
    179         OgreCubeMapRenderTechnique* result = new OgreCubeMapRenderTechnique( 
    180                                                                                                 startFrame, 
    181                                                                                                 cubeMapUpdateInterval, 
    182                                                                                                 cubeMapResolution, 
    183                                                                                                 texID, 
    184                                                                                                 useDistCalc, 
    185                                                                                                 useFaceAngleCalc, 
    186                                                                                                 distTolerance, 
    187                                                                                                 angleTolerance, 
    188                                                                                                 updateAllFace, 
    189                                                                                                 pass, 
    190                                                                                                 parentRenderable, 
    191                                                                                                 parentTechniqueGroup); 
    192          
    193         return result; 
     140        renderSelf = false; 
    194141} 
    195  
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreDistanceCubeMapRenderTechnique.cpp

    r874 r1711  
    1212                                                                                                                float angleTolerance, 
    1313                                                                                                                bool updateAllFace, 
     14                                                                                                                bool renderSelf, 
    1415                                                                                                                Pass* pass, 
    1516                                                                                                                OgreRenderable* parentRenderable, 
    1617                                                                                                                OgreTechniqueGroup* parentTechniqueGroup) 
    17                                                         :OgreRenderTechnique( pass, parentRenderable, parentTechniqueGroup), 
    18                                                         DistanceCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, parentRenderable, parentTechniqueGroup), 
     18                                                        : 
     19                                                        OgreCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, texID, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, pass, parentRenderable, parentTechniqueGroup), 
     20                                                        CubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, parentRenderable, parentTechniqueGroup), 
     21                                                        DistanceCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, parentRenderable, parentTechniqueGroup), 
    1922                                                        RenderTechnique(parentRenderable, parentTechniqueGroup)  
    2023{        
    21         this->texID = texID; 
    22          
    2324        if(sharedRuns->getRun(ILLUMRUN_DISTANCE_CUBEMAP) == 0) 
    2425                sharedRuns->addRun(ILLUMRUN_DISTANCE_CUBEMAP, createDistanceCubeMapRun()); 
     
    6768} 
    6869 
    69  
    70 ///Technique Parsers 
    71 namespace CausticCubemapParsers 
    72 { 
    73         void parseStartFrame(String& params, RenderTechniqueFactory* factory) 
    74         { 
    75                 OgreDistanceCubeMapRenderTechniqueFactory* f = (OgreDistanceCubeMapRenderTechniqueFactory*) factory; 
    76                 f->startFrame =  StringConverter::parseUnsignedLong(params); 
    77         } 
    78         void parseCubeMapUpdateInterval(String& params, RenderTechniqueFactory* factory) 
    79         { 
    80                 OgreDistanceCubeMapRenderTechniqueFactory* f = (OgreDistanceCubeMapRenderTechniqueFactory*) factory; 
    81                 f->cubeMapUpdateInterval =  StringConverter::parseUnsignedLong(params); 
    82         } 
    83  
    84         void parseCubeMapResolution(String& params, RenderTechniqueFactory* factory) 
    85         { 
    86                 OgreDistanceCubeMapRenderTechniqueFactory* f = (OgreDistanceCubeMapRenderTechniqueFactory*) factory; 
    87                 f->cubeMapResolution =  StringConverter::parseUnsignedInt(params); 
    88         } 
    89  
    90         void parseTexID(String& params, RenderTechniqueFactory* factory) 
    91         { 
    92                 OgreDistanceCubeMapRenderTechniqueFactory* f = (OgreDistanceCubeMapRenderTechniqueFactory*) factory; 
    93                 f->texID =  StringConverter::parseUnsignedInt(params); 
    94         } 
    95  
    96         void parseUseDistCalc(String& params, RenderTechniqueFactory* factory) 
    97         { 
    98                 OgreDistanceCubeMapRenderTechniqueFactory* f = (OgreDistanceCubeMapRenderTechniqueFactory*) factory; 
    99                 // format: on/off tolerance(float) 
    100                 StringVector vecparams = StringUtil::split(params, " \t"); 
    101  
    102                 if(StringConverter::parseBool(vecparams[0]))//on 
    103                 { 
    104                         f->useDistCalc = true; 
    105  
    106                         if(vecparams.size()>1) 
    107                         {                        
    108                                 f->distTolerance = StringConverter::parseReal(vecparams[1]); 
    109                         } 
    110                 } 
    111                 else 
    112                 { 
    113                         f->useDistCalc = false; 
    114                 } 
    115         } 
    116  
    117         void parseUseFaceAngleCalc(String& params, RenderTechniqueFactory* factory) 
    118         { 
    119                 OgreDistanceCubeMapRenderTechniqueFactory* f = (OgreDistanceCubeMapRenderTechniqueFactory*) factory; 
    120                 // format: on/off tolerance(float) 
    121                 StringVector vecparams = StringUtil::split(params, " \t"); 
    122  
    123                 if(StringConverter::parseBool(vecparams[0]))//on 
    124                 { 
    125                         f->useFaceAngleCalc = true; 
    126  
    127                         if(vecparams.size()>1) 
    128                         {                        
    129                                 f->angleTolerance = StringConverter::parseReal(vecparams[1]); 
    130                         } 
    131                 } 
    132                 else 
    133                 { 
    134                         f->useFaceAngleCalc = false; 
    135                 } 
    136         } 
    137  
    138         void parseUpdateAllFace(String& params, RenderTechniqueFactory* factory) 
    139         { 
    140                 OgreDistanceCubeMapRenderTechniqueFactory* f = (OgreDistanceCubeMapRenderTechniqueFactory*) factory; 
    141                 f->updateAllFace =  StringConverter::parseBool(params); 
    142         } 
    143 } 
    14470///Technique factory 
    14571OgreDistanceCubeMapRenderTechniqueFactory::OgreDistanceCubeMapRenderTechniqueFactory() 
    14672{ 
    147         typeName = "DistanceCubeMap"; 
    148  
    149         using namespace CausticCubemapParsers; 
    150         //register parsers 
    151         this->attributeParsers.insert(AttribParserList::value_type("start_frame", (ILLUM_ATTRIBUTE_PARSER) parseStartFrame)); 
    152         this->attributeParsers.insert(AttribParserList::value_type("update_interval", (ILLUM_ATTRIBUTE_PARSER) parseCubeMapUpdateInterval)); 
    153         this->attributeParsers.insert(AttribParserList::value_type("resolution", (ILLUM_ATTRIBUTE_PARSER) parseCubeMapResolution)); 
    154         this->attributeParsers.insert(AttribParserList::value_type("texture_unit_id", (ILLUM_ATTRIBUTE_PARSER) parseTexID)); 
    155         this->attributeParsers.insert(AttribParserList::value_type("distance_calc", (ILLUM_ATTRIBUTE_PARSER) parseUseDistCalc)); 
    156         this->attributeParsers.insert(AttribParserList::value_type("face_angle_calc", (ILLUM_ATTRIBUTE_PARSER) parseUseFaceAngleCalc)); 
    157         this->attributeParsers.insert(AttribParserList::value_type("update_all_face", (ILLUM_ATTRIBUTE_PARSER) parseUpdateAllFace)); 
    158  
     73        typeName = "DistanceCubeMap";    
    15974} 
    16075 
     
    16580                                                                                OgreTechniqueGroup* parentTechniqueGroup) 
    16681{        
    167         //reset parameters 
    168         startFrame = 1; 
    169         cubeMapUpdateInterval = 1; 
    170         cubeMapResolution = 256;                                                                                                 
     82        OgreCubeMapRenderTechniqueFactory::resetParams(); 
    17183        texID = 1; 
    172         useDistCalc = 1; 
    173         useFaceAngleCalc = false; 
    174         distTolerance = 2.0; 
    175         angleTolerance = 2.0; 
    176         updateAllFace = false; 
    177  
     84        OgreCubeMapRenderTechniqueFactory::parseParams(params);  
    17885        parseParams(params); 
    179  
     86         
    18087        OgreDistanceCubeMapRenderTechnique* result = new OgreDistanceCubeMapRenderTechnique( 
    18188                                                                                                startFrame, 
     
    18895                                                                                                angleTolerance, 
    18996                                                                                                updateAllFace, 
     97                                                                                                renderSelf, 
    19098                                                                                                pass, 
    19199                                                                                                parentRenderable, 
Note: See TracChangeset for help on using the changeset viewer.