Panda3D
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
EggMesherFanMaker Class Reference

This class is used by EggMesher::find_fans() to attempt to make an EggTriangleFan out of the polygons connected to the indicated vertex. More...

#include "eggMesherFanMaker.h"

Public Types

typedef plist< const EggMesherEdge * > Edges
 
typedef plist< EggMesherStrip * > Strips
 

Public Member Functions

 EggMesherFanMaker (const EggMesherFanMaker &copy)
 
 EggMesherFanMaker (int vertex, EggMesherStrip *tri, EggMesher *mesher)
 
int build (EggGroupNode *unrolled_tris)
 Begins the fanning process.
 
double compute_angle () const
 Returns the overall angle subtended by the fan, from the leading edge to the trailing edge, in degrees.
 
bool is_coplanar_with (const EggMesherFanMaker &other) const
 Returns true if the strip and the other strip are coplanar.
 
bool is_empty () const
 Returns true if the fan maker has no edges, false otherwise.
 
bool is_valid () const
 Returns true if the fan maker has enough edges to define at least one fan, false otherwise.
 
bool join (EggMesherFanMaker &other)
 Attempts to connect two fans end-to-end.
 
bool operator!= (const EggMesherFanMaker &other) const
 Provides a unique ordering between different fan makers based on the leading edge.
 
bool operator< (const EggMesherFanMaker &other) const
 Provides a unique ordering between different fan makers based on the leading edge.
 
void operator= (const EggMesherFanMaker &copy)
 
bool operator== (const EggMesherFanMaker &other) const
 Provides a unique ordering between different fan makers based on the leading edge.
 
void output (std::ostream &out) const
 
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.
 

Public Attributes

Edges _edges
 
EggMesher_mesher
 
bool _planar
 
Strips _strips
 
int _vertex
 

Detailed Description

This class is used by EggMesher::find_fans() to attempt to make an EggTriangleFan out of the polygons connected to the indicated vertex.

Definition at line 34 of file eggMesherFanMaker.h.

Member Typedef Documentation

◆ Edges

Definition at line 36 of file eggMesherFanMaker.h.

◆ Strips

Definition at line 37 of file eggMesherFanMaker.h.

Constructor & Destructor Documentation

◆ EggMesherFanMaker() [1/2]

EggMesherFanMaker::EggMesherFanMaker ( int vertex,
EggMesherStrip * tri,
EggMesher * mesher )

Definition at line 22 of file eggMesherFanMaker.cxx.

◆ EggMesherFanMaker() [2/2]

EggMesherFanMaker::EggMesherFanMaker ( const EggMesherFanMaker & copy)

Definition at line 38 of file eggMesherFanMaker.cxx.

Member Function Documentation

◆ build()

int EggMesherFanMaker::build ( EggGroupNode * unrolled_tris)

Begins the fanning process.

Searches for triangles and connects them into a fan.

In certain cases, if egg_unroll_fans is enabled, the resulting fan may be retesselated into a series of zig-zag triangles, which are stored in unrolled_tris. Otherwise, an EggMesherStrip (representing the fan) is created and added to the mesher.

The return value is (loosely) the number of primitives created.

Definition at line 147 of file eggMesherFanMaker.cxx.

References compute_angle(), and unroll().

◆ compute_angle()

double EggMesherFanMaker::compute_angle ( ) const

Returns the overall angle subtended by the fan, from the leading edge to the trailing edge, in degrees.

Definition at line 111 of file eggMesherFanMaker.cxx.

References EggVertex::get_pos3(), EggVertexPool::get_vertex(), and is_valid().

Referenced by build().

◆ is_coplanar_with()

bool EggMesherFanMaker::is_coplanar_with ( const EggMesherFanMaker & other) const
inline

Returns true if the strip and the other strip are coplanar.

Definition at line 62 of file eggMesherFanMaker.I.

Referenced by join().

◆ is_empty()

bool EggMesherFanMaker::is_empty ( ) const
inline

Returns true if the fan maker has no edges, false otherwise.

Definition at line 45 of file eggMesherFanMaker.I.

◆ is_valid()

bool EggMesherFanMaker::is_valid ( ) const
inline

Returns true if the fan maker has enough edges to define at least one fan, false otherwise.

Definition at line 54 of file eggMesherFanMaker.I.

Referenced by compute_angle().

◆ join()

bool EggMesherFanMaker::join ( EggMesherFanMaker & other)

Attempts to connect two fans end-to-end.

They must both share the same common vertex and a common edge.

The return value is true if the fans were successfully joined, or false if they could not be.

Definition at line 67 of file eggMesherFanMaker.cxx.

References is_coplanar_with().

◆ operator!=()

bool EggMesherFanMaker::operator!= ( const EggMesherFanMaker & other) const
inline

Provides a unique ordering between different fan makers based on the leading edge.

Definition at line 28 of file eggMesherFanMaker.I.

References operator==().

◆ operator<()

bool EggMesherFanMaker::operator< ( const EggMesherFanMaker & other) const
inline

Provides a unique ordering between different fan makers based on the leading edge.

Definition at line 18 of file eggMesherFanMaker.I.

◆ operator=()

void EggMesherFanMaker::operator= ( const EggMesherFanMaker & copy)

Definition at line 51 of file eggMesherFanMaker.cxx.

◆ operator==()

bool EggMesherFanMaker::operator== ( const EggMesherFanMaker & other) const
inline

Provides a unique ordering between different fan makers based on the leading edge.

Definition at line 37 of file eggMesherFanMaker.I.

Referenced by operator!=().

◆ output()

void EggMesherFanMaker::output ( std::ostream & out) const

Definition at line 328 of file eggMesherFanMaker.cxx.

◆ unroll()

int EggMesherFanMaker::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.

The new triangles are added to unrolled_tris; the return value is 1 if successful, or 0 otherwise.

Definition at line 258 of file eggMesherFanMaker.cxx.

References EggGroupNode::add_child(), EggPrimitive::copy_attributes(), and EggVertexPool::get_vertex().

Referenced by build().

Member Data Documentation

◆ _edges

Edges EggMesherFanMaker::_edges

Definition at line 63 of file eggMesherFanMaker.h.

◆ _mesher

EggMesher* EggMesherFanMaker::_mesher

Definition at line 66 of file eggMesherFanMaker.h.

◆ _planar

bool EggMesherFanMaker::_planar

Definition at line 65 of file eggMesherFanMaker.h.

◆ _strips

Strips EggMesherFanMaker::_strips

Definition at line 64 of file eggMesherFanMaker.h.

◆ _vertex

int EggMesherFanMaker::_vertex

Definition at line 62 of file eggMesherFanMaker.h.


The documentation for this class was generated from the following files: