Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/pgraph/billboardEffect.h

Go to the documentation of this file.
00001 // Filename: billboardEffect.h
00002 // Created by:  drose (14Mar02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
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 //       Class : BillboardEffect
00030 // Description : Indicates that geometry at this node should
00031 //               automatically rotate to face the camera, or any other
00032 //               arbitrary node.
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 &params);
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 

Generated on Fri May 2 00:41:06 2003 for Panda by doxygen1.3