added pstat calipers to sprite particles

This commit is contained in:
Asad M. Zaman 2007-02-06 00:34:29 +00:00
parent 7732928c0e
commit 49307714d1
6 changed files with 119 additions and 96 deletions

View File

@ -33,9 +33,12 @@
#include "pointParticleRenderer.h" #include "pointParticleRenderer.h"
#include "pointParticleFactory.h" #include "pointParticleFactory.h"
#include "sphereSurfaceEmitter.h" #include "sphereSurfaceEmitter.h"
#include "pStatTimer.h"
TypeHandle ParticleSystem::_type_handle; TypeHandle ParticleSystem::_type_handle;
PStatCollector ParticleSystem::_update_collector("App:Particles:Update");
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function : ParticleSystem // Function : ParticleSystem
// Access : Public // Access : Public
@ -467,6 +470,8 @@ resize_pool(int size) {
#endif #endif
void ParticleSystem:: void ParticleSystem::
update(float dt) { update(float dt) {
PStatTimer t1(_update_collector);
int ttl_updates_left = _living_particles; int ttl_updates_left = _living_particles;
int current_index = 0, index_counter = 0; int current_index = 0, index_counter = 0;
BaseParticle *bp; BaseParticle *bp;

View File

@ -30,9 +30,8 @@
#include "physical.h" #include "physical.h"
#include "pandaNode.h" #include "pandaNode.h"
#include "referenceCount.h" #include "referenceCount.h"
#include "pdeque.h" #include "pdeque.h"
#include "pStatTimer.h"
#include "baseParticle.h" #include "baseParticle.h"
#include "baseParticleRenderer.h" #include "baseParticleRenderer.h"
#include "baseParticleEmitter.h" #include "baseParticleEmitter.h"
@ -186,6 +185,8 @@ private:
static TypeHandle _type_handle; static TypeHandle _type_handle;
friend class ParticleSystemManager; // particleSystemManager.h friend class ParticleSystemManager; // particleSystemManager.h
static PStatCollector _update_collector;
}; };
#include "particleSystem.I" #include "particleSystem.I"

View File

@ -22,9 +22,12 @@
#include "pandabase.h" #include "pandabase.h"
#include "physicsManager.h" #include "physicsManager.h"
#include "clockObject.h" #include "clockObject.h"
#include "pStatTimer.h"
#include <algorithm> #include <algorithm>
PStatCollector ParticleSystemManager::_do_particles_collector("App:Particles:Do Particles");
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function : ParticleSystemManager // Function : ParticleSystemManager
// Access : public // Access : public
@ -74,6 +77,7 @@ remove_particlesystem(ParticleSystem *ps) {
void ParticleSystemManager:: void ParticleSystemManager::
do_particles(float dt) { do_particles(float dt) {
// cout << "ParticlesystemManager::doparticles entering." << endl; // cout << "ParticlesystemManager::doparticles entering." << endl;
PStatTimer t1(_do_particles_collector);
plist< PT(ParticleSystem) >::iterator cur; plist< PT(ParticleSystem) >::iterator cur;

View File

@ -21,8 +21,8 @@
#include "pandabase.h" #include "pandabase.h"
#include "plist.h" #include "plist.h"
#include "particleSystem.h" #include "particleSystem.h"
#include "pStatCollector.h"
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Class : ParticleSystemManager // Class : ParticleSystemManager
@ -55,6 +55,8 @@ private:
int _nth_frame; int _nth_frame;
int _cur_frame; int _cur_frame;
static PStatCollector _do_particles_collector;
}; };
#include "particleSystemManager.I" #include "particleSystemManager.I"

View File

@ -33,6 +33,10 @@
#include "nodePathCollection.h" #include "nodePathCollection.h"
#include "indent.h" #include "indent.h"
#include "config_particlesystem.h" #include "config_particlesystem.h"
#include "pStatTimer.h"
PStatCollector SpriteParticleRenderer::_sprite_particle_render("App:Particles:Sprite:Render");
PStatCollector SpriteParticleRenderer::_sprite_particle_process_vertices("App:Particles:Sprite:Render:Process Verts");
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function : SpriteParticleRenderer::SpriteParticleRenderer // Function : SpriteParticleRenderer::SpriteParticleRenderer
@ -557,6 +561,7 @@ kill_particle(int) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void SpriteParticleRenderer:: void SpriteParticleRenderer::
render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) {
PStatTimer t1(_sprite_particle_process_vertices);
// There is no texture data available, exit. // There is no texture data available, exit.
if (_anims.empty()) { if (_anims.empty()) {
return; return;
@ -610,6 +615,8 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) {
_aabb_max.set(-99999.0f, -99999.0f, -99999.0f); _aabb_max.set(-99999.0f, -99999.0f, -99999.0f);
// run through every filled slot // run through every filled slot
{
PStatTimer t2(_sprite_particle_process_vertices);
for (i = 0; i < (int)po_vector.size(); i++) { for (i = 0; i < (int)po_vector.size(); i++) {
cur_particle = (BaseParticle *) po_vector[i].p(); cur_particle = (BaseParticle *) po_vector[i].p();
@ -723,7 +730,7 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) {
break; break;
} }
} }
}
int n = 0; int n = 0;
GeomNode *render_node = get_render_node(); GeomNode *render_node = get_render_node();

View File

@ -33,6 +33,7 @@
#include "textureCollection.h" #include "textureCollection.h"
#include "nodePathCollection.h" #include "nodePathCollection.h"
#include "vector_int.h" #include "vector_int.h"
#include "pStatCollector.h"
class NodePath; class NodePath;
@ -267,6 +268,9 @@ private:
vector_int _anim_size; // Holds the number of frames in each animation. vector_int _anim_size; // Holds the number of frames in each animation.
pvector<int*> _ttl_count; // _ttl_count[i][j] holds the number of particles attached to animation 'i' at frame 'j'. pvector<int*> _ttl_count; // _ttl_count[i][j] holds the number of particles attached to animation 'i' at frame 'j'.
vector_int _birth_list; // Holds the list of particles that need a new random animation to start on. vector_int _birth_list; // Holds the list of particles that need a new random animation to start on.
static PStatCollector _sprite_particle_render;
static PStatCollector _sprite_particle_process_vertices;
}; };
#include "spriteParticleRenderer.I" #include "spriteParticleRenderer.I"