Panda3D
 All Classes Functions Variables Enumerations
collisionParabola.h
1 // Filename: collisionParabola.h
2 // Created by: drose (11Oct07)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef COLLISIONPARABOLA_H
16 #define COLLISIONPARABOLA_H
17 
18 #include "pandabase.h"
19 
20 #include "collisionSolid.h"
21 #include "parabola.h"
22 
23 class LensNode;
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : CollisionParabola
27 // Description : This defines a parabolic arc, or subset of an arc,
28 // similar to the path of a projectile or falling
29 // object. It is finite, having a specific beginning
30 // and end, but it is infinitely thin.
31 //
32 // Think of it as a wire bending from point t1 to point
33 // t2 along the path of a pre-defined parabola.
34 ////////////////////////////////////////////////////////////////////
35 class EXPCL_PANDA_COLLIDE CollisionParabola : public CollisionSolid {
36 PUBLISHED:
37  INLINE CollisionParabola();
38  INLINE CollisionParabola(const LParabola &parabola, PN_stdfloat t1, PN_stdfloat t2);
39 
40  virtual LPoint3 get_collision_origin() const;
41 
42 public:
43  INLINE CollisionParabola(const CollisionParabola &copy);
44  virtual CollisionSolid *make_copy();
45 
46  virtual PT(CollisionEntry)
47  test_intersection(const CollisionEntry &entry) const;
48 
49  virtual void xform(const LMatrix4 &mat);
50 
53 
54  virtual void output(ostream &out) const;
55 
56 PUBLISHED:
57  INLINE void set_parabola(const LParabola &parabola);
58  INLINE const LParabola &get_parabola() const;
59 
60  INLINE void set_t1(PN_stdfloat t1);
61  INLINE PN_stdfloat get_t1() const;
62 
63  INLINE void set_t2(PN_stdfloat t2);
64  INLINE PN_stdfloat get_t2() const;
65 
66 protected:
67  virtual PT(BoundingVolume) compute_internal_bounds() const;
68 
69 protected:
70  virtual void fill_viz_geom();
71 
72 private:
73  LParabola _parabola;
74  PN_stdfloat _t1, _t2;
75 
76  static PStatCollector _volume_pcollector;
77  static PStatCollector _test_pcollector;
78 
79 public:
80  static void register_with_read_factory();
81  virtual void write_datagram(BamWriter *manager, Datagram &dg);
82 
83 protected:
84  static TypedWritable *make_from_bam(const FactoryParams &params);
85  void fillin(DatagramIterator &scan, BamReader *manager);
86 
87 public:
88  static TypeHandle get_class_type() {
89  return _type_handle;
90  }
91  static void init_type() {
92  CollisionSolid::init_type();
93  register_type(_type_handle, "CollisionParabola",
94  CollisionSolid::get_class_type());
95  }
96  virtual TypeHandle get_type() const {
97  return get_class_type();
98  }
99  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
100 
101 private:
102  static TypeHandle _type_handle;
103 };
104 
105 #include "collisionParabola.I"
106 
107 #endif
108 
109 
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:122
The abstract base class for all things that can collide with other things in the world, and all the things they can collide with (except geometry).
A node that contains a Lens.
Definition: lensNode.h:32
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:37
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:73
virtual void write_datagram(BamWriter *manager, Datagram &me)
Function to write the important information in the particular object to a Datagram.
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...
This is a 4-by-4 transform matrix.
Definition: lmatrix.h:451
virtual PStatCollector & get_volume_pcollector()
Returns a PStatCollector that is used to count the number of bounding volume tests made against a sol...
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:40
This defines a parabolic arc, or subset of an arc, similar to the path of a projectile or falling obj...
virtual PStatCollector & get_test_pcollector()
Returns a PStatCollector that is used to count the number of intersection tests made against a solid ...
virtual void xform(const LMatrix4 &mat)
Transforms the solid by the indicated matrix.
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:85
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:43