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 */
17INLINE bool FrameBufferProperties::
18operator != (const FrameBufferProperties &other) const {
19 return !operator == (other);
20}
21
22/**
23 *
24 */
25INLINE bool FrameBufferProperties::
26is_single_buffered() const {
27 return (_property[FBP_back_buffers] == 0);
28}
29
30/**
31 *
32 */
33INLINE bool FrameBufferProperties::
34is_stereo() const {
35 return (_flags & FBF_stereo) != 0;
36}
37
38/**
39 *
40 */
41INLINE std::ostream &
42operator << (std::ostream &out, const FrameBufferProperties &properties) {
43 properties.output(out);
44 return out;
45}
46
47/**
48 *
49 */
50INLINE int FrameBufferProperties::
51get_depth_bits() const {
52 return _property[FBP_depth_bits];
53}
54
55/**
56 *
57 */
58INLINE int FrameBufferProperties::
59get_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 */
69INLINE int FrameBufferProperties::
70get_red_bits() const {
71 return _property[FBP_red_bits];
72}
73
74/**
75 *
76 */
77INLINE int FrameBufferProperties::
78get_green_bits() const {
79 return _property[FBP_green_bits];
80}
81
82/**
83 *
84 */
85INLINE int FrameBufferProperties::
86get_blue_bits() const {
87 return _property[FBP_blue_bits];
88}
89
90/**
91 *
92 */
93INLINE int FrameBufferProperties::
94get_alpha_bits() const {
95 return _property[FBP_alpha_bits];
96}
97
98/**
99 *
100 */
101INLINE int FrameBufferProperties::
102get_stencil_bits() const {
103 return _property[FBP_stencil_bits];
104}
105
106/**
107 *
108 */
109INLINE int FrameBufferProperties::
110get_accum_bits() const {
111 return _property[FBP_accum_bits];
112}
113
114/**
115 *
116 */
117INLINE int FrameBufferProperties::
118get_aux_rgba() const {
119 return _property[FBP_aux_rgba];
120}
121
122/**
123 *
124 */
125INLINE int FrameBufferProperties::
126get_aux_hrgba() const {
127 return _property[FBP_aux_hrgba];
128}
129
130/**
131 *
132 */
133INLINE int FrameBufferProperties::
134get_aux_float() const {
135 return _property[FBP_aux_float];
136}
137
138/**
139 *
140 */
141INLINE int FrameBufferProperties::
142get_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 */
151get_coverage_samples() const {
152 return _property[FBP_coverage_samples];
153}
154
155/**
156 *
157 */
158INLINE int FrameBufferProperties::
159get_back_buffers() const {
160 return _property[FBP_back_buffers];
161}
162
163/**
164 *
165 */
166INLINE bool FrameBufferProperties::
167get_indexed_color() const {
168 return (_flags & FBF_indexed_color) != 0;
169}
170
171/**
172 *
173 */
174INLINE bool FrameBufferProperties::
175get_rgb_color() const {
176 return (_flags & FBF_rgb_color) != 0;
177}
178
179/**
180 *
181 */
182INLINE bool FrameBufferProperties::
183get_stereo() const {
184 return (_flags & FBF_stereo) != 0;
185}
186
187/**
188 *
189 */
190INLINE bool FrameBufferProperties::
191get_force_hardware() const {
192 return (_flags & FBF_force_hardware) != 0;
193}
194
195/**
196 *
197 */
198INLINE bool FrameBufferProperties::
199get_force_software() const {
200 return (_flags & FBF_force_software) != 0;
201}
202
203/**
204 *
205 */
206INLINE bool FrameBufferProperties::
207get_srgb_color() const {
208 return (_flags & FBF_srgb_color) != 0;
209}
210
211/**
212 *
213 */
214INLINE bool FrameBufferProperties::
215get_float_color() const {
216 return (_flags & FBF_float_color) != 0;
217}
218
219/**
220 *
221 */
222INLINE bool FrameBufferProperties::
223get_float_depth() const {
224 return (_flags & FBF_float_depth) != 0;
225}
226
227/**
228 *
229 */
230INLINE void FrameBufferProperties::
231set_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 */
244INLINE void FrameBufferProperties::
245set_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 */
255set_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 */
269INLINE void FrameBufferProperties::
270set_red_bits(int n) {
271 _property[FBP_red_bits] = n;
272 _specified |= (1 << FBP_red_bits);
273}
274
275/**
276 *
277 */
278INLINE void FrameBufferProperties::
279set_green_bits(int n) {
280 _property[FBP_green_bits] = n;
281 _specified |= (1 << FBP_green_bits);
282}
283
284/**
285 *
286 */
287INLINE void FrameBufferProperties::
288set_blue_bits(int n) {
289 _property[FBP_blue_bits] = n;
290 _specified |= (1 << FBP_blue_bits);
291}
292
293/**
294 *
295 */
296INLINE void FrameBufferProperties::
297set_alpha_bits(int n) {
298 _property[FBP_alpha_bits] = n;
299 _specified |= (1 << FBP_alpha_bits);
300}
301
302/**
303 *
304 */
305INLINE void FrameBufferProperties::
306set_stencil_bits(int n) {
307 _property[FBP_stencil_bits] = n;
308 _specified |= (1 << FBP_stencil_bits);
309}
310
311/**
312 *
313 */
314INLINE void FrameBufferProperties::
315set_accum_bits(int n) {
316 _property[FBP_accum_bits] = n;
317 _specified |= (1 << FBP_accum_bits);
318}
319
320/**
321 *
322 */
323INLINE void FrameBufferProperties::
324set_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 */
333INLINE void FrameBufferProperties::
334set_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 */
343INLINE void FrameBufferProperties::
344set_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 */
353INLINE void FrameBufferProperties::
354set_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 */
363INLINE void FrameBufferProperties::
365 _property[FBP_coverage_samples] = n;
366 _specified |= (1 << FBP_coverage_samples);
367}
368
369/**
370 *
371 */
372INLINE void FrameBufferProperties::
373set_back_buffers(int n) {
374 _property[FBP_back_buffers] = n;
375 _specified |= (1 << FBP_back_buffers);
376}
377
378/**
379 *
380 */
381INLINE void FrameBufferProperties::
382set_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 */
394INLINE void FrameBufferProperties::
395set_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 */
407INLINE void FrameBufferProperties::
408set_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 */
420INLINE void FrameBufferProperties::
421set_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 */
433INLINE void FrameBufferProperties::
434set_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 */
446INLINE void FrameBufferProperties::
447set_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 */
459INLINE void FrameBufferProperties::
460set_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 */
472INLINE void FrameBufferProperties::
473set_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}
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
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.
void output(std::ostream &out) const
Generates a string representation.
get_coverage_samples
If coverage samples are specified, and there is hardware support, we use coverage multisampling.
set_coverage_samples
If coverage samples are specified, and there is hardware support, we use coverage multisampling.