00001 // Filename: planeNode.h 00002 // Created by: drose (11Jul02) 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 PLANENODE_H 00020 #define PLANENODE_H 00021 00022 #include "pandabase.h" 00023 00024 #include "plane.h" 00025 #include "pandaNode.h" 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Class : PlaneNode 00029 // Description : A node that contains a plane. This is most often 00030 // used as a clipping plane, but it can serve other 00031 // purposes as well; whenever a plane is needed to be 00032 // defined in some coordinate space in the world. 00033 //////////////////////////////////////////////////////////////////// 00034 class EXPCL_PANDA PlaneNode : public PandaNode { 00035 PUBLISHED: 00036 PlaneNode(const string &name); 00037 00038 protected: 00039 PlaneNode(const PlaneNode ©); 00040 public: 00041 virtual void output(ostream &out) const; 00042 virtual void write(ostream &out, int indent_level = 0) const; 00043 00044 virtual PandaNode *make_copy() const; 00045 virtual void xform(const LMatrix4f &mat); 00046 00047 PUBLISHED: 00048 INLINE void set_plane(const Planef &plane); 00049 INLINE const Planef &get_plane() const; 00050 00051 private: 00052 // This is the data that must be cycled between pipeline stages. 00053 class EXPCL_PANDA CData : public CycleData { 00054 public: 00055 INLINE CData(); 00056 INLINE CData(const CData ©); 00057 virtual CycleData *make_copy() const; 00058 virtual void write_datagram(BamWriter *manager, Datagram &dg) const; 00059 virtual void fillin(DatagramIterator &scan, BamReader *manager); 00060 00061 Planef _plane; 00062 }; 00063 00064 PipelineCycler<CData> _cycler; 00065 typedef CycleDataReader<CData> CDReader; 00066 typedef CycleDataWriter<CData> CDWriter; 00067 00068 public: 00069 static void register_with_read_factory(); 00070 virtual void write_datagram(BamWriter *manager, Datagram &dg); 00071 00072 protected: 00073 static TypedWritable *make_from_bam(const FactoryParams ¶ms); 00074 void fillin(DatagramIterator &scan, BamReader *manager); 00075 00076 public: 00077 static TypeHandle get_class_type() { 00078 return _type_handle; 00079 } 00080 static void init_type() { 00081 PandaNode::init_type(); 00082 register_type(_type_handle, "PlaneNode", 00083 PandaNode::get_class_type()); 00084 } 00085 virtual TypeHandle get_type() const { 00086 return get_class_type(); 00087 } 00088 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00089 00090 private: 00091 static TypeHandle _type_handle; 00092 }; 00093 00094 #include "planeNode.I" 00095 00096 #endif