Panda3D
 All Classes Functions Variables Enumerations
collisionParabola.h
00001 // Filename: collisionParabola.h
00002 // Created by:  drose (11Oct07)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef COLLISIONPARABOLA_H
00016 #define COLLISIONPARABOLA_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "collisionSolid.h"
00021 #include "parabola.h"
00022 
00023 class LensNode;
00024 
00025 ////////////////////////////////////////////////////////////////////
00026 //       Class : CollisionParabola
00027 // Description : This defines a parabolic arc, or subset of an arc,
00028 //               similar to the path of a projectile or falling
00029 //               object.  It is finite, having a specific beginning
00030 //               and end, but it is infinitely thin.
00031 //
00032 //               Think of it as a wire bending from point t1 to point
00033 //               t2 along the path of a pre-defined parabola.
00034 ////////////////////////////////////////////////////////////////////
00035 class EXPCL_PANDA_COLLIDE CollisionParabola : public CollisionSolid {
00036 PUBLISHED:
00037   INLINE CollisionParabola();
00038   INLINE CollisionParabola(const LParabola &parabola, PN_stdfloat t1, PN_stdfloat t2);
00039 
00040   virtual LPoint3 get_collision_origin() const;
00041 
00042 public:
00043   INLINE CollisionParabola(const CollisionParabola &copy);
00044   virtual CollisionSolid *make_copy();
00045 
00046   virtual PT(CollisionEntry)
00047   test_intersection(const CollisionEntry &entry) const;
00048 
00049   virtual void xform(const LMatrix4 &mat);
00050 
00051   virtual PStatCollector &get_volume_pcollector();
00052   virtual PStatCollector &get_test_pcollector();
00053 
00054   virtual void output(ostream &out) const;
00055 
00056 PUBLISHED:
00057   INLINE void set_parabola(const LParabola &parabola);
00058   INLINE const LParabola &get_parabola() const;
00059 
00060   INLINE void set_t1(PN_stdfloat t1);
00061   INLINE PN_stdfloat get_t1() const;
00062 
00063   INLINE void set_t2(PN_stdfloat t2);
00064   INLINE PN_stdfloat get_t2() const;
00065 
00066 protected:
00067   virtual PT(BoundingVolume) compute_internal_bounds() const;
00068 
00069 protected:
00070   virtual void fill_viz_geom();
00071 
00072 private:
00073   LParabola _parabola;
00074   PN_stdfloat _t1, _t2;
00075 
00076   static PStatCollector _volume_pcollector;
00077   static PStatCollector _test_pcollector;
00078 
00079 public:
00080   static void register_with_read_factory();
00081   virtual void write_datagram(BamWriter *manager, Datagram &dg);
00082 
00083 protected:
00084   static TypedWritable *make_from_bam(const FactoryParams &params);
00085   void fillin(DatagramIterator &scan, BamReader *manager);
00086 
00087 public:
00088   static TypeHandle get_class_type() {
00089     return _type_handle;
00090   }
00091   static void init_type() {
00092     CollisionSolid::init_type();
00093     register_type(_type_handle, "CollisionParabola",
00094                   CollisionSolid::get_class_type());
00095   }
00096   virtual TypeHandle get_type() const {
00097     return get_class_type();
00098   }
00099   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00100 
00101 private:
00102   static TypeHandle _type_handle;
00103 };
00104 
00105 #include "collisionParabola.I"
00106 
00107 #endif
00108 
00109 
 All Classes Functions Variables Enumerations