Panda3D
eggMesherFanMaker.h
1 // Filename: eggMesherFanMaker.h
2 // Created by: drose (22Mar05)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef EGGMESHERFANMAKER_H
16 #define EGGMESHERFANMAKER_H
17 
18 #include "pandabase.h"
19 
20 #include "eggMesherEdge.h"
21 #include "eggMesherStrip.h"
22 #include "config_egg.h"
23 #include "plist.h"
24 #include "pvector.h"
25 
26 #include "pnotify.h"
27 #include "mathNumbers.h"
28 
29 class EggMesher;
30 
31 ////////////////////////////////////////////////////////////////////
32 // Class : EggMesherFanMaker
33 // Description : This class is used by EggMesher::find_fans() to
34 // attempt to make an EggTriangleFan out of the polygons
35 // connected to the indicated vertex.
36 ////////////////////////////////////////////////////////////////////
38 public:
41 
42  EggMesherFanMaker(int vertex, EggMesherStrip *tri,
43  EggMesher *mesher);
45  void operator = (const EggMesherFanMaker &copy);
46 
47  INLINE bool operator < (const EggMesherFanMaker &other) const;
48  INLINE bool operator != (const EggMesherFanMaker &other) const;
49  INLINE bool operator == (const EggMesherFanMaker &other) const;
50 
51  INLINE bool is_empty() const;
52  INLINE bool is_valid() const;
53  INLINE bool is_coplanar_with(const EggMesherFanMaker &other) const;
54 
55  bool join(EggMesherFanMaker &other);
56  double compute_angle() const;
57 
58  int build(EggGroupNode *unrolled_tris);
59  int unroll(Strips::iterator strip_begin, Strips::iterator strip_end,
60  Edges::iterator edge_begin, Edges::iterator edge_end,
61  EggGroupNode *unrolled_tris);
62 
63  void output(ostream &out) const;
64 
65  int _vertex;
66  Edges _edges;
67  Strips _strips;
68  bool _planar;
69  EggMesher *_mesher;
70 };
71 
72 INLINE ostream &operator << (ostream &out, const EggMesherFanMaker &fm);
73 
74 #include "eggMesherFanMaker.I"
75 
76 #endif
double compute_angle() const
Returns the overall angle subtended by the fan, from the leading edge to the trailing edge...
bool operator==(const EggMesherFanMaker &other) const
Provides a unique ordering between different fan makers based on the leading edge.
A base class for nodes in the hierarchy that are not leaf nodes.
Definition: eggGroupNode.h:51
int unroll(Strips::iterator strip_begin, Strips::iterator strip_end, Edges::iterator edge_begin, Edges::iterator edge_end, EggGroupNode *unrolled_tris)
Unrolls a planar subset of the current working fan, defined by the given iterators, into a series of triangles that zig-zag back and forth for better tristripping properties.
This class is used by EggMesher::find_fans() to attempt to make an EggTriangleFan out of the polygons...
Collects together unrelated EggPrimitives, determines their edge connectivity, and generates a set of...
Definition: eggMesher.h:35
int build(EggGroupNode *unrolled_tris)
Begins the fanning process.
bool is_coplanar_with(const EggMesherFanMaker &other) const
Returns true if the strip and the other strip are coplanar.
Represents a triangle strip or quad strip in progress, as assembled by the mesher.
bool operator<(const EggMesherFanMaker &other) const
Provides a unique ordering between different fan makers based on the leading edge.
bool join(EggMesherFanMaker &other)
Attempts to connect two fans end-to-end.
bool is_valid() const
Returns true if the fan maker has enough edges to define at least one fan, false otherwise.
bool operator!=(const EggMesherFanMaker &other) const
Provides a unique ordering between different fan makers based on the leading edge.
bool is_empty() const
Returns true if the fan maker has no edges, false otherwise.