open_toontown_panda3d/panda/src/collide/collisionRecorder.h

84 lines
2.2 KiB
C++

// Filename: collisionRecorder.h
// Created by: drose (16Apr03)
//
////////////////////////////////////////////////////////////////////
//
// 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
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef COLLISIONRECORDER_H
#define COLLISIONRECORDER_H
#include "pandabase.h"
#include "typeHandle.h"
#include "typedObject.h"
class CollisionTraverser;
class CollisionEntry;
#ifdef DO_COLLISION_RECORDING
////////////////////////////////////////////////////////////////////
// Class : CollisionRecorder
// Description : This class is used to help debug the work the
// collisions system is doing. It is a virtual base
// class that just provides an interface for recording
// collisions tested and detected each frame.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA CollisionRecorder : public TypedObject {
protected:
CollisionRecorder();
public:
virtual ~CollisionRecorder();
PUBLISHED:
void output(ostream &out) const;
public:
virtual void begin_traversal();
virtual void collision_tested(const CollisionEntry &entry, bool detected);
virtual void end_traversal();
private:
int _num_missed;
int _num_detected;
CollisionTraverser *_trav;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
TypedObject::init_type();
register_type(_type_handle, "CollisionRecorder",
TypedObject::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
friend class CollisionTraverser;
};
#include "collisionRecorder.I"
#endif // DO_COLLISION_RECORDING
#endif