Panda3D
eggPolysetMaker.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 eggPolysetMaker.h
10  * @author drose
11  * @date 2001-06-19
12  */
13 
14 #ifndef EGGPOLYSETMAKER_H
15 #define EGGPOLYSETMAKER_H
16 
17 #include "pandabase.h"
18 
19 #include "eggBinMaker.h"
20 
21 #include "dcast.h"
22 
23 /**
24  * A specialization on EggBinMaker for making polysets that share the same
25  * basic rendering characteristic. This really just defines the example
26  * functions described in the leading comment to EggBinMaker.
27  *
28  * It makes some common assumptions about how polysets should be grouped; if
29  * these are not sufficient, you can always rederive your own further
30  * specialization of this class.
31  */
32 class EXPCL_PANDA_EGG EggPolysetMaker : public EggBinMaker {
33 PUBLISHED:
34  // The BinNumber serves to identify why a particular EggBin was created.
35  enum BinNumber {
36  BN_none = 0,
37  BN_polyset,
38  };
39 
40  enum Properties {
41  P_has_texture = 0x001,
42  P_texture = 0x002,
43  P_has_material = 0x004,
44  P_material = 0x008,
45  P_has_poly_color = 0x010,
46  P_poly_color = 0x020,
47  P_has_poly_normal = 0x040,
48  P_has_vertex_normal = 0x080,
49  P_has_vertex_color = 0x100,
50  P_bface = 0x200,
51  };
52 
54  void set_properties(int properties);
55 
56 public:
57  virtual int
58  get_bin_number(const EggNode *node);
59 
60  virtual bool
61  sorts_less(int bin_number, const EggNode *a, const EggNode *b);
62 
63 private:
64  int _properties;
65 
66 public:
67  static TypeHandle get_class_type() {
68  return _type_handle;
69  }
70  static void init_type() {
71  EggBinMaker::init_type();
72  register_type(_type_handle, "EggPolysetMaker",
73  EggBinMaker::get_class_type());
74  }
75  virtual TypeHandle get_type() const {
76  return get_class_type();
77  }
78  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
79 
80 private:
81  static TypeHandle _type_handle;
82 };
83 
84 
85 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual bool sorts_less(int bin_number, const EggNode *a, const EggNode *b)
May be overridden in derived classes to create additional bins within a particular bin number,...
Definition: eggBinMaker.cxx:98
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a handy class for collecting related nodes together.
Definition: eggBinMaker.h:161
A base class for things that may be directly added into the egg hierarchy.
Definition: eggNode.h:35
A specialization on EggBinMaker for making polysets that share the same basic rendering characteristi...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81