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