00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef STENCILRENDERSTATES_H
00016 #define STENCILRENDERSTATES_H
00017
00018 class GraphicsStateGuardian;
00019 typedef unsigned int StencilType;
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 class EXPCL_PANDA_DISPLAY StencilRenderStates {
00030
00031 PUBLISHED:
00032 enum StencilRenderState
00033 {
00034 SRS_front_enable,
00035 SRS_back_enable,
00036
00037 SRS_front_comparison_function,
00038 SRS_front_stencil_fail_operation,
00039 SRS_front_stencil_pass_z_fail_operation,
00040 SRS_front_stencil_pass_z_pass_operation,
00041
00042 SRS_reference,
00043 SRS_read_mask,
00044 SRS_write_mask,
00045
00046 SRS_back_comparison_function,
00047 SRS_back_stencil_fail_operation,
00048 SRS_back_stencil_pass_z_fail_operation,
00049 SRS_back_stencil_pass_z_pass_operation,
00050
00051 SRS_clear,
00052 SRS_clear_value,
00053
00054 SRS_total,
00055
00056 SRS_first = 0,
00057 };
00058
00059 enum StencilComparisonFunction
00060 {
00061 SCF_never,
00062 SCF_less_than,
00063 SCF_equal,
00064 SCF_less_than_or_equal,
00065 SCF_greater_than,
00066 SCF_not_equal,
00067 SCF_greater_than_or_equal,
00068 SCF_always,
00069 };
00070
00071 enum StencilOperation
00072 {
00073 SO_keep,
00074 SO_zero,
00075 SO_replace,
00076 SO_increment,
00077 SO_decrement,
00078 SO_invert,
00079 SO_increment_saturate,
00080 SO_decrement_saturate,
00081 };
00082
00083 public:
00084 typedef void (*StencilFunction) (StencilRenderStates::StencilRenderState stencil_render_state, StencilRenderStates *stencil_render_states);
00085
00086 StencilRenderStates (GraphicsStateGuardian *gsg);
00087 ~StencilRenderStates (void);
00088
00089 void set_stencil_render_state (bool execute_function, StencilRenderStates::StencilRenderState stencil_render_state, StencilType value);
00090 StencilType get_stencil_render_state (StencilRenderStates::StencilRenderState stencil_render_state);
00091
00092 void set_stencil_function (StencilRenderStates::StencilRenderState stencil_render_state, StencilFunction stencil_function);
00093
00094 GraphicsStateGuardian *_gsg;
00095
00096 private:
00097 StencilType _stencil_render_state_array [SRS_total];
00098 StencilFunction _stencil_function_array [SRS_total];
00099 };
00100
00101 #endif