14 #ifndef COLLISIONBOX_H 15 #define COLLISIONBOX_H 30 PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
31 INLINE
explicit CollisionBox(
const LPoint3 &min,
const LPoint3 &max);
33 virtual LPoint3 get_collision_origin()
const;
44 virtual void xform(
const LMatrix4 &mat);
49 virtual void output(std::ostream &out)
const;
51 INLINE
static void flush_level();
55 INLINE
int get_num_points()
const;
56 INLINE LPoint3 get_point_aabb(
int n)
const;
57 INLINE LPoint3 get_point(
int n)
const;
58 INLINE
int get_num_planes()
const;
59 INLINE LPlane set_plane(
int n)
const;
60 INLINE LPlane get_plane(
int n)
const;
61 INLINE
void set_center(
const LPoint3 ¢er);
62 INLINE
void set_center(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
63 INLINE
const LPoint3 &get_center()
const;
64 INLINE
const LPoint3 &get_min()
const;
65 INLINE
const LPoint3 &get_max()
const;
66 INLINE LVector3 get_dimensions()
const;
69 MAKE_PROPERTY(center, get_center);
70 MAKE_PROPERTY(min, get_min);
71 MAKE_PROPERTY(max, get_max);
72 MAKE_PROPERTY(dimensions, get_dimensions);
89 virtual void fill_viz_geom();
92 bool intersects_line(
double &t1,
double &t2,
93 const LPoint3 &from,
const LVector3 &delta,
94 PN_stdfloat inflate_size=0)
const;
100 PN_stdfloat _x, _y, _z, _radius;
104 static const int plane_def[6][4];
110 INLINE
static bool is_right(
const LVector2 &v1,
const LVector2 &v2);
111 INLINE
static PN_stdfloat dist_to_line(
const LPoint2 &p,
112 const LPoint2 &f,
const LVector2 &v);
113 static PN_stdfloat dist_to_line_segment(
const LPoint2 &p,
114 const LPoint2 &f,
const LPoint2 &t,
120 INLINE
PointDef(
const LPoint2 &p,
const LVector2 &v);
121 INLINE
PointDef(PN_stdfloat x, PN_stdfloat y);
123 INLINE
void operator = (
const PointDef ©);
130 static void compute_vectors(
Points &points);
132 const Points &points)
const;
134 bool point_is_inside(
const LPoint2 &p,
const Points &points)
const;
135 PN_stdfloat dist_to_polygon(
const LPoint2 &p,
const Points &points)
const;
137 void setup_points(
const LPoint3 *begin,
const LPoint3 *end,
int plane);
138 INLINE LPoint2 to_2d(
const LVecBase3 &point3d,
int plane)
const;
139 INLINE
void calc_to_3d_mat(LMatrix4 &to_3d_mat,
int plane)
const;
140 INLINE
void rederive_to_3d_mat(LMatrix4 &to_3d_mat,
int plane)
const;
141 INLINE
static LPoint3 to_3d(
const LVecBase2 &point2d,
const LMatrix4 &to_3d_mat);
142 LPoint3 legacy_to_3d(
const LVecBase2 &point2d,
int axis)
const;
143 bool clip_polygon(
Points &new_points,
const Points &source_points,
144 const LPlane &plane,
int plane_no)
const;
150 LMatrix4 _to_2d_mat[6];
153 INLINE
Points get_plane_points(
int n );
156 static void register_with_read_factory();
167 static void init_type() {
168 CollisionSolid::init_type();
170 CollisionSolid::get_class_type());
173 return get_class_type();
175 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
The abstract base class for all things that can collide with other things in the world,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A cuboid collision volume or object.
Base class for objects that can be written to and read from Bam files.
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.
This functions similarly to a LightAttrib.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
virtual void write_datagram(BamWriter *manager, Datagram &me)
Function to write the important information in the particular object to a Datagram.
bool is_right(const LVector2 &v1, const LVector2 &v2)
Returns true if the 2-d v1 is to the right of v2.
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
A lightweight class that represents a single element that may be timed and/or counted via stats.
Defines a single collision event.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual PStatCollector & get_test_pcollector()
Returns a PStatCollector that is used to count the number of intersection tests made against a solid ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A class to retrieve the individual data elements previously stored in a Datagram.
TypeHandle is the identifier used to differentiate C++ class types.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
A node that holds Geom objects, renderable pieces of geometry.