Panda3D
Loading...
Searching...
No Matches
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 */
17INLINE EggRenderMode::
18EggRenderMode(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 */
26INLINE void EggRenderMode::
27set_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 */
35INLINE 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 */
45INLINE void EggRenderMode::
46set_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 */
54INLINE EggRenderMode::DepthTestMode EggRenderMode::
55get_depth_test_mode() const {
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 */
65INLINE void EggRenderMode::
66set_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 */
74INLINE EggRenderMode::VisibilityMode EggRenderMode::
75get_visibility_mode() const {
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 */
88INLINE void EggRenderMode::
89set_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 */
97INLINE EggRenderMode::AlphaMode EggRenderMode::
98get_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 */
108set_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 */
119get_depth_offset() const {
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 */
128has_depth_offset() const {
129 return _has_depth_offset;
130}
131
132/**
133 * Removes the depth-offset flag from this particular object. See
134 * set_depth_offset().
135 */
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 */
149set_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 */
159get_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 */
168has_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 */
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 */
189set_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 */
197INLINE std::string EggRenderMode::
198get_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 */
207has_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 */
216clear_bin() {
217 _bin = std::string();
218}
219
220/**
221 *
222 */
223INLINE bool EggRenderMode::
224operator != (const EggRenderMode &other) const {
225 return !(*this == other);
226}
This class stores miscellaneous rendering properties that is associated with geometry,...
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.
void set_draw_order(int order)
Sets the "draw-order" flag associated with this object.
int get_draw_order() const
Returns the "draw-order" flag as set 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 ...
DepthTestMode get_depth_test_mode() const
Returns the depth_test mode that was set, or DTM_unspecified if nothing was set.
DepthWriteMode get_depth_write_mode() const
Returns the depth_write mode that was set, or DWM_unspecified if nothing was set.
void set_alpha_mode(AlphaMode mode)
Specifies precisely how the transparency for this geometry should be achieved, or if it should be use...
VisibilityMode get_visibility_mode() const
Returns the visibility mode that was set, or VM_unspecified if nothing was set.
void set_depth_test_mode(DepthTestMode mode)
Specifies whether this geometry should be tested against the depth buffer when it is drawn (assuming ...
int get_depth_offset() const
Returns the "depth-offset" flag as set for this particular object.
bool has_draw_order() const
Returns true if the draw-order flag has been set for this particular object.
void clear_draw_order()
Removes the draw-order flag from this particular object.
void set_visibility_mode(VisibilityMode mode)
Specifies whether this geometry is to be considered normally visible, or hidden.
bool has_depth_offset() const
Returns true if the depth-offset flag has been set for this particular object.
void set_bin(const std::string &bin)
Sets the "bin" string for this particular object.
std::string get_bin() const
Returns the bin name that has been set for this particular object, if any.
void clear_bin()
Removes the bin name that was set for this particular object.
AlphaMode get_alpha_mode() const
Returns the alpha mode that was set, or AM_unspecified if nothing was set.
void set_depth_offset(int bias)
Sets the "depth-offset" flag associated with this object.