Sparkle 0.0.1
Loading...
Searching...
No Matches
spk::Mesh2D Class Reference

Renderable mesh composed of 2D vertices. More...

#include <spk_mesh_2d.hpp>

Inheritance diagram for spk::Mesh2D:
Inheritance graph
Collaboration diagram for spk::Mesh2D:
Collaboration graph

Classes

class  Builder
 Fluent builder for assembling mesh polygons. More...

Public Types

using Base = spk::IMesh<Mesh2DVertex>
 Base IMesh type.
using Vertex = Mesh2DVertex
 Vertex type used by the mesh.
using Polygon = Base::Polygon
 Polygon type used by the mesh.
Public Types inherited from spk::IMesh< Mesh2DVertex >
using Polygon
 Polygon type stored by the mesh.
using EditionContract
 Contract type returned by edition subscriptions.
using EditionJob
 Job type invoked on mesh edits.

Public Member Functions

 Mesh2D ()
 Creates an empty mesh.
 Mesh2D (const Mesh2D &p_other)
 Copies another mesh.
Mesh2Doperator= (const Mesh2D &p_other)
 Copy-assigns another mesh.
 Mesh2D (Mesh2D &&p_other) noexcept
 Moves another mesh.
Mesh2Doperator= (Mesh2D &&p_other) noexcept
 Move-assigns another mesh.
Mesh2Doperator+= (const Mesh2D &p_other)
 Appends polygons from another mesh.
Mesh2D fuze (const Mesh2D &p_other) const
 Returns a new mesh combining this mesh with another.
CollisionMesh2D collisionMesh () const
 Builds a collision mesh from this mesh.
void append (const Polygon &p_shape)
 Appends a polygon and notifies subscribers.
void clear ()
 Clears all polygons and notifies subscribers.
const std::vector< Polygon > & polygons () const
 Returns the stored polygons.
Public Member Functions inherited from spk::IMesh< Mesh2DVertex >
 IMesh ()
 Builds an empty mesh with a dynamic buffer set.
 IMesh (const IMesh &p_other)
 Copies polygon data into a new mesh instance.
IMeshoperator= (const IMesh &p_other)
 Assigns polygon data from another mesh.
 IMesh (IMesh &&p_other) noexcept
 Moves polygon data from another mesh.
IMeshoperator= (IMesh &&p_other) noexcept
 Move-assigns polygon data from another mesh.
void clear ()
 Clears all polygons and notifies subscribers.
void append (const Polygon &p_shape)
 Appends a polygon and notifies subscribers.
EditionContract subscribeToEdition (const EditionJob &p_job) const
 Subscribes to mesh edition notifications.
const std::vector< Mesh2DVertex > & vertices () const
 Returns the cached vertex list for all polygons.
const std::vector< Polygon > & polygons () const
 Returns the stored polygons.
const std::vector< uint32_t > & indexes () const
 Returns the cached triangle indices for the mesh.
IMeshoperator+= (const IMesh &p_other)
 Appends polygons from another mesh and notifies subscribers.
const std::shared_ptr< spk::OpenGL::BufferSetObject > & bufferSet () const
 Returns the underlying buffer set.
void synchronize () const
 Updates GPU buffers when mesh data has changed.
IMesh fuze (const IMesh &p_other) const
 Returns a new mesh by concatenating another mesh.

Protected Member Functions

void _configureBufferSet () const override
 Configures the vertex buffer layout for this mesh.

Detailed Description

Renderable mesh composed of 2D vertices.

Constructor & Destructor Documentation

◆ Mesh2D() [1/2]

spk::Mesh2D::Mesh2D ( const Mesh2D & p_other)

Copies another mesh.

Parameters
p_otherMesh to copy from.
Here is the call graph for this function:

◆ Mesh2D() [2/2]

spk::Mesh2D::Mesh2D ( Mesh2D && p_other)
noexcept

Moves another mesh.

Parameters
p_otherMesh to move from.
Here is the call graph for this function:

Member Function Documentation

◆ _configureBufferSet()

void spk::Mesh2D::_configureBufferSet ( ) const
inlineoverrideprotectedvirtual

Configures the vertex buffer layout for this mesh.

Implements spk::IMesh< Mesh2DVertex >.

Here is the call graph for this function:

◆ append()

void spk::IMesh< Mesh2DVertex >::append ( const Polygon & p_shape)
inline

Appends a polygon and notifies subscribers.

Parameters
p_shapePolygon to add.
Here is the caller graph for this function:

◆ collisionMesh()

CollisionMesh2D spk::Mesh2D::collisionMesh ( ) const

Builds a collision mesh from this mesh.

Returns
Collision mesh covering this mesh's vertices.
Here is the caller graph for this function:

◆ fuze()

Mesh2D spk::Mesh2D::fuze ( const Mesh2D & p_other) const

Returns a new mesh combining this mesh with another.

Parameters
p_otherMesh to fuse with.
Returns
Combined mesh.
Here is the call graph for this function:

◆ operator+=()

Mesh2D & spk::Mesh2D::operator+= ( const Mesh2D & p_other)

Appends polygons from another mesh.

Parameters
p_otherMesh to append.
Returns
Reference to this mesh.
Here is the call graph for this function:

◆ operator=() [1/2]

Mesh2D & spk::Mesh2D::operator= ( const Mesh2D & p_other)

Copy-assigns another mesh.

Parameters
p_otherMesh to copy from.
Returns
Reference to this mesh.
Here is the call graph for this function:

◆ operator=() [2/2]

Mesh2D & spk::Mesh2D::operator= ( Mesh2D && p_other)
noexcept

Move-assigns another mesh.

Parameters
p_otherMesh to move from.
Returns
Reference to this mesh.
Here is the call graph for this function:

◆ polygons()

const std::vector< Polygon > & spk::IMesh< Mesh2DVertex >::polygons ( ) const
inline

Returns the stored polygons.

Returns
Polygon vector.

The documentation for this class was generated from the following files:
  • includes/structure/engine/2d/spk_mesh_2d.hpp
  • srcs/structure/engine/2d/spk_mesh_2d.cpp