13 #include <osg/Drawable>
14 #include <osg/TextureCubeMap>
20 #include <matrix/vlVector.h>
21 #include <osg/StateSet>
32 #define NUM_TRITON_SHADER_TYPES 6
43 class DtPlanarReflection;
44 class DtObserverObject;
54 virtual void update(osg::NodeVisitor* nv, osg::Drawable*);
67 osg::TextureCubeMap * environmentMap = NULL,
73 virtual Object* cloneType()
const
76 myEnvironmentInfo, myGeocentricFlag);
78 virtual Object* clone(
const osg::CopyOp& copyop)
const
81 myEnvironmentInfo, myGeocentricFlag);
88 virtual Triton::Environment*
environment() {
return myEnvironment; }
91 virtual void setBeach(
const osg::Vec3& beachOrigin,
const osg::Vec3& normal);
94 virtual void drawImplementation(osg::RenderInfo& renderInfo)
const;
97 virtual void setPlanarReflections(
bool enabled);
98 virtual bool planarReflections()
const;
101 virtual void setBreakingWaveAmplitude(
float meters);
102 virtual float getBreakingWaveAmplitude()
const;
107 virtual void setHeightMap(
bool enabled);
108 virtual bool heightMap()
const;
119 virtual void setBreakingWavesMap(
bool enabled);
120 virtual bool breakingWavesMap()
const;
123 virtual void setWaveDampingDistance(
float meters);
124 virtual float waveDampingDistance()
const;
128 virtual void setMaxReflectionWindSpeed(
double metersPerSecond)
130 myMaxWindForReflections = metersPerSecond;
134 virtual void setUnderwaterFogColor(
const osg::Vec4& color)
136 myUnderwaterFogColor = color;
139 virtual const osg::Vec4& getUnderwaterFogColor()
const
141 return myUnderwaterFogColor;
145 virtual void setUnderwaterVisibility(
double visibility)
147 myUnderwaterVisibility = visibility;
150 virtual double getUnderwaterVisibility()
const
152 return myUnderwaterVisibility;
157 virtual void setWaterVisibility(
double visibility)
159 myDefaultVisibility = visibility;
162 virtual double getWaterVisibility()
const
164 return myDefaultVisibility;
168 virtual void setSurgeDepth(
float depth)
170 mySurgeDepth = std::max( 0.2f, depth );
173 virtual float getSurgeDepth()
const
179 virtual bool getIsInitialized()
const
181 return myInitializationComplete;
186 void setAllowUnderwaterEffects(
bool allow)
188 myAllowUnderwater = allow;
192 bool getAllowUnderwaterEffects()
const
194 return myAllowUnderwater;
199 virtual void setHeightMapResolution(
float metersPerTexel);
201 virtual float getHeightMapResolution()
const;
205 virtual void setBreakingWavesMapResolution(
float metersPerTexel);
207 virtual float getBreakingWavesMapResolution()
const;
210 virtual void enableReflections(
bool enabled);
216 virtual void releaseGLObjects(osg::State* state=0)
const;
219 void heightMapChanged();
222 void breakingWavesMapChanged();
226 osg::ref_ptr<DtPlanarReflection> getPlanarReflection( osg::Camera* camera);
229 osg::Group* getTritonGeode();
230 const osg::Group* getTritonGeode()
const;
233 void shaderUpdateLightUniforms(osg::RenderInfo& info, osg::State &state, GLint shader,
int shaderType)
const;
235 void shaderUpdateViewMatrices(osg::State &state, GLint shader,
int shaderType
237 ,
const Matrix4_32& view_inverse_transpose_matrix_32)
const;
239 void updateCloudShadows(osg::State &state, GLint shader,
int shaderType
240 , GLboolean bIsCloudShadowActive
241 ,
unsigned int cloudshadowTextureUnit
242 ,
unsigned int cloudshadowTextureIndex
243 , osg::Matrixf textureViewProjMatrix
244 ,
unsigned int cloudshadowTextureUnit2
245 ,
unsigned int cloudshadowTextureIndex2
246 , osg::Matrixf textureViewProjMatrix2)
const;
248 void updateOcean(
double simTime);
250 void GetShaderUniformHandles(GLint shader,
int shaderType)
const;
252 osg::ref_ptr<DtPlanarReflection> getOrCreatePlanarReflection(osg::RenderInfo& renderInfo);
254 osg::ref_ptr<DtPlanarReflection> setupPlanarReflections( osg::RenderInfo &renderInfo );
260 void setup(osg::RenderInfo& renderInfo);
261 void cleanup(
void );
262 void removePlanarReflections();
264 const osg::Matrix & localToWorld,
const osg::Vec3& currentPos );
266 void slot_reloadShader();
268 void computeReflectionMatrix(
const osg::Vec3& currentPosition );
270 void GetShaderUniformHandles()
const;
272 void applyLighting(osg::RenderInfo& info)
const;
274 void applyQuality()
const;
276 void updateShader(osg::Node *node, osg::State& state)
const;
278 void computeReflectionBlend(
const osg::Vec3& currentPosition );
280 void adjustDisplacementDampingDistance(
float viewMag );
283 void updateReflectionCamFogColor(osg::Camera *reflectionCam,
bool skyEnabled)
const;
286 void setSpecularThreshold(
float threshold);
288 float specularThreshold()
const;