|
|
@@ -17,12 +17,43 @@
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
#include "eggRenderMode.h"
|
|
|
-#include <indent.h>
|
|
|
-#include <string_utils.h>
|
|
|
-#include <notify.h>
|
|
|
+#include "indent.h"
|
|
|
+#include "string_utils.h"
|
|
|
+#include "notify.h"
|
|
|
|
|
|
TypeHandle EggRenderMode::_type_handle;
|
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+// Function: EggRenderMode::Constructor
|
|
|
+// Access: Public
|
|
|
+// Description:
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+EggRenderMode::
|
|
|
+EggRenderMode() {
|
|
|
+ _alpha_mode = AM_unspecified;
|
|
|
+ _depth_write_mode = DWM_unspecified;
|
|
|
+ _depth_test_mode = DTM_unspecified;
|
|
|
+ _visibility_mode = VM_unspecified;
|
|
|
+ _draw_order = 0;
|
|
|
+ _has_draw_order = false;
|
|
|
+}
|
|
|
+
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+// Function: EggRenderMode::Copy assignment operator
|
|
|
+// Access: Public
|
|
|
+// Description:
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+EggRenderMode &EggRenderMode::
|
|
|
+operator = (const EggRenderMode ©) {
|
|
|
+ _alpha_mode = copy._alpha_mode;
|
|
|
+ _depth_write_mode = copy._depth_write_mode;
|
|
|
+ _depth_test_mode = copy._depth_test_mode;
|
|
|
+ _visibility_mode = copy._visibility_mode;
|
|
|
+ _draw_order = copy._draw_order;
|
|
|
+ _has_draw_order = copy._has_draw_order;
|
|
|
+ return *this;
|
|
|
+}
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: EggRenderMode::write
|
|
|
// Access: Public
|
|
|
@@ -43,6 +74,10 @@ write(ostream &out, int indent_level) const {
|
|
|
indent(out, indent_level)
|
|
|
<< "<Scalar> depth_test { " << get_depth_test_mode() << " }\n";
|
|
|
}
|
|
|
+ if (get_visibility_mode() != VM_unspecified) {
|
|
|
+ indent(out, indent_level)
|
|
|
+ << "<Scalar> visibility { " << get_visibility_mode() << " }\n";
|
|
|
+ }
|
|
|
if (has_draw_order()) {
|
|
|
indent(out, indent_level)
|
|
|
<< "<Scalar> draw-order { " << get_draw_order() << " }\n";
|
|
|
@@ -63,6 +98,7 @@ operator == (const EggRenderMode &other) const {
|
|
|
if (_alpha_mode != other._alpha_mode ||
|
|
|
_depth_write_mode != other._depth_write_mode ||
|
|
|
_depth_test_mode != other._depth_test_mode ||
|
|
|
+ _visibility_mode != other._visibility_mode ||
|
|
|
_has_draw_order != other._has_draw_order) {
|
|
|
return false;
|
|
|
}
|
|
|
@@ -96,6 +132,9 @@ operator < (const EggRenderMode &other) const {
|
|
|
if (_depth_test_mode != other._depth_test_mode) {
|
|
|
return (int)_depth_test_mode < (int)other._depth_test_mode;
|
|
|
}
|
|
|
+ if (_visibility_mode != other._visibility_mode) {
|
|
|
+ return (int)_visibility_mode < (int)other._visibility_mode;
|
|
|
+ }
|
|
|
|
|
|
if (_has_draw_order != other._has_draw_order) {
|
|
|
return (int)_has_draw_order < (int)other._has_draw_order;
|
|
|
@@ -167,7 +206,7 @@ string_depth_write_mode(const string &string) {
|
|
|
// Function: EggRenderMode::string_depth_test_mode
|
|
|
// Access: Public
|
|
|
// Description: Returns the DepthTestMode value associated with the
|
|
|
-// given string representation, or DWM_unspecified if
|
|
|
+// given string representation, or DTM_unspecified if
|
|
|
// the string does not match any known DepthTestMode
|
|
|
// value.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
@@ -182,6 +221,25 @@ string_depth_test_mode(const string &string) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+// Function: EggRenderMode::string_visibility_mode
|
|
|
+// Access: Public
|
|
|
+// Description: Returns the HiddenMode value associated with the
|
|
|
+// given string representation, or VM_unspecified if
|
|
|
+// the string does not match any known HiddenMode
|
|
|
+// value.
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+EggRenderMode::VisibilityMode EggRenderMode::
|
|
|
+string_visibility_mode(const string &string) {
|
|
|
+ if (cmp_nocase_uh(string, "hidden") == 0) {
|
|
|
+ return VM_hidden;
|
|
|
+ } else if (cmp_nocase_uh(string, "normal") == 0) {
|
|
|
+ return VM_normal;
|
|
|
+ } else {
|
|
|
+ return VM_unspecified;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: AlphaMode output operator
|
|
|
@@ -250,3 +308,23 @@ ostream &operator << (ostream &out, EggRenderMode::DepthTestMode mode) {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+// Function: VisibilityMode output operator
|
|
|
+// Description:
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+ostream &operator << (ostream &out, EggRenderMode::VisibilityMode mode) {
|
|
|
+ switch (mode) {
|
|
|
+ case EggRenderMode::VM_unspecified:
|
|
|
+ return out << "unspecified";
|
|
|
+ case EggRenderMode::VM_hidden:
|
|
|
+ return out << "hidden";
|
|
|
+ case EggRenderMode::VM_normal:
|
|
|
+ return out << "normal";
|
|
|
+ }
|
|
|
+
|
|
|
+ nassertr(false, out);
|
|
|
+ return out << "(**invalid**)";
|
|
|
+}
|
|
|
+
|
|
|
+
|