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 #include <Inventor/SbEnums.h>
00031
00032 class SoDepthBuffer;
00033
00050 class SoDepthBufferElement : public SoElement
00051 {
00052 SO_ELEMENT_HEADER(SoDepthBufferElement);
00053
00054 public:
00058 enum DepthWriteFunction {
00060 NEVER = SbEnums::COMP_FUNC_NEVER,
00062 LESS = SbEnums::COMP_FUNC_LESS,
00064 EQUAL = SbEnums::COMP_FUNC_EQUAL,
00066 LEQUAL = SbEnums::COMP_FUNC_LESS_EQUAL,
00068 GREATER = SbEnums::COMP_FUNC_GREATER,
00070 NOTEQUAL = SbEnums::COMP_FUNC_NOT_EQUAL,
00072 GEQUAL = SbEnums::COMP_FUNC_GREATER_EQUAL,
00074 ALWAYS = SbEnums::COMP_FUNC_ALWAYS
00075 };
00076
00082 static void set(SoState* state, const SbBool test, const SbBool write, const DepthWriteFunction function, const SbVec2f range);
00083
00089 static void set(SoState* state, SoDepthBuffer* depthBuffer, const SbBool test, const SbBool write, const DepthWriteFunction function, const SbVec2f range);
00090
00094 static void get(SoState* state, SbBool& test, SbBool& write, DepthWriteFunction& function, SbVec2f& range);
00095
00099 virtual void print(FILE *fp) const;
00100
00104 virtual void push(SoState *state);
00105
00109 virtual void pop(SoState *state, const SoElement *prevTopElement);
00110
00111 private:
00112
00114 virtual void init(SoState *state);
00115
00119 virtual SbBool matches(const SoElement* elt) const;
00120
00124 virtual SoElement* copyMatchInfo() const;
00125
00126
00127 private:
00128
00130 static void initClass();
00131
00133 static void exitClass();
00134
00136 static SbBool getWriteMask(SoState * state);
00137
00138 static void setWriteMask(SoState* state, const SbBool writeMask);
00139
00141 static DepthWriteFunction getFunction(SoState * state);
00142
00143 static void setFunction( SoState* state, const DepthWriteFunction function );
00144
00146 static SbBool getTest( SoState * state );
00147
00148 static void setTest( SoState* state, const SbBool test );
00149
00151 static SbVec2f getRange(SoState * state);
00152
00154 static SoDepthBuffer* getDepthBuffer(SoState * state);
00155
00157 static DepthWriteFunction getDefaultFunction();
00158
00159 private:
00160
00162 virtual ~SoDepthBufferElement();
00163
00169 virtual void setElt(SoDepthBuffer* depthBuffer, const SbBool enable, const SbBool write, const DepthWriteFunction function, const SbVec2f range);
00170
00171 private:
00173 SbBool test;
00175 SbBool write;
00177 DepthWriteFunction function;
00179 SbVec2f range;
00180
00182 SoDepthBuffer* m_depthBuffer;
00183 };
00184
00185 #endif
00186
00187
00188