From Torben Dannhauer, "I added radial fog functionality be using the OpenGL extension 'GL_NV_fog_distance'."

This commit is contained in:
Robert Osfield
2010-05-31 16:53:41 +00:00
parent df57965a34
commit 975b95dd33
3 changed files with 35 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
@@ -17,6 +17,17 @@
#include <osg/StateAttribute>
#include <osg/Vec4>
#ifndef GL_FOG_DISTANCE_MODE_NV
#define GL_FOG_DISTANCE_MODE_NV 0x855A
#endif
#ifndef GL_EYE_PLANE_ABSOLUTE_NV
#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C
#endif
#ifndef GL_EYE_RADIAL_NV
#define GL_EYE_RADIAL_NV 0x855B
#endif
#ifndef GL_FOG_COORDINATE
#define GL_FOG_COORDINATE 0x8451
#endif
@@ -52,7 +63,8 @@ class OSG_EXPORT Fog : public StateAttribute
_start(fog._start),
_end(fog._end),
_color(fog._color),
_fogCoordinateSource(fog._fogCoordinateSource) {}
_fogCoordinateSource(fog._fogCoordinateSource),
_useRadialFog(fog._useRadialFog) {}
META_StateAttribute(osg, Fog,FOG);
@@ -70,6 +82,7 @@ class OSG_EXPORT Fog : public StateAttribute
COMPARE_StateAttribute_Parameter(_end)
COMPARE_StateAttribute_Parameter(_color)
COMPARE_StateAttribute_Parameter(_fogCoordinateSource)
COMPARE_StateAttribute_Parameter(_useRadialFog)
return 0; // passed all the above comparison macro's, must be equal.
}
@@ -98,8 +111,11 @@ class OSG_EXPORT Fog : public StateAttribute
inline void setEnd( float end ) { _end = end; }
inline float getEnd() const { return _end; }
inline void setColor( const Vec4 &color ) { _color = color; }
inline const Vec4& getColor() const { return _color; }
inline void setColor( const Vec4 &color ) { _color = color; }
inline const Vec4& getColor() const { return _color; }
inline void setUseRadialFog( bool useRadialFog ) { _useRadialFog = useRadialFog; }
inline bool getUseRadialFog() const { return _useRadialFog; }
enum FogCoordinateSource
{
@@ -122,6 +138,7 @@ class OSG_EXPORT Fog : public StateAttribute
float _end;
Vec4 _color;
GLint _fogCoordinateSource;
bool _useRadialFog;
};
}