Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/builder/mesherTempl.h

Go to the documentation of this file.
00001 // Filename: mesherTempl.h
00002 // Created by:  drose (15Sep97)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 #ifndef MESHERTEMPL_H
00019 #define MESHERTEMPL_H
00020 
00021 #include <pandabase.h>
00022 
00023 #include "mesherConfig.h"
00024 #include "builderBucket.h"
00025 #include "mesherEdge.h"
00026 #include "mesherStrip.h"
00027 
00028 #include "pvector.h"
00029 #include "plist.h"
00030 #include "pset.h"
00031 #include "pmap.h"
00032 
00033 template <class PrimType>
00034 class MesherFanMaker;
00035 
00036 template <class PrimType>
00037 class MesherTempl {
00038 public:
00039   typedef PrimType Prim;
00040   typedef TYPENAME PrimType::Vertex Vertex;
00041   typedef TYPENAME PrimType::DAttrib MAttrib;
00042   typedef MesherEdge<PrimType> Edge;
00043   typedef MesherStrip<PrimType> Strip;
00044   typedef MesherFanMaker<PrimType> FanMaker;
00045 
00046   MesherTempl(BuilderBucket *bucket);
00047 
00048   int add_prim(const Prim &prim, MesherStripOrigin origin = MO_user);
00049   void mesh();
00050   Prim getPrim();
00051 
00052   void finalize();
00053 
00054   void show(ostream &out);
00055 
00056 protected:
00057   typedef plist<Strip> Strips;
00058   typedef pset<Edge, less<Edge> > Edges;
00059   typedef pset<Edge *, less<Edge *> > EdgePtrs;
00060   typedef pmap<Vertex, EdgePtrs, less<Vertex> > Verts;
00061 
00062   // This is used for show-tstrips.
00063   typedef pvector<BuilderC> Colors;
00064   // And this is used for show-qsheets.
00065   typedef pmap<int, int, less<int> > ColorSheetMap;
00066 
00067   int count_vert_edges(const EdgePtrs &edges) const;
00068   plist<Strip> &choose_strip_list(const Strip &strip);
00069 
00070   void build_sheets();
00071   void find_fans();
00072   void make_quads();
00073   void meshList(Strips &strips);
00074 
00075   Strips _tris, _quads, _strips;
00076   Strips _dead, _done;
00077   Verts _verts;
00078   Edges _edges;
00079   int _stripIndex;
00080   BuilderBucket *_bucket;
00081   TYPENAME Strips::iterator _next_strip;
00082   Colors _colors;
00083   ColorSheetMap _color_sheets;
00084 
00085   friend class MesherStrip<PrimType>;
00086   friend class MesherFanMaker<PrimType>;
00087 };
00088 
00089 #include "mesherTempl.I"
00090 
00091 #endif

Generated on Fri May 2 00:34:50 2003 for Panda by doxygen1.3