Sparkle 0.0.1
Loading...
Searching...
No Matches
spk::TextureMesh::Builder Class Reference

Helper used to build TextureMesh instances from primitives. More...

#include <spk_texture_painter.hpp>

Collaboration diagram for spk::TextureMesh::Builder:
Collaboration graph

Public Member Functions

 Builder ()=default
 Builds an empty builder.
Builderclear ()
 Clears all stored polygons.
BuilderinsertTriangle (const TextureVertex &p_a, const TextureVertex &p_b, const TextureVertex &p_c)
 Inserts a textured triangle.
BuilderinsertQuad (const TextureVertex &p_a, const TextureVertex &p_b, const TextureVertex &p_c, const TextureVertex &p_d, PolygonOrder p_order=PolygonOrder::TriangleFanFromFirst)
 Inserts a textured quad.
BuilderinsertRectangle (const Vector2Int &p_anchor, const Vector2UInt &p_size, const Vector2 &p_uvAnchor, const Vector2 &p_uvSize, PolygonOrder p_order=PolygonOrder::TriangleFanFromFirst)
 Inserts a textured rectangle with explicit UVs.
BuilderinsertRectangleFullUV (const Vector2Int &p_anchor, const Vector2UInt &p_size, PolygonOrder p_order=PolygonOrder::TriangleFanFromFirst)
 Inserts a rectangle using full [0,1] UV range.
BuilderinsertRectangleFullUV (const spk::Extend2D &p_extend, PolygonOrder p_order=PolygonOrder::TriangleFanFromFirst)
 Inserts a rectangle from an extend using full UV range.
TextureMesh construct ()
 Builds a TextureMesh from stored polygons.

Detailed Description

Helper used to build TextureMesh instances from primitives.

builder.insertRectangleFullUV({0, 0}, {32, 32});
auto mesh = builder.construct();
Helper used to build TextureMesh instances from primitives.
Definition spk_texture_painter.hpp:64
Builder & insertRectangleFullUV(const Vector2Int &p_anchor, const Vector2UInt &p_size, PolygonOrder p_order=PolygonOrder::TriangleFanFromFirst)
Inserts a rectangle using full [0,1] UV range.
Definition spk_texture_painter.hpp:148
TextureMesh construct()
Builds a TextureMesh from stored polygons.
Definition spk_texture_painter.hpp:168

Member Function Documentation

◆ clear()

Builder & spk::TextureMesh::Builder::clear ( )
inline

Clears all stored polygons.

Returns
Reference to this builder.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ construct()

TextureMesh spk::TextureMesh::Builder::construct ( )
inline

Builds a TextureMesh from stored polygons.

Returns
Constructed TextureMesh.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertQuad()

Builder & spk::TextureMesh::Builder::insertQuad ( const TextureVertex & p_a,
const TextureVertex & p_b,
const TextureVertex & p_c,
const TextureVertex & p_d,
PolygonOrder p_order = PolygonOrder::TriangleFanFromFirst )
inline

Inserts a textured quad.

Parameters
p_aFirst vertex.
p_bSecond vertex.
p_cThird vertex.
p_dFourth vertex.
p_orderTriangulation order.
Returns
Reference to this builder.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertRectangle()

Builder & spk::TextureMesh::Builder::insertRectangle ( const Vector2Int & p_anchor,
const Vector2UInt & p_size,
const Vector2 & p_uvAnchor,
const Vector2 & p_uvSize,
PolygonOrder p_order = PolygonOrder::TriangleFanFromFirst )
inline

Inserts a textured rectangle with explicit UVs.

Parameters
p_anchorRectangle anchor position.
p_sizeRectangle size.
p_uvAnchorUV anchor.
p_uvSizeUV size.
p_orderTriangulation order.
Returns
Reference to this builder.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertRectangleFullUV() [1/2]

Builder & spk::TextureMesh::Builder::insertRectangleFullUV ( const spk::Extend2D & p_extend,
PolygonOrder p_order = PolygonOrder::TriangleFanFromFirst )
inline

Inserts a rectangle from an extend using full UV range.

Parameters
p_extendRectangle extend.
p_orderTriangulation order.
Returns
Reference to this builder.
Here is the call graph for this function:

◆ insertRectangleFullUV() [2/2]

Builder & spk::TextureMesh::Builder::insertRectangleFullUV ( const Vector2Int & p_anchor,
const Vector2UInt & p_size,
PolygonOrder p_order = PolygonOrder::TriangleFanFromFirst )
inline

Inserts a rectangle using full [0,1] UV range.

Parameters
p_anchorRectangle anchor position.
p_sizeRectangle size.
p_orderTriangulation order.
Returns
Reference to this builder.
Here is the call graph for this function:

◆ insertTriangle()

Builder & spk::TextureMesh::Builder::insertTriangle ( const TextureVertex & p_a,
const TextureVertex & p_b,
const TextureVertex & p_c )
inline

Inserts a textured triangle.

Parameters
p_aFirst vertex.
p_bSecond vertex.
p_cThird vertex.
Returns
Reference to this builder.
Here is the call graph for this function:

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