Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/pgraph/sceneGraphAnalyzer.h

Go to the documentation of this file.
00001 // Filename: sceneGraphAnalyzer.h
00002 // Created by:  drose (02Jul00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef SCENEGRAPHANALYZER_H
00020 #define SCENEGRAPHANALYZER_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include "typedObject.h"
00025 #include "luse.h"
00026 
00027 #include "pmap.h"
00028 
00029 class PandaNode;
00030 class GeomNode;
00031 class Geom;
00032 class Texture;
00033 
00034 ///////////////////////////////////////////////////////////////////
00035 //       Class : SceneGraphAnalyzer
00036 // Description : A handy class that can scrub over a scene graph and
00037 //               collect interesting statistics on it.
00038 ////////////////////////////////////////////////////////////////////
00039 class EXPCL_PANDA SceneGraphAnalyzer {
00040 public:
00041   SceneGraphAnalyzer();
00042   ~SceneGraphAnalyzer();
00043 
00044   void clear();
00045   void add_node(PandaNode *node);
00046 
00047   void write(ostream &out, int indent_level = 0) const;
00048 
00049 private:
00050   void collect_statistics(PandaNode *node, bool under_instance);
00051   void collect_statistics(GeomNode *geom_node);
00052   void collect_statistics(Geom *geom);
00053   void collect_statistics(Texture *texture);
00054 
00055   void consider_normals(const Normalf *norms, const unsigned short *nindex,
00056                         int num);
00057 
00058   typedef pmap<PandaNode *, int> Nodes;
00059   typedef pmap<Texture *, int> Textures;
00060 
00061   Nodes _nodes;
00062   Textures _textures;
00063 
00064 public:
00065   int _num_nodes;
00066   int _num_instances;
00067   int _num_transforms;
00068   int _num_nodes_with_attribs;
00069   int _num_geom_nodes;
00070   int _num_geoms;
00071 
00072   int _num_vertices;
00073   int _num_normals;
00074   int _num_texcoords;
00075   int _num_tris;
00076   int _num_quads;
00077   int _num_polys;
00078   int _num_lines;
00079   int _num_points;
00080   int _num_spheres;
00081 
00082   int _num_individual_tris;
00083   int _num_tristrips;
00084   int _num_triangles_in_strips;
00085   int _num_trifans;
00086   int _num_triangles_in_fans;
00087 
00088   int _texture_bytes;
00089 
00090   int _num_long_normals;
00091   int _num_short_normals;
00092   float _total_normal_length;
00093 };
00094 
00095 #endif

Generated on Fri May 2 00:42:20 2003 for Panda by doxygen1.3