#ifndef OSG_DEPTH #define OSG_DEPTH 1 #include #include #include namespace osg { /** Encapsulte OpenGL glDepthFunc/Mask/Range functions. */ class SG_EXPORT Depth : public StateAttribute { public : Depth(); virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=0L; } virtual Object* clone() const { return new Depth(); } virtual const char* className() const { return "Depth"; } virtual const Type getType() const { return DEPTH; } virtual void setStateSetModes(StateSet& ds,const GLModeValue value) const { ds.setMode(GL_DEPTH_TEST,value); } enum Function { NEVER = GL_NEVER, LESS = GL_LESS, EQUAL = GL_EQUAL, LEQUAL = GL_LEQUAL, GREATER = GL_GREATER, NOTEQUAL = GL_NOTEQUAL, GEQUAL = GL_GEQUAL, ALWAYS = GL_ALWAYS }; inline void setFunction(const Function func) { _func = func; } inline const Function getFunction() const { return _func; } inline void setWriteMask(const bool mask) { _depthWriteMask = mask; } inline const bool getWriteMask() const { return _depthWriteMask; } inline void setRange(const double zNear, const double zFar) { _zNear = zNear; _zFar = zFar; } inline const double getZNear() const { return _zNear; } inline const double getZFar() const { return _zFar; } virtual void apply(State& state) const; protected: virtual ~Depth(); Function _func; bool _depthWriteMask; double _zNear; double _zFar; }; }; #endif