00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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
00036
00037
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