ClanLib  2.3.7
buffer_control.h
Go to the documentation of this file.
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2011 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Harry Storbacka
27 */
28 
31 
32 #pragma once
33 
34 #include "../api_display.h"
35 #include "../../Core/System/sharedptr.h"
36 #include "compare_function.h"
37 
42 {
51 };
52 
55 {
66 };
67 
72 {
89 };
90 
91 class CL_BufferControl_Impl;
92 
97 {
100 
101 public:
104 
105  virtual ~CL_BufferControl();
106 
110 
111 public:
113  bool is_stencil_test_enabled() const;
114 
116  CL_CompareFunction get_stencil_compare_func_front() const;
117 
119  CL_CompareFunction get_stencil_compare_func_back() const;
120 
122  int get_stencil_compare_reference_front() const;
123 
125  int get_stencil_compare_reference_back() const;
126 
128  CL_StencilOp get_stencil_fail_front() const;
129 
131  CL_StencilOp get_stencil_fail_back() const;
132 
134  CL_StencilOp get_stencil_pass_depth_pass_front() const;
135 
137  CL_StencilOp get_stencil_pass_depth_pass_back() const;
138 
140  CL_StencilOp get_stencil_pass_depth_fail_front() const;
141 
143  CL_StencilOp get_stencil_pass_depth_fail_back() const;
144 
146  unsigned char get_stencil_compare_mask_front() const;
147 
149  unsigned char get_stencil_compare_mask_back() const;
150 
152  unsigned char get_stencil_write_mask_front() const;
153 
155  unsigned char get_stencil_write_mask_back() const;
156 
158  bool is_depth_test_enabled() const;
159 
161  bool is_depth_write_enabled() const;
162 
164  CL_CompareFunction get_depth_compare_function() const;
165 
167  void is_color_write_enabled(bool &red, bool &green, bool &blue, bool &alpha) const;
168 
170  CL_DrawBuffer get_draw_buffer() const;
171 
173  bool is_logic_op_enabled() const;
174 
176  CL_LogicOp get_logic_op() const;
177 
181 
182 public:
184  void enable_stencil_test(bool enabled);
185 
187  void set_stencil_compare_func(CL_CompareFunction front, CL_CompareFunction back);
188 
190  void set_stencil_compare_reference(int front_ref, int back_ref);
191 
193  void set_stencil_write_mask(unsigned char front_facing_mask, unsigned char back_facing_mask);
194 
196  void set_stencil_fail(CL_StencilOp front, CL_StencilOp back);
197 
199  void set_stencil_pass_depth_pass(CL_StencilOp front, CL_StencilOp back);
200 
202  void set_stencil_pass_depth_fail(CL_StencilOp front, CL_StencilOp back);
203 
205  void set_stencil_compare_mask(int front_mask, int back_mask);
206 
208  void enable_depth_test(bool enabled);
209 
211  void enable_depth_write(bool enabled);
212 
214  void set_depth_compare_function(CL_CompareFunction func);
215 
217  void enable_color_write(bool enabled);
218 
225  void enable_color_write(bool red, bool green, bool blue, bool alpha);
226 
228  void set_draw_buffer(CL_DrawBuffer buffer);
229 
231  void enable_logic_op(bool enabled);
232 
234  void set_logic_op(CL_LogicOp op);
235 
239 
240 private:
241  CL_SharedPtr<CL_BufferControl_Impl> impl;
243 };
244