Panda3D

eggPolysetMaker.h

00001 // Filename: eggPolysetMaker.h
00002 // Created by:  drose (19Jun01)
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 EGGPOLYSETMAKER_H
00016 #define EGGPOLYSETMAKER_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "eggBinMaker.h"
00021 
00022 #include "dcast.h"
00023 
00024 ////////////////////////////////////////////////////////////////////
00025 //       Class : EggPolysetMaker
00026 // Description : A specialization on EggBinMaker for making polysets
00027 //               that share the same basic rendering characteristic.
00028 //               This really just defines the example functions
00029 //               described in the leading comment to EggBinMaker.
00030 //
00031 //               It makes some common assumptions about how polysets
00032 //               should be grouped; if these are not sufficient, you
00033 //               can always rederive your own further specialization
00034 //               of this class.
00035 ////////////////////////////////////////////////////////////////////
00036 class EXPCL_PANDAEGG EggPolysetMaker : public EggBinMaker {
00037 PUBLISHED:
00038   // The BinNumber serves to identify why a particular EggBin was
00039   // created.
00040   enum BinNumber {
00041     BN_none = 0,
00042     BN_polyset,
00043   };
00044 
00045   enum Properties {
00046     P_has_texture        = 0x001,
00047     P_texture            = 0x002,
00048     P_has_material       = 0x004,
00049     P_material           = 0x008,
00050     P_has_poly_color     = 0x010,
00051     P_poly_color         = 0x020,
00052     P_has_poly_normal    = 0x040,
00053     P_has_vertex_normal  = 0x080,
00054     P_has_vertex_color   = 0x100,
00055     P_bface              = 0x200,
00056   };
00057 
00058   EggPolysetMaker();
00059   void set_properties(int properties);
00060 
00061 public:
00062   virtual int
00063   get_bin_number(const EggNode *node);
00064 
00065   virtual bool
00066   sorts_less(int bin_number, const EggNode *a, const EggNode *b);
00067 
00068 private:
00069   int _properties;
00070 
00071 public:
00072   static TypeHandle get_class_type() {
00073     return _type_handle;
00074   }
00075   static void init_type() {
00076     EggBinMaker::init_type();
00077     register_type(_type_handle, "EggPolysetMaker",
00078                   EggBinMaker::get_class_type());
00079   }
00080   virtual TypeHandle get_type() const {
00081     return get_class_type();
00082   }
00083   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00084 
00085 private:
00086   static TypeHandle _type_handle;
00087 };
00088 
00089 
00090 #endif
 All Classes Functions Variables Enumerations