David Rose 25 лет назад
Родитель
Сommit
286a640ffe

+ 3 - 2
panda/src/builder/Sources.pp

@@ -14,7 +14,7 @@
     builderBucketNode.I builderBucketNode.cxx builderBucketNode.h \
     builderFuncs.I builderFuncs.h builderMisc.cxx builderMisc.h \
     builderNormalVisualizer.I builderNormalVisualizer.cxx \
-    builderNormalVisualizer.h builderPrim.cxx builderPrim.h \
+    builderNormalVisualizer.h builderPrim.I builderPrim.cxx builderPrim.h \
     builderPrimTempl.I builderPrimTempl.h builderProperties.cxx \
     builderProperties.h builderTypes.cxx builderTypes.h \
     builderVertex.I builderVertex.cxx builderVertex.h \
@@ -27,7 +27,8 @@
     builder.I builder.h builderAttrib.I builderAttrib.h \
     builderAttribTempl.I builderAttribTempl.h builderBucket.I \
     builderBucket.h builderBucketNode.I builderBucketNode.h \
-    builderNormalVisualizer.I builderNormalVisualizer.h builderPrim.h \
+    builderNormalVisualizer.I builderNormalVisualizer.h \
+    builderPrim.I builderPrim.h \
     builderPrimTempl.I builderPrimTempl.h builderProperties.h \
     builderTypes.h builderVertex.I builderVertex.h builderVertexTempl.I \
     builderVertexTempl.h config_builder.h

+ 36 - 0
panda/src/builder/builderAttribTempl.I

