00001 // Filename: cullBinAttrib.h 00002 // Created by: drose (01Mar02) 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 CULLBINATTRIB_H 00020 #define CULLBINATTRIB_H 00021 00022 #include "pandabase.h" 00023 00024 #include "renderAttrib.h" 00025 00026 class FactoryParams; 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Class : CullBinAttrib 00030 // Description : Assigns geometry to a particular bin by name. The 00031 // bins must be created separately via the 00032 // CullBinManager interface. 00033 //////////////////////////////////////////////////////////////////// 00034 class EXPCL_PANDA CullBinAttrib : public RenderAttrib { 00035 private: 00036 INLINE CullBinAttrib(); 00037 00038 PUBLISHED: 00039 static CPT(RenderAttrib) make(const string &bin_name, int draw_order); 00040 00041 INLINE const string &get_bin_name() const; 00042 INLINE int get_draw_order() const; 00043 00044 public: 00045 virtual void output(ostream &out) const; 00046 00047 protected: 00048 virtual int compare_to_impl(const RenderAttrib *other) const; 00049 virtual RenderAttrib *make_default_impl() const; 00050 00051 private: 00052 string _bin_name; 00053 int _draw_order; 00054 00055 public: 00056 static void register_with_read_factory(); 00057 virtual void write_datagram(BamWriter *manager, Datagram &dg); 00058 00059 protected: 00060 static TypedWritable *make_from_bam(const FactoryParams ¶ms); 00061 void fillin(DatagramIterator &scan, BamReader *manager); 00062 00063 public: 00064 static TypeHandle get_class_type() { 00065 return _type_handle; 00066 } 00067 static void init_type() { 00068 RenderAttrib::init_type(); 00069 register_type(_type_handle, "CullBinAttrib", 00070 RenderAttrib::get_class_type()); 00071 } 00072 virtual TypeHandle get_type() const { 00073 return get_class_type(); 00074 } 00075 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00076 00077 private: 00078 static TypeHandle _type_handle; 00079 }; 00080 00081 #include "cullBinAttrib.I" 00082 00083 #endif 00084