00001 // Filename: eggBinner.h 00002 // Created by: drose (17Feb00) 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 EGGBINNER_H 00016 #define EGGBINNER_H 00017 00018 #include "pandabase.h" 00019 00020 #include "eggBinMaker.h" 00021 00022 class EggLoader; 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Class : EggBinner 00026 // Description : A special binner used only within this package to 00027 // pre-process the egg tree for the loader and group 00028 // things together as appropriate. 00029 // 00030 // It is used to collect similar polygons together for a 00031 // Geom, as well as to group related LOD children 00032 // together under a single LOD node. 00033 //////////////////////////////////////////////////////////////////// 00034 class EggBinner : public EggBinMaker { 00035 public: 00036 // The BinNumber serves to identify why a particular EggBin was 00037 // created. 00038 enum BinNumber { 00039 BN_none = 0, 00040 BN_polyset, 00041 BN_lod, 00042 BN_nurbs_surface, 00043 BN_nurbs_curve, 00044 }; 00045 00046 EggBinner(EggLoader &loader); 00047 00048 virtual void 00049 prepare_node(EggNode *node); 00050 00051 virtual int 00052 get_bin_number(const EggNode *node); 00053 00054 virtual string 00055 get_bin_name(int bin_number, const EggNode *child); 00056 00057 virtual bool 00058 sorts_less(int bin_number, const EggNode *a, const EggNode *b); 00059 00060 EggLoader &_loader; 00061 }; 00062 00063 00064 #endif