Open 3D Engine AzCore API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::VertexContainer< Vertex > Class Template Reference

#include <VertexContainer.h>

Public Member Functions

 VertexContainer (const IndexFunction &addCallback, const IndexFunction &removeCallback, const IndexFunction &updateCallback, const VoidFunction &setCallback, const VoidFunction &clearCallback)
 
void AddVertex (const Vertex &vertex)
 
bool UpdateVertex (size_t index, const Vertex &vertex)
 
bool InsertVertex (size_t index, const Vertex &vertex)
 
bool RemoveVertex (size_t index)
 
template<typename Vertices >
void SetVertices (Vertices &&vertices)
 
void Clear ()
 Remove all vertices.
 
bool GetVertex (size_t index, Vertex &vertex) const
 
bool GetLastVertex (Vertex &vertex) const
 
size_t Size () const
 Number of vertices in the container.
 
bool Empty () const
 Is the container empty or not.
 
const AZStd::vector< Vertex > & GetVertices () const
 Immutable reference to container of vertices.
 
const Vertex & operator[] (size_t index) const
 Unsafe access to vertices (index must be checked to be in range before use).
 
void SetCallbacks (const IndexFunction &addCallback, const IndexFunction &removeCallback, const IndexFunction &updateCallback, const VoidFunction &setCallback, const VoidFunction &clearCallback)
 

Static Public Member Functions

static void Reflect (ReflectContext *context)
 

Detailed Description

template<typename Vertex>
class AZ::VertexContainer< Vertex >

A wrapper around a AZStd::vector of either Vector2 or Vector3s. Provides an interface to access and modify the container.

Member Function Documentation

◆ AddVertex()

template<typename Vertex >
void AZ::VertexContainer< Vertex >::AddVertex ( const Vertex &  vertex)

Add vertex at end of container.

Parameters
vertexnew vertex position (local space).

◆ GetLastVertex()

template<typename Vertex >
bool AZ::VertexContainer< Vertex >::GetLastVertex ( Vertex &  vertex) const

Get last vertex.

Returns
if vector is empty return false.

◆ GetVertex()

template<typename Vertex >
bool AZ::VertexContainer< Vertex >::GetVertex ( size_t  index,
Vertex &  vertex 
) const

Get vertex at index.

Returns
was the index in range.

◆ InsertVertex()

template<typename Vertex >
bool AZ::VertexContainer< Vertex >::InsertVertex ( size_t  index,
const Vertex &  vertex 
)

Insert vertex before index in container.

Parameters
indexindex of vertex to insert before.
vertexnew vertex position (local space).
Returns
was the index in range.

◆ RemoveVertex()

template<typename Vertex >
bool AZ::VertexContainer< Vertex >::RemoveVertex ( size_t  index)

Remove vertex at index in container.

Parameters
indexindex of vertex to remove.
Returns
was the index in range.

◆ SetCallbacks()

template<typename Vertex >
void AZ::VertexContainer< Vertex >::SetCallbacks ( const IndexFunction addCallback,
const IndexFunction removeCallback,
const IndexFunction updateCallback,
const VoidFunction setCallback,
const VoidFunction clearCallback 
)

Provide callbacks for this container Useful if you could not provide callbacks at construction or you need to re-supply callbacks after deserialization

◆ SetVertices()

template<typename Vertex >
template<typename Vertices >
void AZ::VertexContainer< Vertex >::SetVertices ( Vertices &&  vertices)

Set all vertices.

Parameters
verticesnew vertices to set.

◆ UpdateVertex()

template<typename Vertex >
bool AZ::VertexContainer< Vertex >::UpdateVertex ( size_t  index,
const Vertex &  vertex 
)

Update position of vertex in container.

Parameters
indexindex of current vertex to update.
vertexnew vertex position (local space).
Returns
was the index in range.

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