Panda3D
 All Classes Functions Variables Enumerations
eggPolysetMaker.h
1 // Filename: eggPolysetMaker.h
2 // Created by: drose (19Jun01)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef EGGPOLYSETMAKER_H
16 #define EGGPOLYSETMAKER_H
17 
18 #include "pandabase.h"
19 
20 #include "eggBinMaker.h"
21 
22 #include "dcast.h"
23 
24 ////////////////////////////////////////////////////////////////////
25 // Class : EggPolysetMaker
26 // Description : A specialization on EggBinMaker for making polysets
27 // that share the same basic rendering characteristic.
28 // This really just defines the example functions
29 // described in the leading comment to EggBinMaker.
30 //
31 // It makes some common assumptions about how polysets
32 // should be grouped; if these are not sufficient, you
33 // can always rederive your own further specialization
34 // of this class.
35 ////////////////////////////////////////////////////////////////////
36 class EXPCL_PANDAEGG EggPolysetMaker : public EggBinMaker {
37 PUBLISHED:
38  // The BinNumber serves to identify why a particular EggBin was
39  // created.
40  enum BinNumber {
41  BN_none = 0,
42  BN_polyset,
43  };
44 
45  enum Properties {
46  P_has_texture = 0x001,
47  P_texture = 0x002,
48  P_has_material = 0x004,
49  P_material = 0x008,
50  P_has_poly_color = 0x010,
51  P_poly_color = 0x020,
52  P_has_poly_normal = 0x040,
53  P_has_vertex_normal = 0x080,
54  P_has_vertex_color = 0x100,
55  P_bface = 0x200,
56  };
57 
59  void set_properties(int properties);
60 
61 public:
62  virtual int
63  get_bin_number(const EggNode *node);
64 
65  virtual bool
66  sorts_less(int bin_number, const EggNode *a, const EggNode *b);
67 
68 private:
69  int _properties;
70 
71 public:
72  static TypeHandle get_class_type() {
73  return _type_handle;
74  }
75  static void init_type() {
76  EggBinMaker::init_type();
77  register_type(_type_handle, "EggPolysetMaker",
78  EggBinMaker::get_class_type());
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 };
88 
89 
90 #endif
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...
This is a handy class for collecting related nodes together.
Definition: eggBinMaker.h:254
A base class for things that may be directly added into the egg hierarchy.
Definition: eggNode.h:38
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:85