Panda3D
collisionParabola.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 collisionParabola.h
10  * @author drose
11  * @date 2007-10-11
12  */
13 
14 #ifndef COLLISIONPARABOLA_H
15 #define COLLISIONPARABOLA_H
16 
17 #include "pandabase.h"
18 
19 #include "collisionSolid.h"
20 #include "parabola.h"
21 
22 class LensNode;
23 
24 /**
25  * This defines a parabolic arc, or subset of an arc, similar to the path of a
26  * projectile or falling object. It is finite, having a specific beginning
27  * and end, but it is infinitely thin.
28  *
29  * Think of it as a wire bending from point t1 to point t2 along the path of a
30  * pre-defined parabola.
31  */
32 class EXPCL_PANDA_COLLIDE CollisionParabola : public CollisionSolid {
33 PUBLISHED:
34  INLINE CollisionParabola();
35  INLINE explicit CollisionParabola(const LParabola &parabola, PN_stdfloat t1, PN_stdfloat t2);
36 
37  virtual LPoint3 get_collision_origin() const;
38 
39 public:
40  INLINE CollisionParabola(const CollisionParabola &copy);
41  virtual CollisionSolid *make_copy();
42 
43  virtual PT(CollisionEntry)
44  test_intersection(const CollisionEntry &entry) const;
45 
46  virtual void xform(const LMatrix4 &mat);
47 
48  virtual PStatCollector &get_volume_pcollector();
50 
51  virtual void output(std::ostream &out) const;
52 
53 PUBLISHED:
54  INLINE void set_parabola(const LParabola &parabola);
55  INLINE const LParabola &get_parabola() const;
56 
57  INLINE void set_t1(PN_stdfloat t1);
58  INLINE PN_stdfloat get_t1() const;
59 
60  INLINE void set_t2(PN_stdfloat t2);
61  INLINE PN_stdfloat get_t2() const;
62 
63 PUBLISHED:
64  MAKE_PROPERTY(parabola, get_parabola, set_parabola);
65  MAKE_PROPERTY(t1, get_t1, set_t1);
66  MAKE_PROPERTY(t2, get_t2, set_t2);
67 
68 protected:
69  virtual PT(BoundingVolume) compute_internal_bounds() const;
70 
71 protected:
72  virtual void fill_viz_geom();
73 
74 private:
75  LParabola _parabola;
76  PN_stdfloat _t1, _t2;
77 
78  static PStatCollector _volume_pcollector;
79  static PStatCollector _test_pcollector;
80 
81 public:
82  static void register_with_read_factory();
83  virtual void write_datagram(BamWriter *manager, Datagram &dg);
84 
85 protected:
86  static TypedWritable *make_from_bam(const FactoryParams &params);
87  void fillin(DatagramIterator &scan, BamReader *manager);
88 
89 public:
90  static TypeHandle get_class_type() {
91  return _type_handle;
92  }
93  static void init_type() {
94  CollisionSolid::init_type();
95  register_type(_type_handle, "CollisionParabola",
96  CollisionSolid::get_class_type());
97  }
98  virtual TypeHandle get_type() const {
99  return get_class_type();
100  }
101  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
102 
103 private:
104  static TypeHandle _type_handle;
105 };
106 
107 #include "collisionParabola.I"
108 
109 #endif
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...
Definition: bamReader.h:110
The abstract base class for all things that can collide with other things in the world,...
A node that contains a Lens.
Definition: lensNode.h:29
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.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
virtual void write_datagram(BamWriter *manager, Datagram &me)
Function to write the important information in the particular object to a Datagram.
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...
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...
Definition: factoryParams.h:36
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 ...
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.
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