00001 // Filename: lensNode.h 00002 // Created by: drose (26Feb02) 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 LENSNODE_H 00020 #define LENSNODE_H 00021 00022 #include "pandabase.h" 00023 00024 #include "pandaNode.h" 00025 #include "lens.h" 00026 #include "pointerTo.h" 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Class : LensNode 00030 // Description : A node that contains a Lens. The most important 00031 // example of this kind of node is a Camera, but other 00032 // kinds of nodes also contain a lens (for instance, a 00033 // Spotlight). 00034 //////////////////////////////////////////////////////////////////// 00035 class EXPCL_PANDA LensNode : public PandaNode { 00036 PUBLISHED: 00037 LensNode(const string &name); 00038 00039 protected: 00040 LensNode(const LensNode ©); 00041 public: 00042 virtual void output(ostream &out) const; 00043 virtual void write(ostream &out, int indent_level = 0) const; 00044 00045 virtual void xform(const LMatrix4f &mat); 00046 virtual PandaNode *make_copy() const; 00047 00048 PUBLISHED: 00049 INLINE void copy_lens(const Lens &lens); 00050 INLINE void set_lens(Lens *lens); 00051 INLINE Lens *get_lens() const; 00052 00053 bool is_in_view(const LPoint3f &pos); 00054 00055 protected: 00056 PT(Lens) _lens; 00057 00058 public: 00059 static void register_with_read_factory(); 00060 virtual void write_datagram(BamWriter *manager, Datagram &dg); 00061 virtual int complete_pointers(TypedWritable **plist, 00062 BamReader *manager); 00063 00064 protected: 00065 static TypedWritable *make_from_bam(const FactoryParams ¶ms); 00066 void fillin(DatagramIterator &scan, BamReader *manager); 00067 00068 public: 00069 static TypeHandle get_class_type() { 00070 return _type_handle; 00071 } 00072 static void init_type() { 00073 PandaNode::init_type(); 00074 register_type(_type_handle, "LensNode", 00075 PandaNode::get_class_type()); 00076 } 00077 virtual TypeHandle get_type() const { 00078 return get_class_type(); 00079 } 00080 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00081 00082 private: 00083 static TypeHandle _type_handle; 00084 }; 00085 00086 #include "lensNode.I" 00087 00088 #endif