48 lines
1.3 KiB
Plaintext
48 lines
1.3 KiB
Plaintext
#ifndef OSG_POLYGONOFFSET
|
|
#define OSG_POLYGONOFFSET 1
|
|
|
|
#include <osg/StateAttribute>
|
|
#include <osg/StateSet>
|
|
|
|
namespace osg {
|
|
|
|
/** PolygonOffset - encapsulates the OpenGL glPolygonOffset state.*/
|
|
class SG_EXPORT PolygonOffset : public StateAttribute
|
|
{
|
|
public :
|
|
|
|
PolygonOffset();
|
|
virtual Object* clone() const { return new PolygonOffset(); }
|
|
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const PolygonOffset*>(obj)!=NULL; }
|
|
virtual const char* className() const { return "PolygonOffset"; }
|
|
|
|
virtual const Type getType() const { return POLYGONOFFSET; }
|
|
|
|
virtual void setStateSetModes(StateSet& ds,const GLModeValue value) const
|
|
{
|
|
ds.setMode(GL_POLYGON_OFFSET_FILL,value);
|
|
ds.setMode(GL_POLYGON_OFFSET_LINE,value);
|
|
ds.setMode(GL_POLYGON_OFFSET_POINT,value);
|
|
}
|
|
|
|
inline void setFactor(const float factor) { _factor = factor; }
|
|
inline const float getFactor() const { return _factor; }
|
|
|
|
inline void setUnits(const float units) { _units = units; }
|
|
inline const float getUnits() const { return _units; }
|
|
|
|
virtual void apply(State& state) const;
|
|
|
|
protected :
|
|
|
|
virtual ~PolygonOffset();
|
|
|
|
float _factor;
|
|
float _units;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
#endif
|