@@ -99,6 +99,18 @@ set_normal(const NType &n) {
   return *this;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: BuilderAttribTempl::clear_normal
+//       Access: Public
+//  Description: Removes the attribute's normal.
+////////////////////////////////////////////////////////////////////
+template <class VT, class NT, class TT, class CT>
+INLINE BuilderAttribTempl<VT, NT, TT, CT> &BuilderAttribTempl<VT, NT, TT, CT>::
+clear_normal() {
+  _flags &= ~BAF_normal;
+  return *this;
+}
+
 
 ////////////////////////////////////////////////////////////////////
 //     Function: BuilderAttribTempl::has_color
@@ -140,6 +152,18 @@ set_color(const CType &c) {
   return *this;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: BuilderAttribTempl::clear_color
+//       Access: Public
+//  Description: Removes the attribute's color.
+////////////////////////////////////////////////////////////////////
+template <class VT, class NT, class TT, class CT>
+INLINE BuilderAttribTempl<VT, NT, TT, CT> &BuilderAttribTempl<VT, NT, TT, CT>::
+clear_color() {
+  _flags &= ~BAF_color;
+  return *this;
+}
+
 
 ////////////////////////////////////////////////////////////////////
 //     Function: BuilderAttribTempl::has_pixel_size
@@ -181,6 +205,18 @@ set_pixel_size(float s) {
   return *this;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: BuilderAttribTempl::clear_pixel_size
+//       Access: Public
+//  Description: Removes the attribute's pixel_size.
+////////////////////////////////////////////////////////////////////
+template <class VT, class NT, class TT, class CT>
+INLINE BuilderAttribTempl<VT, NT, TT, CT> &BuilderAttribTempl<VT, NT, TT, CT>::
+clear_pixel_size() {
+  _flags &= ~BAF_pixel_size;
+  return *this;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: BuilderAttribTempl::operator ==
 //       Access: Public

+ 3 - 0
panda/src/builder/builderAttribTempl.h

@@ -37,14 +37,17 @@ public:
   INLINE bool has_normal() const;
   INLINE NType get_normal() const;
   INLINE BuilderAttribTempl &set_normal(const NType &n);
+  INLINE BuilderAttribTempl &clear_normal();
 
   INLINE bool has_color() const;
   INLINE CType get_color() const;
   INLINE BuilderAttribTempl &set_color(const CType &c);
+  INLINE BuilderAttribTempl &clear_color();
 
   INLINE bool has_pixel_size() const;
   INLINE float get_pixel_size() const;
   INLINE BuilderAttribTempl &set_pixel_size(float s);
+  INLINE BuilderAttribTempl &clear_pixel_size();
 
   INLINE bool operator == (const BuilderAttribTempl &other) const;
   INLINE bool operator != (const BuilderAttribTempl &other) const;

+ 2 - 1
panda/src/builder/builderBucketNode.cxx

@@ -16,7 +16,8 @@
 //               Intended to be called from Builder::add_prim().
 ////////////////////////////////////////////////////////////////////
 bool BuilderBucketNode::
-add_prim(const BuilderPrim &prim) {
+add_prim(BuilderPrim prim) {
+  prim.flatten_vertex_properties();
   bool result = expand(prim, *_bucket, inserter(_prims, _prims.begin()));
   return result;
 }

+ 1 - 1
panda/src/builder/builderBucketNode.h

@@ -33,7 +33,7 @@ public:
   INLINE BuilderBucketNode(const BuilderBucketNode &copy);
   INLINE void operator = (const BuilderBucketNode &copy);
 
-  bool add_prim(const BuilderPrim &prim);
+  bool add_prim(BuilderPrim prim);
   bool add_prim(const BuilderPrimI &prim);
   INLINE bool add_prim_nonindexed(const BuilderPrimI &prim);
 

+ 1 - 1
panda/src/builder/builderNormalVisualizer.I

@@ -6,6 +6,6 @@
 INLINE BuilderNormalVisualizer::
 BuilderNormalVisualizer(BuilderBucket &bucket) : _bucket(bucket) {
   _num_vertices = 0;
-  _net_vertex._v.set(0.0, 0.0, 0.0);
+  _net_vertex.set(0.0, 0.0, 0.0);
 }
 

+ 6 - 6
panda/src/builder/builderNormalVisualizer.cxx

@@ -3,22 +3,22 @@
 // 
 ////////////////////////////////////////////////////////////////////
 
-#ifdef SUPPORT_SHOW_NORMALS
-
 #include "builderNormalVisualizer.h"
 #include "builderFuncs.h"
 
+#ifdef SUPPORT_SHOW_NORMALS
+
 void BuilderNormalVisualizer::
 add_prim(const BuilderPrim &prim) {
   if (prim.has_overall_normal()) {
     // Average up all the vertex values to get the primitive center.
     BuilderV net_vertex;
-    net_vertex._v.set(0.0, 0.0, 0.0);
+    net_vertex.set(0.0, 0.0, 0.0);
     int num_verts = prim.get_num_verts();
     for (int i = 0; i < num_verts; i++) {
-      net_vertex._v += prim.get_vertex(i).get_coord();
+      net_vertex += prim.get_vertex(i).get_coord();
     }
-    net_vertex._v /= num_verts;
+    net_vertex /= num_verts;
     add_normal(net_vertex, prim.get_normal());
 
   } else if (prim.has_vertex_normal()) {
@@ -50,7 +50,7 @@ show_normals(GeomNode *node) {
 
 void BuilderNormalVisualizer::
 add_normal(const BuilderV &center, const BuilderN &normal) {
-  BuilderV to = center._v + normal._v * _bucket._normal_scale;
+  BuilderV to = center + normal * _bucket._normal_scale;
     
   BuilderPrim line;
   line.set_type(BPT_line);

+ 4 - 2
panda/src/builder/builderNormalVisualizer.h

@@ -6,10 +6,12 @@
 #ifndef BUILDERNORMALVISUALIZER_H
 #define BUILDERNORMALVISUALIZER_H
 
-#ifdef SUPPORT_SHOW_NORMALS
-
 #include <pandabase.h>
 
+#include "mesherConfig.h"
+
+#ifdef SUPPORT_SHOW_NORMALS
+
 #include "builderBucket.h"
 #include "builderAttrib.h"
 #include "builderVertex.h"

+ 65 - 0
panda/src/builder/builderPrim.I

@@ -0,0 +1,65 @@
+// Filename: builderPrim.I
+// Created by:  drose (11Jan01)
+// 
+////////////////////////////////////////////////////////////////////
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: BuilderPrim::Constructor
+//       Access: Public
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE BuilderPrim::
+BuilderPrim() {
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: BuilderPrim::Copy Constructor
+//       Access: Public
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE BuilderPrim::
+BuilderPrim(const BuilderPrim &copy) :
+  BuilderPrimTempl<BuilderVertex>(copy) {
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: BuilderPrim::Copy Assignment
+//       Access: Public
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE BuilderPrim &BuilderPrim::
+operator = (const BuilderPrim &copy) {
+  BuilderPrimTempl<BuilderVertex>::operator = (copy);  
+  return *this;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: BuilderPrimI::Constructor
+//       Access: Public
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE BuilderPrimI::
+BuilderPrimI() {
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: BuilderPrimI::Copy Constructor
+//       Access: Public
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE BuilderPrimI::
+BuilderPrimI(const BuilderPrimI &copy) :
+  BuilderPrimTempl<BuilderVertexI>(copy) {
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: BuilderPrimI::Copy Assignment
+//       Access: Public
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE BuilderPrimI &BuilderPrimI::
+operator = (const BuilderPrimI &copy) {
+  BuilderPrimTempl<BuilderVertexI>::operator = (copy);  
+  return *this;
+}

+ 56 - 0
panda/src/builder/builderPrim.cxx

@@ -70,6 +70,47 @@ nonindexed_copy(const BuilderPrimTempl<BuilderVertexI> &copy,
 
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: BuilderPrim::flatten_vertex_properties
+//       Access: Public
+//  Description: If all the vertices of the primitive have the same
+//               normal, color, etc., removes those properties from
+//               the vertices and assigns them to the primitive
+//               instead.
+//
+//               This can provide better meshing by removing
+//               properties from otherwise shared vertices.
+////////////////////////////////////////////////////////////////////
+void BuilderPrim::
+flatten_vertex_properties() {
+  int num_verts = get_num_verts();
+  int i;
+
+  if (has_overall_normal()) {
+    set_normal(get_normal());
+
+    for (i = 0; i < num_verts; i++) {
+      get_vertex(i).clear_normal();
+    }
+  }
+
+  if (has_overall_color()) {
+    set_color(get_color());
+
+    for (i = 0; i < num_verts; i++) {
+      get_vertex(i).clear_color();
+    }
+  }
+
+  if (has_overall_pixel_size()) {
+    set_pixel_size(get_pixel_size());
+
+    for (i = 0; i < num_verts; i++) {
+      get_vertex(i).clear_pixel_size();
+    }
+  }
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: BuilderPrim::fill_geom
 //       Access: Public
@@ -103,6 +144,21 @@ fill_geom(Geom *geom, const PTA_BuilderV &v_array,
   }
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: BuilderPrimI::flatten_vertex_properties
+//       Access: Public
+//  Description: If all the vertices of the primitive have the same
+//               normal, color, etc., removes those properties from
+//               the vertices and assigns them to the primitive
+//               instead.
+//
+//               This can do nothing in the case of an indexed
+//               primitive, because we can't monkey with the vertex
+//               properties in this case.
+////////////////////////////////////////////////////////////////////
+void BuilderPrimI::
+flatten_vertex_properties() {
+}
 
 ////////////////////////////////////////////////////////////////////
 //     Function: BuilderPrimI::fill_geom

+ 12 - 2
panda/src/builder/builderPrim.h

@@ -73,11 +73,15 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, BuilderPrimTempl<BuilderVe
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDAEGG BuilderPrim : public BuilderPrimTempl<BuilderVertex> {
 public:
-  BuilderPrim() {}
+  INLINE BuilderPrim();
+  INLINE BuilderPrim(const BuilderPrim &copy);
+  INLINE BuilderPrim &operator = (const BuilderPrim &copy);
  
   BuilderPrim &nonindexed_copy(const BuilderPrimTempl<BuilderVertexI> &copy,
 			       const BuilderBucket &bucket);
 
+  void flatten_vertex_properties();
+
   static void fill_geom(Geom *geom, const PTA_BuilderV &v_array,
 			GeomBindType n_attr, const PTA_BuilderN &n_array,
 			GeomBindType t_attr, const PTA_BuilderTC &t_array,
@@ -97,7 +101,11 @@ public:
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDAEGG BuilderPrimI : public BuilderPrimTempl<BuilderVertexI> {
 public:
-  BuilderPrimI() {}
+  INLINE BuilderPrimI();
+  INLINE BuilderPrimI(const BuilderPrimI &copy);
+  INLINE BuilderPrimI &operator = (const BuilderPrimI &copy);
+
+  void flatten_vertex_properties();
 
   static void fill_geom(Geom *geom, const PTA_ushort &v_array,
 			GeomBindType n_attr, PTA_ushort n_array,
@@ -107,6 +115,8 @@ public:
 			int num_prims, int num_components, int num_verts);
 };
 
+#include "builderPrim.I"
+
 
 // Tell GCC that we'll take care of the instantiation explicitly here.
 #ifdef __GNUC__

+ 48 - 0
panda/src/builder/builderVertexTempl.I

@@ -138,6 +138,18 @@ set_normal(const NType &n) {
   return *this;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: BuilderVertexTempl::clear_normal
+//       Access: Public
+//  Description: Removes the vertex's normal.
+////////////////////////////////////////////////////////////////////
+template <class VT, class NT, class TT, class CT>
+INLINE BuilderVertexTempl<VT, NT, TT, CT> &BuilderVertexTempl<VT, NT, TT, CT>::
+clear_normal() {
+  BuilderAttribTempl<VT, NT, TT, CT>::clear_normal();
+  return *this;
+}
+
 
 ////////////////////////////////////////////////////////////////////
 //     Function: BuilderVertexTempl::has_texcoord
@@ -164,6 +176,18 @@ set_texcoord(const TType &t) {
   return *this;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: BuilderVertexTempl::clear_texcoord
+//       Access: Public
+//  Description: Removes the vertex's texcoord.
+////////////////////////////////////////////////////////////////////
+template <class VT, class NT, class TT, class CT>
+INLINE BuilderVertexTempl<VT, NT, TT, CT> &BuilderVertexTempl<VT, NT, TT, CT>::
+clear_texcoord() {
+  _flags &= ~BAF_texcoord;
+  return *this;
+}
+
 
 ////////////////////////////////////////////////////////////////////
 //     Function: BuilderVertexTempl::get_texcoord
@@ -196,6 +220,18 @@ set_color(const CType &c) {
   return *this;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: BuilderVertexTempl::clear_color
+//       Access: Public
+//  Description: Removes the vertex's color.
+////////////////////////////////////////////////////////////////////
+template <class VT, class NT, class TT, class CT>
+INLINE BuilderVertexTempl<VT, NT, TT, CT> &BuilderVertexTempl<VT, NT, TT, CT>::
+clear_color() {
+  BuilderAttribTempl<VT, NT, TT, CT>::clear_color();
+  return *this;
+}
+
 
 ////////////////////////////////////////////////////////////////////
 //     Function: BuilderVertexTempl::set_pixel_size
@@ -213,6 +249,18 @@ set_pixel_size(float s) {
   return *this;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: BuilderVertexTempl::clear_pixel_size
+//       Access: Public
+//  Description: Removes the vertex's pixel_size.
+////////////////////////////////////////////////////////////////////
+template <class VT, class NT, class TT, class CT>
+INLINE BuilderVertexTempl<VT, NT, TT, CT> &BuilderVertexTempl<VT, NT, TT, CT>::
+clear_pixel_size() {
+  BuilderAttribTempl<VT, NT, TT, CT>::clear_pixel_size();
+  return *this;
+}
+
 
 ////////////////////////////////////////////////////////////////////
 //     Function: BuilderVertexTempl::operator ==

+ 4 - 0
panda/src/builder/builderVertexTempl.h

@@ -42,14 +42,18 @@ public:
   INLINE BuilderVertexTempl &set_coord(const VType &c);
 
   INLINE BuilderVertexTempl &set_normal(const NType &c);
+  INLINE BuilderVertexTempl &clear_normal();
 
   INLINE bool has_texcoord() const;
   INLINE TType get_texcoord() const;
   INLINE BuilderVertexTempl &set_texcoord(const TType &t);
+  INLINE BuilderVertexTempl &clear_texcoord();
 
   INLINE BuilderVertexTempl &set_color(const CType &c);
+  INLINE BuilderVertexTempl &clear_color();
 
   INLINE BuilderVertexTempl &set_pixel_size(float s);
+  INLINE BuilderVertexTempl &clear_pixel_size();
 
   bool operator == (const BuilderVertexTempl &other) const;
   INLINE bool operator != (const BuilderVertexTempl &other) const;

+ 5 - 0
panda/src/builder/mesherConfig.h

@@ -16,4 +16,9 @@
 // actually hurt, by bitching the heuristic).
 #define SUPPORT_FANS
 
+// Define this to enable code to visualize the normals when generating
+// primitives.  This creates line segment geometry to show each normal
+// as the primitives are created.
+#define SUPPORT_SHOW_NORMALS
+
 #endif

+ 11 - 0
panda/src/gobj/fog.I

@@ -109,3 +109,14 @@ INLINE float Fog::get_end(void) const {
 INLINE float Fog::get_density(void) const {
   return _density;
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: Fog::apply
+//       Access: Public
+//  Description: Called during rendering to enable fogging with the
+//               GSG.
+////////////////////////////////////////////////////////////////////
+INLINE void Fog::
+apply(GraphicsStateGuardianBase *gsg) {
+  gsg->apply_fog(this);
+}

+ 3 - 4
panda/src/gobj/fog.h

@@ -36,10 +36,6 @@ PUBLISHED:
   Fog(Mode mode = M_exponential, int hardware_bits = 8);
   ~Fog();
 
-  void apply(GraphicsStateGuardianBase *gsg) {
-    gsg->apply_fog(this);
-  }
-
   INLINE Mode get_mode(void) const;
   INLINE void set_mode(Mode mode);
 
@@ -58,6 +54,9 @@ PUBLISHED:
 
   void output(ostream &out) const;
 
+public:
+  INLINE void apply(GraphicsStateGuardianBase *gsg);
+
 protected:
   void compute_density(void);
 

+ 90 - 43
panda/src/gobj/geom.cxx

@@ -19,6 +19,7 @@
 #include <ioPtaDatagramShort.h>
 #include <ioPtaDatagramInt.h>
 #include <ioPtaDatagramLinMath.h>
+#include <indent.h>
 
 ////////////////////////////////////////////////////////////////////
 // Static variables
@@ -412,8 +413,8 @@ config(void) {
 //  Description: 
 ////////////////////////////////////////////////////////////////////
 void Geom::
-write(ostream &out) const {
-  out << *this << endl;
+write(ostream &out, int indent_level) const {
+  indent(out, indent_level) << *this << endl;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -582,7 +583,7 @@ template <class VecType>
 static void
 describe_attr(ostream &out, const Geom *geom,
 	      GeomBindType bind, const PTA(VecType) &array,
-	      const char *pad) {
+	      bool newline, int indent_level) {
   PTA_int lengths = geom->get_lengths();
   int num_prims = geom->get_num_prims();
   bool components = geom->uses_components();
@@ -590,7 +591,8 @@ describe_attr(ostream &out, const Geom *geom,
   int i, j, vi;
   switch (bind) {
   case G_PER_VERTEX:
-    out << "Per vertex:";
+    indent(out, indent_level)
+      << "Per vertex:";
     vi = 0;
     int num_verts;
     num_verts = geom->get_num_vertices_per_prim();
@@ -598,11 +600,18 @@ describe_attr(ostream &out, const Geom *geom,
       if (components) {
 	num_verts = lengths[i];
       }
-      out << "\n  [ ";
+      out << "\n";
+      indent(out, indent_level) << "[ ";
       if (num_verts > 0) {
 	out << array[vi++];
 	for (j = 1; j < num_verts; j++) {
-	  out << pad << array[vi++];
+	  if (newline) {
+	    out << "\n";
+	    indent(out, indent_level + 2);
+	  } else {
+	    out << " ";
+	  }
+	  out << array[vi++];
 	}
       }
       out << " ]";
@@ -611,17 +620,26 @@ describe_attr(ostream &out, const Geom *geom,
 
   case G_PER_COMPONENT:
     if (!components) {
-      out << "Invalid per-component attribute specified!";
+      indent(out, indent_level)
+	<< "Invalid per-component attribute specified!";
     } else {
-      out << "Per component:";
+      indent(out, indent_level)
+	<< "Per component:";
       vi = 0;
       for (i = 0; i < num_prims; i++) {
 	num_verts = lengths[i] - geom->get_num_more_vertices_than_components();
-	out << "\n  [ ";
+	out << "\n";
+	indent(out, indent_level) << "[ ";
 	if (num_verts > 0) {
 	  out << array[vi++];
 	  for (j = 1; j < num_verts; j++) {
-	    out << pad << array[vi++];
+	    if (newline) {
+	      out << "\n";
+	      indent(out, indent_level + 2);
+	    } else {
+	      out << " ";
+	    }
+	    out << array[vi++];
 	  }
 	  out << " ]";
 	}
@@ -630,14 +648,29 @@ describe_attr(ostream &out, const Geom *geom,
     break;
 
   case G_PER_PRIM:
-    out << "Per prim:";
+    indent(out, indent_level)
+      << "Per prim:";
     for (i = 0; i < num_prims; i++) {
-      out << pad << array[i];
+      if (newline) {
+	out << "\n";
+	indent(out, indent_level + 2);
+      } else {
+	out << " ";
+      }
+      out << array[i];
     }
     break;
 
   case G_OVERALL:
-    out << "Overall:" << pad << array[0];
+    indent(out, indent_level)
+      << "Overall:";
+    if (newline) {
+      out << "\n";
+      indent(out, indent_level + 2);
+    } else {
+      out << " ";
+    }
+    out << array[0];
 
   case G_OFF:
     break;
@@ -653,7 +686,7 @@ describe_attr(ostream &out, const Geom *geom,
 //               not too much detail.
 ////////////////////////////////////////////////////////////////////
 void Geom::
-write_verbose(ostream &out) const {
+write_verbose(ostream &out, int indent_level) const {
   GeomBindType bind_coords;
   GeomBindType bind_normals;
   GeomBindType bind_tcoords;
@@ -674,51 +707,65 @@ write_verbose(ostream &out) const {
   get_texcoords(g_tcoords, bind_tcoords, i_tcoords);
   get_colors(g_colors, bind_colors, i_colors);
 
-  out << "\n" << get_type() << " contains " 
-      << get_num_prims() << " primitives:\n";
+  out << "\n";
+  indent(out, indent_level)
+    << get_type() << " contains " 
+    << get_num_prims() << " primitives:\n";
 
   if (bind_coords == G_OFF) {
-    out << "No coords\n";
+    indent(out, indent_level)
+      << "No coords\n";
   } else if (i_coords!=(ushort*)0L) {
-    out << "Indexed coords = " << (void *)g_coords << ", length = " 
-	<< g_coords.size() << ":\n";
-    describe_attr(out, this, bind_coords, i_coords, " ");
+    indent(out, indent_level)
+      << "Indexed coords = " << (void *)g_coords << ", length = " 
+      << g_coords.size() << ":\n";
+    describe_attr(out, this, bind_coords, i_coords, false, indent_level + 2);
   } else {
-    out << "Nonindexed coords:\n";
-    describe_attr(out, this, bind_coords, g_coords, "\n    ");
+    indent(out, indent_level)
+      << "Nonindexed coords:\n";
+    describe_attr(out, this, bind_coords, g_coords, true, indent_level + 2);
   }
-
+  
   if (bind_colors == G_OFF) {
-    out << "No colors\n";
+    indent(out, indent_level)
+      << "No colors\n";
   } else if (i_colors!=(ushort*)0L) {
-    out << "Indexed colors = " << (void *)g_colors << ", length = " 
-	<< g_colors.size() << "\n";
-    describe_attr(out, this, bind_colors, i_colors, " ");
+    indent(out, indent_level)
+      << "Indexed colors = " << (void *)g_colors << ", length = " 
+      << g_colors.size() << "\n";
+    describe_attr(out, this, bind_colors, i_colors, false, indent_level + 2);
   } else {
-    out << "Nonindexed colors:\n"; 
-    describe_attr(out, this, bind_colors, g_colors, "\n    ");
+    indent(out, indent_level)
+      << "Nonindexed colors:\n"; 
+    describe_attr(out, this, bind_colors, g_colors, true, indent_level + 2);
   }
-
+  
   if (bind_tcoords == G_OFF) {
-    out << "No tcoords\n";
+    indent(out, indent_level)
+      << "No tcoords\n";
   } else if (i_tcoords!=(ushort*)0L) {
-    out << "Indexed tcoords = " << (void *)g_tcoords << ", length = " 
-	<< g_tcoords.size() << "\n";
-    describe_attr(out, this, bind_tcoords, i_tcoords, " ");
+    indent(out, indent_level)
+      << "Indexed tcoords = " << (void *)g_tcoords << ", length = " 
+      << g_tcoords.size() << "\n";
+    describe_attr(out, this, bind_tcoords, i_tcoords, false, indent_level + 2);
   } else {
-    out << "Nonindexed tcoords:\n";
-    describe_attr(out, this, bind_tcoords, g_tcoords, "\n    ");
+    indent(out, indent_level)
+      << "Nonindexed tcoords:\n";
+    describe_attr(out, this, bind_tcoords, g_tcoords, true, indent_level + 2);
   }
-
+  
   if (bind_normals == G_OFF) {
-    out << "No normals\n";
+    indent(out, indent_level)
+      << "No normals\n";
   } else if (i_normals!=(ushort*)0L) {
-    out << "Indexed normals = " << (void *)g_normals << ", length = " 
-	<< g_normals.size() << "\n";
-    describe_attr(out, this, bind_normals, i_normals, " ");
+    indent(out, indent_level)
+      << "Indexed normals = " << (void *)g_normals << ", length = " 
+      << g_normals.size() << "\n";
+    describe_attr(out, this, bind_normals, i_normals, false, indent_level + 2);
   } else {
-    out << "Nonindexed normals:\n";
-    describe_attr(out, this, bind_normals, g_normals, "\n    ");
+    indent(out, indent_level)
+      << "Nonindexed normals:\n";
+    describe_attr(out, this, bind_normals, g_normals, true, indent_level + 2);
   }
 }
 

+ 2 - 2
panda/src/gobj/geom.h

@@ -106,9 +106,9 @@ public:
   virtual Geom *make_copy() const=0;
 
 PUBLISHED: 
-  void write(ostream &out) const;
+  void write(ostream &out, int indent_level = 0) const;
   virtual void output(ostream &out) const;
-  void write_verbose(ostream &out) const;
+  void write_verbose(ostream &out, int indent_level) const;
 
 public: 
   // From parent dDrawable

+ 1 - 1
panda/src/sgattrib/fogAttribute.I

@@ -31,7 +31,7 @@ set_on(Fog *fog) {
 //               is only valid to call this if is_on() has returned
 //               true.
 ////////////////////////////////////////////////////////////////////
-INLINE PT(Fog) FogAttribute::
+INLINE Fog *FogAttribute::
 get_fog() const {
   nassertr(is_on(), NULL);
   return _value;

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

@@ -20,8 +20,9 @@ public:
   INLINE FogAttribute();
 
   INLINE void set_on(Fog *fog);
-  INLINE PT(Fog) get_fog() const;
+  INLINE Fog *get_fog() const;
 
+public:
   virtual TypeHandle get_handle() const;
   virtual NodeAttribute *make_copy() const;
   virtual NodeAttribute *make_initial() const;

+ 1 - 1
panda/src/sgattrib/fogTransition.I

@@ -57,7 +57,7 @@ set_on(Fog *fog) {
 //               It is only valid to call this if is_on() has returned
 //               true.
 ////////////////////////////////////////////////////////////////////
-INLINE PT(Fog) FogTransition::
+INLINE Fog *FogTransition::
 get_fog() const {
   nassertr(is_on(), NULL);
   return _value;

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

@@ -24,8 +24,9 @@ public:
   INLINE static FogTransition off();
 
   INLINE void set_on(Fog *fog);
-  INLINE PT(Fog) get_fog() const;
-  
+  INLINE Fog *get_fog() const;
+
+public:  
   virtual NodeTransition *make_copy() const;
   virtual NodeAttribute *make_attrib() const;
 

+ 2 - 2
panda/src/sgraph/geomNode.cxx

@@ -117,12 +117,12 @@ write(ostream &out, int indent_level) const {
 //  Description: 
 ////////////////////////////////////////////////////////////////////
 void GeomNode::
-write_verbose(ostream &out) const {
+write_verbose(ostream &out, int indent_level) const {
   Geoms::const_iterator gi;
   for (gi = _geoms.begin(); gi != _geoms.end(); ++gi) {
     dDrawable *drawable = (*gi);
     if (drawable->is_of_type(Geom::get_class_type())) {
-      DCAST(Geom, drawable)->write_verbose(out);
+      DCAST(Geom, drawable)->write_verbose(out, indent_level);
     } else {
       out << drawable->get_type() << "\n";
     }

+ 1 - 1
panda/src/sgraph/geomNode.h

@@ -38,7 +38,7 @@ public:
 
 PUBLISHED:
   void write(ostream &out, int indent_level = 0) const;
-  void write_verbose(ostream &out) const;
+  void write_verbose(ostream &out, int indent_level) const;
 
 public:
   void draw(GraphicsStateGuardianBase *gsg);