Browse Source

*** empty log message ***

David Rose 25 years ago
parent
commit
42ffc16344

+ 6 - 5
panda/src/egg/Sources.pp

@@ -9,8 +9,7 @@
     linmath putil
 
   #define SOURCES \
-    config_egg.cxx config_egg.h eggAlphaMode.I eggAlphaMode.cxx \
-    eggAlphaMode.h eggAnimData.I eggAnimData.cxx eggAnimData.h \
+    config_egg.cxx config_egg.h eggAnimData.I eggAnimData.cxx eggAnimData.h \
     eggAttributes.I eggAttributes.cxx eggAttributes.h eggBin.cxx \
     eggBin.h eggBinMaker.cxx eggBinMaker.h eggComment.I eggComment.cxx \
     eggComment.h eggCoordinateSystem.I eggCoordinateSystem.cxx \
@@ -28,7 +27,9 @@
     eggObject.h eggParameters.cxx eggParameters.h eggPoint.I \
     eggPoint.cxx eggPoint.h eggPolygon.I eggPolygon.cxx eggPolygon.h \
     eggPoolUniquifier.cxx eggPoolUniquifier.h \
-    eggPrimitive.I eggPrimitive.cxx eggPrimitive.h eggSAnimData.I \
+    eggPrimitive.I eggPrimitive.cxx eggPrimitive.h \
+    eggRenderMode.I eggRenderMode.cxx \
+    eggRenderMode.h eggSAnimData.I \
     eggSAnimData.cxx eggSAnimData.h eggSurface.I eggSurface.cxx \
     eggSurface.h eggSwitchCondition.cxx eggSwitchCondition.h eggTable.I \
     eggTable.cxx eggTable.h eggTexture.I eggTexture.cxx eggTexture.h \
@@ -40,7 +41,7 @@
     eggXfmSAnim.h parserDefs.h parser.yxx lexerDefs.h lexer.lxx
 
   #define INSTALL_HEADERS \
-    eggAlphaMode.I eggAlphaMode.h eggAnimData.I eggAnimData.h \
+    eggAnimData.I eggAnimData.h \
     eggAttributes.I eggAttributes.h eggBin.h eggBinMaker.h eggComment.I \
     eggComment.h eggCoordinateSystem.I eggCoordinateSystem.h eggCurve.I \
     eggCurve.h eggData.I eggData.h eggExternalReference.I \
@@ -51,7 +52,7 @@
     eggNurbsCurve.I eggNurbsCurve.h eggNurbsSurface.I eggNurbsSurface.h \
     eggObject.I eggObject.h eggParameters.h eggPoint.I eggPoint.h \
     eggPolygon.I eggPolygon.h eggPoolUniquifier.h \
-    eggPrimitive.I eggPrimitive.h \
+    eggPrimitive.I eggPrimitive.h eggRenderMode.I eggRenderMode.h \
     eggSAnimData.I eggSAnimData.h eggSurface.I eggSurface.h \
     eggSwitchCondition.h eggTable.I eggTable.h eggTexture.I \
     eggTexture.h eggTextureCollection.I eggTextureCollection.h \

+ 2 - 2
panda/src/egg/config_egg.cxx

@@ -4,7 +4,7 @@
 ////////////////////////////////////////////////////////////////////
 
 #include "config_egg.h"
-#include "eggAlphaMode.h"
+#include "eggRenderMode.h"
 #include "eggAnimData.h"
 #include "eggAttributes.h"
 #include "eggBin.h"
