![]() |
CUGL 3.0
Cornell University Game Library
|
#include <CUMeshExtruder.h>
Public Member Functions | |
MeshExtruder () | |
MeshExtruder (const std::vector< Vec2 > &points, bool closed) | |
MeshExtruder (const Path2 &path) | |
~MeshExtruder () | |
Mesh< SpriteVertex > | getMesh (Color4 color) const |
Mesh< SpriteVertex > * | getMesh (Mesh< SpriteVertex > *mesh, Color4 color) const |
Mesh< SpriteVertex > | getMesh (Color4 inner, Color4 outer) const |
Mesh< SpriteVertex > * | getMesh (Mesh< SpriteVertex > *mesh, Color4 inner, Color4 outer) const |
![]() | |
SimpleExtruder () | |
SimpleExtruder (const std::vector< Vec2 > &points, bool closed) | |
SimpleExtruder (const Path2 &path) | |
~SimpleExtruder () | |
void | setJoint (poly2::Joint joint) |
poly2::Joint | getJoint () const |
void | setEndCap (poly2::EndCap endcap) |
poly2::EndCap | getEndCap () const |
void | setTolerance (float tolerance) |
float | getTolerance () const |
void | setMitreLimit (float limit) |
float | getMitreLimit () const |
void | set (const std::vector< Vec2 > &points, bool closed) |
void | set (const Vec2 *points, size_t size, bool closed) |
void | set (const Path2 &path) |
void | reset () |
void | clear () |
void | calculate (float width) |
void | calculate (float lwidth, float rwidth) |
Poly2 | getPolygon () const |
Poly2 * | getPolygon (Poly2 *buffer) const |
std::vector< Path2 > | getBorder () const |
size_t | getBorder (std::vector< Path2 > &buffer) const |
Vec2 | getSide (Uint32 index) const |
Additional Inherited Members | |
![]() | |
poly2::Joint | _joint |
poly2::EndCap | _endcap |
float | _tolerance |
float | _mitrelimit |
bool | _closed |
bool | _convex |
bool | _calculated |
Point * | _points |
size_t | _plimit |
size_t | _psize |
float * | _verts |
float * | _sides |
float * | _lefts |
float * | _rghts |
size_t | _vlimit |
size_t | _vsize |
size_t | _lsize |
size_t | _rsize |
Uint32 * | _indxs |
size_t | _ilimit |
size_t | _isize |
Uint32 | _iback2 |
Uint32 | _iback1 |
This class is a factory for extruding paths into a sprite mesh.
The class SimpleExtruder
actually stores enough information to aid with texturing. However, texture information is not part of Poly2
. If we want texture information, we need instead a mesh of SpriteVertex
values. That is the purpose of this extruder.
This functionality was originally part of the base class SimpleExtruder
. However, upon our decision to factor out graphics as its own package, we needed to separate the behavior.
|
inline |
Creates an extruder with no vertex data.
cugl::graphics::MeshExtruder::MeshExtruder | ( | const std::vector< Vec2 > & | points, |
bool | closed | ||
) |
Creates an extruder with the given path.
The path data is copied. The extruder does not retain any references to the original data.
points | The path to extrude |
closed | Whether the path is closed |
cugl::graphics::MeshExtruder::MeshExtruder | ( | const Path2 & | path | ) |
Creates an extruder with the given path.
The path data is copied. The extruder does not retain any references to the original data.
path | The path to extrude |
|
inline |
Deletes this extruder, releasing all resources.
Mesh< SpriteVertex > cugl::graphics::MeshExtruder::getMesh | ( | Color4 | color | ) | const |
Returns a mesh representing the path extrusion.
This method creates a triangular mesh with the vertices of the extrusion, coloring each vertex white. However, if fringe is set to true, then each vertex will instead be colored clear (transparent), unless that vertex is on a zero-width side. This effect can be used to produce border "fringes" around a polygon for anti-aliasing.
If the calculation is not yet performed, this method will return the empty mesh.
color | The default mesh color |
Mesh< SpriteVertex > cugl::graphics::MeshExtruder::getMesh | ( | Color4 | inner, |
Color4 | outer | ||
) | const |
Returns a mesh representing the path extrusion.
This method creates a triangular mesh with the vertices of the extrusion, coloring each vertex white. However, if fringe is set to true, then each vertex will instead be colored clear (transparent), unless that vertex is on a zero-width side. This effect can be used to produce border "fringes" around a polygon for anti-aliasing.
If the calculation is not yet performed, this method will return the empty mesh.
inner | The interior mesh color |
outer | The exterior mesh color |
Mesh< SpriteVertex > * cugl::graphics::MeshExtruder::getMesh | ( | Mesh< SpriteVertex > * | mesh, |
Color4 | color | ||
) | const |
Stores a mesh representing the path extrusion in the given buffer
This method will add both the new vertices, and the corresponding indices to the buffer. If the buffer is not empty, the indices will be adjusted accordingly. You should clear the buffer first if you do not want to preserve the original data.
The vertices in this mesh will be colored white by default. However, if fringe is set to true, then each vertex will instead be colored clear (transparent), unless that vertex is on a zero-width side. This effect can be used to produce border "fringes" around a polygon for anti-aliasing.
If the calculation is not yet performed, this method will do nothing.
mesh | The buffer to store the extruded path mesh |
color | The default mesh color |
Mesh< SpriteVertex > * cugl::graphics::MeshExtruder::getMesh | ( | Mesh< SpriteVertex > * | mesh, |
Color4 | inner, | ||
Color4 | outer | ||
) | const |
Stores a mesh representing the path extrusion in the given buffer
This method will add both the new vertices, and the corresponding indices to the buffer. If the buffer is not empty, the indices will be adjusted accordingly. You should clear the buffer first if you do not want to preserve the original data.
The vertices in this mesh will be colored white by default. However, if fringe is set to true, then each vertex will instead be colored clear (transparent), unless that vertex is on a zero-width side. This effect can be used to produce border "fringes" around a polygon for anti-aliasing.
If the calculation is not yet performed, this method will do nothing.
mesh | The buffer to store the extruded path mesh |
inner | The interior mesh color |
outer | The exterior mesh color |