00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _SO_DEPTH_BUFFER_ELEMENT_
00025 #define _SO_DEPTH_BUFFER_ELEMENT_
00026
00027 #include <Inventor/SbBasic.h>
00028 #include <Inventor/SbVec.h>
00029 #include <Inventor/elements/SoSubElement.h>
00030
00031 class SoDepthBuffer;
00032
00049 class SoDepthBufferElement : public SoElement
00050 {
00051 SO_ELEMENT_HEADER(SoDepthBufferElement);
00052
00053 public:
00057 enum DepthWriteFunction {
00059 NEVER,
00061 LESS,
00063 EQUAL,
00065 LEQUAL,
00067 GREATER,
00069 NOTEQUAL,
00071 GEQUAL,
00073 ALWAYS
00074 };
00075
00081 static void set(SoState* state, const SbBool test, const SbBool write, const DepthWriteFunction function, const SbVec2f range);
00082
00088 static void set(SoState* state, SoDepthBuffer* depthBuffer, const SbBool test, const SbBool write, const DepthWriteFunction function, const SbVec2f range);
00089
00093 static void get(SoState* state, SbBool& test, SbBool& write, DepthWriteFunction& function, SbVec2f& range);
00094
00098 virtual void print(FILE *fp) const;
00099
00103 virtual void push(SoState *state);
00104
00108 virtual void pop(SoState *state, const SoElement *prevTopElement);
00109
00110 private:
00111
00113 virtual void init(SoState *state);
00114
00118 virtual SbBool matches(const SoElement* elt) const;
00119
00123 virtual SoElement* copyMatchInfo() const;
00124
00125
00126 private:
00127
00129 static void initClass();
00130
00132 static void exitClass();
00133
00135 static SbBool getTestEnable(SoState * state);
00136
00138 static SbBool getWriteEnable(SoState * state);
00139
00141 static DepthWriteFunction getFunction(SoState * state);
00142
00144 static SbVec2f getRange(SoState * state);
00145
00147 static SoDepthBuffer* getDepthBuffer(SoState * state);
00148
00149 private:
00150
00152 virtual ~SoDepthBufferElement();
00153
00159 virtual void setElt(SoDepthBuffer* depthBuffer, const SbBool enable, const SbBool write, const DepthWriteFunction function, const SbVec2f range);
00160
00161 private:
00163 SbBool test;
00165 SbBool write;
00167 DepthWriteFunction function;
00169 SbVec2f range;
00170
00172 SoDepthBuffer* m_depthBuffer;
00173 };
00174
00175 #endif
00176
00177
00178