Panda3D
Loading...
Searching...
No Matches
collisionHandler.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 collisionHandler.h
10 * @author drose
11 * @date 2002-03-16
12 */
13
14#ifndef COLLISIONHANDLER_H
15#define COLLISIONHANDLER_H
16
17#include "pandabase.h"
18
19#include "typedReferenceCount.h"
20#include "nodePath.h"
21
22class CollisionEntry;
23
24/**
25 * The abstract interface to a number of classes that decide what to do when a
26 * collision is detected. One of these must be assigned to the
27 * CollisionTraverser that is processing collisions in order to specify how to
28 * dispatch detected collisions.
29 */
30class EXPCL_PANDA_COLLIDE CollisionHandler : public TypedReferenceCount {
31public:
32 CollisionHandler();
33
34 virtual void begin_group();
35 virtual void add_entry(CollisionEntry *entry);
36 virtual bool end_group();
37
38 INLINE bool wants_all_potential_collidees() const;
39 INLINE void set_root(const NodePath &root);
40
41PUBLISHED:
42 static TypeHandle get_class_type() {
43 return _type_handle;
44 }
45
46public:
47 static void init_type() {
48 TypedReferenceCount::init_type();
49 register_type(_type_handle, "CollisionHandler",
50 TypedReferenceCount::get_class_type());
51 }
52 virtual TypeHandle get_type() const {
53 return get_class_type();
54 }
55 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
56
57protected:
58 bool _wants_all_potential_collidees;
59 const NodePath *_root;
60
61private:
62 static TypeHandle _type_handle;
63
64 friend class CollisionTraverser;
65};
66
67#include "collisionHandler.I"
68
69#endif
Defines a single collision event.
bool wants_all_potential_collidees() const
Returns true if handler wants to know about all solids that are within the collider's bounding volume...
virtual bool end_group()
Called by the CollisionTraverser at the completion of all collision detections for this traversal.
virtual void begin_group()
Will be called by the CollisionTraverser before a new traversal is begun.
virtual void add_entry(CollisionEntry *entry)
Called between a begin_group() .
void set_root(const NodePath &root)
Sets the root of the collision traversal.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition nodePath.h:159
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.