Panda3D
collisionLine.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 collisionLine.h
10  * @author drose
11  * @date 2005-01-05
12  */
13 
14 #ifndef COLLISIONLINE_H
15 #define COLLISIONLINE_H
16 
17 #include "pandabase.h"
18 
19 #include "collisionRay.h"
20 
21 /**
22  * An infinite line, similar to a CollisionRay, except that it extends in both
23  * directions. It is, however, directional.
24  */
25 class EXPCL_PANDA_COLLIDE CollisionLine : public CollisionRay {
26 PUBLISHED:
27  INLINE CollisionLine();
28  INLINE explicit CollisionLine(const LPoint3 &origin, const LVector3 &direction);
29  INLINE explicit CollisionLine(PN_stdfloat ox, PN_stdfloat oy, PN_stdfloat oz,
30  PN_stdfloat dx, PN_stdfloat dy, PN_stdfloat dz);
31 
32 public:
33  INLINE CollisionLine(const CollisionLine &copy);
34  virtual CollisionSolid *make_copy();
35 
36  virtual PT(CollisionEntry)
37  test_intersection(const CollisionEntry &entry) const;
38 
39  virtual void output(std::ostream &out) const;
40 
41 protected:
42  virtual void fill_viz_geom();
43 
44 public:
45  static void register_with_read_factory();
46  virtual void write_datagram(BamWriter *manager, Datagram &dg);
47 
48 protected:
49  static TypedWritable *make_from_bam(const FactoryParams &params);
50  void fillin(DatagramIterator &scan, BamReader *manager);
51 
52 public:
53  static TypeHandle get_class_type() {
54  return _type_handle;
55  }
56  static void init_type() {
57  CollisionRay::init_type();
58  register_type(_type_handle, "CollisionLine",
59  CollisionRay::get_class_type());
60  }
61  virtual TypeHandle get_type() const {
62  return get_class_type();
63  }
64  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
65 
66 private:
67  static TypeHandle _type_handle;
68 };
69 
70 #include "collisionLine.I"
71 
72 #endif
An infinite ray, with a specific origin and direction.
Definition: collisionRay.h:27
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
The abstract base class for all things that can collide with other things in the world,...
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Defines a single collision event.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
An infinite line, similar to a CollisionRay, except that it extends in both directions.
Definition: collisionLine.h:25
static void register_with_read_factory()
Tells the BamReader how to create objects of type CollisionRay.
A class to retrieve the individual data elements previously stored in a Datagram.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.