Added SpriteBatch:attachAttribute(attributename, mesh), which lets SpriteBatches use per-vertex information from a vertex attribute in a Mesh when drawing.

Each sprite in a SpriteBatch has 4 vertices in the following order: top-left, bottom-left, top-right, bottom-right. The index returned by SpriteBatch:add (and used by SpriteBatch:set) can be multiplied by 4 to determine the first vertex in a specific sprite.
This commit is contained in:
Alex Szpakowski
2015-11-26 21:24:29 -04:00
parent f1d0187a58
commit 3c1c13793e
7 changed files with 140 additions and 55 deletions
+3
View File
@@ -90,6 +90,9 @@ void *GLBuffer::map()
void GLBuffer::unmapStatic(size_t offset, size_t size)
{
if (size == 0)
return;
// Upload the mapped data to the buffer.
glBufferSubData(getTarget(), (GLintptr) offset, (GLsizeiptr) size, memory_map + offset);
}