Panda3D
Loading...
Searching...
No Matches
collisionRecorder.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file collisionRecorder.h
10 * @author drose
11 * @date 2003-04-16
12 */
13
14#ifndef COLLISIONRECORDER_H
15#define COLLISIONRECORDER_H
16
17#include "pandabase.h"
18#include "typeHandle.h"
19#include "typedObject.h"
20
22class CollisionEntry;
23
24#ifdef DO_COLLISION_RECORDING
25
26/**
27 * This class is used to help debug the work the collisions system is doing.
28 * It is a virtual base class that just provides an interface for recording
29 * collisions tested and detected each frame.
30 */
31class EXPCL_PANDA_COLLIDE CollisionRecorder : public TypedObject {
32protected:
33 CollisionRecorder();
34public:
35 virtual ~CollisionRecorder();
36
37PUBLISHED:
38 void output(std::ostream &out) const;
39
40public:
41 virtual void begin_traversal();
42 virtual void collision_tested(const CollisionEntry &entry, bool detected);
43 virtual void end_traversal();
44
45private:
46 int _num_missed;
47 int _num_detected;
48 CollisionTraverser *_trav;
49
50public:
51 static TypeHandle get_class_type() {
52 return _type_handle;
53 }
54 static void init_type() {
56 register_type(_type_handle, "CollisionRecorder",
57 TypedObject::get_class_type());
58 }
59 virtual TypeHandle get_type() const {
60 return get_class_type();
61 }
62 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
63
64private:
65 static TypeHandle _type_handle;
66
67 friend class CollisionTraverser;
68};
69
70#include "collisionRecorder.I"
71
72#endif // DO_COLLISION_RECORDING
73
74
75#endif
Defines a single collision event.
This class manages the traversal through the scene graph to detect collisions.
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...
Definition typedObject.h:88
static void init_type()
This function is declared non-inline to work around a compiler bug in g++ 2.96.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.