浏览代码

add colors

David Rose 19 年之前
父节点
当前提交
4ff0a5af0e

+ 10 - 0
panda/src/pgraph/sceneGraphAnalyzer.I

@@ -108,6 +108,16 @@ get_num_normals() const {
   return _num_normals;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_num_colors
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+int SceneGraphAnalyzer::
+get_num_colors() const {
+  return _num_colors;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: SceneGraphAnalyzer::get_num_texcoords
 //       Access: Published

+ 5 - 0
panda/src/pgraph/sceneGraphAnalyzer.cxx

@@ -74,6 +74,7 @@ clear() {
 
   _num_vertices = 0;
   _num_normals = 0;
+  _num_colors = 0;
   _num_texcoords = 0;
   _num_tris = 0;
   _num_lines = 0;
@@ -132,6 +133,7 @@ write(ostream &out, int indent_level) const {
 
   indent(out, indent_level)
     << _num_vertices << " vertices, " << _num_normals << " normals, "
+    << _num_colors << " colors, "
     << _num_texcoords << " texture coordinates.\n";
 
   if (_num_long_normals != 0 || _num_short_normals != 0) {
@@ -278,6 +280,9 @@ collect_statistics(const Geom *geom) {
     if (vdata->has_column(InternalName::get_normal())) {
       _num_normals += num_rows;
     }
+    if (vdata->has_column(InternalName::get_color())) {
+      _num_colors += num_rows;
+    }
     const GeomVertexFormat *format = vdata->get_format();
     int num_texcoords = format->get_num_texcoords();
     _num_texcoords += num_rows * num_texcoords;

+ 2 - 0
panda/src/pgraph/sceneGraphAnalyzer.h

@@ -56,6 +56,7 @@ PUBLISHED:
 
   INLINE int get_num_vertices() const;
   INLINE int get_num_normals() const;
+  INLINE int get_num_colors() const;
   INLINE int get_num_texcoords() const;
   INLINE int get_num_tris() const;
   INLINE int get_num_lines() const;
@@ -98,6 +99,7 @@ private:
 
   int _num_vertices;
   int _num_normals;
+  int _num_colors;
   int _num_texcoords;
   int _num_tris;
   int _num_lines;