Panda3D
eggBinner.h
1 // Filename: eggBinner.h
2 // Created by: drose (17Feb00)
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 EGGBINNER_H
16 #define EGGBINNER_H
17 
18 #include "pandabase.h"
19 
20 #include "eggBinMaker.h"
21 
22 class EggLoader;
23 
24 ////////////////////////////////////////////////////////////////////
25 // Class : EggBinner
26 // Description : A special binner used only within this package to
27 // pre-process the egg tree for the loader and group
28 // things together as appropriate.
29 //
30 // It is used to collect similar polygons together for a
31 // Geom, as well as to group related LOD children
32 // together under a single LOD node.
33 ////////////////////////////////////////////////////////////////////
34 class EggBinner : public EggBinMaker {
35 public:
36  // The BinNumber serves to identify why a particular EggBin was
37  // created.
38  enum BinNumber {
39  BN_none = 0,
40  BN_polyset,
41  BN_lod,
42  BN_nurbs_surface,
43  BN_nurbs_curve,
44  BN_patches,
45  };
46 
47  EggBinner(EggLoader &loader);
48 
49  virtual void
50  prepare_node(EggNode *node);
51 
52  virtual int
53  get_bin_number(const EggNode *node);
54 
55  virtual string
56  get_bin_name(int bin_number, const EggNode *child);
57 
58  virtual bool
59  sorts_less(int bin_number, const EggNode *a, const EggNode *b);
60 
61  EggLoader &_loader;
62 };
63 
64 
65 #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...
Definition: eggBinner.cxx:104
This is a handy class for collecting related nodes together.
Definition: eggBinMaker.h:254
A special binner used only within this package to pre-process the egg tree for the loader and group t...
Definition: eggBinner.h:34
virtual void prepare_node(EggNode *node)
May be overridden in derived classes to perform some setup work as each node is encountered.
Definition: eggBinner.cxx:44
A base class for things that may be directly added into the egg hierarchy.
Definition: eggNode.h:38
virtual string get_bin_name(int bin_number, const EggNode *child)
May be overridden in derived classes to define a name for each new bin, based on its bin number...
Definition: eggBinner.cxx:90
Converts an egg data structure, possibly read from an egg file but not necessarily, into a scene graph suitable for rendering.
Definition: eggLoader.h:70