Browse Source

add accessors to SceneGraphAnalzyer

David Rose 19 years ago
parent
commit
9b2f1e4a69

+ 2 - 2
panda/src/pgraph/Sources.pp

@@ -89,7 +89,7 @@
     renderModeAttrib.I renderModeAttrib.h \
     renderState.I renderState.h \
     rescaleNormalAttrib.I rescaleNormalAttrib.h \
-    sceneGraphAnalyzer.h \
+    sceneGraphAnalyzer.h sceneGraphAnalyzer.I \
     sceneGraphReducer.I sceneGraphReducer.h \
     sceneSetup.I sceneSetup.h \
     selectiveChildNode.I selectiveChildNode.h \
@@ -296,7 +296,7 @@
     renderModeAttrib.I renderModeAttrib.h \
     renderState.I renderState.h \
     rescaleNormalAttrib.I rescaleNormalAttrib.h \
-    sceneGraphAnalyzer.h \
+    sceneGraphAnalyzer.h sceneGraphAnalyzer.I \
     sceneGraphReducer.I sceneGraphReducer.h \
     sceneSetup.I sceneSetup.h \
     selectiveChildNode.I selectiveChildNode.h \

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

@@ -0,0 +1,242 @@
+// Filename: sceneGraphAnalyzer.I
+// Created by:  drose (15Oct06)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://etc.cmu.edu/panda3d/docs/license/ .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_num_nodes
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+int SceneGraphAnalyzer::
+get_num_nodes() const {
+  return _num_nodes;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_num_instances
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+int SceneGraphAnalyzer::
+get_num_instances() const {
+  return _num_instances;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_num_transforms
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+int SceneGraphAnalyzer::
+get_num_transforms() const {
+  return _num_transforms;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_num_nodes_with_attribs
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+int SceneGraphAnalyzer::
+get_num_nodes_with_attribs() const {
+  return _num_nodes_with_attribs;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_num_geom_nodes
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+int SceneGraphAnalyzer::
+get_num_geom_nodes() const {
+  return _num_geom_nodes;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_num_geoms
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+int SceneGraphAnalyzer::
+get_num_geoms() const {
+  return _num_geoms;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_num_geom_vertex_datas
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+int SceneGraphAnalyzer::
+get_num_geom_vertex_datas() const {
+  return _num_geom_vertex_datas;
+}
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_num_vertices
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+int SceneGraphAnalyzer::
+get_num_vertices() const {
+  return _num_vertices;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_num_normals
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+int SceneGraphAnalyzer::
+get_num_normals() const {
+  return _num_normals;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_num_texcoords
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+int SceneGraphAnalyzer::
+get_num_texcoords() const {
+  return _num_texcoords;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_num_tris
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+int SceneGraphAnalyzer::
+get_num_tris() const {
+  return _num_tris;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_num_lines
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+int SceneGraphAnalyzer::
+get_num_lines() const {
+  return _num_lines;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_num_points
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+int SceneGraphAnalyzer::
+get_num_points() const {
+  return _num_points;
+}
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_num_individual_tris
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+int SceneGraphAnalyzer::
+get_num_individual_tris() const {
+  return _num_individual_tris;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_num_tristrips
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+int SceneGraphAnalyzer::
+get_num_tristrips() const {
+  return _num_tristrips;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_num_triangles_in_strips
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+int SceneGraphAnalyzer::
+get_num_triangles_in_strips() const {
+  return _num_triangles_in_strips;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_num_trifans
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+int SceneGraphAnalyzer::
+get_num_trifans() const {
+  return _num_trifans;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_num_triangles_in_fans
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+int SceneGraphAnalyzer::
+get_num_triangles_in_fans() const {
+  return _num_triangles_in_fans;
+}
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_texture_bytes
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+int SceneGraphAnalyzer::
+get_texture_bytes() const {
+  return _texture_bytes;
+}
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_num_long_normals
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+int SceneGraphAnalyzer::
+get_num_long_normals() const {
+  return _num_long_normals;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_num_short_normals
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+int SceneGraphAnalyzer::
+get_num_short_normals() const {
+  return _num_short_normals;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: SceneGraphAnalyzer::get_total_normal_length
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+float SceneGraphAnalyzer::
+get_total_normal_length() const {
+  return _total_normal_length;
+}

+ 30 - 1
panda/src/pgraph/sceneGraphAnalyzer.h

@@ -46,6 +46,33 @@ PUBLISHED:
 
   void write(ostream &out, int indent_level = 0) const;
 
+  INLINE int get_num_nodes() const;
+  INLINE int get_num_instances() const;
+  INLINE int get_num_transforms() const;
+  INLINE int get_num_nodes_with_attribs() const;
+  INLINE int get_num_geom_nodes() const;
+  INLINE int get_num_geoms() const;
+  INLINE int get_num_geom_vertex_datas() const;
+
+  INLINE int get_num_vertices() const;
+  INLINE int get_num_normals() const;
+  INLINE int get_num_texcoords() const;
+  INLINE int get_num_tris() const;
+  INLINE int get_num_lines() const;
+  INLINE int get_num_points() const;
+
+  INLINE int get_num_individual_tris() const;
+  INLINE int get_num_tristrips() const;
+  INLINE int get_num_triangles_in_strips() const;
+  INLINE int get_num_trifans() const;
+  INLINE int get_num_triangles_in_fans() const;
+
+  INLINE int get_texture_bytes() const;
+
+  INLINE int get_num_long_normals() const;
+  INLINE int get_num_short_normals() const;
+  INLINE float get_total_normal_length() const;
+
 private:
   void collect_statistics(PandaNode *node, bool under_instance);
   void collect_statistics(GeomNode *geom_node);
@@ -60,7 +87,7 @@ private:
   VDatas _vdatas;
   Textures _textures;
 
-public:
+private:
   int _num_nodes;
   int _num_instances;
   int _num_transforms;
@@ -89,4 +116,6 @@ public:
   float _total_normal_length;
 };
 
+#include "sceneGraphAnalyzer.I"
+
 #endif