Go to the documentation of this file.
47 return entry.
get_into()->test_intersection_from_ray(entry);
54 xform(
const LMatrix4 &mat) {
55 _origin = _origin * mat;
56 _direction = _direction * mat;
58 CollisionSolid::xform(mat);
75 output(std::ostream &out)
const {
76 out <<
"ray, o (" << get_origin() <<
"), d (" << get_direction() <<
")";
92 LPoint3 near_point, far_point;
93 if (!lens->
extrude(point, near_point, far_point)) {
94 _origin = LPoint3::origin();
95 _direction = LVector3::forward();
99 _direction = far_point - near_point;
102 mark_internal_bounds_stale();
112 compute_internal_bounds()
const {
122 if (collide_cat.is_debug()) {
124 <<
"Recomputing viz for " << *
this <<
"\n";
127 static const int num_points = 100;
128 static const double scale = 100.0;
136 for (
int i = 0; i < num_points; i++) {
137 double t = ((double)i / (
double)num_points);
138 vertex.add_data3(get_origin() + t * scale * get_direction());
140 color.add_data4(LColor(1.0f, 1.0f, 1.0f, 1.0f) +
141 t * LColor(0.0f, 0.0f, 0.0f, -1.0f));
145 line->add_next_vertices(num_points);
146 line->close_primitive();
149 geom->add_primitive(line);
151 _viz_geom->add_geom(geom, get_other_viz_state());
152 _bounds_viz_geom->add_geom(geom, get_other_bounds_viz_state());
170 _origin.write_datagram(dg);
171 _direction.write_datagram(dg);
186 node->fillin(scan, manager);
197 CollisionSolid::fillin(scan, manager);
198 _origin.read_datagram(scan);
199 _direction.read_datagram(scan);
A container for geometry primitives.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
CollisionRay()
Creates an invalid ray.
An infinite ray, with a specific origin and direction.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
A class to retrieve the individual data elements previously stored in a Datagram.
Defines a single collision event.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
virtual void write_datagram(BamWriter *manager, Datagram &me)
Function to write the important information in the particular object to a Datagram.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Defines a series of line strips.
Base class for objects that can be written to and read from Bam files.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
TypeHandle is the identifier used to differentiate C++ class types.
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 LPoint3 get_collision_origin() const
Returns the point in space deemed to be the "origin" of the solid for collision purposes.
A base class for any number of different kinds of lenses, linear and otherwise.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This funny bounding volume is an infinite line with no thickness and extending to infinity in both di...
void register_factory(TypeHandle handle, CreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
The abstract base class for all things that can collide with other things in the world,...
Lens * get_lens(int index=0) const
Returns a pointer to the particular Lens associated with this LensNode, or NULL if there is not yet a...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A node that contains a Lens.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_into
Returns the CollisionSolid pointer for the particular solid was collided into.
bool set_from_lens(LensNode *camera, const LPoint2 &point)
Accepts a LensNode and a 2-d point in the range [-1,1].
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
static void register_with_read_factory()
Tells the BamReader how to create objects of type CollisionRay.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
bool extrude(const LPoint2 &point2d, LPoint3 &near_point, LPoint3 &far_point) const
Given a 2-d point in the range (-1,1) in both dimensions, where (0,0) is the center of the lens and (...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PT(CollisionEntry) CollisionRay
Transforms the solid by the indicated matrix.