Panda3D

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