buffer_control.h

Go to the documentation of this file.
00001 /*
00002 **  ClanLib SDK
00003 **  Copyright (c) 1997-2009 The ClanLib Team
00004 **
00005 **  This software is provided 'as-is', without any express or implied
00006 **  warranty.  In no event will the authors be held liable for any damages
00007 **  arising from the use of this software.
00008 **
00009 **  Permission is granted to anyone to use this software for any purpose,
00010 **  including commercial applications, and to alter it and redistribute it
00011 **  freely, subject to the following restrictions:
00012 **
00013 **  1. The origin of this software must not be misrepresented; you must not
00014 **     claim that you wrote the original software. If you use this software
00015 **     in a product, an acknowledgment in the product documentation would be
00016 **     appreciated but is not required.
00017 **  2. Altered source versions must be plainly marked as such, and must not be
00018 **     misrepresented as being the original software.
00019 **  3. This notice may not be removed or altered from any source distribution.
00020 **
00021 **  Note: Some of the libraries ClanLib may link to may have additional
00022 **  requirements or restrictions.
00023 **
00024 **  File Author(s):
00025 **
00026 **    Harry Storbacka
00027 */
00028 
00031 
00032 #pragma once
00033 
00034 #include "../api_display.h"
00035 #include "../../Core/System/sharedptr.h"
00036 #include "compare_function.h"
00037 
00041 enum CL_StencilOp
00042 {
00043         cl_stencil_keep,
00044         cl_stencil_zero,
00045         cl_stencil_replace,
00046         cl_stencil_incr,
00047         cl_stencil_decr,
00048         cl_stencil_invert,
00049         cl_stencil_incr_wrap,
00050         cl_stencil_decr_wrap
00051 };
00052 
00054 enum CL_DrawBuffer
00055 {
00056         cl_buffer_none,
00057         cl_buffer_front_left,
00058         cl_buffer_front_right,
00059         cl_buffer_back_left,
00060         cl_buffer_back_right,
00061         cl_buffer_front,
00062         cl_buffer_back,
00063         cl_buffer_left,
00064         cl_buffer_right,
00065         cl_buffer_front_and_back,
00066         cl_buffer_aux0,
00067         cl_buffer_aux1,
00068         cl_buffer_aux2,
00069         cl_buffer_aux3
00070 };
00071 
00075 enum CL_LogicOp
00076 {
00077         cl_logic_op_clear,
00078         cl_logic_op_and, 
00079         cl_logic_op_and_reverse,
00080         cl_logic_op_copy,
00081         cl_logic_op_and_inverted,
00082         cl_logic_op_noop,
00083         cl_logic_op_xor,
00084         cl_logic_op_or,
00085         cl_logic_op_nor,
00086         cl_logic_op_equiv,
00087         cl_logic_op_invert,
00088         cl_logic_op_or_reverse,
00089         cl_logic_op_copy_inverted,
00090         cl_logic_op_or_inverted,
00091         cl_logic_op_nand,
00092         cl_logic_op_set
00093 };
00094 
00095 class CL_BufferControl_Impl;
00096 
00100 class CL_API_DISPLAY CL_BufferControl
00101 {
00104 
00105 public:
00107         CL_BufferControl();
00108 
00109         virtual ~CL_BufferControl();
00110 
00114 
00115 public:
00117         bool is_stencil_test_enabled() const;
00118 
00120         CL_CompareFunction get_stencil_compare_func_front() const;
00121 
00123         CL_CompareFunction get_stencil_compare_func_back() const;
00124 
00126         int get_stencil_compare_reference_front() const;
00127 
00129         int get_stencil_compare_reference_back() const;
00130 
00132         CL_StencilOp get_stencil_fail_front() const;
00133 
00135         CL_StencilOp get_stencil_fail_back() const;
00136 
00138         CL_StencilOp get_stencil_pass_depth_pass_front() const;
00139 
00141         CL_StencilOp get_stencil_pass_depth_pass_back() const;
00142 
00144         CL_StencilOp get_stencil_pass_depth_fail_front() const;
00145 
00147         CL_StencilOp get_stencil_pass_depth_fail_back() const;
00148 
00150         unsigned char get_stencil_compare_mask_front() const;
00151 
00153         unsigned char get_stencil_compare_mask_back() const;
00154 
00156         unsigned char get_stencil_write_mask_front() const;
00157 
00159         unsigned char get_stencil_write_mask_back() const;
00160 
00162         bool is_depth_test_enabled() const;
00163 
00165         bool is_depth_write_enabled() const;
00166 
00168         CL_CompareFunction get_depth_compare_function() const;
00169 
00171         void is_color_write_enabled(bool &red, bool &green, bool &blue, bool &alpha) const;
00172 
00174         CL_DrawBuffer get_draw_buffer() const;
00175 
00177         bool is_logic_op_enabled() const;
00178 
00180         CL_LogicOp get_logic_op() const;
00181 
00185 
00186 public:
00188         void enable_stencil_test(bool enabled);
00189 
00191         void set_stencil_compare_func(CL_CompareFunction front, CL_CompareFunction back);
00192 
00194         void set_stencil_compare_reference(int front_ref, int back_ref);
00195 
00197         void set_stencil_write_mask(unsigned char front_facing_mask, unsigned char back_facing_mask);
00198 
00200         void set_stencil_fail(CL_StencilOp front, CL_StencilOp back);
00201 
00203         void set_stencil_pass_depth_pass(CL_StencilOp front, CL_StencilOp back);
00204 
00206         void set_stencil_pass_depth_fail(CL_StencilOp front, CL_StencilOp back);
00207 
00209         void set_stencil_compare_mask(int front_mask, int back_mask);
00210 
00212         void enable_depth_test(bool enabled);
00213 
00215         void enable_depth_write(bool enabled);
00216 
00218         void set_depth_compare_function(CL_CompareFunction func);
00219 
00221         void enable_color_write(bool enabled);
00222 
00229         void enable_color_write(bool red, bool green, bool blue, bool alpha);
00230 
00232         void set_draw_buffer(CL_DrawBuffer buffer);
00233 
00235         void enable_logic_op(bool enabled);
00236 
00238         void set_logic_op(CL_LogicOp op);
00239 
00243 
00244 private:
00245         CL_SharedPtr<CL_BufferControl_Impl> impl;
00247 };
00248 

Generated on Thu Dec 3 02:39:28 2009 for ClanLib by  doxygen 1.4.6