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

Revision 2240, 3.7 KB checked in by szirmay, 17 years ago (diff)
Line 
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/**
16        @brief CausticCubeMapRenderingRun used in an OGRE environment.
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
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)
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,
45                                                                 bool updateAllFace,
46                                                                 float attenuation,
47                                                                 bool useTriangles,
48                                                                 bool blurMap
49                                                                 );
50        /**
51                @brief returns the name of the resulting caustic cubemap texture
52        */
53        const String& getCausticCubeMapTextureName()
54        {
55                if(blurMap)
56                        return bluredCausticCubemapTexture->getName();
57                else
58                        return name;
59        }
60
61        //inherited
62        void photonMapChanged(RenderingRun* run);
63        /**
64                @see attenuation
65        */
66        float getAttenuation(){return attenuation;}
67        //inherited
68        bool canJoin(RenderingRun* run)
69        {
70                OgreCausticCubeMapRenderingRun* r = (OgreCausticCubeMapRenderingRun*) run->asOgreRenderingRun();
71                if(r->materialName == materialName)
72                        return true;
73                return false;
74        }
75        /**
76                @see blurMap
77        */
78        void setBlurMap(bool blur){blurMap = blur;}
79
80protected:
81        /**
82                @brief the texture unit state id of the caustic map generation material where the photonhit map should be bound to
83        */
84        unsigned char photonMapTexId;
85        /**
86                @brief a pointer to the OgreSharedRuns this run belongs to
87        */
88        OgreSharedRuns* sharedRuns;
89        /**
90                @brief the name of the cubemap texture that was created by this run
91        */
92        String name;
93        /**
94                @brief a pointer to the cubemap texture that was created by this run
95        */
96        Texture* causticCubemapTexture;
97        /**
98                @brief a pointer to the blurred cubemap texture that was created by this run
99        */
100        Texture* bluredCausticCubemapTexture;
101        /**
102                @brief the name of the material that should be used when rendering the caustic cubemap
103        */
104        String materialName;
105        /**
106                @brief attenuation distance of the caustic
107        */
108        float attenuation;
109        /**
110                @brief sets if triangles should be rendered into the caustic cubemap instead of sprites
111        */
112        bool useTriangles;
113        /**
114                @brief sets if the caustic cubemap should be blurred (recommended if rendering caustic triangles)
115        */
116        bool blurMap;
117       
118        //inherited
119        inline void createCausticCubeMap();
120        //inherited
121        inline void updateCubeFace(int facenum);
122        //inherited
123    bool faceNeedsUpdate(int facenum); 
124       
125};
Note: See TracBrowser for help on using the repository browser.