![]() |
Kale
|
#include <VertexArray.hpp>
Public Member Functions | |
VertexArray () | |
template<size_t N> | |
VertexArray (const std::array< T, N > &verts, BufferUsage usage, bool condense=true) | |
VertexArray (const std::vector< T > &verts, BufferUsage usage, bool condense=true) | |
template<size_t N1, size_t N2, typename index_type = unsigned int> | |
VertexArray (const std::array< T, N1 > &verts, const std::array< index_type, N2 > &indices, BufferUsage usage) | |
template<typename index_type = unsigned int> | |
VertexArray (const std::vector< T > &verts, const std::vector< index_type > &indices, BufferUsage usage) | |
VertexArray (const std::vector< T > &verts, std::vector< unsigned int > &&indices, BufferUsage usage) | |
~VertexArray () | |
void | enableAttributePointer (const std::array< unsigned int, sizeof...(NFloats)> &attributes) const |
void | bind () const |
template<size_t N> | |
void | updateVerticesCondense (const std::array< T, N > &verts, BufferUsage usage) |
void | updateVerticesCondense (const std::vector< T > &verts, BufferUsage usage) |
void | draw () const |
void | drawNoElements () const |
void | draw (DrawType type) const |
void | drawNoElements (DrawType type) const |
Public Attributes | |
Buffer< float > | vertices |
Buffer< unsigned int > | elements |
Private Member Functions | |
constexpr size_t | numFloatsInVert () |
bool | vertFloatPtrEqual (const float *floatPtr, const T &vert) |
template<typename Container > | |
void | condenseVertices (const Container &verts, BufferUsage usage) |
template<typename Verts , typename Func > | |
void | createVerticesAndElements (const Verts &verts, const Func &func, BufferUsage usage) |
Private Attributes | |
unsigned int | vertexArray |
Represents an array of vertices, NOT an OpenGL vertex array (although the class does use OpenGL vertex arrays internally)
T | the struct containing an individual vertex |
NFloats | for each vector within the vertex the number of floats in the vector must be given |
Definition at line 44 of file VertexArray.hpp.
|
inline |
Creates an empty vertex array
Definition at line 152 of file VertexArray.hpp.
|
inline |
Creates a vertex array given the vertices
verts | The vertices |
usage | The usage of the vertex array |
condense | Whether or not to remove the duplicates of vertices given and condense it into elements |
Definition at line 166 of file VertexArray.hpp.
|
inline |
Creates a vertex array given the vertices
verts | The vertices |
usage | The usage of the vertex array |
condense | Whether or not to remove the duplicates of vertices given and condense it into elements |
Definition at line 185 of file VertexArray.hpp.
|
inline |
Creates a vertex array given the vertices and elements/indices
N1 | Size of vertices array |
N2 | Size of indices array |
index_type | Type of indices (should be numeric) |
verts | The vertices |
indices | The indices |
usage | The usage of the vertex array |
Definition at line 208 of file VertexArray.hpp.
|
inline |
Creates a vertex array given the vertices and elements/indices
index_type | The type of indices, should be numeric |
verts | The vertices |
indices | The indices |
usage | The usage of the vertex array |
Definition at line 225 of file VertexArray.hpp.
|
inline |
Creates a vertex array given the vertices and elements/indices
verts | The vertices |
indices | The indices |
usage | The usage of the vertex array |
Definition at line 240 of file VertexArray.hpp.
|
inline |
Frees resources
Definition at line 251 of file VertexArray.hpp.
|
inline |
Binds this vertex array for use externally
Definition at line 275 of file VertexArray.hpp.
|
inlineprivate |
Condenses vertices from a container into the vertices and elements buffers and syncs them with the GPU
verts | The vertices |
usage | The usage of the vertex array |
Definition at line 74 of file VertexArray.hpp.
|
inlineprivate |
Creates the vertices and elements given the vertices container and a function to create the elements
verts | The vertices |
func | The function for setting the elements |
usage | The usage of the vertex array |
Definition at line 127 of file VertexArray.hpp.
|
inline |
Draws the vertex array as triangles
Definition at line 308 of file VertexArray.hpp.
|
inline |
Draws the vertex array
type | The type of object to draw |
Definition at line 325 of file VertexArray.hpp.
|
inline |
Draws the vertex array as triangles directly using the vertex buffer
Definition at line 316 of file VertexArray.hpp.
|
inline |
Draws the vertex array directly using the vertex buffer
type | The type of object to draw |
Definition at line 334 of file VertexArray.hpp.
|
inline |
Links the vertex array to the attributes of shaders. All shaders using this vertex array must use the correct attribute layouts.
attributes | An array of the attribute locations for each vertex component |
Definition at line 260 of file VertexArray.hpp.
|
inlineconstexprprivate |
The total number of floats within a single vertex
Definition at line 55 of file VertexArray.hpp.
|
inline |
Updates the vertices and condenses them NOTE - This condenses again and updates both elements and vertices. If you're only updating vertices and not elements it is highly recommended to directly update the buffers
verts | The vertices |
usage | The usage of the vertex array |
Definition at line 286 of file VertexArray.hpp.
|
inline |
Updates the vertices and condenses them NOTE - This condenses again and updates both elements and vertices. If you're only updating vertices and not elements it is highly recommended to directly update the buffers
verts | The vertices |
usage | The usage of the vertex array |
Definition at line 299 of file VertexArray.hpp.
|
inlineprivate |
Checks if the underlying floats are equal between a float pointer and a vertex
floatPtr | The float pointer to the first float within the vertex |
vert | The vertex to compare to |
Definition at line 65 of file VertexArray.hpp.
Buffer<unsigned int> Kale::OpenGL::VertexArray< T, NFloats >::elements |
The element buffer/index buffer
Definition at line 147 of file VertexArray.hpp.
|
private |
The OpenGL Vertex Array ID
Definition at line 50 of file VertexArray.hpp.
Buffer<float> Kale::OpenGL::VertexArray< T, NFloats >::vertices |
The vertex data itself
Definition at line 142 of file VertexArray.hpp.