#pragma once //disable inheritance warning caused by multiple inheritance #if _WIN32 #if _MSC_VER #pragma warning(disable: 4250) #endif #endif #include "OgreRenderingRun.h" #include "LightVolumeRenderingRun.h" #include "OgreSharedRuns.h" /** @brief ColorCubeMapRenderingRun used in an OGRE environment. */ class OgreLightVolumeRenderingRun : public OgreRenderingRun, public LightVolumeRenderingRun { public: /** @brief Constructor. @param sharedRuns a pointer to the OgreSharedRuns this run belongs to @param name the name of the texture to be created @param startFrame adds an offset to the current frame number to help evenly distribute updates between frames @param updateInterval update frequency @param resolution color cubemap resolution @param materialName the name of the material should be used when rendering the choton hit map */ OgreLightVolumeRenderingRun(OgreSharedRuns* sharedRuns, String name, unsigned long startFrame, unsigned long updateInterval, unsigned int resolution, unsigned int textureDepth, String materialName); /** @brief returns the name of the resulting photon hit map */ String getLightVolumeTextureName() { if(textureDepth == 1) return name; else return lightVolumeTexture3D->getName(); } /** @brief Refreshes light camera matrices, called in each update. */ void refreshLight(); Matrix4 getLightViewProjectionMatrix() { Matrix4 m = lightVolumeCamera->getProjectionMatrixWithRSDepth() * lightVolumeCamera->getViewMatrix(); Vector4 unitX(1,0,0,1); Vector4 unitY(0,1,0,1); Vector4 unitZ(0,0,1,1); Vector4 tX = m * unitX; Vector4 tY = m * unitY; Vector4 tZ = m * unitZ; return m; } protected: /** @brief the name of the material should be used when rendering the choton hit map */ String materialName; /** @brief pointer to the nearest light source from the caster object */ Light* light; /** @brief the created photon hit map texture */ Camera* lightVolumeCamera; /** @brief a pointer to the OgreSharedRuns this run belongs to */ OgreSharedRuns* sharedRuns; /** @brief the name of the photonmap texture that was created by this run */ String name; /** @brief a pointer to the photonmap texture that was created by this run */ Texture* lightVolumeTexture; /** @brief a pointer to the photonmap texture that was created by this run */ Texture* lightVolumeTexture3D; unsigned char* volumeBuffer; float systemRadius; void createVolumeBuffer(); //inherited void updateFrame(unsigned long frameNum); //inherited inline void createLightVolumeMap(); };