source: GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderingRuns/OgreCausticCubeMapRenderingRun.h @ 2320

Revision 2320, 3.8 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 "OgreRenderingRun.h"
11#include "CausticCubeMapRenderingRun.h"
12#include "OgreSharedRuns.h"
13
14
15/**
[2240]16        @brief CausticCubeMapRenderingRun used in an OGRE environment.
[790]17*/
18class OgreCausticCubeMapRenderingRun : public OgreRenderingRun,
19                                                                        public CausticCubeMapRenderingRun
20{       
21public:
22
23        /**
24                @brief Constructor.
25
26                @param sharedRuns                               a pointer to the OgreSharedRuns this run belongs to
27                @param name                                             the name of the cubemap texture to be created
28                @param startFrame                               adds an offset to the current frame number to help evenly distribute updates between frames
29                @param updateInterval                   update frequency
30                @param resolution                               cubemap resolution
31                @param materialName                             the name of the material that should be used when rendering the caustic cubemap
32                @param photonMapTexId                   the texture unit state id of the caustic map generation material where the photonhit map should be bound to
33                @param updateAllFace                    defines if all cubemap faces should be updated in a frame or only one face per frame
[2240]34                @param attenuation                              attenuation distance of the caustic
35                @param useTriangles                             sets if triangles should be rendered into the caustic cubemap instead of sprites
36                @param blurMap                                  sets if the caustic cubemap should be blurred (recommended if rendering caustic triangles)
[790]37        */     
38        OgreCausticCubeMapRenderingRun(OgreSharedRuns* sharedRuns,
39                                                                String name,
40                                                                  unsigned long startFrame,
41                                                                unsigned long updateInterval,
42                                                                unsigned int resolution,
43                                                                 String materialName,
44                                                                 unsigned char photonMapTexId,
[1055]45                                                                 bool updateAllFace,
[1351]46                                                                 float attenuation,
[1688]47                                                                 bool useTriangles,
48                                                                 bool blurMap
[790]49                                                                 );
[2320]50
51        virtual ~OgreCausticCubeMapRenderingRun(){}
[790]52        /**
53                @brief returns the name of the resulting caustic cubemap texture
54        */
[1688]55        const String& getCausticCubeMapTextureName()
56        {
57                if(blurMap)
58                        return bluredCausticCubemapTexture->getName();
59                else
60                        return name;
61        }
[790]62
63        //inherited
64        void photonMapChanged(RenderingRun* run);
[2240]65        /**
66                @see attenuation
67        */
[1055]68        float getAttenuation(){return attenuation;}
[2240]69        //inherited
[1722]70        bool canJoin(RenderingRun* run)
[1055]71        {
[1722]72                OgreCausticCubeMapRenderingRun* r = (OgreCausticCubeMapRenderingRun*) run->asOgreRenderingRun();
[1055]73                if(r->materialName == materialName)
74                        return true;
75                return false;
76        }
[2240]77        /**
78                @see blurMap
79        */
[2142]80        void setBlurMap(bool blur){blurMap = blur;}
81
[2320]82        void freeAllResources();
83
[790]84protected:
85        /**
86                @brief the texture unit state id of the caustic map generation material where the photonhit map should be bound to
87        */
88        unsigned char photonMapTexId;
89        /**
90                @brief a pointer to the OgreSharedRuns this run belongs to
91        */
92        OgreSharedRuns* sharedRuns;
93        /**
94                @brief the name of the cubemap texture that was created by this run
95        */
96        String name;
97        /**
98                @brief a pointer to the cubemap texture that was created by this run
99        */
100        Texture* causticCubemapTexture;
101        /**
[1688]102                @brief a pointer to the blurred cubemap texture that was created by this run
103        */
104        Texture* bluredCausticCubemapTexture;
105        /**
[790]106                @brief the name of the material that should be used when rendering the caustic cubemap
107        */
108        String materialName;
[2240]109        /**
110                @brief attenuation distance of the caustic
111        */
[1055]112        float attenuation;
[2240]113        /**
114                @brief sets if triangles should be rendered into the caustic cubemap instead of sprites
115        */
[1351]116        bool useTriangles;
[2240]117        /**
118                @brief sets if the caustic cubemap should be blurred (recommended if rendering caustic triangles)
119        */
[1688]120        bool blurMap;
[790]121       
122        //inherited
123        inline void createCausticCubeMap();
124        //inherited
125        inline void updateCubeFace(int facenum);
126        //inherited
127    bool faceNeedsUpdate(int facenum); 
128       
129};
Note: See TracBrowser for help on using the repository browser.