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
22 class 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 */
30 class EXPCL_PANDA_COLLIDE CollisionHandler : public TypedReferenceCount {
31 public:
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
46 public:
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
57 protected:
58 bool _wants_all_potential_collidees;
59 const NodePath *_root;
60
61 private:
62 static TypeHandle _type_handle;
63
64 friend class CollisionTraverser;
65};
66
67#include "collisionHandler.I"
68
69#endif
CollisionEntry
Defines a single collision event.
Definition collisionEntry.h:42
CollisionHandler::wants_all_potential_collidees
bool wants_all_potential_collidees() const
Returns true if handler wants to know about all solids that are within the collider's bounding volume...
Definition collisionHandler.I:19
CollisionHandler::end_group
virtual bool end_group()
Called by the CollisionTraverser at the completion of all collision detections for this traversal.
Definition collisionHandler.cxx:53
CollisionHandler::begin_group
virtual void begin_group()
Will be called by the CollisionTraverser before a new traversal is begun.
Definition collisionHandler.cxx:32
CollisionHandler::add_entry
virtual void add_entry(CollisionEntry *entry)
Called between a begin_group() .
Definition collisionHandler.cxx:40
CollisionHandler::set_root
void set_root(const NodePath &root)
Sets the root of the collision traversal.
Definition collisionHandler.I:28
NodePath
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition nodePath.h:159
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
collisionHandler.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
nodePath.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition register_type.I:22
typedReferenceCount.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.