ImFusion C++ SDK 4.5.0
ImFusion::GL::FixedFunctionPipeline::VertexData< PosT, TexCoordT, ColorT > Struct Template Reference

#include <ImFusion/Core/GL/FixedFunctionPipeline.h>

Utility struct to build a VertexBuffer to be used with FixedFunctionPipeline in a type-safe fashion. More...

Detailed Description

template<typename PosT, typename TexCoordT = detail::NullAtribT, typename ColorT = detail::NullAtribT>
struct ImFusion::GL::FixedFunctionPipeline::VertexData< PosT, TexCoordT, ColorT >

Utility struct to build a VertexBuffer to be used with FixedFunctionPipeline in a type-safe fashion.

You can either fill a VertexBuffer with the data using assign() or create a new one using createBuffer(). This interface also provides an implicit conversion to std::unique_ptr<VertexBuffer> to minimize code overhead.

Note
Do instantiate this class manually but use the FixedFunctionPipeline::makeVertexData() factory function:
std::vector<vec2> vertices = ...;
std::vector<vec2> texCoords = ...;
static VertexData< T > makeVertexData(const std::vector< T > &vertexPositions)
Factory function to create a VertexData object without the need to explicitly specify the template ty...

Public Member Functions

template<typename T>
VertexData< PosT, TexCoordT, T > useColors (const std::vector< T > &colors) const
 Add per-vertex colors to the vertex data.
template<typename T>
VertexData< PosT, T, ColorT > useTexCoords (const std::vector< T > &texCoords) const
 Add per-vertex texture coordinates to the vertex data.
void assign (VertexBuffer &buffer) const
 Assign the previously specified vertex data to the given buffer.
std::unique_ptr< VertexBuffercreateBuffer () const
 Create a new GlVertexBuffer and fill it with the previously provided vertex data.
 operator std::unique_ptr< VertexBuffer > () const
 Implicit conversion to a std::unique_ptr<GL::VertexBuffer>.

Public Attributes

const std::vector< PosT > * m_vertices
 Pointer to vertex position data, must not be 0.
const std::vector< TexCoordT > * m_texCoords
 Pointer to vertex texture coordinate data, points to detail::emptyBuffer if not specified.
const std::vector< ColorT > * m_colors
 Pointer to vertex color data, points to detail::emptyBuffer if not specified.

Member Function Documentation

◆ useColors()

template<typename PosT, typename TexCoordT = detail::NullAtribT, typename ColorT = detail::NullAtribT>
template<typename T>
VertexData< PosT, TexCoordT, T > ImFusion::GL::FixedFunctionPipeline::VertexData< PosT, TexCoordT, ColorT >::useColors ( const std::vector< T > & colors) const

Add per-vertex colors to the vertex data.

The number of colors must match the number of vertex positions.

◆ useTexCoords()

template<typename PosT, typename TexCoordT = detail::NullAtribT, typename ColorT = detail::NullAtribT>
template<typename T>
VertexData< PosT, T, ColorT > ImFusion::GL::FixedFunctionPipeline::VertexData< PosT, TexCoordT, ColorT >::useTexCoords ( const std::vector< T > & texCoords) const

Add per-vertex texture coordinates to the vertex data.

The number of colors must match the number of vertex positions.

◆ assign()

template<typename PosT, typename TexCoordT = detail::NullAtribT, typename ColorT = detail::NullAtribT>
void ImFusion::GL::FixedFunctionPipeline::VertexData< PosT, TexCoordT, ColorT >::assign ( VertexBuffer & buffer) const

Assign the previously specified vertex data to the given buffer.

Note
The buffer will remain bound to the current OpenGL state.

◆ createBuffer()

template<typename PosT, typename TexCoordT = detail::NullAtribT, typename ColorT = detail::NullAtribT>
std::unique_ptr< VertexBuffer > ImFusion::GL::FixedFunctionPipeline::VertexData< PosT, TexCoordT, ColorT >::createBuffer ( ) const

Create a new GlVertexBuffer and fill it with the previously provided vertex data.

Note
The buffer will remain bound to the current OpenGL state.

The documentation for this struct was generated from the following file:
  • ImFusion/Core/GL/FixedFunctionPipeline.h
Search Tab / S to search, Esc to close