Panda3D
|
00001 // Filename: cullBinAttrib.h 00002 // Created by: drose (01Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef CULLBINATTRIB_H 00016 #define CULLBINATTRIB_H 00017 00018 #include "pandabase.h" 00019 00020 #include "renderAttrib.h" 00021 00022 class FactoryParams; 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Class : CullBinAttrib 00026 // Description : Assigns geometry to a particular bin by name. The 00027 // bins must be created separately via the 00028 // CullBinManager interface. 00029 //////////////////////////////////////////////////////////////////// 00030 class EXPCL_PANDA_PGRAPH CullBinAttrib : public RenderAttrib { 00031 private: 00032 INLINE CullBinAttrib(); 00033 00034 PUBLISHED: 00035 static CPT(RenderAttrib) make(const string &bin_name, int draw_order); 00036 static CPT(RenderAttrib) make_default(); 00037 00038 INLINE const string &get_bin_name() const; 00039 INLINE int get_draw_order() const; 00040 00041 public: 00042 virtual void output(ostream &out) const; 00043 00044 protected: 00045 virtual int compare_to_impl(const RenderAttrib *other) const; 00046 00047 private: 00048 string _bin_name; 00049 int _draw_order; 00050 00051 PUBLISHED: 00052 static int get_class_slot() { 00053 return _attrib_slot; 00054 } 00055 virtual int get_slot() const { 00056 return get_class_slot(); 00057 } 00058 00059 public: 00060 static void register_with_read_factory(); 00061 virtual void write_datagram(BamWriter *manager, Datagram &dg); 00062 00063 protected: 00064 static TypedWritable *make_from_bam(const FactoryParams ¶ms); 00065 void fillin(DatagramIterator &scan, BamReader *manager); 00066 00067 public: 00068 static TypeHandle get_class_type() { 00069 return _type_handle; 00070 } 00071 static void init_type() { 00072 RenderAttrib::init_type(); 00073 register_type(_type_handle, "CullBinAttrib", 00074 RenderAttrib::get_class_type()); 00075 _attrib_slot = register_slot(_type_handle, 100, make_default); 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 static int _attrib_slot; 00085 }; 00086 00087 #include "cullBinAttrib.I" 00088 00089 #endif 00090