source: GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreCubeMapRenderTechnique.h @ 2355

Revision 2355, 5.1 KB checked in by szirmay, 17 years ago (diff)
RevLine 
[790]1#pragma once
2
3//disable inheritance warning caused by multiple inheritance
4#if _WIN32
5#if _MSC_VER
6#pragma warning(disable: 4250)
7#endif
8#endif
9
10#include "CubeMapRenderTechnique.h"
11#include "OgreRenderTechnique.h"
12#include "Ogre.h"
13
14using namespace Ogre;
15
16/**
17        @brief CubeMapRenderTechnique used in an Ogre environment.
18*/
[1711]19class OgreCubeMapRenderTechnique :      virtual public CubeMapRenderTechnique,
[790]20                                                                        public OgreRenderTechnique
21{
22public:
23
24        /**
25                @brief Constructor.
26
27                @param startFrame                               adds an offset to the current frame number to help evenly distribute updates between frames
28                @param cubeMapUpdateInterval    update frequency
29                @param cubeMapResolution                color cubemap resolution
30                @param texID                                    the id of the texture unit state the resulting cubemap should be bound to
31                @param useDistCalc                              flag to skip cube face update if object is far away
32                @param useFaceAngleCalc                 flag to skip cube face update if face is neglible
33                @param distTolerance                    distance tolerance used in face skip
34                @param angleTolerance                   angle tolerance used in face skip
35                @param updateAllFace                    defines if all cubemap faces should be updated in a frame or only one face per frame
[2240]36                @param renderSelf                               sets if the object should be rendered to the cube map
37                @param renderEnvironment                sets if the environment should be rendered to the cube map
38                @param selfMaterial                             the material that should be set for the object while rendering the cubemap
39                @param environmentMaterial      the material that should be set for the environment while rendering the cubemap
40                @param layer                                    the layer of this cubemap
41                @param getMinMax                                sets if the minimum and maximum values of the cubemap should be computed
42                @param attachToTexUnit                  sets if this cubemap should be attach to a texture unit of the pass
43                @param minVariableName                  sets the name of the gpu shader program parameter to which the minimum value should be bound to
44                @param maxVariableName                  sets the name of the gpu shader program parameter to which the maximum value should be bound to
[790]45                @param pass                                             the pass to operate on                 
46                @param parentRenderable                 the object to operate on
47                @param parentTechniqueGroup             the TechniqueGroup this RenderedTechnique is attached to
48        */
49        OgreCubeMapRenderTechnique( unsigned long startFrame,
50                                                        unsigned long cubeMapUpdateInterval,
51                                                        unsigned int cubeMapResolution,                                                                                         
52                                                        unsigned char texID,
53                                                        bool useDistCalc,
54                                                        bool useFaceAngleCalc,
55                                                        float distTolerance,
56                                                        float angleTolerance,
57                                                        bool updateAllFace,
[1711]58                                                        bool renderSelf,
[1722]59                                                        bool renderEnvironment,
60                                                        String selfMaterial,
61                                                        String environmentMaterial,
[1725]62                                                        int layer,
[1886]63                                                        bool getMinMax,
64                                                        bool attachToTexUnit,
65                                                        String minVariableName,
66                                                    String maxVariableName,
[2355]67                                                        String triggerName,
[790]68                                                        Pass* pass,
69                                                        OgreRenderable* parentRenderable,
[1722]70                                                        OgreTechniqueGroup* parentTechniqueGroup,
71                                                        bool createCubeRun = false
[790]72                                                        );
73        /**
74                @brief Destructor.
75        */
[2320]76        virtual ~OgreCubeMapRenderTechnique();
[1722]77       
[1711]78               
[790]79protected:
80               
81        /**
82                @brief the id of the texture unit state the resulting cubemap should be bound to
83        */
[1722]84        unsigned char texID;
[2240]85        /**
86                @brief the material that should be set for the object while rendering the cubemap
87        */
[1722]88        String selfMaterial;
[2240]89        /**
90                @brief the material that should be set for the environment while rendering the cubemap
91        */
[1722]92        String environmentMaterial;
[2240]93        //helper string to name the created cubemaps
[1722]94        String texturePostFix;
[2240]95        /**
96                @brief sets if the minimum and maximum values of the cubemap should be computed
97        */
[1886]98        bool getMinMax;
[2240]99        /**
100                @brief sets if this cubemap should be attach to a texture unit of the pass
101        */
[1886]102        bool attachToTexUnit;
[2240]103        /**
104                @brief sets the name of the gpu shader program parameter to which the minimum value should be bound to
105        */
[1886]106        String minVariableName;
[2240]107        /**
108                @brief sets the name of the gpu shader program parameter to which the maximum value should be bound to
109        */
[1886]110        String maxVariableName;
111
[2355]112        String triggerName;
113
[2240]114        //inherited
[1722]115        RenderingRun* createCubeMapRun();
[2240]116        //inherited
117        void cubeMapRunChanged(RenderingRun* run);
118        //inherited
[1930]119        void cubeMapRunUpdated(RenderingRun* run);     
[836]120};
121
[2240]122/**
123        @brief RenderTechniqueFactory to create OgreCubeMapRenderTechnique instances.
124*/
[1711]125class OgreCubeMapRenderTechniqueFactory : public RenderTechniqueFactory
[836]126{
127public:
128       
[1711]129        OgreCubeMapRenderTechniqueFactory();
[1722]130
131        OgreRenderTechnique* createInstance(IllumTechniqueParams* params,
132                                                                                Pass* pass,
133                                                                                OgreRenderable* parentRenderable,
134                                                                                OgreTechniqueGroup* parentTechniqueGroup);
135
136        void resetParams();
[1711]137       
[836]138        unsigned long startFrame;
139        unsigned long cubeMapUpdateInterval;
140        unsigned int cubeMapResolution;                                                                                         
141        unsigned char texID;
142        bool useDistCalc;
143        bool useFaceAngleCalc;
144        float distTolerance;
145        float angleTolerance;
146        bool updateAllFace;
[1711]147        bool renderSelf;
[1722]148        bool renderEnvironment;
149        String selfMaterial;
150        String environmentMaterial;
[1725]151        int layer;
[1886]152
153        bool getMinMax;
154        bool attachToTexUnit;
155        String minVariableName;
156        String maxVariableName;
[2355]157        String triggerName;
[1711]158};
Note: See TracBrowser for help on using the repository browser.