Panda3D
eggRenderMode.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 eggRenderMode.I
10  * @author drose
11  * @date 1999-01-20
12  */
13 
14 /**
15  *
16  */
17 INLINE EggRenderMode::
18 EggRenderMode(const EggRenderMode &copy) {
19  (*this) = copy;
20 }
21 
22 /**
23  * Specifies whether writes should be made to the depth buffer (assuming the
24  * rendering backend provides a depth buffer) when rendering this geometry.
25  */
26 INLINE void EggRenderMode::
27 set_depth_write_mode(DepthWriteMode mode) {
28  _depth_write_mode = mode;
29 }
30 
31 /**
32  * Returns the depth_write mode that was set, or DWM_unspecified if nothing
33  * was set. See set_depth_write_mode().
34  */
35 INLINE EggRenderMode::DepthWriteMode EggRenderMode::
37  return _depth_write_mode;
38 }
39 
40 /**
41  * Specifies whether this geometry should be tested against the depth buffer
42  * when it is drawn (assuming the rendering backend provides a depth buffer).
43  * Note that this is different, and independent from, the depth_write mode.
44  */
45 INLINE void EggRenderMode::
46 set_depth_test_mode(DepthTestMode mode) {
47  _depth_test_mode = mode;
48 }
49 
50 /**
51  * Returns the depth_test mode that was set, or DTM_unspecified if nothing was
52  * set. See set_depth_test_mode().
53  */
54 INLINE EggRenderMode::DepthTestMode EggRenderMode::
56  return _depth_test_mode;
57 }
58 
59 /**
60  * Specifies whether this geometry is to be considered normally visible, or
61  * hidden. If it is hidden, it is either not loaded into the scene graph at
62  * all, or loaded as a "stashed" node, according to the setting of egg-
63  * suppress-hidden.
64  */
65 INLINE void EggRenderMode::
66 set_visibility_mode(VisibilityMode mode) {
67  _visibility_mode = mode;
68 }
69 
70 /**
71  * Returns the visibility mode that was set, or VM_unspecified if nothing was
72  * set. See set_visibility_mode().
73  */
74 INLINE EggRenderMode::VisibilityMode EggRenderMode::
76  return _visibility_mode;
77 }
78 
79 /**
80  * Specifies precisely how the transparency for this geometry should be
81  * achieved, or if it should be used. The default, AM_unspecified, is to use
82  * transparency if the geometry has a color whose alpha value is non-1, or if
83  * it has a four-channel texture applied; otherwise, AM_on forces transparency
84  * on, and AM_off forces it off. The other flavors of transparency are
85  * specific ways to turn on transparency, which may or may not be supported by
86  * a particular rendering backend.
87  */
88 INLINE void EggRenderMode::
89 set_alpha_mode(AlphaMode mode) {
90  _alpha_mode = mode;
91 }
92 
93 /**
94  * Returns the alpha mode that was set, or AM_unspecified if nothing was set.
95  * See set_alpha_mode().
96  */
97 INLINE EggRenderMode::AlphaMode EggRenderMode::
98 get_alpha_mode() const {
99  return _alpha_mode;
100 }
101 
102 /**
103  * Sets the "depth-offset" flag associated with this object. This adds or
104  * subtracts an offset bias into the depth buffer. See also DepthOffsetAttrib
105  * and NodePath::set_depth_offset().
106  */
107 INLINE void EggRenderMode::
108 set_depth_offset(int order) {
109  _depth_offset = order;
110  _has_depth_offset = true;
111 }
112 
113 
114 /**
115  * Returns the "depth-offset" flag as set for this particular object. See
116  * set_depth_offset().
117  */
118 INLINE int EggRenderMode::
120  return _depth_offset;
121 }
122 
123 /**
124  * Returns true if the depth-offset flag has been set for this particular
125  * object. See set_depth_offset().
126  */
127 INLINE bool EggRenderMode::
129  return _has_depth_offset;
130 }
131 
132 /**
133  * Removes the depth-offset flag from this particular object. See
134  * set_depth_offset().
135  */
136 INLINE void EggRenderMode::
138  _has_depth_offset = false;
139 }
140 
141 
142 /**
143  * Sets the "draw-order" flag associated with this object. This specifies a
144  * particular order in which objects of this type should be drawn, within the
145  * specified bin. If a bin is not explicitly specified, "fixed" is used. See
146  * also set_bin().
147  */
148 INLINE void EggRenderMode::
149 set_draw_order(int order) {
150  _draw_order = order;
151  _has_draw_order = true;
152 }
153 
154 /**
155  * Returns the "draw-order" flag as set for this particular object. See
156  * set_draw_order().
157  */
158 INLINE int EggRenderMode::
159 get_draw_order() const {
160  return _draw_order;
161 }
162 
163 /**
164  * Returns true if the draw-order flag has been set for this particular
165  * object. See set_draw_order().
166  */
167 INLINE bool EggRenderMode::
168 has_draw_order() const {
169  return _has_draw_order;
170 }
171 
172 /**
173  * Removes the draw-order flag from this particular object. See
174  * set_draw_order().
175  */
176 INLINE void EggRenderMode::
178  _has_draw_order = false;
179 }
180 
181 /**
182  * Sets the "bin" string for this particular object. This names a particular
183  * bin in which the object should be rendered. The exact meaning of a bin is
184  * implementation defined, but generally a GeomBin matching each bin name must
185  * also be specifically added to the rendering engine (e.g. the
186  * CullTraverser) in use for this to work. See also set_draw_order().
187  */
188 INLINE void EggRenderMode::
189 set_bin(const std::string &bin) {
190  _bin = bin;
191 }
192 
193 /**
194  * Returns the bin name that has been set for this particular object, if any.
195  * See set_bin().
196  */
197 INLINE std::string EggRenderMode::
198 get_bin() const {
199  return _bin;
200 }
201 
202 /**
203  * Returns true if a bin name has been set for this particular object. See
204  * set_bin().
205  */
206 INLINE bool EggRenderMode::
207 has_bin() const {
208  return !_bin.empty();
209 }
210 
211 /**
212  * Removes the bin name that was set for this particular object. See
213  * set_bin().
214  */
215 INLINE void EggRenderMode::
217  _bin = std::string();
218 }
219 
220 /**
221  *
222  */
223 INLINE bool EggRenderMode::
224 operator != (const EggRenderMode &other) const {
225  return !(*this == other);
226 }
AlphaMode get_alpha_mode() const
Returns the alpha mode that was set, or AM_unspecified if nothing was set.
Definition: eggRenderMode.I:98
VisibilityMode get_visibility_mode() const
Returns the visibility mode that was set, or VM_unspecified if nothing was set.
Definition: eggRenderMode.I:75
void set_depth_test_mode(DepthTestMode mode)
Specifies whether this geometry should be tested against the depth buffer when it is drawn (assuming ...
Definition: eggRenderMode.I:46
void clear_depth_offset()
Removes the depth-offset flag from this particular object.
bool has_bin() const
Returns true if a bin name has been set for this particular object.
std::string get_bin() const
Returns the bin name that has been set for this particular object, if any.
void set_depth_write_mode(DepthWriteMode mode)
Specifies whether writes should be made to the depth buffer (assuming the rendering backend provides ...
Definition: eggRenderMode.I:27
int get_draw_order() const
Returns the "draw-order" flag as set for this particular object.
void clear_draw_order()
Removes the draw-order flag from this particular object.
void set_depth_offset(int bias)
Sets the "depth-offset" flag associated with this object.
DepthWriteMode get_depth_write_mode() const
Returns the depth_write mode that was set, or DWM_unspecified if nothing was set. ...
Definition: eggRenderMode.I:36
void set_bin(const std::string &bin)
Sets the "bin" string for this particular object.
This class stores miscellaneous rendering properties that is associated with geometry, and which may be set on the geometry primitive level, on the group above it, or indirectly via a texture.
Definition: eggRenderMode.h:31
void clear_bin()
Removes the bin name that was set for this particular object.
void set_draw_order(int order)
Sets the "draw-order" flag associated with this object.
void set_alpha_mode(AlphaMode mode)
Specifies precisely how the transparency for this geometry should be achieved, or if it should be use...
Definition: eggRenderMode.I:89
void set_visibility_mode(VisibilityMode mode)
Specifies whether this geometry is to be considered normally visible, or hidden.
Definition: eggRenderMode.I:66
bool has_draw_order() const
Returns true if the draw-order flag has been set for this particular object.
bool has_depth_offset() const
Returns true if the depth-offset flag has been set for this particular object.
int get_depth_offset() const
Returns the "depth-offset" flag as set for this particular object.
DepthTestMode get_depth_test_mode() const
Returns the depth_test mode that was set, or DTM_unspecified if nothing was set.
Definition: eggRenderMode.I:55