source: GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/Másolat - OgreRenderingRun.h @ 1055

Revision 1055, 5.9 KB checked in by szirmay, 18 years ago (diff)
Line 
1#pragma once
2#include "RenderingRun.h"
3#include "Ogre.h"
4#include "SpriteSet.h"
5
6using namespace Ogre;
7
8/**
9        @brief Base class of a RenderingRun in an OGRE environment.     
10*/
11class OgreRenderingRun : virtual public RenderingRun
12{       
13public:
14        /**
15                @brief Constructor.
16               
17                @param startFrame                       adds an offset to the current frame number to help evenly distribute updates between frames
18                @param updateInterval           photon map update frequency             
19        */
20        OgreRenderingRun(unsigned long startFrame,
21                                        unsigned long updateInterval)
22                                                :RenderingRun(startFrame, updateInterval)
23        {
24                pixelSprites = 0;
25        }
26        /**
27                @brief Conversion to OgreRenderRun.
28
29                This function is needed because of virtual inheritance.
30        */
31        OgreRenderingRun* asOgreRenderingRun(){return this;}
32
33protected:
34
35        /**
36                @brief map of Renderables which will be rendered with a given material
37
38                The String stores the original material name that will be restored after rendering.
39
40                @see setMaterialForVisibles
41                @see setMaterialForRenderables
42                @see restoreMaterials
43        */
44        std::map<Renderable*, String> visibleObjects;
45        /**
46                @brief fulls screen quad plane used in full screen quad rendering
47
48                @see renderFullscreenQuad
49        */
50        static MovablePlane* fullScreenQuad;
51        /**
52                @brief fulls screen quad Entity used in full screen quad rendering
53
54                @see renderFullscreenQuad
55        */
56        static Entity* fullScreenQuadEntity;
57        /**
58                @brief fulls screen quad SceneNode used in full screen quad rendering
59
60                @see renderFullscreenQuad
61        */
62        static SceneNode* fullScreenQuadNode;
63        /**
64                @brief SpriteSet used in pixel sprite rendering
65
66                @see renderPixelSprites
67        */
68        SpriteSet* pixelSprites;
69        /**
70                @brief unique name of the SpriteSet used in pixel sprite rendering
71
72                @see renderPixelSprites
73        */
74        String spriteSetName;
75
76        /**
77                @brief Returns a direction for a cubemap face id.
78
79                This is a helper function to retrieve the normal direction of a given
80                cubemap face.
81
82                @param faceId the number of the face
83        */
84        Vector3 getCubeMapFaceDirection(unsigned char faceId);
85        /**
86                @brief Creates a cubemap texture.
87
88                This is a helper function to easily create a cubemap texture and automaticly attach
89                viewports to each face so it can be used as a rendertarget.
90
91                @param name the name of the texture to be created
92                @param position the initial position of the cubemap
93                @param resolution the resolution of one cubemapface
94                @param format the pixel format of the cubemap
95                @param numMips the number of mipmap levels
96                @param clearColor initial color
97        */
98        Texture* createCubeRenderTexture(String name, const Vector3 position, unsigned int resolution = 512, PixelFormat format = PF_FLOAT16_RGBA, int numMips = 0, ColourValue clearColor = ColourValue::Black);
99        /**
100                @brief Sets the given material for each Renderable in a RenderQueue.
101
102                This is a helper function to set a material to each element of a previously filled Renderque.
103                The orginal material of the Renderables are stored so they can be restored later.
104                The function also tells the current SceneManager not to search for visible objects, as we are
105                going to use the given RenderQueue during the next rendering.
106
107                @param materialName the name of the material to set for the Renderables
108                @param rq pointer to the filled Renderqueue instance to set material for
109        */
110        void setMaterialForRenderables(String& materialName, RenderQueue* rq);
111        /**
112                @brief Sets the given material for each Renderable visible from a given camera.
113
114                This helper function is similar to setMaterialForRenderables but it is also responsible for filling the RenderQueue.
115                First the RenderQueue of the current SceneManager fill be filled with the visible objects seen from the given camera.
116                Then the required material will be set for each element of the RenderQueue.
117                The orginal material of the Renderables are stored so they can be restored later.
118                The function also tells the current SceneManager not to search for visible objects, as we are
119                going to use the filled RenderQueue during the next rendering.
120
121                @param materialName the name of the material to set for the Renderables
122                @param cam pointer to the camera from which visible objects should be searched
123                @param shadowcastersonly flag to search for only shadow casters
124        */
125        void setMaterialForVisibles(String& materialName, Camera* cam, bool shadowcastersonly = false);
126        /**
127                @brief Restores previously stored materials.
128
129                This helper function is typically used after a setMaterialForRenderables or setMaterialForVisibles
130                call and a rendering process to restore the original material settings.
131                The function also tells the current SceneManager to search for visible objects, as this is the
132                default behaviour of SceneManager.             
133        */
134        void restoreMaterials();
135        /**
136                @brief Renderes a full screen quad on a given RendderTarget with a given material.
137
138                @param materialName the name of the material bind to the quad
139                @param target the RenderTarget the quad should be rendered on
140        */
141        void renderFullscreenQuad(String materialName, RenderTarget* target);
142        /**
143                @brief Renderes sprites to pixels of the screen on a given RendderTarget with a given material.
144
145                Pixel sprites are pixel sized quads, placed on each pixel of the RenderTarget.
146                The number of sprites not necessary corresponds to the resolution of the rendertarget.
147                The pixel quads will evenly fill the rendertarget's area with sizes corresponding to the given resolution.
148                We can render fewer or more pixel quads than the number of pixels the rendertarget has (eg.: in case of caustic cubemap generation).
149               
150                @param materialName the name of the material bind to the pixel sprites
151                @param rt the RenderTarget the quads should be rendered on
152                @param width the desired resolution width of the sprites
153                @param height the desired resolution height of the sprites
154        */
155        void renderPixelSprites(String& materialName, RenderTarget* rt, int width, int height);
156       
157};
Note: See TracBrowser for help on using the repository browser.