Panda3D
 All Classes Functions Variables Enumerations
eggRenderMode.I
1 // Filename: eggRenderMode.I
2 // Created by: drose (20Jan99)
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 ////////////////////////////////////////////////////////////////////
18 // Function: EggRenderMode::Copy Constructor
19 // Access: Public
20 // Description:
21 ////////////////////////////////////////////////////////////////////
22 INLINE EggRenderMode::
23 EggRenderMode(const EggRenderMode &copy) {
24  (*this) = copy;
25 }
26 
27 ////////////////////////////////////////////////////////////////////
28 // Function: EggRenderMode::set_depth_write_mode
29 // Access: Public
30 // Description: Specifies whether writes should be made to the depth
31 // buffer (assuming the rendering backend provides a
32 // depth buffer) when rendering this geometry.
33 ////////////////////////////////////////////////////////////////////
34 INLINE void EggRenderMode::
35 set_depth_write_mode(DepthWriteMode mode) {
36  _depth_write_mode = mode;
37 }
38 
39 ////////////////////////////////////////////////////////////////////
40 // Function: EggRenderMode::get_depth_write_mode
41 // Access: Public
42 // Description: Returns the depth_write mode that was set, or
43 // DWM_unspecified if nothing was set. See
44 // set_depth_write_mode().
45 ////////////////////////////////////////////////////////////////////
46 INLINE EggRenderMode::DepthWriteMode EggRenderMode::
48  return _depth_write_mode;
49 }
50 
51 ////////////////////////////////////////////////////////////////////
52 // Function: EggRenderMode::set_depth_test_mode
53 // Access: Public
54 // Description: Specifies whether this geometry should be tested
55 // against the depth buffer when it is drawn (assuming
56 // the rendering backend provides a depth buffer). Note
57 // that this is different, and independent from, the
58 // depth_write mode.
59 ////////////////////////////////////////////////////////////////////
60 INLINE void EggRenderMode::
61 set_depth_test_mode(DepthTestMode mode) {
62  _depth_test_mode = mode;
63 }
64 
65 ////////////////////////////////////////////////////////////////////
66 // Function: EggRenderMode::get_depth_test_mode
67 // Access: Public
68 // Description: Returns the depth_test mode that was set, or
69 // DTM_unspecified if nothing was set. See
70 // set_depth_test_mode().
71 ////////////////////////////////////////////////////////////////////
72 INLINE EggRenderMode::DepthTestMode EggRenderMode::
74  return _depth_test_mode;
75 }
76 
77 ////////////////////////////////////////////////////////////////////
78 // Function: EggRenderMode::set_visibility_mode
79 // Access: Public
80 // Description: Specifies whether this geometry is to be considered
81 // normally visible, or hidden. If it is hidden, it is
82 // either not loaded into the scene graph at all, or
83 // loaded as a "stashed" node, according to the setting
84 // of egg-suppress-hidden.
85 ////////////////////////////////////////////////////////////////////
86 INLINE void EggRenderMode::
87 set_visibility_mode(VisibilityMode mode) {
88  _visibility_mode = mode;
89 }
90 
91 ////////////////////////////////////////////////////////////////////
92 // Function: EggRenderMode::get_visibility_mode
93 // Access: Public
94 // Description: Returns the visibility mode that was set, or
95 // VM_unspecified if nothing was set. See
96 // set_visibility_mode().
97 ////////////////////////////////////////////////////////////////////
98 INLINE EggRenderMode::VisibilityMode EggRenderMode::
100  return _visibility_mode;
101 }
102 
103 ////////////////////////////////////////////////////////////////////
104 // Function: EggRenderMode::set_alpha_mode
105 // Access: Public
106 // Description: Specifies precisely how the transparency for this
107 // geometry should be achieved, or if it should be used.
108 // The default, AM_unspecified, is to use transparency
109 // if the geometry has a color whose alpha value is
110 // non-1, or if it has a four-channel texture applied;
111 // otherwise, AM_on forces transparency on, and AM_off
112 // forces it off. The other flavors of transparency are
113 // specific ways to turn on transparency, which may or
114 // may not be supported by a particular rendering
115 // backend.
116 ////////////////////////////////////////////////////////////////////
117 INLINE void EggRenderMode::
118 set_alpha_mode(AlphaMode mode) {
119  _alpha_mode = mode;
120 }
121 
122 ////////////////////////////////////////////////////////////////////
123 // Function: EggRenderMode::get_alpha_mode
124 // Access: Public
125 // Description: Returns the alpha mode that was set, or
126 // AM_unspecified if nothing was set. See
127 // set_alpha_mode().
128 ////////////////////////////////////////////////////////////////////
129 INLINE EggRenderMode::AlphaMode EggRenderMode::
130 get_alpha_mode() const {
131  return _alpha_mode;
132 }
133 
134 ////////////////////////////////////////////////////////////////////
135 // Function: EggRenderMode::set_depth_offset
136 // Access: Public
137 // Description: Sets the "depth-offset" flag associated with this
138 // object. This adds or subtracts an offset bias
139 // into the depth buffer. See also DepthOffsetAttrib
140 // and NodePath::set_depth_offset().
141 ////////////////////////////////////////////////////////////////////
142 INLINE void EggRenderMode::
143 set_depth_offset(int order) {
144  _depth_offset = order;
145  _has_depth_offset = true;
146 }
147 
148 
149 ////////////////////////////////////////////////////////////////////
150 // Function: EggRenderMode::get_depth_offset
151 // Access: Public
152 // Description: Returns the "depth-offset" flag as set for this
153 // particular object. See set_depth_offset().
154 ////////////////////////////////////////////////////////////////////
155 INLINE int EggRenderMode::
157  return _depth_offset;
158 }
159 
160 ////////////////////////////////////////////////////////////////////
161 // Function: EggRenderMode::has_depth_offset
162 // Access: Public
163 // Description: Returns true if the depth-offset flag has been set for
164 // this particular object. See set_depth_offset().
165 ////////////////////////////////////////////////////////////////////
166 INLINE bool EggRenderMode::
168  return _has_depth_offset;
169 }
170 
171 ////////////////////////////////////////////////////////////////////
172 // Function: EggRenderMode::clear_depth_offset
173 // Access: Public
174 // Description: Removes the depth-offset flag from this particular
175 // object. See set_depth_offset().
176 ////////////////////////////////////////////////////////////////////
177 INLINE void EggRenderMode::
179  _has_depth_offset = false;
180 }
181 
182 
183 ////////////////////////////////////////////////////////////////////
184 // Function: EggRenderMode::set_draw_order
185 // Access: Public
186 // Description: Sets the "draw-order" flag associated with this
187 // object. This specifies a particular order in which
188 // objects of this type should be drawn, within the
189 // specified bin. If a bin is not explicitly specified,
190 // "fixed" is used. See also set_bin().
191 ////////////////////////////////////////////////////////////////////
192 INLINE void EggRenderMode::
193 set_draw_order(int order) {
194  _draw_order = order;
195  _has_draw_order = true;
196 }
197 
198 ////////////////////////////////////////////////////////////////////
199 // Function: EggRenderMode::get_draw_order
200 // Access: Public
201 // Description: Returns the "draw-order" flag as set for this
202 // particular object. See set_draw_order().
203 ////////////////////////////////////////////////////////////////////
204 INLINE int EggRenderMode::
205 get_draw_order() const {
206  return _draw_order;
207 }
208 
209 ////////////////////////////////////////////////////////////////////
210 // Function: EggRenderMode::has_draw_order
211 // Access: Public
212 // Description: Returns true if the draw-order flag has been set for
213 // this particular object. See set_draw_order().
214 ////////////////////////////////////////////////////////////////////
215 INLINE bool EggRenderMode::
216 has_draw_order() const {
217  return _has_draw_order;
218 }
219 
220 ////////////////////////////////////////////////////////////////////
221 // Function: EggRenderMode::clear_draw_order
222 // Access: Public
223 // Description: Removes the draw-order flag from this particular
224 // object. See set_draw_order().
225 ////////////////////////////////////////////////////////////////////
226 INLINE void EggRenderMode::
228  _has_draw_order = false;
229 }
230 
231 ////////////////////////////////////////////////////////////////////
232 // Function: EggRenderMode::set_bin
233 // Access: Public
234 // Description: Sets the "bin" string for this particular object.
235 // This names a particular bin in which the object
236 // should be rendered. The exact meaning of a bin is
237 // implementation defined, but generally a GeomBin
238 // matching each bin name must also be specifically
239 // added to the rendering engine (e.g. the
240 // CullTraverser) in use for this to work. See also
241 // set_draw_order().
242 ////////////////////////////////////////////////////////////////////
243 INLINE void EggRenderMode::
244 set_bin(const string &bin) {
245  _bin = bin;
246 }
247 
248 ////////////////////////////////////////////////////////////////////
249 // Function: EggRenderMode::get_bin
250 // Access: Public
251 // Description: Returns the bin name that has been set for this
252 // particular object, if any. See set_bin().
253 ////////////////////////////////////////////////////////////////////
254 INLINE string EggRenderMode::
255 get_bin() const {
256  return _bin;
257 }
258 
259 ////////////////////////////////////////////////////////////////////
260 // Function: EggRenderMode::has_bin
261 // Access: Public
262 // Description: Returns true if a bin name has been set for this
263 // particular object. See set_bin().
264 ////////////////////////////////////////////////////////////////////
265 INLINE bool EggRenderMode::
266 has_bin() const {
267  return !_bin.empty();
268 }
269 
270 ////////////////////////////////////////////////////////////////////
271 // Function: EggRenderMode::clear_bin
272 // Access: Public
273 // Description: Removes the bin name that was set for this particular
274 // object. See set_bin().
275 ////////////////////////////////////////////////////////////////////
276 INLINE void EggRenderMode::
278  _bin = string();
279 }
280 
281 ////////////////////////////////////////////////////////////////////
282 // Function: EggRenderMode::Inequality Operator
283 // Access: Public
284 // Description:
285 ////////////////////////////////////////////////////////////////////
286 INLINE bool EggRenderMode::
287 operator != (const EggRenderMode &other) const {
288  return !(*this == other);
289 }
VisibilityMode get_visibility_mode() const
Returns the visibility mode that was set, or VM_unspecified if nothing was set.
Definition: eggRenderMode.I:99
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:61
void clear_depth_offset()
Removes the depth-offset flag from this particular object.
bool has_depth_offset() const
Returns true if the depth-offset flag has been set for this particular object.
void set_bin(const string &bin)
Sets the "bin" string for this particular object.
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:35
DepthWriteMode get_depth_write_mode() const
Returns the depth_write mode that was set, or DWM_unspecified if nothing was set. ...
Definition: eggRenderMode.I:47
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.
bool has_bin() const
Returns true if a bin name has been set 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:36
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.
bool has_draw_order() const
Returns true if the draw-order flag has been set for this particular object.
void set_alpha_mode(AlphaMode mode)
Specifies precisely how the transparency for this geometry should be achieved, or if it should be use...
string get_bin() const
Returns the bin name that has been set for this particular object, if any.
void set_visibility_mode(VisibilityMode mode)
Specifies whether this geometry is to be considered normally visible, or hidden.
Definition: eggRenderMode.I:87
DepthTestMode get_depth_test_mode() const
Returns the depth_test mode that was set, or DTM_unspecified if nothing was set.
Definition: eggRenderMode.I:73
AlphaMode get_alpha_mode() const
Returns the alpha mode that was set, or AM_unspecified if nothing was set.
int get_depth_offset() const
Returns the "depth-offset" flag as set for this particular object.