mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 01:26:50 -04:00
Add hint that vertices can be drawn as a flat sprite
Previously just rendering the UI in the 2D loading/generating menu took around 20 seconds in the 68x build. Now it's a very fast 15 seconds
This commit is contained in:
parent
09751a8aa4
commit
ffb790b1b5
@ -333,7 +333,8 @@ CC_API void Gfx_SetDynamicVbData(GfxResourceID vb, void* vertices, int vCount);
|
||||
|
||||
/*########################################################################################################################*
|
||||
*------------------------------------------------------Vertex drawing-----------------------------------------------------*
|
||||
*#########################################################################################################################*//*
|
||||
*#########################################################################################################################*/
|
||||
/*
|
||||
SUMMARY:
|
||||
Vertex drawing functions draw lines or triangles from the currently active vertex buffer
|
||||
IMPLEMENTATION NOTES:
|
||||
@ -344,13 +345,19 @@ USAGE NOTES:
|
||||
With the triangle drawing functions, the default bound index buffer
|
||||
is setup to draw groups of 2 triangles from 4 vertices (1 quad)
|
||||
*/
|
||||
|
||||
typedef enum DrawHints_ {
|
||||
DRAW_HINT_NONE = 0,
|
||||
DRAW_HINT_SPRITE = 9,
|
||||
} DrawHints;
|
||||
|
||||
/* Sets the format of the rendered vertices */
|
||||
CC_API void Gfx_SetVertexFormat(VertexFormat fmt);
|
||||
/* Renders vertices from the currently bound vertex buffer as lines */
|
||||
CC_API void Gfx_DrawVb_Lines(int verticesCount);
|
||||
/* Renders vertices from the currently bound vertex and index buffer as triangles */
|
||||
/* NOTE: Offsets each index by startVertex */
|
||||
CC_API void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex);
|
||||
CC_API void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex, DrawHints hints);
|
||||
/* Renders vertices from the currently bound vertex and index buffer as triangles */
|
||||
CC_API void Gfx_DrawVb_IndexedTris(int verticesCount);
|
||||
/* Special case Gfx_DrawVb_IndexedTris_Range for map renderer */
|
||||
|
@ -984,7 +984,7 @@ static void SetVertexSource(int startVertex) {
|
||||
// NOTE: Can't use GPUREG_VERTEX_OFFSET, it only works when drawing non-indexed arrays
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex, DrawHints hints) {
|
||||
SetVertexSource(startVertex);
|
||||
C3D_DrawElements(GPU_TRIANGLES, ICOUNT(verticesCount));
|
||||
}
|
||||
|
@ -495,7 +495,7 @@ void Gfx_DrawVb_IndexedTris(int verticesCount) {
|
||||
ID3D11DeviceContext_DrawIndexed(context, ICOUNT(verticesCount), 0, 0);
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex, DrawHints hints) {
|
||||
ID3D11DeviceContext_DrawIndexed(context, ICOUNT(verticesCount), 0, startVertex);
|
||||
}
|
||||
|
||||
|
@ -707,7 +707,7 @@ void Gfx_DrawVb_IndexedTris(int verticesCount) {
|
||||
0, 0, verticesCount, 0, verticesCount >> 1);
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex, DrawHints hints) {
|
||||
IDirect3DDevice9_DrawIndexedPrimitive(device, D3DPT_TRIANGLELIST,
|
||||
startVertex, 0, verticesCount, 0, verticesCount >> 1);
|
||||
}
|
||||
|
@ -806,7 +806,7 @@ void Gfx_DrawVb_Lines(int verticesCount) {
|
||||
//glDrawArrays(GL_LINES, 0, verticesCount);
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex, DrawHints hints) {
|
||||
void* src;
|
||||
if (gfx_format == VERTEX_FORMAT_TEXTURED) {
|
||||
src = gfx_vertices + startVertex * SIZEOF_VERTEX_TEXTURED;
|
||||
|
@ -628,7 +628,7 @@ static void Draw_TexturedTriangles(int verticesCount, int startVertex) {
|
||||
GX_End();
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex, DrawHints hints) {
|
||||
if (gfx_format == VERTEX_FORMAT_TEXTURED) {
|
||||
Draw_TexturedTriangles(verticesCount, startVertex);
|
||||
} else {
|
||||
|
@ -327,7 +327,7 @@ void Gfx_DrawVb_Lines(int verticesCount) {
|
||||
_glDrawArrays(GL_LINES, 0, verticesCount);
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex, DrawHints hints) {
|
||||
#ifdef CC_BUILD_GL11
|
||||
if (activeList != gl_DYNAMICLISTID) { glCallList(activeList); return; }
|
||||
#endif
|
||||
|
@ -673,7 +673,7 @@ void Gfx_DrawVb_Lines(int verticesCount) {
|
||||
glDrawArrays(GL_LINES, 0, verticesCount);
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex, DrawHints hints) {
|
||||
gfx_setupVBRangeFunc(startVertex);
|
||||
glDrawElements(GL_TRIANGLES, ICOUNT(verticesCount), GL_UNSIGNED_SHORT, NULL);
|
||||
}
|
||||
|
@ -514,7 +514,7 @@ void Gfx_SetVertexFormat(VertexFormat fmt) {
|
||||
void Gfx_DrawVb_Lines(int verticesCount) {
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex, DrawHints hints) {
|
||||
rspq_block_t* block = VB_GetCached(gfx_vb, startVertex, verticesCount);
|
||||
|
||||
if (block) {
|
||||
|
@ -658,7 +658,7 @@ static void Draw_TexturedTriangles(int verticesCount, int startVertex) {
|
||||
GFX_END = 0;
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex, DrawHints hints) {
|
||||
if (gfx_format == VERTEX_FORMAT_TEXTURED) {
|
||||
Draw_TexturedTriangles(verticesCount, startVertex);
|
||||
} else {
|
||||
|
@ -1094,7 +1094,7 @@ static void DrawQuads(int verticesCount, int startVertex) {
|
||||
}
|
||||
|
||||
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex, DrawHints hints) {
|
||||
DrawQuads(verticesCount, startVertex);
|
||||
}
|
||||
|
||||
|
@ -715,7 +715,7 @@ void Gfx_DrawVb_Lines(int verticesCount) {
|
||||
//SetPrimitiveType(PRIM_LINE);
|
||||
} /* TODO */
|
||||
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex, DrawHints hints) {
|
||||
//SetPrimitiveType(PRIM_TRIANGLE);
|
||||
DrawTriangles(verticesCount, startVertex);
|
||||
}
|
||||
|
@ -710,25 +710,25 @@ void Gfx_DisableTextureOffset(void) {
|
||||
void Gfx_SetVertexFormat(VertexFormat fmt) {
|
||||
if (fmt == gfx_format) return;
|
||||
gfx_format = fmt;
|
||||
gfx_stride = strideSizes[fmt];/* TODO */
|
||||
gfx_stride = strideSizes[fmt];
|
||||
|
||||
VP_SwitchActive();
|
||||
FP_SwitchActive();
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_Lines(int verticesCount) {/* TODO */
|
||||
void Gfx_DrawVb_Lines(int verticesCount) {
|
||||
rsxDrawVertexArray(context, GCM_TYPE_LINES, 0, verticesCount);
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {/* TODO */
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex, DrawHints hints) {
|
||||
rsxDrawVertexArray(context, GCM_TYPE_QUADS, startVertex, verticesCount);
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_IndexedTris(int verticesCount) {/* TODO */
|
||||
void Gfx_DrawVb_IndexedTris(int verticesCount) {
|
||||
rsxDrawVertexArray(context, GCM_TYPE_QUADS, 0, verticesCount);
|
||||
}
|
||||
|
||||
void Gfx_DrawIndexedTris_T2fC4b(int verticesCount, int startVertex) {/* TODO */
|
||||
void Gfx_DrawIndexedTris_T2fC4b(int verticesCount, int startVertex) {
|
||||
rsxDrawVertexArray(context, GCM_TYPE_QUADS, startVertex, verticesCount);
|
||||
}
|
||||
#endif
|
||||
|
@ -440,7 +440,7 @@ void Gfx_DrawVb_Lines(int verticesCount) {
|
||||
sceGuDrawArray(GU_LINES, gfx_fields, verticesCount, NULL, gfx_vertices);
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex, DrawHints hints) {
|
||||
sceGuDrawArray(GU_TRIANGLES, gfx_fields | GU_INDEX_16BIT, ICOUNT(verticesCount),
|
||||
gfx_indices, gfx_vertices + startVertex * gfx_stride);
|
||||
}
|
||||
|
@ -1080,7 +1080,7 @@ void Gfx_DrawVb_Lines(int verticesCount) {
|
||||
}
|
||||
|
||||
// TODO probably wrong to offset index buffer
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex, DrawHints hints) {
|
||||
//Platform_Log2("DRAW1: %i, %i", &verticesCount, &startVertex); Thread_Sleep(100);
|
||||
sceGxmDraw(gxm_context, SCE_GXM_PRIMITIVE_TRIANGLES,
|
||||
SCE_GXM_INDEX_FORMAT_U16, gfx_indices + ICOUNT(startVertex), ICOUNT(verticesCount));
|
||||
|
@ -611,7 +611,7 @@ static void DrawTexturedQuads3D(int verticesCount, int startVertex) {
|
||||
}
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex, DrawHints hints) {
|
||||
if (gfx_rendering2D) {
|
||||
if (gfx_format == VERTEX_FORMAT_TEXTURED) {
|
||||
DrawTexturedQuads2D(verticesCount, startVertex);
|
||||
|
@ -384,6 +384,65 @@ static CC_INLINE int FastFloor(float value) {
|
||||
return valueI > value ? valueI - 1 : valueI;
|
||||
}
|
||||
|
||||
static void DrawSprite2D(Vertex* V0, Vertex* V1, Vertex* V2) {
|
||||
int x0 = (int)V0->x, y0 = (int)V0->y;
|
||||
int x1 = (int)V1->x, y1 = (int)V1->y;
|
||||
int x2 = (int)V2->x, y2 = (int)V2->y;
|
||||
int minX = min(x0, min(x1, x2));
|
||||
int minY = min(y0, min(y1, y2));
|
||||
int maxX = max(x0, max(x1, x2));
|
||||
int maxY = max(y0, max(y1, y2));
|
||||
|
||||
int width = maxX - minX;
|
||||
int height = maxY - minY;
|
||||
|
||||
// Reject triangles completely outside
|
||||
if (maxX < 0 || minX > fb_maxX) return;
|
||||
if (maxY < 0 || minY > fb_maxY) return;
|
||||
|
||||
int begTX = (int)(V0->u * curTexWidth);
|
||||
int begTY = (int)(V0->v * curTexHeight);
|
||||
|
||||
// Perform scissoring
|
||||
minX = max(minX, 0); maxX = min(maxX, fb_maxX);
|
||||
minY = max(minY, 0); maxY = min(maxY, fb_maxY);
|
||||
|
||||
for (int y = minY; y <= maxY; y++)
|
||||
{
|
||||
int texY = (begTY + (y - minY)) & texHeightMask;
|
||||
for (int x = minX; x <= maxX; x++)
|
||||
{
|
||||
int texX = (begTX + (x - minX)) & texWidthMask;
|
||||
int texIndex = texY * curTexWidth + texX;
|
||||
|
||||
BitmapCol color = curTexPixels[texIndex];
|
||||
int R, G, B, A;
|
||||
|
||||
A = BitmapCol_A(color);
|
||||
if (gfx_alphaBlend && A == 0) continue;
|
||||
int cb_index = y * cb_stride + x;
|
||||
|
||||
if (gfx_alphaBlend && A != 255) {
|
||||
BitmapCol dst = colorBuffer[cb_index];
|
||||
int dstR = BitmapCol_R(dst);
|
||||
int dstG = BitmapCol_G(dst);
|
||||
int dstB = BitmapCol_B(dst);
|
||||
|
||||
R = BitmapCol_R(color);
|
||||
G = BitmapCol_G(color);
|
||||
B = BitmapCol_B(color);
|
||||
|
||||
R = (R * A + dstR * (255 - A)) >> 8;
|
||||
G = (G * A + dstG * (255 - A)) >> 8;
|
||||
B = (B * A + dstB * (255 - A)) >> 8;
|
||||
color = BitmapCol_Make(R, G, B, 0xFF);
|
||||
}
|
||||
|
||||
colorBuffer[cb_index] = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define edgeFunction(ax,ay, bx,by, cx,cy) (((bx) - (ax)) * ((cy) - (ay)) - ((by) - (ay)) * ((cx) - (ax)))
|
||||
|
||||
static void DrawTriangle2D(Vertex* V0, Vertex* V1, Vertex* V2) {
|
||||
@ -883,11 +942,21 @@ static void DrawClipped(int mask, Vertex* v0, Vertex* v1, Vertex* v2, Vertex* v3
|
||||
}
|
||||
}
|
||||
|
||||
void DrawQuads(int startVertex, int verticesCount) {
|
||||
void DrawQuads(int startVertex, int verticesCount, DrawHints hints) {
|
||||
Vertex vertices[4];
|
||||
int j = startVertex;
|
||||
|
||||
if (gfx_rendering2D) {
|
||||
if (gfx_rendering2D && hints == DRAW_HINT_SPRITE) {
|
||||
// 4 vertices = 1 quad = 2 triangles
|
||||
for (int i = 0; i < verticesCount / 4; i++, j += 4)
|
||||
{
|
||||
TransformVertex2D(j + 0, &vertices[0]);
|
||||
TransformVertex2D(j + 1, &vertices[1]);
|
||||
TransformVertex2D(j + 2, &vertices[2]);
|
||||
|
||||
DrawSprite2D(&vertices[0], &vertices[1], &vertices[2]);
|
||||
}
|
||||
} else if (gfx_rendering2D) {
|
||||
// 4 vertices = 1 quad = 2 triangles
|
||||
for (int i = 0; i < verticesCount / 4; i++, j += 4)
|
||||
{
|
||||
@ -934,16 +1003,16 @@ void Gfx_SetVertexFormat(VertexFormat fmt) {
|
||||
|
||||
void Gfx_DrawVb_Lines(int verticesCount) { } /* TODO */
|
||||
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
||||
DrawQuads(startVertex, verticesCount);
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex, DrawHints hints) {
|
||||
DrawQuads(startVertex, verticesCount, hints);
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_IndexedTris(int verticesCount) {
|
||||
DrawQuads(0, verticesCount);
|
||||
DrawQuads(0, verticesCount, DRAW_HINT_NONE);
|
||||
}
|
||||
|
||||
void Gfx_DrawIndexedTris_T2fC4b(int verticesCount, int startVertex) {
|
||||
DrawQuads(startVertex, verticesCount);
|
||||
DrawQuads(startVertex, verticesCount, DRAW_HINT_NONE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -327,7 +327,7 @@ void Gfx_DrawVb_IndexedTris(int verticesCount) {
|
||||
GX2DrawEx(GX2_PRIMITIVE_MODE_QUADS, verticesCount, 0, 1);
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex, DrawHints hints) {
|
||||
BindPendingTexture();
|
||||
GX2DrawEx(GX2_PRIMITIVE_MODE_QUADS, verticesCount, startVertex, 1);
|
||||
}
|
||||
|
@ -687,7 +687,7 @@ static void DrawIndexedVertices(int verticesCount, int startVertex) {
|
||||
DrawArrays(NV097_SET_BEGIN_END_OP_QUADS, startVertex, verticesCount);
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex, DrawHints hints) {
|
||||
DrawIndexedVertices(verticesCount, startVertex);
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,7 @@ void Gfx_DrawVb_IndexedTris(int verticesCount) {
|
||||
Xe_DrawPrimitive(xe, XE_PRIMTYPE_QUADLIST, 0, verticesCount >> 2);
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex, DrawHints hints) {
|
||||
Platform_Log1("DRAW_TRIS_RANGE: %i", &verticesCount);
|
||||
Xe_DrawPrimitive(xe, XE_PRIMTYPE_QUADLIST, startVertex, verticesCount >> 2);
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ void IsometricDrawer_Render(int count, int offset, int* state) {
|
||||
|
||||
/* Flush previous batch */
|
||||
Atlas1D_Bind(curIdx);
|
||||
Gfx_DrawVb_IndexedTris_Range(batchLen, batchBeg);
|
||||
Gfx_DrawVb_IndexedTris_Range(batchLen, batchBeg, DRAW_HINT_NONE);
|
||||
|
||||
/* Reset for next batch */
|
||||
curIdx = state[i];
|
||||
@ -168,5 +168,5 @@ void IsometricDrawer_Render(int count, int offset, int* state) {
|
||||
}
|
||||
|
||||
Atlas1D_Bind(curIdx);
|
||||
Gfx_DrawVb_IndexedTris_Range(batchLen, batchBeg);
|
||||
Gfx_DrawVb_IndexedTris_Range(batchLen, batchBeg, DRAW_HINT_NONE);
|
||||
}
|
||||
|
@ -2565,7 +2565,7 @@ static int TexIdsOverlay_RenderTerrain(struct TexIdsOverlay* s, int offset) {
|
||||
{
|
||||
Atlas1D_Bind(i);
|
||||
|
||||
Gfx_DrawVb_IndexedTris_Range(count, offset);
|
||||
Gfx_DrawVb_IndexedTris_Range(count, offset, DRAW_HINT_NONE);
|
||||
offset += count;
|
||||
}
|
||||
return offset;
|
||||
@ -2607,7 +2607,7 @@ static void TexIdsOverlay_Render(void* screen, float delta) {
|
||||
offset = TexIdsOverlay_RenderTerrain(s, offset);
|
||||
|
||||
Gfx_BindTexture(s->idAtlas.tex.ID);
|
||||
Gfx_DrawVb_IndexedTris_Range(s->textVertices, offset);
|
||||
Gfx_DrawVb_IndexedTris_Range(s->textVertices, offset, DRAW_HINT_SPRITE);
|
||||
}
|
||||
|
||||
static int TexIdsOverlay_KeyDown(void* screen, int key, struct InputDevice* device) {
|
||||
|
10
src/Model.c
10
src/Model.c
@ -972,9 +972,9 @@ static void HumanModel_DrawCore(struct Entity* e, struct ModelSet* model, cc_boo
|
||||
if (opaqueBody) {
|
||||
/* human model draws the body opaque so players can't have invisible skins */
|
||||
Gfx_SetAlphaTest(false);
|
||||
Gfx_DrawVb_IndexedTris_Range(HUMAN_BASE_VERTICES, 0);
|
||||
Gfx_DrawVb_IndexedTris_Range(HUMAN_BASE_VERTICES, 0, DRAW_HINT_NONE);
|
||||
Gfx_SetAlphaTest(true);
|
||||
Gfx_DrawVb_IndexedTris_Range(num - HUMAN_BASE_VERTICES, HUMAN_BASE_VERTICES);
|
||||
Gfx_DrawVb_IndexedTris_Range(num - HUMAN_BASE_VERTICES, HUMAN_BASE_VERTICES, DRAW_HINT_NONE);
|
||||
} else {
|
||||
Gfx_DrawVb_IndexedTris(num);
|
||||
}
|
||||
@ -1789,7 +1789,7 @@ static void SheepModel_Draw(struct Entity* e) {
|
||||
Model_UnlockVB();
|
||||
Gfx_DrawVb_IndexedTris(SHEEP_BODY_VERTICES);
|
||||
Gfx_BindTexture(fur_tex.texID);
|
||||
Gfx_DrawVb_IndexedTris_Range(SHEEP_FUR_VERTICES, SHEEP_BODY_VERTICES);
|
||||
Gfx_DrawVb_IndexedTris_Range(SHEEP_FUR_VERTICES, SHEEP_BODY_VERTICES, DRAW_HINT_NONE);
|
||||
}
|
||||
|
||||
static float SheepModel_GetNameY(struct Entity* e) { return 1.48125f; }
|
||||
@ -2203,7 +2203,7 @@ static void BlockModel_DrawParts(void) {
|
||||
|
||||
/* Different 1D flush texture, flush current vertices */
|
||||
Atlas1D_Bind(lastTexIndex);
|
||||
Gfx_DrawVb_IndexedTris_Range(count, offset);
|
||||
Gfx_DrawVb_IndexedTris_Range(count, offset, DRAW_HINT_NONE);
|
||||
lastTexIndex = bModel_texIndices[i];
|
||||
|
||||
offset += count;
|
||||
@ -2213,7 +2213,7 @@ static void BlockModel_DrawParts(void) {
|
||||
/* Leftover vertices */
|
||||
if (!count) return;
|
||||
Atlas1D_Bind(lastTexIndex);
|
||||
Gfx_DrawVb_IndexedTris_Range(count, offset);
|
||||
Gfx_DrawVb_IndexedTris_Range(count, offset, DRAW_HINT_NONE);
|
||||
}
|
||||
|
||||
static void BlockModel_Draw(struct Entity* e) {
|
||||
|
@ -301,7 +301,7 @@ static void Terrain_Render(float t) {
|
||||
if (!partCount) continue;
|
||||
|
||||
Atlas1D_Bind(i);
|
||||
Gfx_DrawVb_IndexedTris_Range(partCount, offset);
|
||||
Gfx_DrawVb_IndexedTris_Range(partCount, offset, DRAW_HINT_NONE);
|
||||
offset += partCount;
|
||||
}
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ static void HUDScreen_Render(void* screen, float delta) {
|
||||
} else if (IsOnlyChatActive() && Gui.ShowFPS) {
|
||||
Widget_Render2(&s->line2, 8);
|
||||
Gfx_BindTexture(s->posAtlas.tex.ID);
|
||||
Gfx_DrawVb_IndexedTris_Range(s->posCount, 12 + HOTBAR_MAX_VERTICES);
|
||||
Gfx_DrawVb_IndexedTris_Range(s->posCount, 12 + HOTBAR_MAX_VERTICES, DRAW_HINT_SPRITE);
|
||||
/* TODO swap these two lines back */
|
||||
}
|
||||
|
||||
@ -844,7 +844,7 @@ static void TabListOverlay_Render(void* screen, float delta) {
|
||||
if (!s->textures[i].ID) continue;
|
||||
Gfx_BindTexture(s->textures[i].ID);
|
||||
|
||||
Gfx_DrawVb_IndexedTris_Range(4, offset);
|
||||
Gfx_DrawVb_IndexedTris_Range(4, offset, DRAW_HINT_SPRITE);
|
||||
offset += 4;
|
||||
}
|
||||
|
||||
@ -1174,7 +1174,7 @@ static void ChatScreen_DrawChat(struct ChatScreen* s, float delta) {
|
||||
if (Chat_GetLogTime(logIdx) + 10 < now) continue;
|
||||
|
||||
Gfx_BindTexture(tex.ID);
|
||||
Gfx_DrawVb_IndexedTris_Range(4, i * 4);
|
||||
Gfx_DrawVb_IndexedTris_Range(4, i * 4, DRAW_HINT_SPRITE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1947,7 +1947,7 @@ static void LoadingScreen_Render(void* screen, float delta) {
|
||||
if (s->rows) {
|
||||
loc = Block_Tex(BLOCK_DIRT, FACE_YMAX);
|
||||
Atlas1D_Bind(Atlas1D_Index(loc));
|
||||
Gfx_DrawVb_IndexedTris(s->rows * 4);
|
||||
Gfx_DrawVb_IndexedTris_Range(s->rows * 4, 0, DRAW_HINT_NONE);
|
||||
offset = s->rows * 4;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ static int TextWidget_Render2(void* widget, int offset) {
|
||||
struct TextWidget* w = (struct TextWidget*)widget;
|
||||
if (w->tex.ID) {
|
||||
Gfx_BindTexture(w->tex.ID);
|
||||
Gfx_DrawVb_IndexedTris_Range(4, offset);
|
||||
Gfx_DrawVb_IndexedTris_Range(4, offset, DRAW_HINT_SPRITE);
|
||||
}
|
||||
return offset + 4;
|
||||
}
|
||||
@ -216,11 +216,11 @@ static int ButtonWidget_Render2(void* widget, int offset) {
|
||||
struct ButtonWidget* w = (struct ButtonWidget*)widget;
|
||||
Gfx_BindTexture(Gui.ClassicTexture ? Gui.GuiClassicTex : Gui.GuiTex);
|
||||
/* TODO: Does this 400 need to take DPI into account */
|
||||
Gfx_DrawVb_IndexedTris_Range(w->width >= 400 ? 4 : 8, offset);
|
||||
Gfx_DrawVb_IndexedTris_Range(w->width >= 400 ? 4 : 8, offset, DRAW_HINT_NONE);
|
||||
|
||||
if (w->tex.ID) {
|
||||
Gfx_BindTexture(w->tex.ID);
|
||||
Gfx_DrawVb_IndexedTris_Range(4, offset + 8);
|
||||
Gfx_DrawVb_IndexedTris_Range(4, offset + 8, DRAW_HINT_NONE);
|
||||
}
|
||||
return offset + 12;
|
||||
}
|
||||
@ -452,7 +452,7 @@ static void HotbarWidget_RenderOutline(struct HotbarWidget* w, int offset) {
|
||||
tex = Gui.ClassicTexture ? Gui.GuiClassicTex : Gui.GuiTex;
|
||||
|
||||
Gfx_BindTexture(tex);
|
||||
Gfx_DrawVb_IndexedTris_Range(8, offset);
|
||||
Gfx_DrawVb_IndexedTris_Range(8, offset, DRAW_HINT_NONE);
|
||||
}
|
||||
|
||||
static void HotbarWidget_RenderEntries(struct HotbarWidget* w, int offset) {
|
||||
@ -1597,12 +1597,12 @@ static void TextInputWidget_BuildMesh(void* widget, struct VertexTextured** vert
|
||||
static int TextInputWidget_Render2(void* widget, int offset) {
|
||||
struct InputWidget* w = (struct InputWidget*)widget;
|
||||
Gfx_BindTexture(w->inputTex.ID);
|
||||
Gfx_DrawVb_IndexedTris_Range(4, offset);
|
||||
Gfx_DrawVb_IndexedTris_Range(4, offset, DRAW_HINT_SPRITE);
|
||||
offset += 4;
|
||||
|
||||
if (w->showCaret && Math_Mod1((float)w->caretAccumulator) < 0.5f) {
|
||||
Gfx_BindTexture(w->caretTex.ID);
|
||||
Gfx_DrawVb_IndexedTris_Range(4, offset);
|
||||
Gfx_DrawVb_IndexedTris_Range(4, offset, DRAW_HINT_SPRITE);
|
||||
}
|
||||
return offset + 4;
|
||||
}
|
||||
@ -2460,7 +2460,7 @@ static int TextGroupWidget_Render2(void* widget, int offset) {
|
||||
if (!textures[i].ID) continue;
|
||||
|
||||
Gfx_BindTexture(textures[i].ID);
|
||||
Gfx_DrawVb_IndexedTris_Range(4, offset);
|
||||
Gfx_DrawVb_IndexedTris_Range(4, offset, DRAW_HINT_SPRITE);
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
@ -2817,7 +2817,7 @@ static int ThumbstickWidget_Render2(void* widget, int offset) {
|
||||
Gfx_BindTexture(Gui.TouchTex);
|
||||
for (i = 0; i < 4; i++) {
|
||||
base = (flags & (1 << i)) ? 0 : THUMBSTICKWIDGET_PER;
|
||||
Gfx_DrawVb_IndexedTris_Range(4, offset + base + (i * 4));
|
||||
Gfx_DrawVb_IndexedTris_Range(4, offset + base + (i * 4), DRAW_HINT_NONE);
|
||||
}
|
||||
}
|
||||
return offset + THUMBSTICKWIDGET_MAX;
|
||||
|
Loading…
x
Reference in New Issue
Block a user