@@ -44,7 +44,7 @@ Configure(config_egg);
 NotifyCategoryDef(egg, "");
 
 ConfigureFn(config_egg) {
-  EggAlphaMode::init_type();
+  EggRenderMode::init_type();
   EggAnimData::init_type();
   EggAttributes::init_type();
   EggBin::init_type();

+ 0 - 141
panda/src/egg/eggAlphaMode.cxx

@@ -1,141 +0,0 @@
-// Filename: eggAlphaMode.cxx
-// Created by:  drose (20Jan99)
-// 
-////////////////////////////////////////////////////////////////////
-
-#include "eggAlphaMode.h"
-#include <indent.h>
-#include <string_utils.h>
-#include <notify.h>
-
-TypeHandle EggAlphaMode::_type_handle;
-
-////////////////////////////////////////////////////////////////////
-//     Function: EggAlphaMode::write
-//       Access: Public
-//  Description: Writes the attributes to the indicated output stream in
-//               Egg format.
-////////////////////////////////////////////////////////////////////
-void EggAlphaMode::
-write(ostream &out, int indent_level) const {
-  if (get_alpha_mode() != AM_unspecified) {
-    indent(out, indent_level)
-      << "<Scalar> alpha { " << get_alpha_mode() << " }\n";
-  }
-  if (has_draw_order()) {
-    indent(out, indent_level)
-      << "<Scalar> draw-order { " << get_draw_order() << " }\n";
-  }
-  if (has_bin()) {
-    indent(out, indent_level)
-      << "<Scalar> bin { " << get_bin() << " }\n";
-  }
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: EggAlphaMode::Equality Operator
-//       Access: Public
-//  Description: 
-////////////////////////////////////////////////////////////////////
-bool EggAlphaMode::
-operator == (const EggAlphaMode &other) const {
-  if (_alpha_mode != other._alpha_mode ||
-      _has_draw_order != other._has_draw_order) {
-    return false;
-  }
-
-  if (_has_draw_order) {
-    if (_draw_order != other._draw_order) {
-      return false;
-    }
-  }
-
-  if (_bin != other._bin) {
-    return false;
-  }
-
-  return true;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: EggAlphaMode::Ordering Operator
-//       Access: Public
-//  Description: 
-////////////////////////////////////////////////////////////////////
-bool EggAlphaMode::
-operator < (const EggAlphaMode &other) const {
-  if (_alpha_mode != other._alpha_mode) {
-    return (int)_alpha_mode < (int)other._alpha_mode;
-  }
-
-  if (_has_draw_order != other._has_draw_order) {
-    return (int)_has_draw_order < (int)other._has_draw_order;
-  }
-
-  if (_has_draw_order) {
-    if (_draw_order != other._draw_order) {
-      return _draw_order < other._draw_order;
-    }
-  }
-
-  if (_bin != other._bin) {
-    return _bin < other._bin;
-  }
-
-  return false;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: EggAlphaMode::string_alpha_mode
-//       Access: Public
-//  Description: Returns the AlphaMode value associated with the given
-//               string representation, or AM_unspecified if the string
-//               does not match any known AlphaMode value.
-////////////////////////////////////////////////////////////////////
-EggAlphaMode::AlphaMode EggAlphaMode::
-string_alpha_mode(const string &string) {
-  if (cmp_nocase_uh(string, "off") == 0) {
-    return AM_off;
-  } else if (cmp_nocase_uh(string, "on") == 0) {
-    return AM_on;
-  } else if (cmp_nocase_uh(string, "blend") == 0) {
-    return AM_blend;
-  } else if (cmp_nocase_uh(string, "blend_no_occlude") == 0) {
-    return AM_blend_no_occlude;
-  } else if (cmp_nocase_uh(string, "ms") == 0) {
-    return AM_ms;
-  } else if (cmp_nocase_uh(string, "ms_mask") == 0) {
-    return AM_ms_mask;
-  } else {
-    return AM_unspecified;
-  }
-}
-
-
-////////////////////////////////////////////////////////////////////
-//     Function: AlphaMode output operator
-//  Description: 
-////////////////////////////////////////////////////////////////////
-ostream &operator << (ostream &out, EggAlphaMode::AlphaMode mode) {
-  switch (mode) {
-  case EggAlphaMode::AM_unspecified:
-    return out << "unspecified";
-  case EggAlphaMode::AM_off:
-    return out << "off";
-  case EggAlphaMode::AM_on:
-    return out << "on";
-  case EggAlphaMode::AM_blend:
-    return out << "blend";
-  case EggAlphaMode::AM_blend_no_occlude:
-    return out << "blend_no_occlude";
-  case EggAlphaMode::AM_ms:
-    return out << "ms";
-  case EggAlphaMode::AM_ms_mask:
-    return out << "ms_mask";
-  }
-
-  nassertr(false, out);
-  return out << "(**invalid**)";
-}
-
-    

+ 0 - 84
panda/src/egg/eggAlphaMode.h

@@ -1,84 +0,0 @@
-// Filename: eggAlphaMode.h
-// Created by:  drose (20Jan99)
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef EGGALPHAMODE_H
-#define EGGALPHAMODE_H
-
-#include <pandabase.h>
-
-#include <typeHandle.h>
-
-#include <string>
-
-
-////////////////////////////////////////////////////////////////////
-// 	 Class : EggAlphaMode
-// Description : This is a base class for things that can have the
-//               alpha mode and draw order set on them.  This includes
-//               textures, primitives, and groups.
-//
-//               This class cannot inherit from EggObject, because it
-//               causes problems at the EggPolygon level with multiple
-//               appearances of the EggObject base class.  And making
-//               EggObject a virtual base class is just no fun.
-////////////////////////////////////////////////////////////////////
-class EXPCL_PANDAEGG EggAlphaMode {
-public:
-  INLINE EggAlphaMode();
-  INLINE EggAlphaMode(const EggAlphaMode &copy);
-  INLINE EggAlphaMode &operator = (const EggAlphaMode &copy);
-
-  void write(ostream &out, int indent_level) const;
-
-  enum AlphaMode {
-    AM_unspecified, AM_off, AM_on,
-    AM_blend, AM_blend_no_occlude, AM_ms, AM_ms_mask
-  };
-
-  INLINE void set_alpha_mode(AlphaMode mode);
-  INLINE AlphaMode get_alpha_mode() const;
-
-  INLINE void set_draw_order(int order);
-  INLINE int get_draw_order() const;
-  INLINE bool has_draw_order() const;
-  INLINE void clear_draw_order();
-
-  INLINE void set_bin(const string &bin);
-  INLINE string get_bin() const;
-  INLINE bool has_bin() const;
-  INLINE void clear_bin();
-
-  // Comparison operators are handy.
-  bool operator == (const EggAlphaMode &other) const;
-  INLINE bool operator != (const EggAlphaMode &other) const;
-  bool operator < (const EggAlphaMode &other) const;
-
-  static AlphaMode string_alpha_mode(const string &string);
-
-private:
-  AlphaMode _alpha_mode;
-  int _draw_order;
-  bool _has_draw_order;
-  string _bin;
-
-
-public:
-  static TypeHandle get_class_type() {
-    return _type_handle;
-  }
-  static void init_type() {
-    register_type(_type_handle, "EggAlphaMode");
-  }
-
-private:
-  static TypeHandle _type_handle;
-};
-
-ostream &operator << (ostream &out, EggAlphaMode::AlphaMode mode);
-
-#include "eggAlphaMode.I"
-
-#endif
-

+ 42 - 8
panda/src/egg/eggGroup.cxx

@@ -74,7 +74,7 @@ operator = (const EggGroup &copy) {
   // will force an update_under().  Therefore, we can't call it until
   // all the attributes that affect adjust_under() are in place.
   EggGroupNode::operator = (copy);
-  EggAlphaMode::operator = (copy);
+  EggRenderMode::operator = (copy);
 
   return *this;
 }
@@ -257,7 +257,7 @@ write(ostream &out, int indent_level) const {
     indent(out, indent_level + 2) << "<Scalar> direct { 1 }\n";
   }
 
-  EggAlphaMode::write(out, indent_level + 2);
+  EggRenderMode::write(out, indent_level + 2);
 
   write_vertex_ref(out, indent_level + 2);
 
@@ -271,10 +271,10 @@ write(ostream &out, int indent_level) const {
 //  Description: Walks back up the hierarchy, looking for an EggGroup
 //               or EggPrimitive or some such object at this level or
 //               above this group that has an alpha_mode other than
-//               AM_unspecified.  Returns a valid EggAlphaMode pointer
+//               AM_unspecified.  Returns a valid EggRenderMode pointer
 //               if one is found, or NULL otherwise.
 ////////////////////////////////////////////////////////////////////
-EggAlphaMode *EggGroup::
+EggRenderMode *EggGroup::
 determine_alpha_mode() {
   if (get_alpha_mode() != AM_unspecified) {
     return this;
@@ -282,16 +282,50 @@ determine_alpha_mode() {
   return EggGroupNode::determine_alpha_mode();
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: EggGroup::determine_depth_write_mode
+//       Access: Public, Virtual
+//  Description: Walks back up the hierarchy, looking for an EggGroup
+//               or EggPrimitive or some such object at this level or
+//               above this group that has an depth_write_mode other
+//               than DWM_unspecified.  Returns a valid EggRenderMode
+//               pointer if one is found, or NULL otherwise.
+////////////////////////////////////////////////////////////////////
+EggRenderMode *EggGroup::
+determine_depth_write_mode() {
+  if (get_depth_write_mode() != DWM_unspecified) {
+    return this;
+  }
+  return EggGroupNode::determine_depth_write_mode();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: EggGroup::determine_depth_test_mode
+//       Access: Public, Virtual
+//  Description: Walks back up the hierarchy, looking for an EggGroup
+//               or EggPrimitive or some such object at this level or
+//               above this group that has an depth_test_mode other
+//               than DTM_unspecified.  Returns a valid EggRenderMode
+//               pointer if one is found, or NULL otherwise.
+////////////////////////////////////////////////////////////////////
+EggRenderMode *EggGroup::
+determine_depth_test_mode() {
+  if (get_depth_test_mode() != DTM_unspecified) {
+    return this;
+  }
+  return EggGroupNode::determine_depth_test_mode();
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: EggGroup::determine_draw_order
 //       Access: Public, Virtual
 //  Description: Walks back up the hierarchy, looking for an EggGroup
 //               or EggPrimitive or some such object at this level or
 //               above this group that has a draw_order specified.
-//               Returns a valid EggAlphaMode pointer if one is found,
+//               Returns a valid EggRenderMode pointer if one is found,
 //               or NULL otherwise.
 ////////////////////////////////////////////////////////////////////
-EggAlphaMode *EggGroup::
+EggRenderMode *EggGroup::
 determine_draw_order() {
   if (has_draw_order()) {
     return this;
@@ -305,10 +339,10 @@ determine_draw_order() {
 //  Description: Walks back up the hierarchy, looking for an EggGroup
 //               or EggPrimitive or some such object at this level or
 //               above this group that has a bin specified.  Returns a
-//               valid EggAlphaMode pointer if one is found, or NULL
+//               valid EggRenderMode pointer if one is found, or NULL
 //               otherwise.
 ////////////////////////////////////////////////////////////////////
-EggAlphaMode *EggGroup::
+EggRenderMode *EggGroup::
 determine_bin() {
   if (has_bin()) {
     return this;

+ 9 - 7
panda/src/egg/eggGroup.h

@@ -9,7 +9,7 @@
 #include <pandabase.h>
 
 #include "eggGroupNode.h"
-#include "eggAlphaMode.h"
+#include "eggRenderMode.h"
 #include "eggVertex.h"
 #include "eggSwitchCondition.h"
 
@@ -21,7 +21,7 @@
 // Description : The main glue of the egg hierarchy, this corresponds
 //               to the <Group>, <Instance>, and <Joint> type nodes.
 ////////////////////////////////////////////////////////////////////
-class EXPCL_PANDAEGG EggGroup : public EggGroupNode, public EggAlphaMode {
+class EXPCL_PANDAEGG EggGroup : public EggGroupNode, public EggRenderMode {
 public:
   typedef map<PT(EggVertex), double> VertexRef;
 
@@ -77,9 +77,11 @@ public:
   virtual void write(ostream &out, int indent_level) const;
   bool parse_egg(const string &egg_syntax);
 
-  virtual EggAlphaMode *determine_alpha_mode();
-  virtual EggAlphaMode *determine_draw_order();
-  virtual EggAlphaMode *determine_bin();
+  virtual EggRenderMode *determine_alpha_mode();
+  virtual EggRenderMode *determine_depth_write_mode();
+  virtual EggRenderMode *determine_depth_test_mode();
+  virtual EggRenderMode *determine_draw_order();
+  virtual EggRenderMode *determine_bin();
 
   void set_group_type(GroupType type);
   INLINE GroupType get_group_type() const;
@@ -224,10 +226,10 @@ public:
   }
   static void init_type() {
     EggGroupNode::init_type();
-    EggAlphaMode::init_type();
+    EggRenderMode::init_type();
     register_type(_type_handle, "EggGroup",
                   EggGroupNode::get_class_type(),
-		  EggAlphaMode::get_class_type());
+		  EggRenderMode::get_class_type());
   }
   virtual TypeHandle get_type() const {
     return get_class_type();

+ 45 - 9
panda/src/egg/eggNode.cxx

@@ -17,32 +17,68 @@ TypeHandle EggNode::_type_handle;
 //  Description: Walks back up the hierarchy, looking for an EggGroup
 //               or EggPrimitive or some such object at this level or
 //               above this node that has an alpha_mode other than
-//               AM_unspecified.  Returns a valid EggAlphaMode pointer
+//               AM_unspecified.  Returns a valid EggRenderMode pointer
 //               if one is found, or NULL otherwise.
 ////////////////////////////////////////////////////////////////////
-EggAlphaMode *EggNode::
+EggRenderMode *EggNode::
 determine_alpha_mode() {
   if (_parent == (EggGroupNode *)NULL) {
     // Too bad; we're done.
-    return (EggAlphaMode *)NULL;
+    return (EggRenderMode *)NULL;
   }
   return _parent->determine_alpha_mode();
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: EggNode::determine_depth_write_mode
+//       Access: Public, Virtual
+//  Description: Walks back up the hierarchy, looking for an EggGroup
+//               or EggPrimitive or some such object at this level or
+//               above this node that has a depth_write_mode other than
+//               DWM_unspecified.  Returns a valid EggRenderMode pointer
+//               if one is found, or NULL otherwise.
+////////////////////////////////////////////////////////////////////
+EggRenderMode *EggNode::
+determine_depth_write_mode() {
+  if (_parent == (EggGroupNode *)NULL) {
+    // Too bad; we're done.
+    return (EggRenderMode *)NULL;
+  }
+  return _parent->determine_depth_write_mode();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: EggNode::determine_depth_test_mode
+//       Access: Public, Virtual
+//  Description: Walks back up the hierarchy, looking for an EggGroup
+//               or EggPrimitive or some such object at this level or
+//               above this node that has a depth_test_mode other than
+//               DTM_unspecified.  Returns a valid EggRenderMode pointer
+//               if one is found, or NULL otherwise.
+////////////////////////////////////////////////////////////////////
+EggRenderMode *EggNode::
+determine_depth_test_mode() {
+  if (_parent == (EggGroupNode *)NULL) {
+    // Too bad; we're done.
+    return (EggRenderMode *)NULL;
+  }
+  return _parent->determine_depth_test_mode();
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: EggNode::determine_draw_order
 //       Access: Public, Virtual
 //  Description: Walks back up the hierarchy, looking for an EggGroup
 //               or EggPrimitive or some such object at this level or
 //               above this node that has a draw_order specified.
-//               Returns a valid EggAlphaMode pointer if one is found,
+//               Returns a valid EggRenderMode pointer if one is found,
 //               or NULL otherwise.
 ////////////////////////////////////////////////////////////////////
-EggAlphaMode *EggNode::
+EggRenderMode *EggNode::
 determine_draw_order() {
   if (_parent == (EggGroupNode *)NULL) {
     // Too bad; we're done.
-    return (EggAlphaMode *)NULL;
+    return (EggRenderMode *)NULL;
   }
   return _parent->determine_draw_order();
 }
@@ -53,14 +89,14 @@ determine_draw_order() {
 //  Description: Walks back up the hierarchy, looking for an EggGroup
 //               or EggPrimitive or some such object at this level or
 //               above this node that has a bin specified.  Returns a
-//               valid EggAlphaMode pointer if one is found, or NULL
+//               valid EggRenderMode pointer if one is found, or NULL
 //               otherwise.
 ////////////////////////////////////////////////////////////////////
-EggAlphaMode *EggNode::
+EggRenderMode *EggNode::
 determine_bin() {
   if (_parent == (EggGroupNode *)NULL) {
     // Too bad; we're done.
-    return (EggAlphaMode *)NULL;
+    return (EggRenderMode *)NULL;
   }
   return _parent->determine_bin();
 }

+ 6 - 4
panda/src/egg/eggNode.h

@@ -16,7 +16,7 @@
 #include <referenceCount.h>
 
 class EggGroupNode;
-class EggAlphaMode;
+class EggRenderMode;
 
 ////////////////////////////////////////////////////////////////////
 // 	 Class : EggNode
@@ -37,9 +37,11 @@ public:
   INLINE bool is_under_transform() const;
   INLINE bool is_local_coord() const;
 
-  virtual EggAlphaMode *determine_alpha_mode();
-  virtual EggAlphaMode *determine_draw_order();
-  virtual EggAlphaMode *determine_bin();
+  virtual EggRenderMode *determine_alpha_mode();
+  virtual EggRenderMode *determine_depth_write_mode();
+  virtual EggRenderMode *determine_depth_test_mode();
+  virtual EggRenderMode *determine_draw_order();
+  virtual EggRenderMode *determine_bin();
 
   INLINE const LMatrix4d &get_vertex_frame() const;
   INLINE const LMatrix4d &get_node_frame() const;

+ 49 - 7
panda/src/egg/eggPrimitive.cxx

@@ -19,10 +19,10 @@ TypeHandle EggPrimitive::_type_handle;
 //  Description: Walks back up the hierarchy, looking for an EggPrimitive
 //               or EggPrimitive or some such object at this level or
 //               above this primitive that has an alpha_mode other than
-//               AM_unspecified.  Returns a valid EggAlphaMode pointer
+//               AM_unspecified.  Returns a valid EggRenderMode pointer
 //               if one is found, or NULL otherwise.
 ////////////////////////////////////////////////////////////////////
-EggAlphaMode *EggPrimitive::
+EggRenderMode *EggPrimitive::
 determine_alpha_mode() {
   if (get_alpha_mode() != AM_unspecified) {
     return this;
@@ -33,16 +33,58 @@ determine_alpha_mode() {
   return EggNode::determine_alpha_mode();
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: EggPrimitive::determine_depth_write_mode
+//       Access: Public, Virtual
+//  Description: Walks back up the hierarchy, looking for an EggGroup
+//               or EggPrimitive or some such object at this level or
+//               above this node that has a depth_write_mode other than
+//               DWM_unspecified.  Returns a valid EggRenderMode pointer
+//               if one is found, or NULL otherwise.
+////////////////////////////////////////////////////////////////////
+EggRenderMode *EggPrimitive::
+determine_depth_write_mode() {
+  if (get_depth_write_mode() != DWM_unspecified) {
+    return this;
+  }
+  if (has_texture() && 
+      get_texture()->get_depth_write_mode() != DWM_unspecified) {
+    return get_texture();
+  }
+  return EggNode::determine_depth_write_mode();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: EggPrimitive::determine_depth_test_mode
+//       Access: Public, Virtual
+//  Description: Walks back up the hierarchy, looking for an EggGroup
+//               or EggPrimitive or some such object at this level or
+//               above this node that has a depth_test_mode other than
+//               DTM_unspecified.  Returns a valid EggRenderMode pointer
+//               if one is found, or NULL otherwise.
+////////////////////////////////////////////////////////////////////
+EggRenderMode *EggPrimitive::
+determine_depth_test_mode() {
+  if (get_depth_test_mode() != DTM_unspecified) {
+    return this;
+  }
+  if (has_texture() && 
+      get_texture()->get_depth_test_mode() != DTM_unspecified) {
+    return get_texture();
+  }
+  return EggNode::determine_depth_test_mode();
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: EggPrimitive::determine_draw_order
 //       Access: Public, Virtual
 //  Description: Walks back up the hierarchy, looking for an EggPrimitive
 //               or EggPrimitive or some such object at this level or
 //               above this primitive that has a draw_order specified.
-//               Returns a valid EggAlphaMode pointer if one is found,
+//               Returns a valid EggRenderMode pointer if one is found,
 //               or NULL otherwise.
 ////////////////////////////////////////////////////////////////////
-EggAlphaMode *EggPrimitive::
+EggRenderMode *EggPrimitive::
 determine_draw_order() {
   if (has_draw_order()) {
     return this;
@@ -59,10 +101,10 @@ determine_draw_order() {
 //  Description: Walks back up the hierarchy, looking for an EggPrimitive
 //               or EggPrimitive or some such object at this level or
 //               above this primitive that has a bin specified.  Returns a
-//               valid EggAlphaMode pointer if one is found, or NULL
+//               valid EggRenderMode pointer if one is found, or NULL
 //               otherwise.
 ////////////////////////////////////////////////////////////////////
-EggAlphaMode *EggPrimitive::
+EggRenderMode *EggPrimitive::
 determine_bin() {
   if (has_bin()) {
     return this;
@@ -379,7 +421,7 @@ write_body(ostream &out, int indent_level) const {
   test_vref_integrity();
 
   EggAttributes::write(out, indent_level);
-  EggAlphaMode::write(out, indent_level);
+  EggRenderMode::write(out, indent_level);
 
   if (has_texture()) {
     EggTexture *texture = get_texture();

+ 9 - 7
panda/src/egg/eggPrimitive.h

@@ -13,7 +13,7 @@
 #include "eggVertex.h"
 #include "eggTexture.h"
 #include "eggMaterial.h"
-#include "eggAlphaMode.h"
+#include "eggRenderMode.h"
 #include <pointerTo.h>
 #include <vector>
 
@@ -33,7 +33,7 @@ class EggVertexPool;
 //               the same vertex pool.
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDAEGG EggPrimitive : public EggNode, public EggAttributes,
-		     public EggAlphaMode
+		     public EggRenderMode
 {
 
   // This is a bit of private interface stuff that must be here as a
@@ -51,9 +51,11 @@ public:
   INLINE EggPrimitive &operator = (const EggPrimitive &copy);
   INLINE ~EggPrimitive();
 
-  virtual EggAlphaMode *determine_alpha_mode();
-  virtual EggAlphaMode *determine_draw_order();
-  virtual EggAlphaMode *determine_bin();
+  virtual EggRenderMode *determine_alpha_mode();
+  virtual EggRenderMode *determine_depth_write_mode();
+  virtual EggRenderMode *determine_depth_test_mode();
+  virtual EggRenderMode *determine_draw_order();
+  virtual EggRenderMode *determine_bin();
 
   INLINE void set_texture(PT(EggTexture) texture);
   INLINE void clear_texture();
@@ -154,11 +156,11 @@ public:
   static void init_type() {
     EggNode::init_type();
     EggAttributes::init_type();
-    EggAlphaMode::get_class_type();
+    EggRenderMode::get_class_type();
     register_type(_type_handle, "EggPrimitive",
                   EggNode::get_class_type(),
                   EggAttributes::get_class_type(),
-		  EggAlphaMode::get_class_type());
+		  EggRenderMode::get_class_type());
   }
   virtual TypeHandle get_type() const {
     return get_class_type();

+ 100 - 36
panda/src/egg/eggAlphaMode.I → panda/src/egg/eggRenderMode.I

@@ -1,40 +1,44 @@
-// Filename: eggAlphaMode.I
+// Filename: eggRenderMode.I
 // Created by:  drose (20Jan99)
 // 
 ////////////////////////////////////////////////////////////////////
 
 
 ////////////////////////////////////////////////////////////////////
-//     Function: EggAlphaMode::Constructor
+//     Function: EggRenderMode::Constructor
 //       Access: Public
 //  Description: 
 ////////////////////////////////////////////////////////////////////
-INLINE EggAlphaMode::
-EggAlphaMode() {
+INLINE EggRenderMode::
+EggRenderMode() {
   _alpha_mode = AM_unspecified;
+  _depth_write_mode = DWM_unspecified;
+  _depth_test_mode = DTM_unspecified;
   _draw_order = 0;
   _has_draw_order = false;
 }
 
 
 ////////////////////////////////////////////////////////////////////
-//     Function: EggAlphaMode::Copy Constructor
+//     Function: EggRenderMode::Copy Constructor
 //       Access: Public
 //  Description: 
 ////////////////////////////////////////////////////////////////////
-INLINE EggAlphaMode::
-EggAlphaMode(const EggAlphaMode &copy) {
+INLINE EggRenderMode::
+EggRenderMode(const EggRenderMode &copy) {
   (*this) = copy;
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: EggAlphaMode::Copy assignment operator
+//     Function: EggRenderMode::Copy assignment operator
 //       Access: Public
 //  Description: 
 ////////////////////////////////////////////////////////////////////
-INLINE EggAlphaMode &EggAlphaMode::
-operator = (const EggAlphaMode &copy) {
+INLINE EggRenderMode &EggRenderMode::
+operator = (const EggRenderMode &copy) {
   _alpha_mode = copy._alpha_mode;
+  _depth_write_mode = copy._depth_write_mode;
+  _depth_test_mode = copy._depth_test_mode;
   _draw_order = copy._draw_order;
   _has_draw_order = copy._has_draw_order;
   return *this;
@@ -42,29 +46,89 @@ operator = (const EggAlphaMode &copy) {
 
 
 ////////////////////////////////////////////////////////////////////
-//     Function: EggAlphaMode::set_alpha_mode
+//     Function: EggRenderMode::set_depth_write_mode
 //       Access: Public
-//  Description: 
+//  Description: Specifies whether writes should be made to the depth
+//               buffer (assuming the rendering backend provides a
+//               depth buffer) when rendering this geometry.
+////////////////////////////////////////////////////////////////////
+INLINE void EggRenderMode::
+set_depth_write_mode(DepthWriteMode mode) {
+  _depth_write_mode = mode;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: EggRenderMode::get_depth_write_mode
+//       Access: Public
+//  Description: Returns the depth_write mode that was set, or
+//               DWM_unspecified if nothing was set.  See
+//               set_depth_write_mode().
 ////////////////////////////////////////////////////////////////////
-INLINE void EggAlphaMode::
+INLINE EggRenderMode::DepthWriteMode EggRenderMode::
+get_depth_write_mode() const {
+  return _depth_write_mode;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: EggRenderMode::set_depth_test_mode
+//       Access: Public
+//  Description: Specifies whether this geometry should be tested
+//               against the depth buffer when it is drawn (assuming
+//               the rendering backend provides a depth buffer).  Note
+//               that this is different, and independent from, the
+//               depth_write mode.
+////////////////////////////////////////////////////////////////////
+INLINE void EggRenderMode::
+set_depth_test_mode(DepthTestMode mode) {
+  _depth_test_mode = mode;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: EggRenderMode::get_depth_test_mode
+//       Access: Public
+//  Description: Returns the depth_test mode that was set, or
+//               DTM_unspecified if nothing was set.  See
+//               set_depth_test_mode().
+////////////////////////////////////////////////////////////////////
+INLINE EggRenderMode::DepthTestMode EggRenderMode::
+get_depth_test_mode() const {
+  return _depth_test_mode;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: EggRenderMode::set_alpha_mode
+//       Access: Public
+//  Description: Specifies precisely how the transparency for this
+//               geometry should be achieved, or if it should be used.
+//               The default, AM_unspecified, is to use transparency
+//               if the geometry has a color whose alpha value is
+//               non-1, or if it has a four-channel texture applied;
+//               otherwise, AM_on forces transparency on, and AM_off
+//               forces it off.  The other flavors of transparency are
+//               specific ways to turn on transparency, which may or
+//               may not be supported by a particular rendering
+//               backend.
+////////////////////////////////////////////////////////////////////
+INLINE void EggRenderMode::
 set_alpha_mode(AlphaMode mode) {
   _alpha_mode = mode;
 }
 
-
 ////////////////////////////////////////////////////////////////////
-//     Function: EggAlphaMode::get_alpha_mode
+//     Function: EggRenderMode::get_alpha_mode
 //       Access: Public
-//  Description: 
+//  Description: Returns the alpha mode that was set, or
+//               AM_unspecified if nothing was set.  See
+//               set_alpha_mode().
 ////////////////////////////////////////////////////////////////////
-INLINE EggAlphaMode::AlphaMode EggAlphaMode::
+INLINE EggRenderMode::AlphaMode EggRenderMode::
 get_alpha_mode() const {
   return _alpha_mode;
 }
 
 
 ////////////////////////////////////////////////////////////////////
-//     Function: EggAlphaMode::set_draw_order
+//     Function: EggRenderMode::set_draw_order
 //       Access: Public
 //  Description: Sets the "draw-order" flag associated with this
 //               object.  This specifies a particular order in which
@@ -72,47 +136,47 @@ get_alpha_mode() const {
 //               specified bin.  If a bin is not explicitly specified,
 //               "fixed" is used.  See also set_bin().
 ////////////////////////////////////////////////////////////////////
-INLINE void EggAlphaMode::
+INLINE void EggRenderMode::
 set_draw_order(int order) {
   _draw_order = order;
   _has_draw_order = true;
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: EggAlphaMode::get_draw_order
+//     Function: EggRenderMode::get_draw_order
 //       Access: Public
 //  Description: Returns the "draw-order" flag as set for this
 //               particular object.  See set_draw_order().
 ////////////////////////////////////////////////////////////////////
-INLINE int EggAlphaMode::
+INLINE int EggRenderMode::
 get_draw_order() const {
   return _draw_order;
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: EggAlphaMode::has_draw_order
+//     Function: EggRenderMode::has_draw_order
 //       Access: Public
 //  Description: Returns true if the draw-order flag has been set for
 //               this particular object.  See set_draw_order().
 ////////////////////////////////////////////////////////////////////
-INLINE bool EggAlphaMode::
+INLINE bool EggRenderMode::
 has_draw_order() const {
   return _has_draw_order;
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: EggAlphaMode::clear_draw_order
+//     Function: EggRenderMode::clear_draw_order
 //       Access: Public
 //  Description: Removes the draw-order flag from this particular
 //               object.  See set_draw_order().
 ////////////////////////////////////////////////////////////////////
-INLINE void EggAlphaMode::
+INLINE void EggRenderMode::
 clear_draw_order() {
   _has_draw_order = false;
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: EggAlphaMode::set_bin
+//     Function: EggRenderMode::set_bin
 //       Access: Public
 //  Description: Sets the "bin" string for this particular object.
 //               This names a particular bin in which the object
@@ -123,50 +187,50 @@ clear_draw_order() {
 //               CullTraverser) in use for this to work.  See also
 //               set_draw_order().
 ////////////////////////////////////////////////////////////////////
-INLINE void EggAlphaMode::
+INLINE void EggRenderMode::
 set_bin(const string &bin) {
   _bin = bin;
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: EggAlphaMode::get_bin
+//     Function: EggRenderMode::get_bin
 //       Access: Public
 //  Description: Returns the bin name that has been set for this
 //               particular object, if any.  See set_bin().
 ////////////////////////////////////////////////////////////////////
-INLINE string EggAlphaMode::
+INLINE string EggRenderMode::
 get_bin() const {
   return _bin;
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: EggAlphaMode::has_bin
+//     Function: EggRenderMode::has_bin
 //       Access: Public
 //  Description: Returns true if a bin name has been set for this
 //               particular object.  See set_bin().
 ////////////////////////////////////////////////////////////////////
-INLINE bool EggAlphaMode::
+INLINE bool EggRenderMode::
 has_bin() const {
   return !_bin.empty();
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: EggAlphaMode::clear_bin
+//     Function: EggRenderMode::clear_bin
 //       Access: Public
 //  Description: Removes the bin name that was set for this particular
 //               object.  See set_bin().
 ////////////////////////////////////////////////////////////////////
-INLINE void EggAlphaMode::
+INLINE void EggRenderMode::
 clear_bin() {
   _bin = string();
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: EggAlphaMode::Inequality Operator
+//     Function: EggRenderMode::Inequality Operator
 //       Access: Public
 //  Description: 
 ////////////////////////////////////////////////////////////////////
-INLINE bool EggAlphaMode::
-operator != (const EggAlphaMode &other) const {
+INLINE bool EggRenderMode::
+operator != (const EggRenderMode &other) const {
   return !(*this == other);
 }

+ 231 - 0
panda/src/egg/eggRenderMode.cxx

@@ -0,0 +1,231 @@
+// Filename: eggRenderMode.cxx
+// Created by:  drose (20Jan99)
+// 
+////////////////////////////////////////////////////////////////////
+
+#include "eggRenderMode.h"
+#include <indent.h>
+#include <string_utils.h>
+#include <notify.h>
+
+TypeHandle EggRenderMode::_type_handle;
+
+////////////////////////////////////////////////////////////////////
+//     Function: EggRenderMode::write
+//       Access: Public
+//  Description: Writes the attributes to the indicated output stream in
+//               Egg format.
+////////////////////////////////////////////////////////////////////
+void EggRenderMode::
+write(ostream &out, int indent_level) const {
+  if (get_alpha_mode() != AM_unspecified) {
+    indent(out, indent_level)
+      << "<Scalar> alpha { " << get_alpha_mode() << " }\n";
+  }
+  if (get_depth_write_mode() != DWM_unspecified) {
+    indent(out, indent_level)
+      << "<Scalar> depth_write { " << get_depth_write_mode() << " }\n";
+  }
+  if (get_depth_test_mode() != DTM_unspecified) {
+    indent(out, indent_level)
+      << "<Scalar> depth_test { " << get_depth_test_mode() << " }\n";
+  }
+  if (has_draw_order()) {
+    indent(out, indent_level)
+      << "<Scalar> draw-order { " << get_draw_order() << " }\n";
+  }
+  if (has_bin()) {
+    indent(out, indent_level)
+      << "<Scalar> bin { " << get_bin() << " }\n";
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: EggRenderMode::Equality Operator
+//       Access: Public
+//  Description: 
+////////////////////////////////////////////////////////////////////
+bool EggRenderMode::
+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 ||
+      _has_draw_order != other._has_draw_order) {
+    return false;
+  }
+
+  if (_has_draw_order) {
+    if (_draw_order != other._draw_order) {
+      return false;
+    }
+  }
+
+  if (_bin != other._bin) {
+    return false;
+  }
+
+  return true;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: EggRenderMode::Ordering Operator
+//       Access: Public
+//  Description: 
+////////////////////////////////////////////////////////////////////
+bool EggRenderMode::
+operator < (const EggRenderMode &other) const {
+  if (_alpha_mode != other._alpha_mode) {
+    return (int)_alpha_mode < (int)other._alpha_mode;
+  }
+  if (_depth_write_mode != other._depth_write_mode) {
+    return (int)_depth_write_mode < (int)other._depth_write_mode;
+  }
+  if (_depth_test_mode != other._depth_test_mode) {
+    return (int)_depth_test_mode < (int)other._depth_test_mode;
+  }
+
+  if (_has_draw_order != other._has_draw_order) {
+    return (int)_has_draw_order < (int)other._has_draw_order;
+  }
+
+  if (_has_draw_order) {
+    if (_draw_order != other._draw_order) {
+      return _draw_order < other._draw_order;
+    }
+  }
+
+  if (_bin != other._bin) {
+    return _bin < other._bin;
+  }
+
+  return false;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: EggRenderMode::string_alpha_mode
+//       Access: Public
+//  Description: Returns the AlphaMode value associated with the given
+//               string representation, or AM_unspecified if the string
+//               does not match any known AlphaMode value.
+////////////////////////////////////////////////////////////////////
+EggRenderMode::AlphaMode EggRenderMode::
+string_alpha_mode(const string &string) {
+  if (cmp_nocase_uh(string, "off") == 0) {
+    return AM_off;
+  } else if (cmp_nocase_uh(string, "on") == 0) {
+    return AM_on;
+  } else if (cmp_nocase_uh(string, "blend") == 0) {
+    return AM_blend;
+  } else if (cmp_nocase_uh(string, "blend_no_occlude") == 0) {
+    return AM_blend_no_occlude;
+  } else if (cmp_nocase_uh(string, "ms") == 0) {
+    return AM_ms;
+  } else if (cmp_nocase_uh(string, "ms_mask") == 0) {
+    return AM_ms_mask;
+  } else {
+    return AM_unspecified;
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: EggRenderMode::string_depth_write_mode
+//       Access: Public
+//  Description: Returns the DepthWriteMode value associated with the
+//               given string representation, or DWM_unspecified if
+//               the string does not match any known DepthWriteMode
+//               value.
+////////////////////////////////////////////////////////////////////
+EggRenderMode::DepthWriteMode EggRenderMode::
+string_depth_write_mode(const string &string) {
+  if (cmp_nocase_uh(string, "off") == 0) {
+    return DWM_off;
+  } else if (cmp_nocase_uh(string, "on") == 0) {
+    return DWM_on;
+  } else {
+    return DWM_unspecified;
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: EggRenderMode::string_depth_test_mode
+//       Access: Public
+//  Description: Returns the DepthTestMode value associated with the
+//               given string representation, or DWM_unspecified if
+//               the string does not match any known DepthTestMode
+//               value.
+////////////////////////////////////////////////////////////////////
+EggRenderMode::DepthTestMode EggRenderMode::
+string_depth_test_mode(const string &string) {
+  if (cmp_nocase_uh(string, "off") == 0) {
+    return DTM_off;
+  } else if (cmp_nocase_uh(string, "on") == 0) {
+    return DTM_on;
+  } else {
+    return DTM_unspecified;
+  }
+}
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: AlphaMode output operator
+//  Description: 
+////////////////////////////////////////////////////////////////////
+ostream &operator << (ostream &out, EggRenderMode::AlphaMode mode) {
+  switch (mode) {
+  case EggRenderMode::AM_unspecified:
+    return out << "unspecified";
+  case EggRenderMode::AM_off:
+    return out << "off";
+  case EggRenderMode::AM_on:
+    return out << "on";
+  case EggRenderMode::AM_blend:
+    return out << "blend";
+  case EggRenderMode::AM_blend_no_occlude:
+    return out << "blend_no_occlude";
+  case EggRenderMode::AM_ms:
+    return out << "ms";
+  case EggRenderMode::AM_ms_mask:
+    return out << "ms_mask";
+  }
+
+  nassertr(false, out);
+  return out << "(**invalid**)";
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: DepthWriteMode output operator
+//  Description: 
+////////////////////////////////////////////////////////////////////
+ostream &operator << (ostream &out, EggRenderMode::DepthWriteMode mode) {
+  switch (mode) {
+  case EggRenderMode::DWM_unspecified:
+    return out << "unspecified";
+  case EggRenderMode::DWM_off:
+    return out << "off";
+  case EggRenderMode::DWM_on:
+    return out << "on";
+  }
+
+  nassertr(false, out);
+  return out << "(**invalid**)";
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: DepthTestMode output operator
+//  Description: 
+////////////////////////////////////////////////////////////////////
+ostream &operator << (ostream &out, EggRenderMode::DepthTestMode mode) {
+  switch (mode) {
+  case EggRenderMode::DTM_unspecified:
+    return out << "unspecified";
+  case EggRenderMode::DTM_off:
+    return out << "off";
+  case EggRenderMode::DTM_on:
+    return out << "on";
+  }
+
+  nassertr(false, out);
+  return out << "(**invalid**)";
+}
+
+    

+ 107 - 0
panda/src/egg/eggRenderMode.h

@@ -0,0 +1,107 @@
+// Filename: eggRenderMode.h
+// Created by:  drose (20Jan99)
+//
+////////////////////////////////////////////////////////////////////
+
+#ifndef EGGRENDERMODE_H
+#define EGGRENDERMODE_H
+
+#include <pandabase.h>
+
+#include <typeHandle.h>
+
+#include <string>
+
+
+////////////////////////////////////////////////////////////////////
+// 	 Class : EggRenderMode
+// Description : 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.  It's intended
+//               to be a base class for egg objects that can have
+//               these properties set.
+//
+//               This class cannot inherit from EggObject, because it
+//               causes problems at the EggPolygon level with multiple
+//               appearances of the EggObject base class.  And making
+//               EggObject a virtual base class is just no fun.
+////////////////////////////////////////////////////////////////////
+class EXPCL_PANDAEGG EggRenderMode {
+public:
+  INLINE EggRenderMode();
+  INLINE EggRenderMode(const EggRenderMode &copy);
+  INLINE EggRenderMode &operator = (const EggRenderMode &copy);
+
+  void write(ostream &out, int indent_level) const;
+
+  enum AlphaMode {
+    AM_unspecified, AM_off, AM_on,
+    AM_blend, AM_blend_no_occlude, AM_ms, AM_ms_mask
+  };
+
+  enum DepthWriteMode {
+    DWM_unspecified, DWM_off, DWM_on
+  };
+
+  enum DepthTestMode {
+    DTM_unspecified, DTM_off, DTM_on
+  };
+
+  INLINE void set_alpha_mode(AlphaMode mode);
+  INLINE AlphaMode get_alpha_mode() const;
+
+  INLINE void set_depth_write_mode(DepthWriteMode mode);
+  INLINE DepthWriteMode get_depth_write_mode() const;
+
+  INLINE void set_depth_test_mode(DepthTestMode mode);
+  INLINE DepthTestMode get_depth_test_mode() const;
+
+  INLINE void set_draw_order(int order);
+  INLINE int get_draw_order() const;
+  INLINE bool has_draw_order() const;
+  INLINE void clear_draw_order();
+
+  INLINE void set_bin(const string &bin);
+  INLINE string get_bin() const;
+  INLINE bool has_bin() const;
+  INLINE void clear_bin();
+
+  // Comparison operators are handy.
+  bool operator == (const EggRenderMode &other) const;
+  INLINE bool operator != (const EggRenderMode &other) const;
+  bool operator < (const EggRenderMode &other) const;
+
+  static AlphaMode string_alpha_mode(const string &string);
+  static DepthWriteMode string_depth_write_mode(const string &string);
+  static DepthTestMode string_depth_test_mode(const string &string);
+
+private:
+  AlphaMode _alpha_mode;
+  DepthWriteMode _depth_write_mode;
+  DepthTestMode _depth_test_mode;
+  int _draw_order;
+  bool _has_draw_order;
+  string _bin;
+
+
+public:
+  static TypeHandle get_class_type() {
+    return _type_handle;
+  }
+  static void init_type() {
+    register_type(_type_handle, "EggRenderMode");
+  }
+
+private:
+  static TypeHandle _type_handle;
+};
+
+ostream &operator << (ostream &out, EggRenderMode::AlphaMode mode);
+ostream &operator << (ostream &out, EggRenderMode::DepthWriteMode mode);
+ostream &operator << (ostream &out, EggRenderMode::DepthTestMode mode);
+
+#include "eggRenderMode.I"
+
+#endif
+

+ 5 - 5
panda/src/egg/eggTexture.cxx

@@ -53,7 +53,7 @@ EggTexture(const EggTexture &copy) {
 EggTexture &EggTexture::
 operator = (const EggTexture &copy) {
   EggFilenameNode::operator = (copy);
-  EggAlphaMode::operator = (copy);
+  EggRenderMode::operator = (copy);
   
   _format = copy._format;
   _wrap_mode = copy._wrap_mode;
@@ -139,7 +139,7 @@ write(ostream &out, int indent_level) const {
     out << " }\n";
   }
 
-  EggAlphaMode::write(out, indent_level + 2);
+  EggRenderMode::write(out, indent_level + 2);
 
   if (has_transform()) {
     write_transform(out, _transform, indent_level + 2);
@@ -234,7 +234,7 @@ is_equivalent_to(const EggTexture &other, int eq) const {
     _env_type != other._env_type) {
       return false;
     }
-    if (EggAlphaMode::operator != (other)) {
+    if (EggRenderMode::operator != (other)) {
       return false;
     }
   }
@@ -328,8 +328,8 @@ sorts_less_than(const EggTexture &other, int eq) const {
       return (int)_env_type < (int)other._env_type;
     }
 
-    if (EggAlphaMode::operator != (other)) {
-      return EggAlphaMode::operator < (other);
+    if (EggRenderMode::operator != (other)) {
+      return EggRenderMode::operator < (other);
     }
   }
 

+ 4 - 4
panda/src/egg/eggTexture.h

@@ -8,7 +8,7 @@
 
 #include <pandabase.h>
 
-#include "eggAlphaMode.h"
+#include "eggRenderMode.h"
 #include "eggFilenameNode.h"
 
 #include <luse.h>
@@ -19,7 +19,7 @@
 // Description : Defines a texture map that may be applied to
 //               geometry.
 ////////////////////////////////////////////////////////////////////
-class EXPCL_PANDAEGG EggTexture : public EggFilenameNode, public EggAlphaMode {
+class EXPCL_PANDAEGG EggTexture : public EggFilenameNode, public EggRenderMode {
 public:
   EggTexture(const string &tref_name, const string &filename);
   EggTexture(const EggTexture &copy);
@@ -147,10 +147,10 @@ public:
   }
   static void init_type() {
     EggFilenameNode::init_type();
-    EggAlphaMode::init_type();
+    EggRenderMode::init_type();
     register_type(_type_handle, "EggTexture",
                   EggFilenameNode::get_class_type(),
-          EggAlphaMode::get_class_type());
+          EggRenderMode::get_class_type());
   }
   virtual TypeHandle get_type() const {
     return get_class_type();

+ 96 - 10
panda/src/egg/parser.yxx

@@ -376,13 +376,31 @@ texture_body:
     }
 
   } else if (cmp_nocase_uh(name, "alpha") == 0) {
-    EggAlphaMode::AlphaMode a = EggAlphaMode::string_alpha_mode(strval);
-    if (a == EggAlphaMode::AM_unspecified) {
+    EggRenderMode::AlphaMode a = EggRenderMode::string_alpha_mode(strval);
+    if (a == EggRenderMode::AM_unspecified) {
       eggyywarning("Unknown alpha mode " + strval);
     } else {
       texture->set_alpha_mode(a);
     }
 
+  } else if (cmp_nocase_uh(name, "depth_write") == 0) {
+    EggRenderMode::DepthWriteMode m = 
+      EggRenderMode::string_depth_write_mode(strval);
+    if (m == EggRenderMode::DWM_unspecified) {
+      eggyywarning("Unknown depth-write mode " + strval);
+    } else {
+      texture->set_depth_write_mode(m);
+    }
+
+  } else if (cmp_nocase_uh(name, "depth_test") == 0) {
+    EggRenderMode::DepthTestMode m = 
+      EggRenderMode::string_depth_test_mode(strval);
+    if (m == EggRenderMode::DTM_unspecified) {
+      eggyywarning("Unknown depth-test mode " + strval);
+    } else {
+      texture->set_depth_test_mode(m);
+    }
+
   } else if (cmp_nocase_uh(name, "draw_order") == 0) {
     texture->set_draw_order((int)value);
 
@@ -807,12 +825,29 @@ group_body:
   } else if (cmp_nocase_uh(name, "direct") == 0) {
     group->set_direct_flag(value != 0);
   } else if (cmp_nocase_uh(name, "alpha") == 0) {
-    EggAlphaMode::AlphaMode a = EggAlphaMode::string_alpha_mode(strval);
-    if (a == EggAlphaMode::AM_unspecified) {
+    EggRenderMode::AlphaMode a = EggRenderMode::string_alpha_mode(strval);
+    if (a == EggRenderMode::AM_unspecified) {
       eggyywarning("Unknown alpha mode " + strval);
     } else {
       group->set_alpha_mode(a);
     }
+  } else if (cmp_nocase_uh(name, "depth_write") == 0) {
+    EggRenderMode::DepthWriteMode m = 
+      EggRenderMode::string_depth_write_mode(strval);
+    if (m == EggRenderMode::DWM_unspecified) {
+      eggyywarning("Unknown depth-write mode " + strval);
+    } else {
+      group->set_depth_write_mode(m);
+    }
+
+  } else if (cmp_nocase_uh(name, "depth_test") == 0) {
+    EggRenderMode::DepthTestMode m = 
+      EggRenderMode::string_depth_test_mode(strval);
+    if (m == EggRenderMode::DTM_unspecified) {
+      eggyywarning("Unknown depth-test mode " + strval);
+    } else {
+      group->set_depth_test_mode(m);
+    }
   } else if (cmp_nocase_uh(name, "draw_order") == 0) {
     group->set_draw_order((int)value);
   } else if (cmp_nocase_uh(name, "bin") == 0) {
@@ -1323,12 +1358,29 @@ primitive_body:
   string strval = $<_string>5;
   
   if (cmp_nocase_uh(name, "alpha") == 0) {
-    EggAlphaMode::AlphaMode a = EggAlphaMode::string_alpha_mode(strval);
-    if (a == EggAlphaMode::AM_unspecified) {
+    EggRenderMode::AlphaMode a = EggRenderMode::string_alpha_mode(strval);
+    if (a == EggRenderMode::AM_unspecified) {
       eggyywarning("Unknown alpha mode " + strval);
     } else {
       primitive->set_alpha_mode(a);
     }
+  } else if (cmp_nocase_uh(name, "depth_write") == 0) {
+    EggRenderMode::DepthWriteMode m = 
+      EggRenderMode::string_depth_write_mode(strval);
+    if (m == EggRenderMode::DWM_unspecified) {
+      eggyywarning("Unknown depth-write mode " + strval);
+    } else {
+      primitive->set_depth_write_mode(m);
+    }
+
+  } else if (cmp_nocase_uh(name, "depth_test") == 0) {
+    EggRenderMode::DepthTestMode m = 
+      EggRenderMode::string_depth_test_mode(strval);
+    if (m == EggRenderMode::DTM_unspecified) {
+      eggyywarning("Unknown depth-test mode " + strval);
+    } else {
+      primitive->set_depth_test_mode(m);
+    }
   } else if (cmp_nocase_uh(name, "draw_order") == 0) {
     primitive->set_draw_order((int)value);
   } else if (cmp_nocase_uh(name, "bin") == 0) {
@@ -1373,12 +1425,29 @@ nurbs_surface_body:
   string strval = $<_string>5;
   
   if (cmp_nocase_uh(name, "alpha") == 0) {
-    EggAlphaMode::AlphaMode a = EggAlphaMode::string_alpha_mode(strval);
-    if (a == EggAlphaMode::AM_unspecified) {
+    EggRenderMode::AlphaMode a = EggRenderMode::string_alpha_mode(strval);
+    if (a == EggRenderMode::AM_unspecified) {
       eggyywarning("Unknown alpha mode " + strval);
     } else {
       primitive->set_alpha_mode(a);
     }
+  } else if (cmp_nocase_uh(name, "depth_write") == 0) {
+    EggRenderMode::DepthWriteMode m = 
+      EggRenderMode::string_depth_write_mode(strval);
+    if (m == EggRenderMode::DWM_unspecified) {
+      eggyywarning("Unknown depth-write mode " + strval);
+    } else {
+      primitive->set_depth_write_mode(m);
+    }
+
+  } else if (cmp_nocase_uh(name, "depth_test") == 0) {
+    EggRenderMode::DepthTestMode m = 
+      EggRenderMode::string_depth_test_mode(strval);
+    if (m == EggRenderMode::DTM_unspecified) {
+      eggyywarning("Unknown depth-test mode " + strval);
+    } else {
+      primitive->set_depth_test_mode(m);
+    }
   } else if (cmp_nocase_uh(name, "draw_order") == 0) {
     primitive->set_draw_order((int)value);
   } else if (cmp_nocase_uh(name, "bin") == 0) {
@@ -1420,12 +1489,29 @@ nurbs_curve_body:
   string strval = $<_string>5;
   
   if (cmp_nocase_uh(name, "alpha") == 0) {
-    EggAlphaMode::AlphaMode a = EggAlphaMode::string_alpha_mode(strval);
-    if (a == EggAlphaMode::AM_unspecified) {
+    EggRenderMode::AlphaMode a = EggRenderMode::string_alpha_mode(strval);
+    if (a == EggRenderMode::AM_unspecified) {
       eggyywarning("Unknown alpha mode " + strval);
     } else {
       primitive->set_alpha_mode(a);
     }
+  } else if (cmp_nocase_uh(name, "depth_write") == 0) {
+    EggRenderMode::DepthWriteMode m = 
+      EggRenderMode::string_depth_write_mode(strval);
+    if (m == EggRenderMode::DWM_unspecified) {
+      eggyywarning("Unknown depth-write mode " + strval);
+    } else {
+      primitive->set_depth_write_mode(m);
+    }
+
+  } else if (cmp_nocase_uh(name, "depth_test") == 0) {
+    EggRenderMode::DepthTestMode m = 
+      EggRenderMode::string_depth_test_mode(strval);
+    if (m == EggRenderMode::DTM_unspecified) {
+      eggyywarning("Unknown depth-test mode " + strval);
+    } else {
+      primitive->set_depth_test_mode(m);
+    }
   } else if (cmp_nocase_uh(name, "draw_order") == 0) {
     primitive->set_draw_order((int)value);
   } else if (cmp_nocase_uh(name, "bin") == 0) {

+ 61 - 25
panda/src/egg2sg/eggLoader.cxx

@@ -41,6 +41,7 @@
 #include <directRenderTransition.h>
 #include <pruneTransition.h>
 #include <depthWriteTransition.h>
+#include <depthTestTransition.h>
 #include <animBundleNode.h>
 #include <character.h>
 #include <notify.h>
@@ -898,33 +899,42 @@ setup_bucket(BuilderBucket &bucket, NamedNode *parent,
 
   // Assign the appropriate properties to the bucket.
 
-  // The three "alpha mode"-associated properties--alpha mode, draw
-  // order, and bin--can be defined directly at the primitive, at a
-  // group above the primitive, or an a texture applied to the
-  // primitive.  The EggNode::determine_*() functions can find the
-  // right pointer to the level at which this is actually defined for
-  // a given primitive.
-  EggAlphaMode::AlphaMode am = EggAlphaMode::AM_unspecified;
+  // The various EggRenderMode properties can be defined directly at
+  // the primitive, at a group above the primitive, or an a texture
+  // applied to the primitive.  The EggNode::determine_*() functions
+  // can find the right pointer to the level at which this is actually
+  // defined for a given primitive.
+  EggRenderMode::AlphaMode am = EggRenderMode::AM_unspecified;
+  EggRenderMode::DepthWriteMode dwm = EggRenderMode::DWM_unspecified;
+  EggRenderMode::DepthTestMode dtm = EggRenderMode::DTM_unspecified;
   bool implicit_alpha = false;
   bool has_draw_order = false;
   int draw_order = 0;
   bool has_bin = false;
   string bin;
 
-  EggAlphaMode *egg_alpha;
-  egg_alpha = egg_prim->determine_alpha_mode();
-  if (egg_alpha != (EggAlphaMode *)NULL) {
-    am = egg_alpha->get_alpha_mode();
+  EggRenderMode *render_mode;
+  render_mode = egg_prim->determine_alpha_mode();
+  if (render_mode != (EggRenderMode *)NULL) {
+    am = render_mode->get_alpha_mode();
   }
-  egg_alpha = egg_prim->determine_draw_order();
-  if (egg_alpha != (EggAlphaMode *)NULL) {
+  render_mode = egg_prim->determine_depth_write_mode();
+  if (render_mode != (EggRenderMode *)NULL) {
+    dwm = render_mode->get_depth_write_mode();
+  }
+  render_mode = egg_prim->determine_depth_test_mode();
+  if (render_mode != (EggRenderMode *)NULL) {
+    dtm = render_mode->get_depth_test_mode();
+  }
+  render_mode = egg_prim->determine_draw_order();
+  if (render_mode != (EggRenderMode *)NULL) {
     has_draw_order = true;
-    draw_order = egg_alpha->get_draw_order();
+    draw_order = render_mode->get_draw_order();
   }
-  egg_alpha = egg_prim->determine_bin();
-  if (egg_alpha != (EggAlphaMode *)NULL) {
+  render_mode = egg_prim->determine_bin();
+  if (render_mode != (EggRenderMode *)NULL) {
     has_bin = true;
-    bin = egg_alpha->get_bin();
+    bin = render_mode->get_bin();
   }
 
   bucket._trans.set_transition(new TextureTransition(TextureTransition::off()));
@@ -939,7 +949,7 @@ setup_bucket(BuilderBucket &bucket, NamedNode *parent,
       // If neither the primitive nor the texture specified an alpha
       // mode, assume it should be alpha'ed if the texture has an
       // alpha channel.
-      if (am == EggAlphaMode::AM_unspecified) {
+      if (am == EggRenderMode::AM_unspecified) {
 	Texture *tex = def._texture->get_texture();
 	nassertv(tex != (Texture *)NULL);
 	int num_components = tex->_pbuffer->get_num_components();
@@ -952,7 +962,7 @@ setup_bucket(BuilderBucket &bucket, NamedNode *parent,
 
   // Also check the color of the primitive to see if we should assume
   // alpha based on the alpha values specified in the egg file.
-  if (am == EggAlphaMode::AM_unspecified) {
+  if (am == EggRenderMode::AM_unspecified) {
     if (egg_prim->has_color()) {
       if (egg_prim->get_color()[3] != 1.0) {
 	implicit_alpha = true;
@@ -970,26 +980,26 @@ setup_bucket(BuilderBucket &bucket, NamedNode *parent,
     }
     
     if (implicit_alpha) {
-      am = EggAlphaMode::AM_on;
+      am = EggRenderMode::AM_on;
     }
   }
 
   switch (am) {
-  case EggAlphaMode::AM_on:
-  case EggAlphaMode::AM_blend:
+  case EggRenderMode::AM_on:
+  case EggRenderMode::AM_blend:
     bucket._trans.set_transition(new TransparencyTransition(TransparencyProperty::M_alpha));
     break;
 
-  case EggAlphaMode::AM_blend_no_occlude:
+  case EggRenderMode::AM_blend_no_occlude:
     bucket._trans.set_transition(new TransparencyTransition(TransparencyProperty::M_alpha));
     bucket._trans.set_transition(new DepthWriteTransition(DepthWriteTransition::off()));
     break;
 
-  case EggAlphaMode::AM_ms:
+  case EggRenderMode::AM_ms:
     bucket._trans.set_transition(new TransparencyTransition(TransparencyProperty::M_multisample));
     break;
 
-  case EggAlphaMode::AM_ms_mask:
+  case EggRenderMode::AM_ms_mask:
     bucket._trans.set_transition(new TransparencyTransition(TransparencyProperty::M_multisample_mask));
     break;
 
@@ -998,6 +1008,32 @@ setup_bucket(BuilderBucket &bucket, NamedNode *parent,
     break;
   }
 
+  switch (dwm) {
+  case EggRenderMode::DWM_on:
+    bucket._trans.set_transition(new DepthWriteTransition);
+    break;
+
+  case EggRenderMode::DWM_off:
+    bucket._trans.set_transition(new DepthWriteTransition(DepthWriteTransition::off()));
+    break;
+
+  default:
+    break;
+  }
+
+  switch (dtm) {
+  case EggRenderMode::DTM_on:
+    bucket._trans.set_transition(new DepthTestTransition(DepthTestProperty::M_less));
+    break;
+
+  case EggRenderMode::DTM_off:
+    bucket._trans.set_transition(new DepthTestTransition(DepthTestProperty::M_none));
+    break;
+
+  default:
+    break;
+  }
+
   if (has_bin) {
     bucket._trans.set_transition(new GeomBinTransition(bin, draw_order));
 

+ 13 - 5
panda/src/graph/nodeAttributes.cxx

@@ -204,13 +204,21 @@ compare_to(const NodeAttributes &other) const {
 ////////////////////////////////////////////////////////////////////
 void NodeAttributes::
 apply_from(const NodeAttributes &other, const NodeTransitionCache &trans) {
-  Attributes temp;
+  if (&other == this && trans._cache.empty()) {
+    // In this case, we don't need to do anything--we're not updating
+    // the attributes at all.
 
-  tmap_apply(other._attributes.begin(), other._attributes.end(),
-	     trans._cache.begin(), trans._cache.end(),
-	     inserter(temp, temp.begin()));
+  } else {
+    // Otherwise, even if the cache is empty, we do need to at least
+    // copy the other attributes, so we go ahead and do this work.
+    Attributes temp;
 
-  _attributes.swap(temp);
+    tmap_apply(other._attributes.begin(), other._attributes.end(),
+	       trans._cache.begin(), trans._cache.end(),
+	       inserter(temp, temp.begin()));
+    
+    _attributes.swap(temp);
+  }
 }
 
 

+ 3 - 1
panda/src/graph/nodeTransitions.cxx

@@ -272,7 +272,9 @@ write(ostream &out, int indent_level) const {
   Transitions::const_iterator ti;
   for (ti = _transitions.begin(); ti != _transitions.end(); ++ti) {
     if ((*ti).second != (NodeTransition *)NULL) {
-      (*ti).second->write(out, indent_level);
+      indent(out, indent_level)
+	<< (*ti).first << " = " << *(*ti).second << "\n";
+      //      (*ti).second->write(out, indent_level + 2);
     }
   }
 }

+ 1 - 0
panda/src/sgattrib/config_sgattrib.cxx

@@ -190,6 +190,7 @@ ConfigureFn(config_sgattrib) {
   ColorMatrixTransition::register_with_read_factory();
   CullFaceTransition::register_with_read_factory();
   DecalTransition::register_with_read_factory();
+  DepthTestTransition::register_with_read_factory();
   DepthWriteTransition::register_with_read_factory();
   PruneTransition::register_with_read_factory();
   RenderRelation::register_with_read_factory();

+ 0 - 14
panda/src/sgattrib/cullFaceProperty.I

@@ -14,20 +14,6 @@ CullFaceProperty(Mode mode) :
 {
 }
 
-////////////////////////////////////////////////////////////////////
-//     Function: CullFaceProperty::Constructor
-//       Access: Public
-//  Description: This should only be called in the Protected 
-//               constructor of CullFaceTransition.  It is made 
-//               public, only for that to access, and is necessary
-//               for creating an object in make_CullFaceTransition
-//               before any information has been read
-////////////////////////////////////////////////////////////////////
-INLINE CullFaceProperty::
-CullFaceProperty(void)
-{
-}
-
 ////////////////////////////////////////////////////////////////////
 //     Function: CullFaceProperty::set_mode
 //       Access: Public

+ 1 - 2
panda/src/sgattrib/cullFaceProperty.h

@@ -27,8 +27,7 @@ public:
   };
 
 public:
-  INLINE CullFaceProperty(Mode mode);
-  INLINE CullFaceProperty(void);
+  INLINE CullFaceProperty(Mode mode = M_cull_none);
 
   INLINE void set_mode(Mode mode);
   INLINE Mode get_mode() const;

+ 10 - 10
panda/src/sgattrib/cullFaceTransition.I

@@ -14,16 +14,6 @@ CullFaceTransition(CullFaceProperty::Mode mode) :
 {
 }
 
-////////////////////////////////////////////////////////////////////
-//     Function: CullFaceTransition::Constructor
-//       Access: Public
-//  Description: 
-////////////////////////////////////////////////////////////////////
-INLINE CullFaceTransition::
-CullFaceTransition(void)
-{
-}
-
 ////////////////////////////////////////////////////////////////////
 //     Function: CullFaceTransition::set_mode
 //       Access: Public
@@ -44,3 +34,13 @@ INLINE CullFaceProperty::Mode CullFaceTransition::
 get_mode() const {
   return _value.get_mode();
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: CullFaceTransition::Default Constructor
+//       Access: Protected
+//  Description: This constructor is only for the benefit of the Bam
+//               reader.
+////////////////////////////////////////////////////////////////////
+INLINE CullFaceTransition::
+CullFaceTransition() {
+}

+ 24 - 0
panda/src/sgattrib/depthTestProperty.cxx

@@ -4,6 +4,8 @@
 ////////////////////////////////////////////////////////////////////
 
 #include "depthTestProperty.h"
+#include <datagram.h>
+#include <datagramIterator.h>
 
 ostream &
 operator << (ostream &out, DepthTestProperty::Mode mode) {
@@ -39,6 +41,28 @@ operator << (ostream &out, DepthTestProperty::Mode mode) {
   return out << "**invalid**(" << (int)mode << ")";
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: DepthTestProperty::write_datagram
+//       Access: Public
+//  Description: Function to write the important information in
+//               this object to a Datagram
+////////////////////////////////////////////////////////////////////
+void DepthTestProperty::
+write_datagram(Datagram &destination) {
+  destination.add_uint8(_mode);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: DepthTestProperty::read_datagram
+//       Access: Public
+//  Description: Function to write the important information into
+//               this object out of a Datagram
+////////////////////////////////////////////////////////////////////
+void DepthTestProperty::
+read_datagram(DatagramIterator &source) {
+  _mode = (Mode)source.get_uint8();
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: DepthTestProperty::output
 //       Access: Public

+ 9 - 2
panda/src/sgattrib/depthTestProperty.h

@@ -8,13 +8,16 @@
 
 #include <pandabase.h>
 
+class Datagram;
+class DatagramIterator;
+
 ////////////////////////////////////////////////////////////////////
 // 	 Class : DepthTestProperty
 // Description : This defines the types of depth testing we can
 //               enable.
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDA DepthTestProperty {
-public:
+PUBLISHED:
   enum Mode {
     M_none,             // No depth test; may still write to depth buffer.
     M_never,            // Never draw.
@@ -28,7 +31,7 @@ public:
   };
 
 public:
-  INLINE DepthTestProperty(Mode mode);
+  INLINE DepthTestProperty(Mode mode = M_none);
 
   INLINE void set_mode(Mode mode);
   INLINE Mode get_mode() const;
@@ -37,6 +40,10 @@ public:
 
   void output(ostream &out) const;
 
+public:
+  void write_datagram(Datagram &destination);
+  void read_datagram(DatagramIterator &source);
+
 private:
   Mode _mode;
 };

+ 10 - 0
panda/src/sgattrib/depthTestTransition.I

@@ -34,3 +34,13 @@ INLINE DepthTestProperty::Mode DepthTestTransition::
 get_mode() const {
   return _value.get_mode();
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: DepthTestTransition::Default Constructor
+//       Access: Protected
+//  Description: This constructor is only for the benefit of the Bam
+//               reader.
+////////////////////////////////////////////////////////////////////
+INLINE DepthTestTransition::
+DepthTestTransition() {
+}

+ 58 - 0
panda/src/sgattrib/depthTestTransition.cxx

@@ -6,6 +6,10 @@
 #include "depthTestTransition.h"
 #include "depthTestAttribute.h"
 
+#include <datagram.h>
+#include <datagramIterator.h>
+#include <bamReader.h>
+#include <bamWriter.h>
 #include <indent.h>
 
 TypeHandle DepthTestTransition::_type_handle;
@@ -76,3 +80,57 @@ void DepthTestTransition::
 write_value(ostream &out, int indent_level) const {
   indent(out, indent_level) << _value << "\n";
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: DepthTestTransition::register_with_factory
+//       Access: Public, Static
+//  Description: Factory method to generate a DepthTestTransition object
+////////////////////////////////////////////////////////////////////
+void DepthTestTransition::
+register_with_read_factory() {
+  BamReader::get_factory()->register_factory(get_class_type(), make_DepthTestTransition);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: DepthTestTransition::write_datagram
+//       Access: Public
+//  Description: Function to write the important information in
+//               the particular object to a Datagram
+////////////////////////////////////////////////////////////////////
+void DepthTestTransition::
+write_datagram(BamWriter *manager, Datagram &me) {
+  OnTransition::write_datagram(manager, me);
+  _value.write_datagram(me);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: DepthTestTransition::make_DepthTestTransition
+//       Access: Protected
+//  Description: Factory method to generate a DepthTestTransition object
+////////////////////////////////////////////////////////////////////
+TypedWriteable* DepthTestTransition::
+make_DepthTestTransition(const FactoryParams &params) {
+  DepthTestTransition *me = new DepthTestTransition;
+  BamReader *manager;
+  Datagram packet;
+
+  parse_params(params, manager, packet);
+  DatagramIterator scan(packet);
+
+  me->fillin(scan, manager);
+  return me;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: DepthTestTransition::fillin
+//       Access: Protected
+//  Description: Function that reads out of the datagram (or asks
+//               manager to read) all of the data that is needed to
+//               re-create this object and stores it in the appropiate
+//               place
+////////////////////////////////////////////////////////////////////
+void DepthTestTransition::
+fillin(DatagramIterator& scan, BamReader* manager) {
+  OnTransition::fillin(scan, manager);
+  _value.read_datagram(scan);
+}

+ 13 - 2
panda/src/sgattrib/depthTestTransition.h

@@ -21,16 +21,18 @@
 //               DepthWriteTransition.
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDA DepthTestTransition : public OnTransition {
-public:
+PUBLISHED:
   INLINE DepthTestTransition(DepthTestProperty::Mode mode);
 
   INLINE void set_mode(DepthTestProperty::Mode mode);
   INLINE DepthTestProperty::Mode get_mode() const;
-  
+
+public:  
   virtual NodeTransition *make_copy() const;
   virtual NodeAttribute *make_attrib() const;
 
 protected:
+  INLINE DepthTestTransition();
   virtual void set_value_from(const OnTransition *other);
   virtual int compare_values(const OnTransition *other) const;
   virtual void output_value(ostream &out) const;
@@ -38,6 +40,15 @@ protected:
 
   DepthTestProperty _value;
 
+public:
+  static void register_with_read_factory();
+  virtual void write_datagram(BamWriter *manager, Datagram &me);  
+
+  static TypedWriteable *make_DepthTestTransition(const FactoryParams &params);
+
+protected:
+  void fillin(DatagramIterator &scan, BamReader *manager);
+
 public:
   virtual TypeHandle get_type() const {
     return get_class_type();

+ 3 - 2
panda/src/sgattrib/depthWriteTransition.h

@@ -16,10 +16,11 @@
 //               buffer.
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDA DepthWriteTransition : public OnOffTransition {
-public:
+PUBLISHED:
   INLINE DepthWriteTransition();
   INLINE static DepthWriteTransition off();
-  
+
+public:  
   virtual NodeTransition *make_copy() const;
   virtual NodeAttribute *make_attrib() const;
 

+ 3 - 3
pandatool/src/egg-palettize/textureReference.cxx

@@ -98,14 +98,14 @@ from_egg(EggFile *egg_file, EggData *data, EggTexture *egg_tex) {
   _source_texture->update_properties(_properties);
 
   _uses_alpha = false;
-  EggAlphaMode::AlphaMode alpha_mode = _egg_tex->get_alpha_mode();
-  if (alpha_mode == EggAlphaMode::AM_unspecified) {
+  EggRenderMode::AlphaMode alpha_mode = _egg_tex->get_alpha_mode();
+  if (alpha_mode == EggRenderMode::AM_unspecified) {
     if (_source_texture->get_size()) {
       _uses_alpha = 
 	_egg_tex->has_alpha_channel(_source_texture->get_num_channels());
     }
 
-  } else if (alpha_mode == EggAlphaMode::AM_off) {
+  } else if (alpha_mode == EggRenderMode::AM_off) {
     _uses_alpha = false;
     
   } else {