[790] | 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 "OgreRenderTechnique.h"
|
---|
| 11 | #include "CausticCasterRenderTechnique.h"
|
---|
| 12 |
|
---|
| 13 | /**
|
---|
| 14 | @brief CausticCasterRenderTechnique used in an OGRE environment.
|
---|
| 15 | */
|
---|
| 16 | class OgreCausticCasterRenderTechnique : public OgreRenderTechnique,
|
---|
| 17 | public CausticCasterRenderTechnique
|
---|
| 18 | {
|
---|
| 19 | public:
|
---|
| 20 | /**
|
---|
| 21 | @brief Constructor.
|
---|
| 22 |
|
---|
| 23 | @param startFrame adds an offset to the current frame number to help evenly distribute updates between frames
|
---|
| 24 | @param photonMapUpdateInterval photon map and caustic cubemap update frequency
|
---|
| 25 | @param photonMapResolution photon map resolution
|
---|
| 26 | @param causticCubeMapResolution caustic cubemap resolution
|
---|
[2285] | 27 | @param photonMapMaterialName the name of the material should be used when rendering the photon hit map
|
---|
[790] | 28 | @param causticMapMaterialName the name of the material that should be used when rendering the caustic cubemap
|
---|
| 29 | @param photonMapTexID the texture unit state id of the caustic map generation material where the photonhit map should be bound to
|
---|
| 30 | @param updateAllFace defines if all cubemap faces should be updated in a frame or only one face per frame
|
---|
| 31 | @param useDistance tells if a distance cubemap impostor should be used in photon hit calculation (recommended)
|
---|
[2240] | 32 | @param attenuation attenuation distance of the caustic
|
---|
| 33 | @param useTriangles sets if triangles should be rendered into the caustic cubemap instead of sprites
|
---|
| 34 | @param blurCauCubeMap sets if the caustic cubemap should be blurred (recommended if rendering caustic triangles)
|
---|
[790] | 35 | @param pass the pass to operate on
|
---|
| 36 | @param parentRenderable the object to operate on
|
---|
| 37 | @param parentTechniqueGroup the TechniqueGroup this RenderedTechnique is attached to
|
---|
| 38 | */
|
---|
| 39 | OgreCausticCasterRenderTechnique( unsigned long startFrame,
|
---|
| 40 | unsigned long photonMapUpdateInterval,
|
---|
| 41 | unsigned int photonMapResolution,
|
---|
[2240] | 42 | unsigned int causticCubeMapResolution,
|
---|
[790] | 43 | String photonMapMaterialName,
|
---|
| 44 | String causticMapMaterialName,
|
---|
| 45 | unsigned char photonMapTexID,
|
---|
| 46 | bool updateAllFace,
|
---|
| 47 | bool useDistance,
|
---|
[1055] | 48 | float attenuation,
|
---|
[1351] | 49 | bool useTriangles,
|
---|
[1688] | 50 | bool blurCauCubeMap,
|
---|
[790] | 51 | Pass* pass,
|
---|
| 52 | OgreRenderable* parentRenderable,
|
---|
| 53 | OgreTechniqueGroup* parentTechniqueGroup
|
---|
| 54 | );
|
---|
| 55 | /**
|
---|
| 56 | @brief Destructor.
|
---|
| 57 | */
|
---|
[2320] | 58 | virtual ~OgreCausticCasterRenderTechnique();
|
---|
[790] | 59 | /**
|
---|
| 60 | @brief Returns the name of the created caustic cubemap.
|
---|
| 61 |
|
---|
| 62 | @return name of the caustic cubemap texture
|
---|
| 63 | */
|
---|
[1688] | 64 | const String& getCausticCubeMapName();
|
---|
[2240] | 65 | /**
|
---|
| 66 | @see attenuation
|
---|
| 67 | */
|
---|
[1055] | 68 | float getAttenuation(){return attenuation;}
|
---|
[790] | 69 |
|
---|
| 70 | protected:
|
---|
[1055] | 71 |
|
---|
[790] | 72 | /**
|
---|
| 73 | @brief name of the created photon hit map texture
|
---|
| 74 | */
|
---|
| 75 | String photonMapMaterialName;
|
---|
| 76 | /**
|
---|
| 77 | @brief name of the created caustic cubemap texture
|
---|
| 78 | */
|
---|
| 79 | String causticMapMaterialName;
|
---|
| 80 | /**
|
---|
| 81 | @brief the texture unit state id of the caustic map generation material where the photonhit map should be bound to.
|
---|
| 82 | */
|
---|
| 83 | unsigned char photonMapTexID;
|
---|
[2240] | 84 | /**
|
---|
| 85 | @brief attenuation distance of the caustic
|
---|
| 86 | */
|
---|
[1055] | 87 | float attenuation;
|
---|
[2240] | 88 | /**
|
---|
| 89 | @brief sets if triangles should be rendered into the caustic cubemap instead of sprites
|
---|
| 90 | */
|
---|
[1351] | 91 | bool useTriangles;
|
---|
[2240] | 92 | /**
|
---|
| 93 | @brief sets if the caustic cubemap should be blurred (recommended if rendering caustic triangles)
|
---|
| 94 | */
|
---|
[1688] | 95 | bool blurCauCubeMap;
|
---|
[2299] | 96 |
|
---|
[790] | 97 | //inherited
|
---|
[1055] | 98 | void photonMapRunChanged(RenderingRun* run);
|
---|
[790] | 99 | //inherited
|
---|
[1055] | 100 | void causticCubeMapRunChanged(RenderingRun* run);
|
---|
[790] | 101 | //inherited
|
---|
[1055] | 102 | void distanceCubeMapRunChanged(RenderingRun* run);
|
---|
[790] | 103 | //inherited
|
---|
[949] | 104 | void distanceCubeMapRunUpdated(RenderingRun* run);
|
---|
| 105 | //inherited
|
---|
[1055] | 106 | RenderingRun* createPhotonMapRun();
|
---|
[790] | 107 | //inherited
|
---|
[1055] | 108 | RenderingRun* createCausticCubeMapRun();
|
---|
[790] | 109 | //inherited
|
---|
[1055] | 110 | RenderingRun* createDistanceCubeMapRun();
|
---|
[836] | 111 | };
|
---|
| 112 |
|
---|
[2240] | 113 | /**
|
---|
| 114 | @brief RenderTechniqueFactory to create OgreCausticCasterRenderTechnique instances.
|
---|
| 115 | */
|
---|
[836] | 116 | class OgreCausticCasterRenderTechniqueFactory : public RenderTechniqueFactory
|
---|
| 117 | {
|
---|
| 118 | public:
|
---|
| 119 |
|
---|
| 120 | OgreCausticCasterRenderTechniqueFactory();
|
---|
| 121 |
|
---|
| 122 | OgreRenderTechnique* createInstance(IllumTechniqueParams* params,
|
---|
| 123 | Pass* pass,
|
---|
| 124 | OgreRenderable* parentRenderable,
|
---|
| 125 | OgreTechniqueGroup* parentTechniqueGroup);
|
---|
| 126 |
|
---|
| 127 |
|
---|
[1055] | 128 | float attenuation;
|
---|
[836] | 129 | unsigned long startFrame;
|
---|
| 130 | unsigned long photonMapUpdateInterval;
|
---|
| 131 | unsigned int photonMapResolution;
|
---|
| 132 | unsigned int causticCubeMapResolution;
|
---|
| 133 | String photonMapMaterialName;
|
---|
| 134 | String causticMapMaterialName;
|
---|
| 135 | unsigned char photonMapTexID;
|
---|
| 136 | bool updateAllFace;
|
---|
| 137 | bool useDistance;
|
---|
[1351] | 138 | bool useTriangles;
|
---|
[2299] | 139 | bool blurCauCubeMap;
|
---|
[836] | 140 | };
|
---|