Panda3D
 All Classes Functions Variables Enumerations
frameBufferProperties.h
1 // Filename: frameBufferProperties.h
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 #ifndef FRAMEBUFFERPROPERTIES_H
16 #define FRAMEBUFFERPROPERTIES_H
17 
18 #include "pandabase.h"
19 #include "pnotify.h"
20 
21 class Texture;
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : FrameBufferProperties
25 // Description : A container for the various kinds of properties we
26 // might ask to have on a graphics frameBuffer before we
27 // create a GSG.
28 ////////////////////////////////////////////////////////////////////
29 class EXPCL_PANDA_DISPLAY FrameBufferProperties {
30 
31 private:
32  enum FrameBufferProperty {
33  // This section has to start with "depth" and end with "accum"
34  FBP_depth_bits,
35  FBP_color_bits,
36  FBP_red_bits,
37  FBP_green_bits,
38  FBP_blue_bits,
39  FBP_alpha_bits,
40  FBP_stencil_bits,
41  FBP_accum_bits,
42 
43  // This section has to start with "rgba" and end with "float"
44  FBP_aux_rgba,
45  FBP_aux_hrgba,
46  FBP_aux_float,
47 
48  // This section can be in any order.
49  FBP_multisamples,
50  FBP_coverage_samples,
51  FBP_back_buffers,
52 
53  // This is a sentinel value.
54  FBP_COUNT
55  };
56 
57  enum FrameBufferFlag {
58  FBF_indexed_color = 0x001,
59  FBF_rgb_color = 0x002,
60  FBF_stereo = 0x004,
61  FBF_force_hardware = 0x008,
62  FBF_force_software = 0x010,
63  FBF_srgb_color = 0x020,
64  FBF_float_color = 0x040,
65  FBF_float_depth = 0x080,
66  FBF_all = 0x100-1,
67  };
68 
69  int _property[FBP_COUNT];
70  int _specified;
71 
72  int _flags;
73  int _flags_specified;
74 
75 PUBLISHED:
76 
77  // Individual queries.
78  INLINE int get_depth_bits() const;
79  INLINE int get_color_bits() const;
80  INLINE int get_red_bits() const;
81  INLINE int get_green_bits() const;
82  INLINE int get_blue_bits() const;
83  INLINE int get_alpha_bits() const;
84  INLINE int get_stencil_bits() const;
85  INLINE int get_accum_bits() const;
86  INLINE int get_aux_rgba() const;
87  INLINE int get_aux_hrgba() const;
88  INLINE int get_aux_float() const;
89  INLINE int get_multisamples() const;
90  INLINE int get_coverage_samples() const;
91  INLINE int get_back_buffers() const;
92  INLINE bool get_indexed_color() const;
93  INLINE bool get_rgb_color() const;
94  INLINE bool get_stereo() const;
95  INLINE bool get_force_hardware() const;
96  INLINE bool get_force_software() const;
97  INLINE bool get_srgb_color() const;
98  INLINE bool get_float_color() const;
99  INLINE bool get_float_depth() const;
100 
101  // Individual assigners.
102  INLINE void set_depth_bits(int n);
103  INLINE void set_color_bits(int n);
104  INLINE void set_rgba_bits(int r, int g, int b, int a);
105  INLINE void set_red_bits(int n);
106  INLINE void set_green_bits(int n);
107  INLINE void set_blue_bits(int n);
108  INLINE void set_alpha_bits(int n);
109  INLINE void set_stencil_bits(int n);
110  INLINE void set_accum_bits(int n);
111  INLINE void set_aux_rgba(int n);
112  INLINE void set_aux_hrgba(int n);
113  INLINE void set_aux_float(int n);
114  INLINE void set_multisamples(int n);
115  INLINE void set_coverage_samples(int n);
116  INLINE void set_back_buffers(int n);
117  INLINE void set_indexed_color(bool n);
118  INLINE void set_rgb_color(bool n);
119  INLINE void set_stereo(bool n);
120  INLINE void set_force_hardware(bool n);
121  INLINE void set_force_software(bool n);
122  INLINE void set_srgb_color(bool n);
123  INLINE void set_float_color(bool n);
124  INLINE void set_float_depth(bool n);
125 
126  // Other.
127 
129  INLINE FrameBufferProperties(const FrameBufferProperties &copy);
130  INLINE ~FrameBufferProperties();
131  void operator = (const FrameBufferProperties &copy);
132  static const FrameBufferProperties &get_default();
133  bool operator == (const FrameBufferProperties &other) const;
134  INLINE bool operator != (const FrameBufferProperties &other) const;
135 
136  void clear();
137  void set_all_specified();
138  bool subsumes(const FrameBufferProperties &other) const;
139  void add_properties(const FrameBufferProperties &other);
140  void output(ostream &out) const;
141  void set_one_bit_per_channel();
142 
143  INLINE bool is_stereo() const;
144  INLINE bool is_single_buffered() const;
145  int get_quality(const FrameBufferProperties &reqs) const;
146  bool is_any_specified() const;
147  bool is_basic() const;
148  int get_aux_mask() const;
149  int get_buffer_mask() const;
150  bool verify_hardware_software(const FrameBufferProperties &props, const string &renderer) const;
151 
152  bool setup_color_texture(Texture *tex) const;
153  bool setup_depth_texture(Texture *tex) const;
154 };
155 
156 INLINE ostream &operator << (ostream &out, const FrameBufferProperties &properties);
157 
158 #include "frameBufferProperties.I"
159 
160 #endif
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Definition: texture.h:75
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...