Panda3D
 All Classes Functions Variables Enumerations
cullBinAttrib.h
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   virtual size_t get_hash_impl() const;
00047 
00048 private:
00049   string _bin_name;
00050   int _draw_order;
00051 
00052 PUBLISHED:
00053   static int get_class_slot() {
00054     return _attrib_slot;
00055   }
00056   virtual int get_slot() const {
00057     return get_class_slot();
00058   }
00059 
00060 public:
00061   static void register_with_read_factory();
00062   virtual void write_datagram(BamWriter *manager, Datagram &dg);
00063 
00064 protected:
00065   static TypedWritable *make_from_bam(const FactoryParams &params);
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     RenderAttrib::init_type();
00074     register_type(_type_handle, "CullBinAttrib",
00075                   RenderAttrib::get_class_type());
00076     _attrib_slot = register_slot(_type_handle, 100, make_default);
00077   }
00078   virtual TypeHandle get_type() const {
00079     return get_class_type();
00080   }
00081   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00082 
00083 private:
00084   static TypeHandle _type_handle;
00085   static int _attrib_slot;
00086 };
00087 
00088 #include "cullBinAttrib.I"
00089 
00090 #endif
00091 
 All Classes Functions Variables Enumerations