Panda3D
frameBufferProperties.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file frameBufferProperties.I
10  * @author drose
11  * @date 2003-01-27
12  */
13 
14 /**
15  *
16  */
17 INLINE bool FrameBufferProperties::
18 operator != (const FrameBufferProperties &other) const {
19  return !operator == (other);
20 }
21 
22 /**
23  *
24  */
25 INLINE bool FrameBufferProperties::
26 is_single_buffered() const {
27  return (_property[FBP_back_buffers] == 0);
28 }
29 
30 /**
31  *
32  */
33 INLINE bool FrameBufferProperties::
34 is_stereo() const {
35  return (_flags & FBF_stereo) != 0;
36 }
37 
38 /**
39  *
40  */
41 INLINE std::ostream &
42 operator << (std::ostream &out, const FrameBufferProperties &properties) {
43  properties.output(out);
44  return out;
45 }
46 
47 /**
48  *
49  */
50 INLINE int FrameBufferProperties::
51 get_depth_bits() const {
52  return _property[FBP_depth_bits];
53 }
54 
55 /**
56  *
57  */
58 INLINE int FrameBufferProperties::
59 get_color_bits() const {
60  return std::max(_property[FBP_color_bits],
61  _property[FBP_red_bits] +
62  _property[FBP_green_bits] +
63  _property[FBP_blue_bits]);
64 }
65 
66 /**
67  *
68  */
69 INLINE int FrameBufferProperties::
70 get_red_bits() const {
71  return _property[FBP_red_bits];
72 }
73 
74 /**
75  *
76  */
77 INLINE int FrameBufferProperties::
78 get_green_bits() const {
79  return _property[FBP_green_bits];
80 }
81 
82 /**
83  *
84  */
85 INLINE int FrameBufferProperties::
86 get_blue_bits() const {
87  return _property[FBP_blue_bits];
88 }
89 
90 /**
91  *
92  */
93 INLINE int FrameBufferProperties::
94 get_alpha_bits() const {
95  return _property[FBP_alpha_bits];
96 }
97 
98 /**
99  *
100  */
101 INLINE int FrameBufferProperties::
102 get_stencil_bits() const {
103  return _property[FBP_stencil_bits];
104 }
105 
106 /**
107  *
108  */
109 INLINE int FrameBufferProperties::
110 get_accum_bits() const {
111  return _property[FBP_accum_bits];
112 }
113 
114 /**
115  *
116  */
117 INLINE int FrameBufferProperties::
118 get_aux_rgba() const {
119  return _property[FBP_aux_rgba];
120 }
121 
122 /**
123  *
124  */
125 INLINE int FrameBufferProperties::
126 get_aux_hrgba() const {
127  return _property[FBP_aux_hrgba];
128 }
129 
130 /**
131  *
132  */
133 INLINE int FrameBufferProperties::
134 get_aux_float() const {
135  return _property[FBP_aux_float];
136 }
137 
138 /**
139  *
140  */
141 INLINE int FrameBufferProperties::
142 get_multisamples() const {
143  return _property[FBP_multisamples];
144 }
145 
146 /**
147  * If coverage samples are specified, and there is hardware support, we use
148  * coverage multisampling.
149  */
150 INLINE int FrameBufferProperties::
151 get_coverage_samples() const {
152  return _property[FBP_coverage_samples];
153 }
154 
155 /**
156  *
157  */
158 INLINE int FrameBufferProperties::
159 get_back_buffers() const {
160  return _property[FBP_back_buffers];
161 }
162 
163 /**
164  *
165  */
166 INLINE bool FrameBufferProperties::
167 get_indexed_color() const {
168  return (_flags & FBF_indexed_color) != 0;
169 }
170 
171 /**
172  *
173  */
174 INLINE bool FrameBufferProperties::
175 get_rgb_color() const {
176  return (_flags & FBF_rgb_color) != 0;
177 }
178 
179 /**
180  *
181  */
182 INLINE bool FrameBufferProperties::
183 get_stereo() const {
184  return (_flags & FBF_stereo) != 0;
185 }
186 
187 /**
188  *
189  */
190 INLINE bool FrameBufferProperties::
191 get_force_hardware() const {
192  return (_flags & FBF_force_hardware) != 0;
193 }
194 
195 /**
196  *
197  */
198 INLINE bool FrameBufferProperties::
199 get_force_software() const {
200  return (_flags & FBF_force_software) != 0;
201 }
202 
203 /**
204  *
205  */
206 INLINE bool FrameBufferProperties::
207 get_srgb_color() const {
208  return (_flags & FBF_srgb_color) != 0;
209 }
210 
211 /**
212  *
213  */
214 INLINE bool FrameBufferProperties::
215 get_float_color() const {
216  return (_flags & FBF_float_color) != 0;
217 }
218 
219 /**
220  *
221  */
222 INLINE bool FrameBufferProperties::
223 get_float_depth() const {
224  return (_flags & FBF_float_depth) != 0;
225 }
226 
227 /**
228  *
229  */
230 INLINE void FrameBufferProperties::
231 set_depth_bits(int n) {
232  _property[FBP_depth_bits] = n;
233  _specified |= (1 << FBP_depth_bits);
234 }
235 
236 /**
237  * Sets the number of requested color bits as a single number that represents
238  * the sum of the individual numbers of red, green and blue bits. Panda won't
239  * care how the individual bits are divided up.
240  *
241  * See also set_rgba_bits, which allows you to specify requirements for the
242  * individual components.
243  */
244 INLINE void FrameBufferProperties::
245 set_color_bits(int n) {
246  _property[FBP_color_bits] = n;
247  _specified |= (1 << FBP_color_bits);
248 }
249 
250 /**
251  * Convenience method for setting the red, green, blue and alpha bits in one
252  * go.
253  */
254 INLINE void FrameBufferProperties::
255 set_rgba_bits(int r, int g, int b, int a) {
256  _property[FBP_red_bits] = r;
257  _property[FBP_green_bits] = g;
258  _property[FBP_blue_bits] = b;
259  _property[FBP_alpha_bits] = a;
260  _property[FBP_color_bits] = r + g + b;
261  _specified |= (1 << FBP_color_bits) | (1 << FBP_red_bits) |
262  (1 << FBP_green_bits) | (1 << FBP_blue_bits) |
263  (1 << FBP_alpha_bits);
264 }
265 
266 /**
267  *
268  */
269 INLINE void FrameBufferProperties::
270 set_red_bits(int n) {
271  _property[FBP_red_bits] = n;
272  _specified |= (1 << FBP_red_bits);
273 }
274 
275 /**
276  *
277  */
278 INLINE void FrameBufferProperties::
279 set_green_bits(int n) {
280  _property[FBP_green_bits] = n;
281  _specified |= (1 << FBP_green_bits);
282 }
283 
284 /**
285  *
286  */
287 INLINE void FrameBufferProperties::
288 set_blue_bits(int n) {
289  _property[FBP_blue_bits] = n;
290  _specified |= (1 << FBP_blue_bits);
291 }
292 
293 /**
294  *
295  */
296 INLINE void FrameBufferProperties::
297 set_alpha_bits(int n) {
298  _property[FBP_alpha_bits] = n;
299  _specified |= (1 << FBP_alpha_bits);
300 }
301 
302 /**
303  *
304  */
305 INLINE void FrameBufferProperties::
306 set_stencil_bits(int n) {
307  _property[FBP_stencil_bits] = n;
308  _specified |= (1 << FBP_stencil_bits);
309 }
310 
311 /**
312  *
313  */
314 INLINE void FrameBufferProperties::
315 set_accum_bits(int n) {
316  _property[FBP_accum_bits] = n;
317  _specified |= (1 << FBP_accum_bits);
318 }
319 
320 /**
321  *
322  */
323 INLINE void FrameBufferProperties::
324 set_aux_rgba(int n) {
325  nassertv(n <= 4);
326  _property[FBP_aux_rgba] = n;
327  _specified |= (1 << FBP_aux_rgba);
328 }
329 
330 /**
331  *
332  */
333 INLINE void FrameBufferProperties::
334 set_aux_hrgba(int n) {
335  nassertv(n <= 4);
336  _property[FBP_aux_hrgba] = n;
337  _specified |= (1 << FBP_aux_hrgba);
338 }
339 
340 /**
341  *
342  */
343 INLINE void FrameBufferProperties::
344 set_aux_float(int n) {
345  nassertv(n <= 4);
346  _property[FBP_aux_float] = n;
347  _specified |= (1 << FBP_aux_float);
348 }
349 
350 /**
351  *
352  */
353 INLINE void FrameBufferProperties::
354 set_multisamples(int n) {
355  _property[FBP_multisamples] = n;
356  _specified |= (1 << FBP_multisamples);
357 }
358 
359 /**
360  * If coverage samples are specified, and there is hardware support, we use
361  * coverage multisampling
362  */
363 INLINE void FrameBufferProperties::
364 set_coverage_samples(int n) {
365  _property[FBP_coverage_samples] = n;
366  _specified |= (1 << FBP_coverage_samples);
367 }
368 
369 /**
370  *
371  */
372 INLINE void FrameBufferProperties::
373 set_back_buffers(int n) {
374  _property[FBP_back_buffers] = n;
375  _specified |= (1 << FBP_back_buffers);
376 }
377 
378 /**
379  *
380  */
381 INLINE void FrameBufferProperties::
382 set_indexed_color(bool n) {
383  if (n) {
384  _flags |= FBF_indexed_color;
385  } else {
386  _flags &= ~FBF_indexed_color;
387  }
388  _flags_specified |= FBF_indexed_color;
389 }
390 
391 /**
392  *
393  */
394 INLINE void FrameBufferProperties::
395 set_rgb_color(bool n) {
396  if (n) {
397  _flags |= FBF_rgb_color;
398  } else {
399  _flags &= ~FBF_rgb_color;
400  }
401  _flags_specified |= FBF_rgb_color;
402 }
403 
404 /**
405  *
406  */
407 INLINE void FrameBufferProperties::
408 set_stereo(bool n) {
409  if (n) {
410  _flags |= FBF_stereo;
411  } else {
412  _flags &= ~FBF_stereo;
413  }
414  _flags_specified |= FBF_stereo;
415 }
416 
417 /**
418  *
419  */
420 INLINE void FrameBufferProperties::
421 set_force_hardware(bool n) {
422  if (n) {
423  _flags |= FBF_force_hardware;
424  } else {
425  _flags &= ~FBF_force_hardware;
426  }
427  _flags_specified |= FBF_force_hardware;
428 }
429 
430 /**
431  *
432  */
433 INLINE void FrameBufferProperties::
434 set_force_software(bool n) {
435  if (n) {
436  _flags |= FBF_force_software;
437  } else {
438  _flags &= ~FBF_force_software;
439  }
440  _flags_specified |= FBF_force_software;
441 }
442 
443 /**
444  *
445  */
446 INLINE void FrameBufferProperties::
447 set_srgb_color(bool n) {
448  if (n) {
449  _flags |= FBF_srgb_color;
450  } else {
451  _flags &= ~FBF_srgb_color;
452  }
453  _flags_specified |= FBF_srgb_color;
454 }
455 
456 /**
457  *
458  */
459 INLINE void FrameBufferProperties::
460 set_float_color(bool n) {
461  if (n) {
462  _flags |= FBF_float_color;
463  } else {
464  _flags &= ~FBF_float_color;
465  }
466  _flags_specified |= FBF_float_color;
467 }
468 
469 /**
470  *
471  */
472 INLINE void FrameBufferProperties::
473 set_float_depth(bool n) {
474  if (n) {
475  _flags |= FBF_float_depth;
476  } else {
477  _flags &= ~FBF_float_depth;
478  }
479  _flags_specified |= FBF_float_depth;
480 }
void output(std::ostream &out) const
Generates a string representation.
set_color_bits
Sets the number of requested color bits as a single number that represents the sum of the individual ...
void set_rgba_bits(int r, int g, int b, int a)
Convenience method for setting the red, green, blue and alpha bits in one go.
set_coverage_samples
If coverage samples are specified, and there is hardware support, we use coverage multisampling.
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...