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

SceneGraphAnalyzer Class Reference

A handy class that can scrub over a scene graph and collect interesting statistics on it. More...

#include <sceneGraphAnalyzer.h>

List of all members.

Public Member Functions

 SceneGraphAnalyzer ()
 ~SceneGraphAnalyzer ()
void clear ()
 Resets all of the data in the analyzer in preparation for a new run.

void add_node (PandaNode *node)
 Adds a new node to the set of data for analysis.

void write (ostream &out, int indent_level=0) const
 Describes all the data collected.


Public Attributes

int _num_nodes
int _num_instances
int _num_transforms
int _num_nodes_with_attribs
int _num_geom_nodes
int _num_geoms
int _num_vertices
int _num_normals
int _num_texcoords
int _num_tris
int _num_quads
int _num_polys
int _num_lines
int _num_points
int _num_spheres
int _num_individual_tris
int _num_tristrips
int _num_triangles_in_strips
int _num_trifans
int _num_triangles_in_fans
int _texture_bytes
int _num_long_normals
int _num_short_normals
float _total_normal_length

Private Types

typedef pmap< PandaNode *,
int > 
Nodes
typedef pmap< Texture *, int > Textures

Private Member Functions

void collect_statistics (PandaNode *node, bool under_instance)
 Recursively visits each node, counting up the statistics.

void collect_statistics (GeomNode *geom_node)
 Recursively visits each node, counting up the statistics.

void collect_statistics (Geom *geom)
 Recursively visits each node, counting up the statistics.

void collect_statistics (Texture *texture)
 Recursively visits each node, counting up the statistics.

void consider_normals (const Normalf *norms, const unsigned short *nindex, int num)
 Examines the indicated set of normals.


Private Attributes

Nodes _nodes
Textures _textures


Detailed Description

A handy class that can scrub over a scene graph and collect interesting statistics on it.

Definition at line 46 of file sceneGraphAnalyzer.h.


Member Typedef Documentation

typedef pmap<PandaNode *, int> SceneGraphAnalyzer::Nodes [private]
 

Definition at line 65 of file sceneGraphAnalyzer.h.

typedef pmap<Texture *, int> SceneGraphAnalyzer::Textures [private]
 

Definition at line 66 of file sceneGraphAnalyzer.h.


Constructor & Destructor Documentation

SceneGraphAnalyzer::SceneGraphAnalyzer  ) 
 

Definition at line 41 of file sceneGraphAnalyzer.cxx.

SceneGraphAnalyzer::~SceneGraphAnalyzer  ) 
 

Definition at line 53 of file sceneGraphAnalyzer.cxx.

References _nodes, _num_geom_nodes, _num_geoms, _num_instances, _num_nodes, _num_nodes_with_attribs, _num_transforms, _textures, and PointerToArray< PointerTo< Texture > >::clear().


Member Function Documentation

void SceneGraphAnalyzer::add_node PandaNode node  ) 
 

Adds a new node to the set of data for analysis.

Normally, this would only be called once, and passed the top of the scene graph, but it's possible to repeatedly pass in subgraphs to get an analysis of all the graphs together.

Definition at line 118 of file sceneGraphAnalyzer.cxx.

References _num_nodes, and _num_nodes_with_attribs.

void SceneGraphAnalyzer::clear void   ) 
 

Resets all of the data in the analyzer in preparation for a new run.

Definition at line 67 of file sceneGraphAnalyzer.cxx.

References _num_individual_tris, _num_lines, _num_long_normals, _num_normals, _num_points, _num_polys, _num_quads, _num_short_normals, _num_spheres, _num_texcoords, _num_triangles_in_fans, _num_triangles_in_strips, _num_trifans, _num_tris, _num_tristrips, _num_vertices, _texture_bytes, and _total_normal_length.

void SceneGraphAnalyzer::collect_statistics Texture texture  )  [private]
 

Recursively visits each node, counting up the statistics.

Definition at line 396 of file sceneGraphAnalyzer.cxx.

References _num_long_normals, _num_normals, _num_short_normals, _total_normal_length, IS_THRESHOLD_EQUAL, Normalf, and NULL.

void SceneGraphAnalyzer::collect_statistics Geom geom  )  [private]
 

Recursively visits each node, counting up the statistics.

Definition at line 296 of file sceneGraphAnalyzer.cxx.

References G_OFF, G_PER_COMPONENT, and G_PER_VERTEX.

void SceneGraphAnalyzer::collect_statistics GeomNode geom_node  )  [private]
 

Recursively visits each node, counting up the statistics.

Definition at line 260 of file sceneGraphAnalyzer.cxx.

References _num_vertices, consider_normals(), G_OVERALL, G_PER_PRIM, GeomBindType, Geom::get_length(), Geom::get_normals(), Geom::get_num_more_vertices_than_components(), Geom::get_num_prims(), Geom::get_num_vertices_per_prim(), and Geom::uses_components().

void SceneGraphAnalyzer::collect_statistics PandaNode node,
bool  under_instance
[private]
 

