Nymph Game Engine
Chaiscript based Game Engine
|
Class for vertex data. More...
#include <vertex_data.h>
Public Types | |
enum | DATA_TYPE : unsigned int { GEOMETRY = 0, TEX_COORDS = 1, TEXTURE_UNIT = 2, NORMAL_COORDS = 3, RESERVED2 = 4, RESERVED3 = 5, RESERVED4 = 6, RESERVED5 = 7, RESERVED6 = 8, RESERVED7 = 9, RESERVED8 = 10, RESERVED9 = 11, ONE_WIDE = 12, TWO_WIDE = 13, THREE_WIDE = 14, FOUR_WIDE = 15 } |
VertexData possible types. More... | |
Public Member Functions | |
VertexData (const GLenum primitive_type=GL_TRIANGLES) | |
VertexData constructor. More... | |
VertexData (const VertexData &vertex_data) | |
VertexData copy constructor. More... | |
VertexData | operator= (const VertexData &vertex_data) |
= operator More... | |
~VertexData () | |
Destroys the object. More... | |
bool | operator== (const VertexData &other) |
== operator More... | |
bool | operator!= (const VertexData &other) |
!= operator More... | |
void | addIndices (const std::vector< unsigned int > &indices) |
Adds indices. More... | |
template<typename T > | |
void | addVec (DATA_TYPE data_type, const std::vector< T > &vec) |
Adds a vector of data for a certain data type. More... | |
unsigned int | getIndexCount () const noexcept |
Gets the index count. More... | |
unsigned int | getVertexCount () const noexcept |
Gets the vertex count. More... | |
template<typename T > | |
std::map< DATA_TYPE, std::vector< T > > | getCollapsedVectors () const |
Gets a map of collapsed type vectors to a data types. More... | |
std::vector< unsigned int > | getIndices () const noexcept |
Gets the indices. More... | |
float | highestZ () const noexcept |
Returns the highest Z value found in this vertex data. More... | |
unsigned int | numberVertexBufferObjects () const noexcept |
Returns number of vertex buffer objects needed for this vertex data. More... | |
unsigned int | generateVertexArrayObject () const |
Generates an opengl vertex array object. More... | |
std::string | to_string () const noexcept |
Returns a string representation of the object. More... | |
template<> | |
void | addVec (VertexData::DATA_TYPE data_type, const std::vector< float > &vec) |
template<> | |
void | addVec (VertexData::DATA_TYPE data_type, const std::vector< double > &vec) |
template<> | |
void | addVec (VertexData::DATA_TYPE data_type, const std::vector< int > &vec) |
template<> | |
void | addVec (VertexData::DATA_TYPE data_type, const std::vector< unsigned int > &vec) |
template<> | |
std::map < VertexData::DATA_TYPE, std::vector< float > > | getCollapsedVectors () const |
template<> | |
std::map < VertexData::DATA_TYPE, std::vector< double > > | getCollapsedVectors () const |
template<> | |
std::map < VertexData::DATA_TYPE, std::vector< int > > | getCollapsedVectors () const |
template<> | |
std::map < VertexData::DATA_TYPE, std::vector< unsigned int > > | getCollapsedVectors () const |
Static Public Attributes | |
static const std::map < DATA_TYPE, unsigned int > | DataWidth |
Class for vertex data.
enum Graphics::VertexData::DATA_TYPE : unsigned int |
VertexData possible types.
Enumerator | |
---|---|
GEOMETRY | |
TEX_COORDS | |
TEXTURE_UNIT | |
NORMAL_COORDS | |
RESERVED2 | |
RESERVED3 | |
RESERVED4 | |
RESERVED5 | |
RESERVED6 | |
RESERVED7 | |
RESERVED8 | |
RESERVED9 | |
ONE_WIDE | |
TWO_WIDE | |
THREE_WIDE | |
FOUR_WIDE |
Graphics::VertexData::VertexData | ( | const GLenum | primitive_type = GL_TRIANGLES | ) |
VertexData constructor.
[in] | primitive_type | The primitive type |
Graphics::VertexData::VertexData | ( | const VertexData & | vertex_data | ) |
VertexData copy constructor.
[in] | vertex_data | The vertex data |
Graphics::VertexData::~VertexData | ( | ) |
Destroys the object.
void Graphics::VertexData::addIndices | ( | const std::vector< unsigned int > & | indices | ) |
Adds indices.
If indices are added first, then they are used for min and divisibility validation otherwise, vertices added are used for min and divisibility validation
[in] | indices | The indices |
Referenced by Graphics::UI::FontGenerator::loadFont().
void Graphics::VertexData::addVec | ( | DATA_TYPE | data_type, |
const std::vector< T > & | vec | ||
) |
Adds a vector of data for a certain data type.
[in] | data_type | The data type |
[in] | vec | The vector |
T | Physical Type of data to add |
Referenced by Graphics::UI::FontGenerator::loadFont().
void Graphics::VertexData::addVec | ( | VertexData::DATA_TYPE | data_type, |
const std::vector< float > & | vec | ||
) |
void Graphics::VertexData::addVec | ( | VertexData::DATA_TYPE | data_type, |
const std::vector< double > & | vec | ||
) |
void Graphics::VertexData::addVec | ( | VertexData::DATA_TYPE | data_type, |
const std::vector< int > & | vec | ||
) |
void Graphics::VertexData::addVec | ( | VertexData::DATA_TYPE | data_type, |
const std::vector< unsigned int > & | vec | ||
) |
unsigned int Graphics::VertexData::generateVertexArrayObject | ( | ) | const |
Generates an opengl vertex array object.
References DataWidth, getIndices(), and numberVertexBufferObjects().
Referenced by Graphics::Renderable::create(), and Graphics::UI::FontGenerator::loadFont().
std::map<DATA_TYPE, std::vector<T> > Graphics::VertexData::getCollapsedVectors | ( | ) | const |
Gets a map of collapsed type vectors to a data types.
std::map<VertexData::DATA_TYPE, std::vector<float> > Graphics::VertexData::getCollapsedVectors | ( | ) | const |
std::map<VertexData::DATA_TYPE, std::vector<int> > Graphics::VertexData::getCollapsedVectors | ( | ) | const |
std::map<VertexData::DATA_TYPE, std::vector<unsigned int> > Graphics::VertexData::getCollapsedVectors | ( | ) | const |
std::map<VertexData::DATA_TYPE, std::vector<double> > Graphics::VertexData::getCollapsedVectors | ( | ) | const |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
Returns the highest Z value found in this vertex data.
Referenced by Graphics::Renderable::highestZ().
|
noexcept |
Returns number of vertex buffer objects needed for this vertex data.
Referenced by generateVertexArrayObject().
bool Graphics::VertexData::operator!= | ( | const VertexData & | other | ) |
!= operator
[in] | other | The other |
VertexData Graphics::VertexData::operator= | ( | const VertexData & | vertex_data | ) |
= operator
[in] | vertex_data | The vertex data |
bool Graphics::VertexData::operator== | ( | const VertexData & | other | ) |
== operator
[in] | other | The other |
|
noexcept |
Returns a string representation of the object.
|
static |
Holds the different data widths possible for DATA_TYPE
Referenced by generateVertexArrayObject().