00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef BILLBOARDEFFECT_H
00020 #define BILLBOARDEFFECT_H
00021
00022 #include "pandabase.h"
00023
00024 #include "renderEffect.h"
00025 #include "luse.h"
00026 #include "nodePath.h"
00027
00028
00029
00030
00031
00032
00033
00034 class EXPCL_PANDA BillboardEffect : public RenderEffect {
00035 private:
00036 INLINE BillboardEffect();
00037
00038 PUBLISHED:
00039 static CPT(RenderEffect) make(const LVector3f &up_vector,
00040 bool eye_relative,
00041 bool axial_rotate,
00042 float offset,
00043 const NodePath &look_at,
00044 const LPoint3f &look_at_point);
00045 INLINE static CPT(RenderEffect) make_axis();
00046 INLINE static CPT(RenderEffect) make_point_eye();
00047 INLINE static CPT(RenderEffect) make_point_world();
00048
00049 INLINE bool is_off() const;
00050 INLINE const LVector3f &get_up_vector() const;
00051 INLINE bool get_eye_relative() const;
00052 INLINE bool get_axial_rotate() const;
00053 INLINE float get_offset() const;
00054 INLINE const NodePath &get_look_at() const;
00055 INLINE const LPoint3f &get_look_at_point() const;
00056
00057 public:
00058 virtual bool safe_to_transform() const;
00059 virtual void output(ostream &out) const;
00060
00061 CPT(TransformState) do_billboard(const TransformState *net_transform,
00062 const TransformState *camera_transform) const;
00063
00064 protected:
00065 virtual int compare_to_impl(const RenderEffect *other) const;
00066
00067 private:
00068 bool _off;
00069 LVector3f _up_vector;
00070 bool _eye_relative;
00071 bool _axial_rotate;
00072 float _offset;
00073 NodePath _look_at;
00074 LPoint3f _look_at_point;
00075
00076 public:
00077 static void register_with_read_factory();
00078 virtual void write_datagram(BamWriter *manager, Datagram &dg);
00079
00080 protected:
00081 static TypedWritable *make_from_bam(const FactoryParams ¶ms);
00082 void fillin(DatagramIterator &scan, BamReader *manager);
00083
00084 public:
00085 static TypeHandle get_class_type() {
00086 return _type_handle;
00087 }
00088 static void init_type() {
00089 RenderEffect::init_type();
00090 register_type(_type_handle, "BillboardEffect",
00091 RenderEffect::get_class_type());
00092 }
00093 virtual TypeHandle get_type() const {
00094 return get_class_type();
00095 }
00096 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00097
00098 private:
00099 static TypeHandle _type_handle;
00100 };
00101
00102 #include "billboardEffect.I"
00103
00104 #endif
00105