00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef COLLISIONSEGMENT_H
00020 #define COLLISIONSEGMENT_H
00021
00022 #include "pandabase.h"
00023
00024 #include "collisionSolid.h"
00025
00026 class LensNode;
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 class EXPCL_PANDA CollisionSegment : public CollisionSolid {
00040 PUBLISHED:
00041 INLINE CollisionSegment();
00042 INLINE CollisionSegment(const LPoint3f &a, const LPoint3f &db);
00043 INLINE CollisionSegment(float ax, float ay, float az,
00044 float bx, float by, float bz);
00045
00046 public:
00047 INLINE CollisionSegment(const CollisionSegment ©);
00048 virtual CollisionSolid *make_copy();
00049
00050 virtual PT(CollisionEntry)
00051 test_intersection(const CollisionEntry &entry) const;
00052
00053 virtual void xform(const LMatrix4f &mat);
00054 virtual LPoint3f get_collision_origin() const;
00055
00056 virtual void output(ostream &out) const;
00057
00058 PUBLISHED:
00059 INLINE void set_point_a(const LPoint3f &a);
00060 INLINE void set_point_a(float x, float y, float z);
00061 INLINE const LPoint3f &get_point_a() const;
00062
00063 INLINE void set_point_b(const LPoint3f &b);
00064 INLINE void set_point_b(float x, float y, float z);
00065 INLINE const LPoint3f &get_point_b() const;
00066
00067 bool set_from_lens(LensNode *camera, const LPoint2f &point);
00068 INLINE bool set_from_lens(LensNode *camera, float px, float py);
00069
00070 protected:
00071 virtual BoundingVolume *recompute_bound();
00072
00073 protected:
00074 virtual void fill_viz_geom();
00075
00076 private:
00077 LPoint3f _a, _b;
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 ¶ms);
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, "CollisionSegment",
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 "collisionSegment.I"
00106
00107 #endif
00108
00109