Panda3D
cullBinAttrib.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file cullBinAttrib.h
10  * @author drose
11  * @date 2002-03-01
12  */
13 
14 #ifndef CULLBINATTRIB_H
15 #define CULLBINATTRIB_H
16 
17 #include "pandabase.h"
18 
19 #include "renderAttrib.h"
20 
21 class FactoryParams;
22 
23 /**
24  * Assigns geometry to a particular bin by name. The bins must be created
25  * separately via the CullBinManager interface.
26  */
27 class EXPCL_PANDA_PGRAPH CullBinAttrib : public RenderAttrib {
28 private:
29  INLINE CullBinAttrib();
30 
31 PUBLISHED:
32  static CPT(RenderAttrib) make(const std::string &bin_name, int draw_order);
33  static CPT(RenderAttrib) make_default();
34 
35  INLINE const std::string &get_bin_name() const;
36  INLINE int get_draw_order() const;
37 
38 PUBLISHED:
39  MAKE_PROPERTY(bin_name, get_bin_name);
40  MAKE_PROPERTY(draw_order, get_draw_order);
41 
42 public:
43  virtual void output(std::ostream &out) const;
44 
45 protected:
46  virtual int compare_to_impl(const RenderAttrib *other) const;
47  virtual size_t get_hash_impl() const;
48 
49 private:
50  std::string _bin_name;
51  int _draw_order;
52 
53 PUBLISHED:
54  static int get_class_slot() {
55  return _attrib_slot;
56  }
57  virtual int get_slot() const {
58  return get_class_slot();
59  }
60  MAKE_PROPERTY(class_slot, get_class_slot);
61 
62 public:
63  static void register_with_read_factory();
64  virtual void write_datagram(BamWriter *manager, Datagram &dg);
65 
66 protected:
67  static TypedWritable *make_from_bam(const FactoryParams &params);
68  void fillin(DatagramIterator &scan, BamReader *manager);
69 
70 public:
71  static TypeHandle get_class_type() {
72  return _type_handle;
73  }
74  static void init_type() {
75  RenderAttrib::init_type();
76  register_type(_type_handle, "CullBinAttrib",
77  RenderAttrib::get_class_type());
78  _attrib_slot = register_slot(_type_handle, 100, new CullBinAttrib);
79  }
80  virtual TypeHandle get_type() const {
81  return get_class_type();
82  }
83  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
84 
85 private:
86  static TypeHandle _type_handle;
87  static int _attrib_slot;
88 };
89 
90 #include "cullBinAttrib.I"
91 
92 #endif
This is the base class for a number of render attributes (other than transform) that may be set on sc...
Definition: renderAttrib.h:51
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
static int register_slot(TypeHandle type_handle, int sort, RenderAttrib *default_attrib)
Adds the indicated TypeHandle to the registry, if it is not there already, and returns a unique slot ...
Definition: renderAttrib.I:101
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Assigns geometry to a particular bin by name.
Definition: cullBinAttrib.h:27
A class to retrieve the individual data elements previously stored in a Datagram.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38