xoreos
0.0.5
|
Buffer containing vertex data. More...
#include <vertexbuffer.h>
Public Member Functions | |
VertexBuffer () | |
VertexBuffer (const VertexBuffer &other) | |
~VertexBuffer () | |
VertexBuffer & | operator= (const VertexBuffer &other) |
void | setSize (uint32 vertCount, uint32 vertSize) |
Change buffer size. More... | |
void | setVertexDecl (const VertexDecl &decl) |
Set vertex declaration for this buffer. More... | |
void | setVertexDeclLinear (uint32 vertCount, VertexDecl &decl) |
Set the linear vertex declaration for this buffer. More... | |
void | setVertexDeclInterleave (uint32 vertCount, VertexDecl &decl) |
Set the interleaved vertex declaration for this buffer. More... | |
GLvoid * | getData () |
Access buffer data. More... | |
const GLvoid * | getData () const |
Access buffer data. More... | |
GLvoid * | getData (size_t vertexDecl) |
Access buffer data of a specific vertex declaration. More... | |
const GLvoid * | getData (size_t vertexDecl) const |
Access buffer data of a specific vertex declaration. More... | |
const VertexDecl & | getVertexDecl () const |
Access vertex declaration. More... | |
uint32 | getCount () const |
Get vertex count. More... | |
uint32 | getSize () const |
Get vertex element size in bytes. More... | |
void | initGL (GLuint hint=GL_STATIC_DRAW) |
Initialise internal buffer object for GL handling. More... | |
void | updateGL () |
Update existing GL buffer object. More... | |
void | updateGLBound () const |
Update an existing GL buffer object, assuming it is already bound. More... | |
void | destroyGL () |
Clear (destroy) GL resources associated with the buffer. More... | |
GLuint | getVBO () const |
void | draw (GLenum mode, const IndexBuffer &indexBuffer) const |
Draw this IndexBuffer/VertexBuffer combination. More... | |
Static Private Member Functions | |
static uint32 | getTypeSize (GLenum type) |
Private Attributes | |
VertexDecl | _decl |
Vertex declaration. More... | |
uint32 | _count |
Number of elements in buffer. More... | |
uint32 | _size |
Size of a buffer element in bytes (vertex attributes size sum). More... | |
byte * | _data |
Buffer data. More... | |
GLuint | _vbo |
Vertex Buffer Object. More... | |
GLuint | _hint |
GL hint for static or dynamic data. More... | |
Buffer containing vertex data.
Definition at line 68 of file vertexbuffer.h.
Graphics::VertexBuffer::VertexBuffer | ( | ) |
Definition at line 92 of file vertexbuffer.cpp.
Graphics::VertexBuffer::VertexBuffer | ( | const VertexBuffer & | other | ) |
Definition at line 95 of file vertexbuffer.cpp.
Graphics::VertexBuffer::~VertexBuffer | ( | ) |
Definition at line 99 of file vertexbuffer.cpp.
References _data, and destroyGL().
void Graphics::VertexBuffer::destroyGL | ( | ) |
Clear (destroy) GL resources associated with the buffer.
Definition at line 275 of file vertexbuffer.cpp.
References _vbo.
Referenced by Graphics::Mesh::Mesh::destroyGL(), and ~VertexBuffer().
void Graphics::VertexBuffer::draw | ( | GLenum | mode, |
const IndexBuffer & | indexBuffer | ||
) | const |
Draw this IndexBuffer/VertexBuffer combination.
Definition at line 286 of file vertexbuffer.cpp.
References _decl, Graphics::IndexBuffer::getCount(), getCount(), Graphics::IndexBuffer::getData(), and Graphics::IndexBuffer::getType().
Referenced by Graphics::Aurora::GeometryObject::render().
uint32 Graphics::VertexBuffer::getCount | ( | ) | const |
Get vertex count.
Definition at line 241 of file vertexbuffer.cpp.
References _count.
Referenced by Graphics::Aurora::ModelNode::buildMaterial(), Graphics::Aurora::ModelNode::createBound(), draw(), Graphics::Aurora::ModelNode::flushBuffers(), Graphics::Mesh::Mesh::init(), Graphics::Render::RenderManager::queueRenderable(), Graphics::Mesh::MeshFont::render(), Graphics::Mesh::Mesh::render(), and Graphics::Aurora::Animation::updateSkinnedModel().
GLvoid * Graphics::VertexBuffer::getData | ( | ) |
Access buffer data.
Definition at line 217 of file vertexbuffer.cpp.
References _data.
Referenced by Graphics::Aurora::ModelNode_Jade::createMesh(), Graphics::Aurora::ModelNode_DragonAge::createVertexBuffer(), Graphics::Aurora::Model_Sonic::evaluatePrimitive(), Graphics::Aurora::ModelNode::flushBuffers(), Graphics::Mesh::Mesh::init(), Graphics::Mesh::Mesh::initGL(), Engines::Jade::Trigger::loadInstance(), Graphics::Aurora::ModelNode_NWN2::loadRigid(), Graphics::Aurora::ModelNode_NWN2::loadSkin(), Engines::NWN2::TRXFile::loadTRRN(), Engines::NWN2::TRXFile::loadWATR(), Graphics::Mesh::MeshFont::MeshFont(), Graphics::Mesh::MeshQuad::MeshQuad(), Graphics::Mesh::MeshWireBox::MeshWireBox(), Graphics::Aurora::ModelNode_Witcher::readMesh(), Graphics::Aurora::ModelNode_NWN_Binary::readMesh(), Graphics::Aurora::ModelNode_KotOR::readMesh(), Graphics::Aurora::ModelNode_Witcher::readTexturePaint(), Graphics::Mesh::MeshFont::render(), and Graphics::Mesh::Mesh::renderBind().
const GLvoid * Graphics::VertexBuffer::getData | ( | ) | const |
GLvoid * Graphics::VertexBuffer::getData | ( | size_t | vertexDecl | ) |
Access buffer data of a specific vertex declaration.
Definition at line 225 of file vertexbuffer.cpp.
References _decl.
const GLvoid * Graphics::VertexBuffer::getData | ( | size_t | vertexDecl | ) | const |
Access buffer data of a specific vertex declaration.
Definition at line 231 of file vertexbuffer.cpp.
References _decl.
uint32 Graphics::VertexBuffer::getSize | ( | ) | const |
Get vertex element size in bytes.
Definition at line 245 of file vertexbuffer.cpp.
References _size.
Referenced by Graphics::Aurora::ModelNode::flushBuffers().
|
staticprivate |
Definition at line 157 of file vertexbuffer.cpp.
Referenced by setVertexDeclInterleave(), and setVertexDeclLinear().
GLuint Graphics::VertexBuffer::getVBO | ( | ) | const |
Definition at line 282 of file vertexbuffer.cpp.
References _vbo.
Referenced by Graphics::Mesh::Mesh::initGL(), Graphics::Mesh::Mesh::renderBind(), and Graphics::Aurora::TextureFont::renderBind().
const VertexDecl & Graphics::VertexBuffer::getVertexDecl | ( | ) | const |
Access vertex declaration.
Definition at line 237 of file vertexbuffer.cpp.
References _decl.
Referenced by Graphics::Aurora::ModelNode_Witcher::buildMaterial(), Graphics::Aurora::ModelNode::createBound(), Graphics::Mesh::Mesh::init(), Graphics::Mesh::Mesh::initGL(), Graphics::Mesh::Mesh::renderBind(), and Graphics::Mesh::Mesh::renderUnbind().
void Graphics::VertexBuffer::initGL | ( | GLuint | hint = GL_STATIC_DRAW | ) |
Initialise internal buffer object for GL handling.
Definition at line 249 of file vertexbuffer.cpp.
References _count, _data, _hint, _size, and _vbo.
Referenced by Graphics::Mesh::Mesh::initGL().
VertexBuffer & Graphics::VertexBuffer::operator= | ( | const VertexBuffer & | other | ) |
Definition at line 104 of file vertexbuffer.cpp.
References _count, _data, _decl, _size, setSize(), and setVertexDecl().
Change buffer size.
Will allocate memory, free previous.
Definition at line 141 of file vertexbuffer.cpp.
References _count, _data, and _size.
Referenced by Graphics::Mesh::MeshFont::MeshFont(), Graphics::Mesh::MeshWireBox::MeshWireBox(), operator=(), setVertexDeclInterleave(), and setVertexDeclLinear().
void Graphics::VertexBuffer::setVertexDecl | ( | const VertexDecl & | decl | ) |
Set vertex declaration for this buffer.
Definition at line 153 of file vertexbuffer.cpp.
References _decl.
Referenced by Graphics::Mesh::MeshWireBox::MeshWireBox(), and operator=().
void Graphics::VertexBuffer::setVertexDeclInterleave | ( | uint32 | vertCount, |
VertexDecl & | decl | ||
) |
Set the interleaved vertex declaration for this buffer.
Will allocate memory to fit vertCount vertices into this buffer and modify the declaration's pointers and strides to fit an interleaved layout.
Definition at line 199 of file vertexbuffer.cpp.
References _data, _decl, getTypeSize(), and setSize().
Referenced by Graphics::Aurora::ModelNode_Jade::createMesh(), Graphics::Aurora::ModelNode_DragonAge::createVertexBuffer(), Graphics::Aurora::Model_Sonic::evaluatePrimitive(), Graphics::Aurora::ModelNode_NWN2::loadRigid(), Graphics::Aurora::ModelNode_NWN2::loadSkin(), Engines::NWN2::TRXFile::loadTRRN(), Engines::NWN2::TRXFile::loadWATR(), Graphics::Aurora::ModelNode_NWN_Binary::readMesh(), and Graphics::Aurora::ModelNode_KotOR::readMesh().
void Graphics::VertexBuffer::setVertexDeclLinear | ( | uint32 | vertCount, |
VertexDecl & | decl | ||
) |
Set the linear vertex declaration for this buffer.
Will allocate memory to fit vertCount vertices into this buffer and modify the declaration's pointers and strides to fit a linear layout.
Definition at line 181 of file vertexbuffer.cpp.
References _data, _decl, getTypeSize(), and setSize().
Referenced by Engines::Jade::Trigger::loadInstance(), Graphics::Mesh::MeshFont::MeshFont(), Graphics::Mesh::MeshQuad::MeshQuad(), Graphics::Aurora::ModelNode_Witcher::readMesh(), and Graphics::Aurora::ModelNode_Witcher::readTexturePaint().
void Graphics::VertexBuffer::updateGL | ( | ) |
Update existing GL buffer object.
Try not to call while rendering.
Definition at line 263 of file vertexbuffer.cpp.
References _count, _data, _hint, _size, and _vbo.
Referenced by Graphics::Aurora::ModelNode::render(), and Graphics::Mesh::Mesh::updateGL().
void Graphics::VertexBuffer::updateGLBound | ( | ) | const |
Update an existing GL buffer object, assuming it is already bound.
Definition at line 271 of file vertexbuffer.cpp.
References _count, _data, and _size.
Referenced by Graphics::Mesh::MeshFont::render().
|
private |
Number of elements in buffer.
Definition at line 139 of file vertexbuffer.h.
Referenced by getCount(), initGL(), operator=(), setSize(), updateGL(), and updateGLBound().
|
private |
Buffer data.
Definition at line 141 of file vertexbuffer.h.
Referenced by getData(), initGL(), operator=(), setSize(), setVertexDeclInterleave(), setVertexDeclLinear(), updateGL(), updateGLBound(), and ~VertexBuffer().
|
private |
Vertex declaration.
Definition at line 138 of file vertexbuffer.h.
Referenced by draw(), getData(), getVertexDecl(), operator=(), setVertexDecl(), setVertexDeclInterleave(), and setVertexDeclLinear().
|
private |
GL hint for static or dynamic data.
Definition at line 144 of file vertexbuffer.h.
Referenced by initGL(), and updateGL().
|
private |
Size of a buffer element in bytes (vertex attributes size sum).
Definition at line 140 of file vertexbuffer.h.
Referenced by getSize(), initGL(), operator=(), setSize(), updateGL(), and updateGLBound().
|
private |
Vertex Buffer Object.
Definition at line 143 of file vertexbuffer.h.
Referenced by destroyGL(), getVBO(), initGL(), and updateGL().