15 #include "eggRenderMode.h"
17 #include "string_utils.h"
29 _alpha_mode = AM_unspecified;
30 _depth_write_mode = DWM_unspecified;
31 _depth_test_mode = DTM_unspecified;
32 _visibility_mode = VM_unspecified;
34 _has_depth_offset =
false;
36 _has_draw_order =
false;
46 _alpha_mode = copy._alpha_mode;
47 _depth_write_mode = copy._depth_write_mode;
48 _depth_test_mode = copy._depth_test_mode;
49 _visibility_mode = copy._visibility_mode;
50 _depth_offset = copy._depth_offset;
51 _has_depth_offset = copy._has_depth_offset;
52 _draw_order = copy._draw_order;
53 _has_draw_order = copy._has_draw_order;
64 write(ostream &out,
int indent_level)
const {
66 indent(out, indent_level)
70 indent(out, indent_level)
74 indent(out, indent_level)
78 indent(out, indent_level)
82 indent(out, indent_level)
86 indent(out, indent_level)
90 indent(out, indent_level)
91 <<
"<Scalar> bin { " <<
get_bin() <<
" }\n";
102 if (_alpha_mode != other._alpha_mode ||
103 _depth_write_mode != other._depth_write_mode ||
104 _depth_test_mode != other._depth_test_mode ||
105 _visibility_mode != other._visibility_mode ||
106 _has_depth_offset != other._has_depth_offset ||
107 _has_draw_order != other._has_draw_order) {
111 if (_has_depth_offset) {
112 if (_depth_offset != other._depth_offset) {
117 if (_has_draw_order) {
118 if (_draw_order != other._draw_order) {
123 if (_bin != other._bin) {
137 if (_alpha_mode != other._alpha_mode) {
138 return (
int)_alpha_mode < (int)other._alpha_mode;
140 if (_depth_write_mode != other._depth_write_mode) {
141 return (
int)_depth_write_mode < (int)other._depth_write_mode;
143 if (_depth_test_mode != other._depth_test_mode) {
144 return (
int)_depth_test_mode < (int)other._depth_test_mode;
146 if (_visibility_mode != other._visibility_mode) {
147 return (
int)_visibility_mode < (int)other._visibility_mode;
150 if (_has_depth_offset != other._has_depth_offset) {
151 return (
int)_has_depth_offset < (int)other._has_depth_offset;
153 if (_has_draw_order != other._has_draw_order) {
154 return (
int)_has_draw_order < (int)other._has_draw_order;
157 if (_has_depth_offset) {
158 if (_depth_offset != other._depth_offset) {
159 return _depth_offset < other._depth_offset;
162 if (_has_draw_order) {
163 if (_draw_order != other._draw_order) {
164 return _draw_order < other._draw_order;
168 if (_bin != other._bin) {
169 return _bin < other._bin;
184 if (cmp_nocase_uh(
string,
"off") == 0) {
186 }
else if (cmp_nocase_uh(
string,
"on") == 0) {
188 }
else if (cmp_nocase_uh(
string,
"blend") == 0) {
190 }
else if (cmp_nocase_uh(
string,
"blend_no_occlude") == 0) {
191 return AM_blend_no_occlude;
192 }
else if (cmp_nocase_uh(
string,
"ms") == 0) {
194 }
else if (cmp_nocase_uh(
string,
"ms_mask") == 0) {
196 }
else if (cmp_nocase_uh(
string,
"binary") == 0) {
198 }
else if (cmp_nocase_uh(
string,
"dual") == 0) {
201 return AM_unspecified;
215 if (cmp_nocase_uh(
string,
"off") == 0) {
217 }
else if (cmp_nocase_uh(
string,
"on") == 0) {
220 return DWM_unspecified;
234 if (cmp_nocase_uh(
string,
"off") == 0) {
236 }
else if (cmp_nocase_uh(
string,
"on") == 0) {
239 return DTM_unspecified;
253 if (cmp_nocase_uh(
string,
"hidden") == 0) {
255 }
else if (cmp_nocase_uh(
string,
"normal") == 0) {
258 return VM_unspecified;
267 ostream &operator << (ostream &out, EggRenderMode::AlphaMode mode) {
269 case EggRenderMode::AM_unspecified:
270 return out <<
"unspecified";
271 case EggRenderMode::AM_off:
273 case EggRenderMode::AM_on:
275 case EggRenderMode::AM_blend:
276 return out <<
"blend";
277 case EggRenderMode::AM_blend_no_occlude:
278 return out <<
"blend_no_occlude";
279 case EggRenderMode::AM_ms:
281 case EggRenderMode::AM_ms_mask:
282 return out <<
"ms_mask";
283 case EggRenderMode::AM_binary:
284 return out <<
"binary";
285 case EggRenderMode::AM_dual:
286 return out <<
"dual";
289 nassertr(
false, out);
290 return out <<
"(**invalid**)";
297 istream &operator >> (istream &in, EggRenderMode::AlphaMode &mode) {
308 ostream &operator << (ostream &out, EggRenderMode::DepthWriteMode mode) {
310 case EggRenderMode::DWM_unspecified:
311 return out <<
"unspecified";
312 case EggRenderMode::DWM_off:
314 case EggRenderMode::DWM_on:
318 nassertr(
false, out);
319 return out <<
"(**invalid**)";
326 ostream &operator << (ostream &out, EggRenderMode::DepthTestMode mode) {
328 case EggRenderMode::DTM_unspecified:
329 return out <<
"unspecified";
330 case EggRenderMode::DTM_off:
332 case EggRenderMode::DTM_on:
336 nassertr(
false, out);
337 return out <<
"(**invalid**)";
346 ostream &operator << (ostream &out, EggRenderMode::VisibilityMode mode) {
348 case EggRenderMode::VM_unspecified:
349 return out <<
"unspecified";
350 case EggRenderMode::VM_hidden:
351 return out <<
"hidden";
352 case EggRenderMode::VM_normal:
353 return out <<
"normal";
356 nassertr(
false, out);
357 return out <<
"(**invalid**)";
VisibilityMode get_visibility_mode() const
Returns the visibility mode that was set, or VM_unspecified if nothing was set.
static DepthTestMode string_depth_test_mode(const string &string)
Returns the DepthTestMode value associated with the given string representation, or DTM_unspecified i...
static AlphaMode string_alpha_mode(const string &string)
Returns the AlphaMode value associated with the given string representation, or AM_unspecified if the...
bool has_depth_offset() const
Returns true if the depth-offset flag has been set for this particular object.
DepthWriteMode get_depth_write_mode() const
Returns the depth_write mode that was set, or DWM_unspecified if nothing was set. ...
int get_draw_order() const
Returns the "draw-order" flag as set for this particular object.
static VisibilityMode string_visibility_mode(const string &string)
Returns the HiddenMode value associated with the given string representation, or VM_unspecified if th...
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.
void write(ostream &out, int indent_level) const
Writes the attributes to the indicated output stream in Egg format.
static DepthWriteMode string_depth_write_mode(const string &string)
Returns the DepthWriteMode value associated with the given string representation, or DWM_unspecified ...
bool has_draw_order() const
Returns true if the draw-order flag has been set for this particular object.
string get_bin() const
Returns the bin name that has been set for this particular object, if any.
DepthTestMode get_depth_test_mode() const
Returns the depth_test mode that was set, or DTM_unspecified if nothing was set.
AlphaMode get_alpha_mode() const
Returns the alpha mode that was set, or AM_unspecified if nothing was set.
TypeHandle is the identifier used to differentiate C++ class types.
int get_depth_offset() const
Returns the "depth-offset" flag as set for this particular object.