Recursively visits each node, counting up the statistics.

Definition at line 206 of file sceneGraphAnalyzer.cxx.

void SceneGraphAnalyzer::consider_normals const Normalf norms,
const unsigned short *  nindex,
int  num
[private]
 

Examines the indicated set of normals.

Definition at line 434 of file sceneGraphAnalyzer.cxx.

Referenced by collect_statistics().

void SceneGraphAnalyzer::write ostream &  out,
int  indent_level = 0
const
 

Describes all the data collected.

Definition at line 131 of file sceneGraphAnalyzer.cxx.

References _num_long_normals, _num_normals, _num_short_normals, _total_normal_length, and indent().


Member Data Documentation

Nodes SceneGraphAnalyzer::_nodes [private]
 

Definition at line 68 of file sceneGraphAnalyzer.h.

Referenced by ~SceneGraphAnalyzer().

int SceneGraphAnalyzer::_num_geom_nodes
 

Definition at line 76 of file sceneGraphAnalyzer.h.

Referenced by ~SceneGraphAnalyzer().

int SceneGraphAnalyzer::_num_geoms
 

Definition at line 77 of file sceneGraphAnalyzer.h.

Referenced by ~SceneGraphAnalyzer().

int SceneGraphAnalyzer::_num_individual_tris
 

Definition at line 89 of file sceneGraphAnalyzer.h.

Referenced by clear().

int SceneGraphAnalyzer::_num_instances
 

Definition at line 73 of file sceneGraphAnalyzer.h.

Referenced by ~SceneGraphAnalyzer().

int SceneGraphAnalyzer::_num_lines
 

Definition at line 85 of file sceneGraphAnalyzer.h.

Referenced by clear().

int SceneGraphAnalyzer::_num_long_normals
 

Definition at line 97 of file sceneGraphAnalyzer.h.

Referenced by clear(), collect_statistics(), and write().

int SceneGraphAnalyzer::_num_nodes
 

Definition at line 72 of file sceneGraphAnalyzer.h.

Referenced by add_node(), and ~SceneGraphAnalyzer().

int SceneGraphAnalyzer::_num_nodes_with_attribs
 

Definition at line 75 of file sceneGraphAnalyzer.h.

Referenced by add_node(), and ~SceneGraphAnalyzer().

int SceneGraphAnalyzer::_num_normals
 

Definition at line 80 of file sceneGraphAnalyzer.h.

Referenced by clear(), collect_statistics(), and write().

int SceneGraphAnalyzer::_num_points
 

Definition at line 86 of file sceneGraphAnalyzer.h.

Referenced by clear().

int SceneGraphAnalyzer::_num_polys
 

Definition at line 84 of file sceneGraphAnalyzer.h.

Referenced by clear().

int SceneGraphAnalyzer::_num_quads
 

Definition at line 83 of file sceneGraphAnalyzer.h.

Referenced by clear().

int SceneGraphAnalyzer::_num_short_normals
 

Definition at line 98 of file sceneGraphAnalyzer.h.

Referenced by clear(), collect_statistics(), and write().

int SceneGraphAnalyzer::_num_spheres
 

Definition at line 87 of file sceneGraphAnalyzer.h.

Referenced by clear().

int SceneGraphAnalyzer::_num_texcoords
 

Definition at line 81 of file sceneGraphAnalyzer.h.

Referenced by clear().

int SceneGraphAnalyzer::_num_transforms
 

Definition at line 74 of file sceneGraphAnalyzer.h.

Referenced by ~SceneGraphAnalyzer().

int SceneGraphAnalyzer::_num_triangles_in_fans
 

Definition at line 93 of file sceneGraphAnalyzer.h.

Referenced by clear().

int SceneGraphAnalyzer::_num_triangles_in_strips
 

Definition at line 91 of file sceneGraphAnalyzer.h.

Referenced by clear().

int SceneGraphAnalyzer::_num_trifans
 

Definition at line 92 of file sceneGraphAnalyzer.h.

Referenced by clear().

int SceneGraphAnalyzer::_num_tris
 

Definition at line 82 of file sceneGraphAnalyzer.h.

Referenced by clear().

int SceneGraphAnalyzer::_num_tristrips
 

Definition at line 90 of file sceneGraphAnalyzer.h.

Referenced by clear().

int SceneGraphAnalyzer::_num_vertices
 

Definition at line 79 of file sceneGraphAnalyzer.h.

Referenced by clear(), and collect_statistics().

int SceneGraphAnalyzer::_texture_bytes
 

Definition at line 95 of file sceneGraphAnalyzer.h.

Referenced by clear().

Textures SceneGraphAnalyzer::_textures [private]
 

Definition at line 69 of file sceneGraphAnalyzer.h.

Referenced by ~SceneGraphAnalyzer().

float SceneGraphAnalyzer::_total_normal_length
 

Definition at line 99 of file sceneGraphAnalyzer.h.

Referenced by clear(), collect_statistics(), and write().


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:54:56 2003 for Panda by doxygen1.3