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