Panda3D

collisionLine.h

00001 // Filename: collisionLine.h
00002 // Created by:  drose (05Jan05)
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 COLLISIONLINE_H
00016 #define COLLISIONLINE_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "collisionRay.h"
00021 
00022 ////////////////////////////////////////////////////////////////////
00023 //       Class : CollisionLine
00024 // Description : An infinite line, similar to a CollisionRay, except
00025 //               that it extends in both directions.  It is, however,
00026 //               directional.
00027 ////////////////////////////////////////////////////////////////////
00028 class EXPCL_PANDA_COLLIDE CollisionLine : public CollisionRay {
00029 PUBLISHED:
00030   INLINE CollisionLine();
00031   INLINE CollisionLine(const LPoint3 &origin, const LVector3 &direction);
00032   INLINE CollisionLine(PN_stdfloat ox, PN_stdfloat oy, PN_stdfloat oz,
00033                        PN_stdfloat dx, PN_stdfloat dy, PN_stdfloat dz);
00034 
00035 public:
00036   INLINE CollisionLine(const CollisionLine &copy);
00037   virtual CollisionSolid *make_copy();
00038 
00039   virtual PT(CollisionEntry)
00040   test_intersection(const CollisionEntry &entry) const;
00041 
00042   virtual void output(ostream &out) const;
00043 
00044 protected:
00045   virtual void fill_viz_geom();
00046 
00047 public:
00048   static void register_with_read_factory();
00049   virtual void write_datagram(BamWriter *manager, Datagram &dg);
00050 
00051 protected:
00052   static TypedWritable *make_from_bam(const FactoryParams &params);
00053   void fillin(DatagramIterator &scan, BamReader *manager);
00054 
00055 public:
00056   static TypeHandle get_class_type() {
00057     return _type_handle;
00058   }
00059   static void init_type() {
00060     CollisionRay::init_type();
00061     register_type(_type_handle, "CollisionLine",
00062                   CollisionRay::get_class_type());
00063   }
00064   virtual TypeHandle get_type() const {
00065     return get_class_type();
00066   }
00067   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00068 
00069 private:
00070   static TypeHandle _type_handle;
00071 };
00072 
00073 #include "collisionLine.I"
00074 
00075 #endif
00076 
00077 
 All Classes Functions Variables Enumerations