|
|
|
Represents a triangle strip or quad strip in progress, as assembled by the mesher.
More...
#include "eggMesherStrip.h"
List of all members.
Public Types |
|
typedef plist< EggMesherEdge * > | Edges |
| enum | MesherOrigin {
MO_unknown,
MO_user,
MO_firstquad,
MO_fanpoly,
MO_mate
} |
| enum | MesherStatus { MS_alive,
MS_dead,
MS_done,
MS_paired
} |
|
typedef plist< CPT(EggPrimitive) > | Prims |
| enum | PrimType {
PT_poly,
PT_point,
PT_line,
PT_tri,
PT_tristrip,
PT_trifan,
PT_quad,
PT_quadstrip,
PT_linestrip
} |
|
typedef plist< int > | Verts |
Public Member Functions |
|
| EggMesherStrip (PrimType prim_type, MesherOrigin origin) |
|
| EggMesherStrip (const EggPrimitive *prim, int index, const EggVertexPool *vertex_pool, bool flat_shaded) |
|
| EggMesherStrip (const EggMesherStrip ©) |
| bool | can_invert () const |
| | Returns true if the strip can be inverted (reverse its facing direction).
|
| void | combine_edges (EggMesherStrip &other, int remove_sides) |
| | Removes the edges from the given strip and appends them to our own.
|
| void | convert_to_type (PrimType want_type) |
| | Converts the EggMesherStrip from whatever form it is--triangle, quad, or quadstrip--into a tristrip or quadstrip.
|
| float | coplanarity (const EggMesherStrip &other) const |
| | Returns the degree to which the two strips are coplanar.
|
| int | count_neighbors () const |
| | Returns the number of neighbors the strip shares.
|
|
void | cut_sheet (int first_row_id, int do_mate, const EggVertexPool *vertex_pool) |
| const EggMesherEdge * | find_adjacent_edge (const EggMesherEdge *edge) const |
| | Returns the first edge found that shares exactly one vertex with the given edge.
|
| bool | find_ideal_mate (EggMesherStrip *&mate, EggMesherEdge *&common_edge, const EggVertexPool *vertex_pool) |
| | Searches our neighbors for the most suitable mate.
|
| const EggMesherEdge * | find_opposite_edge (const EggMesherEdge *edge) const |
| | Returns the first edge found that shares no vertices with the given edge.
|
| const EggMesherEdge * | find_opposite_edge (int vi) const |
| | Returns the first edge found that does not contain the given vertex.
|
| int | find_uncommon_vertex (const EggMesherEdge *edge) const |
| | Returns the first vertex found that is not shared by the given edge.
|
| EggMesherEdge | get_head_edge () const |
| | Returns an EggMesherEdge which represents the leading edge in the quadstrip or tristrip.
|
| EggMesherEdge | get_tail_edge () const |
| | Returns an EggMesherEdge which represents the trailing edge in the quadstrip or tristrip.
|
| bool | invert () |
| | Reverses the facing of a quadstrip by reversing pairs of vertices.
|
| bool | is_coplanar_with (const EggMesherStrip &other, float threshold) const |
| | Returns true if the strip and the other strip are coplanar, within the indicated threshold.
|
| bool | is_odd () const |
| | Returns true if the tristrip or quadstrip contains an odd number of pieces.
|
| bool | mate (const EggVertexPool *vertex_pool) |
| | Finds a neighboring strip and joins up with it to make a larger strip.
|
| void | measure_sheet (const EggMesherEdge *edge, int new_row, int &num_prims, int &num_rows, int first_row_id, int this_row_id, int this_row_distance) |
| | Determines the extents of the quadsheet that can be derived by starting with this strip, and searching in the direction indicated by the given edge.
|
|
bool | operator!= (const EggMesherStrip &other) const |
| bool | operator== (const EggMesherStrip &other) const |
| | Defines equality for strips.
|
| void | output (ostream &out) const |
| | Formats the vertex for output in some sensible way.
|
| void | output_neighbors (ostream &out) const |
| | Writes all the neighbor indexes to the ostream.
|
| bool | pick_mate (const EggMesherStrip &a_strip, const EggMesherStrip &b_strip, const EggMesherEdge &a_edge, const EggMesherEdge &b_edge, const EggVertexPool *vertex_pool) const |
| | Defines an ordering to select neighbors to mate with.
|
| bool | pick_sheet_mate (const EggMesherStrip &a_strip, const EggMesherStrip &b_strip) const |
| | Defines an ordering to select neighbors to follow when measuring out a quadsheet.
|
|
| PT (EggPrimitive) make_prim(const EggVertexPool *vertex_pool) |
| void | remove_all_edges () |
| | Removes all active edges from the strip.
|
| void | rotate_back () |
| | Rotates a triangle or quad by bringing its last vertex to the front.
|
| void | rotate_forward () |
| | Rotates a triangle or quad by bringing its first vertex to the back.
|
| void | rotate_to_back (const EggMesherEdge *edge) |
| | Rotates a triangle or quad so that the given edge is last in the vertex list.
|
| void | rotate_to_front (const EggMesherEdge *edge) |
| | Rotates a triangle or quad so that the given edge is first in the vertex list.
|
| int | type_category () const |
| | Returns an integer which gives a heuristic about the similarity of different strip types.
|
| bool | would_reverse_tail (PrimType want_type) const |
| | Returns true if convert_to_type() would reverse the tail edge of the given strip, false otherwise.
|
Static Public Member Functions |
| static bool | convex_quad (EggMesherEdge *common_edge, EggMesherStrip &front, EggMesherStrip &back, const EggVertexPool *vertex_pool) |
| | Returns true if the quad that would be formed by connecting coplanar tris front and back along common_edge is convex, false otherwise.
|
| static bool | mate_pieces (EggMesherEdge *common_edge, EggMesherStrip &front, EggMesherStrip &back, const EggVertexPool *vertex_pool) |
| | Connects two pieces of arbitrary type, if possible.
|
| static bool | mate_strips (EggMesherEdge *common_edge, EggMesherStrip &front, EggMesherStrip &back, PrimType type) |
| | Stitches two strips together, producing in "front" a new strip of the indicated type (quadstrip or tristrip).
|
| static bool | must_invert (const EggMesherStrip &front, const EggMesherStrip &back, bool will_reverse_back, PrimType type) |
| | Returns false if the strips can be mated as they currently are.
|
Public Attributes |
|
Edges | _edges |
|
bool | _flat_shaded |
|
int | _index |
|
MesherOrigin | _origin |
|
bool | _planar |
|
Normald | _plane_normal |
|
float | _plane_offset |
|
Prims | _prims |
|
int | _row_distance |
|
int | _row_id |
|
MesherStatus | _status |
|
PrimType | _type |
|
Verts | _verts |
Detailed Description
Represents a triangle strip or quad strip in progress, as assembled by the mesher.
It might also represent a single polygon such as a triangle or quad, since that's how strips generally start out.
Definition at line 33 of file eggMesherStrip.h.
Member Function Documentation
| bool EggMesherStrip::can_invert |
( |
| ) |
const |
Returns true if the strip can be inverted (reverse its facing direction).
Generally, this is true for quadstrips and false for tristrips.
Definition at line 1094 of file eggMesherStrip.cxx.
Referenced by invert(), and mate_strips().
| void EggMesherStrip::combine_edges |
( |
EggMesherStrip & |
other, |
|
|
int |
remove_sides |
|
) |
| |
| void EggMesherStrip::convert_to_type |
( |
EggMesherStrip::PrimType |
want_type | ) |
|
| float EggMesherStrip::coplanarity |
( |
const EggMesherStrip & |
other | ) |
const [inline] |
Returns the degree to which the two strips are coplanar.
0.0 is exactly coplanar; numbers somewhat larger than zero indicate less coplanar. 1.0 is at right angles; 2.0 is exactly backfacing. If either strip is not itself planar, 3.0 is returned.
Definition at line 59 of file eggMesherStrip.I.
Referenced by is_coplanar_with(), and pick_mate().
| int EggMesherStrip::count_neighbors |
( |
| ) |
const |
Searches our neighbors for the most suitable mate.
Returns true if one is found, false if we have no neighbors.
Definition at line 447 of file eggMesherStrip.cxx.
References pick_mate().
Referenced by mate().
| const EggMesherEdge * EggMesherStrip::find_opposite_edge |
( |
int |
vi | ) |
const |
| int EggMesherStrip::find_uncommon_vertex |
( |
const EggMesherEdge * |
edge | ) |
const |
| bool EggMesherStrip::invert |
( |
| ) |
|
| bool EggMesherStrip::is_coplanar_with |
( |
const EggMesherStrip & |
other, |
|
|
float |
threshold |
|
) |
| const [inline] |
| bool EggMesherStrip::is_odd |
( |
| ) |
const |
Stitches two strips together, producing in "front" a new strip of the indicated type (quadstrip or tristrip).
The front strip stores the result, and the back strip is emptied on success.
Returns true if successful, false if failure (generally because of incorrect polarity of tristrips), in which case nothing has changed (or at least, not much).
Definition at line 632 of file eggMesherStrip.cxx.
References can_invert(), convert_to_type(), get_head_edge(), get_tail_edge(), invert(), is_odd(), EggMesherEdge::matches(), must_invert(), rotate_to_back(), rotate_to_front(), and would_reverse_tail().
Referenced by mate_pieces().
| void EggMesherStrip::measure_sheet |
( |
const EggMesherEdge * |
edge, |
|
|
int |
new_row, |
|
|
int & |
num_prims, |
|
|
int & |
num_rows, |
|
|
int |
first_row_id, |
|
|
int |
this_row_id, |
|
|
int |
this_row_distance |
|
) |
| |
| bool EggMesherStrip::must_invert |
( |
const EggMesherStrip & |
front, |
|
|
const EggMesherStrip & |
back, |
|
|
bool |
will_reverse_back, |
|
|
EggMesherStrip::PrimType |
type |
|
) |
| [static] |
| bool EggMesherStrip::operator== |
( |
const EggMesherStrip & |
other | ) |
const [inline] |
Defines equality for strips.
This actually tests only pointer equality; it's used only when removing a strip from the list.
Definition at line 157 of file eggMesherStrip.I.
| void EggMesherStrip::output |
( |
ostream & |
out | ) |
const |
| void EggMesherStrip::output_neighbors |
( |
ostream & |
out | ) |
const |
Defines an ordering to select neighbors to follow when measuring out a quadsheet.
This is only called when three or more prims share a single edge, which should be rarely--generally only when coplanar polys are going on.
Definition at line 1414 of file eggMesherStrip.cxx.
References type_category().
Referenced by measure_sheet().
| void EggMesherStrip::remove_all_edges |
( |
| ) |
|
Removes all active edges from the strip.
This effectively renders it ineligible to mate with anything else.
Definition at line 1334 of file eggMesherStrip.cxx.
| void EggMesherStrip::rotate_back |
( |
| ) |
[inline] |
| void EggMesherStrip::rotate_forward |
( |
| ) |
[inline] |
| void EggMesherStrip::rotate_to_back |
( |
const EggMesherEdge * |
edge | ) |
|
| void EggMesherStrip::rotate_to_front |
( |
const EggMesherEdge * |
edge | ) |
|
| int EggMesherStrip::type_category |
( |
| ) |
const [inline] |
Returns an integer which gives a heuristic about the similarity of different strip types.
In general, closer numbers are more similar.
Definition at line 74 of file eggMesherStrip.I.
Referenced by pick_mate(), and pick_sheet_mate().
| bool EggMesherStrip::would_reverse_tail |
( |
EggMesherStrip::PrimType |
want_type | ) |
const |
The documentation for this class was generated from the following files:
| | |