Panda3D

collisionPlane.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 collisionPlane.h
10 * @author drose
11 * @date 2000-04-25
12 */
13
14 #ifndef COLLISIONPLANE_H
15 #define COLLISIONPLANE_H
16
17 #include "pandabase.h"
18
19 #include "collisionSolid.h"
20
21 #include "luse.h"
22 #include "plane.h"
23
24 /**
25 *
26 */
27 class EXPCL_PANDA_COLLIDE CollisionPlane : public CollisionSolid {
28 protected:
29 INLINE CollisionPlane();
30
31 PUBLISHED:
32 INLINE CollisionPlane(const LPlane &plane);
33 INLINE CollisionPlane(const CollisionPlane &copy);
34
35 virtual LPoint3 get_collision_origin() const;
36
37 public:
38 virtual CollisionSolid *make_copy();
39
40 virtual void xform(const LMatrix4 &mat);
41
42 virtual PStatCollector &get_volume_pcollector();
43 virtual PStatCollector &get_test_pcollector();
44
45 virtual void output(std::ostream &out) const;
46
47 INLINE static void flush_level();
48
49 PUBLISHED:
50 INLINE LVector3 get_normal() const;
51 INLINE PN_stdfloat dist_to_plane(const LPoint3 &point) const;
52
53 INLINE void set_plane(const LPlane &plane);
54 INLINE const LPlane &get_plane() const;
55
56 INLINE void flip();
57
58 PUBLISHED:
59 MAKE_PROPERTY(normal, get_normal);
60 MAKE_PROPERTY(plane, get_plane, set_plane);
61
62 protected:
63 virtual PT(BoundingVolume) compute_internal_bounds() const;
64
65 protected:
66 virtual PT(CollisionEntry)
67 test_intersection_from_sphere(const CollisionEntry &entry) const;
68 virtual PT(CollisionEntry)
69 test_intersection_from_line(const CollisionEntry &entry) const;
70 virtual PT(CollisionEntry)
71 test_intersection_from_ray(const CollisionEntry &entry) const;
72 virtual PT(CollisionEntry)
73 test_intersection_from_segment(const CollisionEntry &entry) const;
74 virtual PT(CollisionEntry)
75 test_intersection_from_capsule(const CollisionEntry &entry) const;
76 virtual PT(CollisionEntry)
77 test_intersection_from_parabola(const CollisionEntry &entry) const;
78 virtual PT(CollisionEntry)
79 test_intersection_from_box(const CollisionEntry &entry) const;
80
81 virtual void fill_viz_geom();
82
83 private:
84 LPlane _plane;
85
86 static PStatCollector _volume_pcollector;
87 static PStatCollector _test_pcollector;
88
89 public:
90 static void register_with_read_factory();
91 virtual void write_datagram(BamWriter* manager, Datagram &me);
92
93 static TypedWritable *make_CollisionPlane(const FactoryParams &params);
94
95 protected:
96 void fillin(DatagramIterator& scan, BamReader* manager);
97
98 public:
99 static TypeHandle get_class_type() {
100 return _type_handle;
101 }
102 static void init_type() {
103 CollisionSolid::init_type();
104 register_type(_type_handle, "CollisionPlane",
105 CollisionSolid::get_class_type());
106 }
107 virtual TypeHandle get_type() const {
108 return get_class_type();
109 }
110 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
111
112 private:
113 static TypeHandle _type_handle;
114 };
115
116 #include "collisionPlane.I"
117
118 #endif
BamReader
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
BamWriter
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
BoundingVolume
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
Definition: boundingVolume.h:41
CollisionEntry
Defines a single collision event.
Definition: collisionEntry.h:42
CollisionPlane
Definition: collisionPlane.h:27
CollisionSolid
The abstract base class for all things that can collide with other things in the world,...
Definition: collisionSolid.h:45
CollisionSolid::write_datagram
virtual void write_datagram(BamWriter *manager, Datagram &me)
Function to write the important information in the particular object to a Datagram.
Definition: collisionSolid.cxx:345
CollisionSolid::get_test_pcollector
virtual PStatCollector & get_test_pcollector()
Returns a PStatCollector that is used to count the number of intersection tests made against a solid ...
Definition: collisionSolid.cxx:169
DatagramIterator
A class to retrieve the individual data elements previously stored in a Datagram.
Definition: datagramIterator.h:27
Datagram
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38
FactoryParams
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
PStatCollector
A lightweight class that represents a single element that may be timed and/or counted via stats.
Definition: pStatCollector.h:43
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
TypedWritable
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
collisionPlane.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
collisionSolid.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
luse.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
plane.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