#pragma once //disable inheritance warning caused by multiple inheritance #if _WIN32 #if _MSC_VER #pragma warning(disable: 4250) #endif #endif #include "CubeMapRenderTechnique.h" #include "OgreRenderTechnique.h" #include "Ogre.h" using namespace Ogre; /** @brief CubeMapRenderTechnique used in an Ogre environment. */ class __declspec( dllexport ) OgreCubeMapRenderTechnique : virtual public CubeMapRenderTechnique, public OgreRenderTechnique { public: /** @brief Constructor. @param startFrame adds an offset to the current frame number to help evenly distribute updates between frames @param cubeMapUpdateInterval update frequency @param cubeMapResolution color cubemap resolution @param texID the id of the texture unit state the resulting cubemap should be bound to @param useDistCalc flag to skip cube face update if object is far away @param useFaceAngleCalc flag to skip cube face update if face is neglible @param distTolerance distance tolerance used in face skip @param angleTolerance angle tolerance used in face skip @param updateAllFace defines if all cubemap faces should be updated in a frame or only one face per frame @param renderSelf sets if the object should be rendered to the cube map @param renderEnvironment sets if the environment should be rendered to the cube map @param selfMaterial the material that should be set for the object while rendering the cubemap @param environmentMaterial the material that should be set for the environment while rendering the cubemap @param layer the layer of this cubemap @param getMinMax sets if the minimum and maximum values of the cubemap should be computed @param attachToTexUnit sets if this cubemap should be attach to a texture unit of the pass @param minVariableName sets the name of the gpu shader program parameter to which the minimum value should be bound to @param maxVariableName sets the name of the gpu shader program parameter to which the maximum value should be bound to @param pass the pass to operate on @param parentRenderable the object to operate on @param parentTechniqueGroup the TechniqueGroup this RenderedTechnique is attached to */ OgreCubeMapRenderTechnique( unsigned long startFrame, unsigned long cubeMapUpdateInterval, unsigned int cubeMapResolution, unsigned char texID, bool useDistCalc, bool useFaceAngleCalc, float distTolerance, float angleTolerance, bool updateAllFace, bool renderSelf, bool renderEnvironment, String selfMaterial, String environmentMaterial, int layer, bool getMinMax, bool attachToTexUnit, String minVariableName, String maxVariableName, String triggerName, Pass* pass, OgreRenderable* parentRenderable, OgreTechniqueGroup* parentTechniqueGroup, bool createCubeRun = false ); /** @brief Destructor. */ virtual ~OgreCubeMapRenderTechnique(); protected: /** @brief the id of the texture unit state the resulting cubemap should be bound to */ unsigned char texID; /** @brief the material that should be set for the object while rendering the cubemap */ String selfMaterial; /** @brief the material that should be set for the environment while rendering the cubemap */ String environmentMaterial; //helper string to name the created cubemaps String texturePostFix; /** @brief sets if the minimum and maximum values of the cubemap should be computed */ bool getMinMax; /** @brief sets if this cubemap should be attach to a texture unit of the pass */ bool attachToTexUnit; /** @brief sets the name of the gpu shader program parameter to which the minimum value should be bound to */ String minVariableName; /** @brief sets the name of the gpu shader program parameter to which the maximum value should be bound to */ String maxVariableName; String triggerName; //inherited RenderingRun* createCubeMapRun(); //inherited void cubeMapRunChanged(RenderingRun* run); //inherited void cubeMapRunUpdated(RenderingRun* run); }; /** @brief RenderTechniqueFactory to create OgreCubeMapRenderTechnique instances. */ class __declspec( dllexport ) OgreCubeMapRenderTechniqueFactory : public RenderTechniqueFactory { public: OgreCubeMapRenderTechniqueFactory(); OgreRenderTechnique* createInstance(IllumTechniqueParams* params, Pass* pass, OgreRenderable* parentRenderable, OgreTechniqueGroup* parentTechniqueGroup); void resetParams(); virtual bool needMaterialCopy(IllumTechniqueParams* params){return true;} unsigned long startFrame; unsigned long cubeMapUpdateInterval; unsigned int cubeMapResolution; unsigned char texID; bool useDistCalc; bool useFaceAngleCalc; float distTolerance; float angleTolerance; bool updateAllFace; bool renderSelf; bool renderEnvironment; String selfMaterial; String environmentMaterial; int layer; bool getMinMax; bool attachToTexUnit; String minVariableName; String maxVariableName; String triggerName; };