more tweaks to batch API
parent
e93662f231
commit
6a86f5b533
|
@ -116,11 +116,13 @@ WELLSPRINGAPI uint8_t* Wellspring_GetPixelDataPointer(
|
||||||
WELLSPRINGAPI Wellspring_TextBatch* Wellspring_CreateTextBatch();
|
WELLSPRINGAPI Wellspring_TextBatch* Wellspring_CreateTextBatch();
|
||||||
|
|
||||||
/* Also restarts the batch */
|
/* Also restarts the batch */
|
||||||
WELLSPRINGAPI void Wellspring_StartTextBatch(Wellspring_TextBatch *textBatch);
|
WELLSPRINGAPI void Wellspring_StartTextBatch(
|
||||||
|
Wellspring_TextBatch *textBatch,
|
||||||
|
Wellspring_Packer *packer
|
||||||
|
);
|
||||||
|
|
||||||
WELLSPRINGAPI uint8_t Wellspring_Draw(
|
WELLSPRINGAPI uint8_t Wellspring_Draw(
|
||||||
Wellspring_TextBatch *textBatch,
|
Wellspring_TextBatch *textBatch,
|
||||||
Wellspring_Packer *packer,
|
|
||||||
float x,
|
float x,
|
||||||
float y,
|
float y,
|
||||||
float depth,
|
float depth,
|
||||||
|
@ -129,12 +131,6 @@ WELLSPRINGAPI uint8_t Wellspring_Draw(
|
||||||
uint32_t strLengthInBytes
|
uint32_t strLengthInBytes
|
||||||
);
|
);
|
||||||
|
|
||||||
WELLSPRINGAPI void Wellspring_GetBufferLengths(
|
|
||||||
Wellspring_TextBatch *textBatch,
|
|
||||||
uint32_t *pVertexCount,
|
|
||||||
uint32_t *pIndexCount
|
|
||||||
);
|
|
||||||
|
|
||||||
WELLSPRINGAPI void Wellspring_GetBufferData(
|
WELLSPRINGAPI void Wellspring_GetBufferData(
|
||||||
Wellspring_TextBatch *textBatch,
|
Wellspring_TextBatch *textBatch,
|
||||||
Wellspring_Vertex **pVertexBuffer,
|
Wellspring_Vertex **pVertexBuffer,
|
||||||
|
|
|
@ -89,6 +89,8 @@ typedef struct Batch
|
||||||
uint32_t *indices;
|
uint32_t *indices;
|
||||||
uint32_t indexCount;
|
uint32_t indexCount;
|
||||||
uint32_t indexCapacity;
|
uint32_t indexCapacity;
|
||||||
|
|
||||||
|
Packer *currentPacker;
|
||||||
} Batch;
|
} Batch;
|
||||||
|
|
||||||
/* UTF-8 Decoder */
|
/* UTF-8 Decoder */
|
||||||
|
@ -236,16 +238,18 @@ Wellspring_TextBatch* Wellspring_CreateTextBatch()
|
||||||
return (Wellspring_TextBatch*) batch;
|
return (Wellspring_TextBatch*) batch;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wellspring_StartTextBatch(Wellspring_TextBatch *textBatch)
|
void Wellspring_StartTextBatch(
|
||||||
{
|
Wellspring_TextBatch *textBatch,
|
||||||
|
Wellspring_Packer *packer
|
||||||
|
) {
|
||||||
Batch *batch = (Batch*) textBatch;
|
Batch *batch = (Batch*) textBatch;
|
||||||
|
batch->currentPacker = (Packer*) packer;
|
||||||
batch->vertexCount = 0;
|
batch->vertexCount = 0;
|
||||||
batch->indexCount = 0;
|
batch->indexCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Wellspring_Draw(
|
uint8_t Wellspring_Draw(
|
||||||
Wellspring_TextBatch *textBatch,
|
Wellspring_TextBatch *textBatch,
|
||||||
Wellspring_Packer *packer,
|
|
||||||
float x,
|
float x,
|
||||||
float y,
|
float y,
|
||||||
float depth,
|
float depth,
|
||||||
|
@ -254,7 +258,7 @@ uint8_t Wellspring_Draw(
|
||||||
uint32_t strLength
|
uint32_t strLength
|
||||||
) {
|
) {
|
||||||
Batch *batch = (Batch*) textBatch;
|
Batch *batch = (Batch*) textBatch;
|
||||||
Packer *myPacker = (Packer*) packer;
|
Packer *myPacker = batch->currentPacker;
|
||||||
uint32_t decodeState = 0;
|
uint32_t decodeState = 0;
|
||||||
uint32_t codepoint;
|
uint32_t codepoint;
|
||||||
int32_t glyphIndex;
|
int32_t glyphIndex;
|
||||||
|
@ -372,16 +376,6 @@ uint8_t Wellspring_Draw(
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wellspring_GetBufferLengths(
|
|
||||||
Wellspring_TextBatch *textBatch,
|
|
||||||
uint32_t *pVertexCount,
|
|
||||||
uint32_t *pIndexCount
|
|
||||||
) {
|
|
||||||
Batch *batch = (Batch*) textBatch;
|
|
||||||
*pVertexCount = batch->vertexCount;
|
|
||||||
*pIndexCount = batch->indexCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Wellspring_GetBufferData(
|
void Wellspring_GetBufferData(
|
||||||
Wellspring_TextBatch *textBatch,
|
Wellspring_TextBatch *textBatch,
|
||||||
Wellspring_Vertex **pVertexBuffer,
|
Wellspring_Vertex **pVertexBuffer,
|
||||||
|
|
Loading…
Reference in New Issue