Panda3D

eggMesherFanMaker.h

00001 // Filename: eggMesherFanMaker.h
00002 // Created by:  drose (22Mar05)
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 EGGMESHERFANMAKER_H
00016 #define EGGMESHERFANMAKER_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "eggMesherEdge.h"
00021 #include "eggMesherStrip.h"
00022 #include "config_egg.h"
00023 #include "plist.h"
00024 #include "pvector.h"
00025 
00026 #include "pnotify.h"
00027 #include "mathNumbers.h"
00028 
00029 class EggMesher;
00030 
00031 ////////////////////////////////////////////////////////////////////
00032 //       Class : EggMesherFanMaker
00033 // Description : This class is used by EggMesher::find_fans() to
00034 //               attempt to make an EggTriangleFan out of the polygons
00035 //               connected to the indicated vertex.
00036 ////////////////////////////////////////////////////////////////////
00037 class EggMesherFanMaker {
00038 public:
00039   typedef plist<const EggMesherEdge *> Edges;
00040   typedef plist<EggMesherStrip *> Strips;
00041 
00042   EggMesherFanMaker(int vertex, EggMesherStrip *tri, 
00043                     EggMesher *mesher);
00044   EggMesherFanMaker(const EggMesherFanMaker &copy);
00045   void operator = (const EggMesherFanMaker &copy);
00046 
00047   INLINE bool operator < (const EggMesherFanMaker &other) const;
00048   INLINE bool operator != (const EggMesherFanMaker &other) const;
00049   INLINE bool operator == (const EggMesherFanMaker &other) const;
00050 
00051   INLINE bool is_empty() const;
00052   INLINE bool is_valid() const;
00053   INLINE bool is_coplanar_with(const EggMesherFanMaker &other) const;
00054 
00055   bool join(EggMesherFanMaker &other);
00056   double compute_angle() const;
00057 
00058   int build(EggGroupNode *unrolled_tris);
00059   int unroll(Strips::iterator strip_begin, Strips::iterator strip_end,
00060              Edges::iterator edge_begin, Edges::iterator edge_end,
00061              EggGroupNode *unrolled_tris);
00062 
00063   void output(ostream &out) const;
00064 
00065   int _vertex;
00066   Edges _edges;
00067   Strips _strips;
00068   bool _planar;
00069   EggMesher *_mesher;
00070 };
00071 
00072 INLINE ostream &operator << (ostream &out, const EggMesherFanMaker &fm);
00073 
00074 #include "eggMesherFanMaker.I"
00075 
00076 #endif
 All Classes Functions Variables Enumerations