13 #include <osg/Drawable>
14 #include <osg/TextureCubeMap>
20 #include <matrix/vlVector.h>
21 #include <osg/StateSet>
34 #define NUM_TRITON_SHADER_TYPES 6
45 class DtPlanarReflection;
46 class DtObserverObject;
56 virtual void update(osg::NodeVisitor* nv, osg::Drawable*);
69 osg::TextureCubeMap * environmentMap = NULL,
75 virtual Object* cloneType()
const
78 myEnvironmentInfo, myGeocentricFlag);
80 virtual Object* clone(
const osg::CopyOp& copyop)
const
83 myEnvironmentInfo, myGeocentricFlag);
90 virtual Triton::Environment*
environment() {
return myEnvironment; }
93 virtual void setBeach(
const osg::Vec3& beachOrigin, osg::Vec3 normal);
96 virtual void drawImplementation(osg::RenderInfo& renderInfo)
const;
99 virtual void setPlanarReflections(
bool enabled);
100 virtual bool planarReflections()
const;
103 virtual void setBreakingWaveAmplitude(
float meters);
104 virtual float getBreakingWaveAmplitude()
const;
109 virtual void setHeightMap(
bool enabled);
110 virtual bool heightMap()
const;
121 virtual void setBreakingWavesMap(
bool enabled);
122 virtual bool breakingWavesMap()
const;
125 virtual void setWaveDampingDistance(
float meters);
126 virtual float waveDampingDistance()
const;
130 virtual void setMaxReflectionWindSpeed(
double metersPerSecond)
132 myMaxWindForReflections = metersPerSecond;
136 virtual void setUnderwaterFogColor(
const osg::Vec4& color)
138 myUnderwaterFogColor = color;
141 virtual const osg::Vec4& getUnderwaterFogColor()
const
143 return myUnderwaterFogColor;
147 virtual void setUnderwaterVisibility(
double visibility)
149 myUnderwaterVisibility = visibility;
152 virtual double getUnderwaterVisibility()
const
154 return myUnderwaterVisibility;
159 virtual void setWaterVisibility(
double visibility)
161 myDefaultVisibility = visibility;
164 virtual double getWaterVisibility()
const
166 return myDefaultVisibility;
170 virtual void setSurgeDepth(
float depth)
172 mySurgeDepth = std::max( 0.2f, depth );
175 virtual float getSurgeDepth()
const
181 virtual bool getIsInitialized()
const
183 return myInitializationComplete;
188 void setAllowUnderwaterEffects(
bool allow)
190 myAllowUnderwater = allow;
194 bool getAllowUnderwaterEffects()
const
196 return myAllowUnderwater;
201 virtual void setHeightMapResolution(
float metersPerTexel);
203 virtual float getHeightMapResolution()
const;
207 virtual void setBreakingWavesMapResolution(
float metersPerTexel);
209 virtual float getBreakingWavesMapResolution()
const;
212 virtual void enableReflections(
bool enabled);
218 virtual void releaseGLObjects(osg::State* state=0)
const;
221 void heightMapChanged();
224 void breakingWavesMapChanged();
228 osg::ref_ptr<DtPlanarReflection> getPlanarReflection( osg::Camera* camera);
231 void shaderUpdateLightUniforms(osg::RenderInfo& info, osg::State &state, GLint shader,
int shaderType)
const;
233 void shaderUpdateViewMatrices(osg::State &state, GLint shader,
int shaderType
235 ,
const Matrix4_32& view_inverse_transpose_matrix_32)
const;
237 void updateCloudShadows(osg::State &state, GLint shader,
int shaderType
238 , GLboolean bIsCloudShadowActive
239 ,
unsigned int cloudshadowTextureUnit
240 ,
unsigned int cloudshadowTextureIndex
241 , osg::Matrixf textureViewProjMatrix)
const;
243 void GetShaderUniformHandles(GLint shader,
int shaderType)
const;
245 osg::ref_ptr<DtPlanarReflection> getOrCreatePlanarReflection(osg::RenderInfo& renderInfo);
247 osg::ref_ptr<DtPlanarReflection> setupPlanarReflections( osg::RenderInfo &renderInfo );
254 void cleanup(
void );
255 void removePlanarReflections();
257 const osg::Matrix & localToWorld,
const osg::Vec3& currentPos );
259 void computeReflectionMatrix(
const osg::Vec3& currentPosition );
261 void GetShaderUniformHandles()
const;
263 void applyLighting(osg::RenderInfo& info)
const;
265 void applyQuality()
const;
267 void updateShader(osg::Node *node, osg::State& state)
const;
269 void computeReflectionBlend(
const osg::Vec3& currentPosition );
271 void adjustDisplacementDampingDistance();
274 void updateReflectionCamFogColor(osg::Camera *reflectionCam,
bool skyEnabled)
const;
277 void setSpecularThreshold(
float threshold);
279 float specularThreshold()
const;