source: GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderingRuns/OgreLightVolumeRenderingRun.h @ 2264

Revision 2264, 2.9 KB checked in by szirmay, 17 years ago (diff)
RevLine 
[1425]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 "LightVolumeRenderingRun.h"
12#include "OgreSharedRuns.h"
13
14
15/**
[2264]16        @brief LightVolumeRenderingRun used in an OGRE environment.
[1425]17*/
18class OgreLightVolumeRenderingRun : public OgreRenderingRun,
19                                                                        public LightVolumeRenderingRun
20{       
21public:
22
23        /**
24                @brief Constructor.
25
26                @param sharedRuns                       a pointer to the OgreSharedRuns this run belongs to
[2264]27                @param name                                     the name of the light volume texture to be created
[1425]28                @param startFrame                       adds an offset to the current frame number to help evenly distribute updates between frames
29                @param updateInterval           update frequency
[2264]30                @param resolution                       light volume texture resolution
31                @param materialName                     the name of the material should be used when rendering the light volume
[1425]32        */     
33        OgreLightVolumeRenderingRun(OgreSharedRuns* sharedRuns,
34                                                                String name,
35                                                                unsigned long startFrame,
36                                                                unsigned long updateInterval,
37                                                                unsigned int resolution,
38                                                                unsigned int textureDepth,
39                                                                String materialName);
40        /**
[2264]41                @brief returns the name of the resulting light volume texture
[1425]42        */
43        String getLightVolumeTextureName()
44        {
45                if(textureDepth == 1)
[2041]46                        return lightVolumeTexture2->getName();
[1425]47                else
48                        return lightVolumeTexture3D->getName();
49        }
50        /**
51                @brief Refreshes light camera matrices, called in each update.
52        */
53        void refreshLight();
[2264]54        /**
55                @brief Returns the light matrix used while rendering the light volume.
56        */
[1425]57        Matrix4 getLightViewProjectionMatrix()
58        {
59                Matrix4 m = lightVolumeCamera->getProjectionMatrixWithRSDepth() * lightVolumeCamera->getViewMatrix();
60                Vector4 unitX(1,0,0,1);
61                Vector4 unitY(0,1,0,1);
62                Vector4 unitZ(0,0,1,1);
63                Vector4 tX = m * unitX;
64                Vector4 tY = m * unitY;
65                Vector4 tZ = m * unitZ;
66                return  m;
67                               
68        }
69       
70protected:     
71        /**
[2264]72                @brief the name of the material should be used when rendering the light volume
[1425]73        */
74        String materialName;
75        /**
[2264]76                @brief pointer to the nearest light source to the particle system
[1425]77        */
78        Light* light;
79        /**
[2264]80                @brief pointer to the camera used while rendering the light volume
[1425]81        */
82        Camera* lightVolumeCamera;
83        /**
84                @brief a pointer to the OgreSharedRuns this run belongs to
85        */
86        OgreSharedRuns* sharedRuns;
87        /**
[2264]88                @brief the name of the light volume texture that was created by this run
[1425]89        */
90        String name;
[2264]91       
[1425]92        Texture* lightVolumeTexture;
[1987]93        Texture* lightVolumeTexture2;
94        Texture* lightVolumeTextureThis;
95        Texture* lightVolumeTextureLast;
[2264]96       
97        Texture* lightVolumeTexture3D;
98
99        unsigned char* volumeBuffer;
[1425]100        /**
[2264]101                @brief the radius of the particle system
[1425]102        */
103        float systemRadius;     
104        void createVolumeBuffer();
105       
106        //inherited
107        void updateFrame(unsigned long frameNum);       
108        //inherited
109        inline void createLightVolumeMap();
110
111};
Note: See TracBrowser for help on using the repository browser.