00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MESHERFANMAKER_H
00020 #define MESHERFANMAKER_H
00021
00022 #ifdef SUPPORT_FANS
00023
00024 #include <pandabase.h>
00025
00026 #include "mesherConfig.h"
00027 #include "builderAttrib.h"
00028 #include "builderVertex.h"
00029 #include "builderBucket.h"
00030 #include "mesherEdge.h"
00031 #include "mesherStrip.h"
00032
00033 #include "plist.h"
00034 #include "pvector.h"
00035
00036
00037 template <class PrimType>
00038 class MesherTempl;
00039
00040 template <class PrimType>
00041 class MesherFanMaker {
00042 public:
00043 typedef PrimType Prim;
00044 typedef TYPENAME PrimType::Vertex Vertex;
00045 typedef TYPENAME PrimType::DAttrib FAttrib;
00046 typedef MesherEdge<PrimType> Edge;
00047 typedef MesherStrip<PrimType> Strip;
00048 typedef MesherTempl<PrimType> Mesher;
00049
00050 typedef plist<const Edge *> Edges;
00051 typedef plist<Strip *> Strips;
00052
00053 MesherFanMaker() {}
00054 MesherFanMaker(const Vertex *vertex, Strip *tri, Mesher *mesher);
00055
00056 INLINE bool operator < (const MesherFanMaker &other) const;
00057 INLINE bool operator != (const MesherFanMaker &other) const;
00058 INLINE bool operator == (const MesherFanMaker &other) const;
00059
00060 INLINE bool is_empty() const;
00061 INLINE bool is_valid() const;
00062 INLINE bool is_coplanar_with(const MesherFanMaker &other) const;
00063
00064 bool join(MesherFanMaker &other);
00065 float compute_angle() const;
00066
00067 int build(pvector<Prim> &unrolled_tris);
00068 int unroll(TYPENAME Strips::iterator strip_begin, TYPENAME Strips::iterator strip_end,
00069 TYPENAME Edges::iterator edge_begin, TYPENAME Edges::iterator edge_end,
00070 pvector<Prim> &unrolled_tris);
00071
00072 ostream &output(ostream &out) const;
00073
00074
00075 const Vertex *_vertex;
00076 Edges _edges;
00077 Strips _strips;
00078 int _planar;
00079 BuilderBucket *_bucket;
00080 Mesher *_mesher;
00081 };
00082
00083 template <class PrimType>
00084 ostream &operator << (ostream &out, const MesherFanMaker<PrimType> &fe) {
00085 return fe.output(out);
00086 }
00087
00088 #include "mesherFanMaker.I"
00089
00090 #endif // SUPPORT_FANS
00091
00092 #endif