mirror of https://github.com/bjornbytes/lovr.git
rm lovr.graphics.triangle;
This commit is contained in:
parent
3055cd718c
commit
39a4d2c1d5
|
@ -931,23 +931,6 @@ static int l_lovrGraphicsLine(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int l_lovrGraphicsTriangle(lua_State* L) {
|
||||
DrawStyle style = STYLE_FILL;
|
||||
Material* material = NULL;
|
||||
if (lua_isuserdata(L, 1)) {
|
||||
material = luax_checktype(L, 1, Material);
|
||||
} else {
|
||||
style = luax_checkenum(L, 1, DrawStyle, NULL);
|
||||
}
|
||||
|
||||
float* vertices;
|
||||
uint32_t count = luax_getvertexcount(L, 2);
|
||||
lovrAssert(count % 3 == 0, "Triangle vertex count must be a multiple of 3");
|
||||
lovrGraphicsTriangle(style, material, count, &vertices);
|
||||
luax_readvertices(L, 2, vertices, count);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_lovrGraphicsPlane(lua_State* L) {
|
||||
DrawStyle style = STYLE_FILL;
|
||||
Material* material = NULL;
|
||||
|
@ -1809,7 +1792,6 @@ static const luaL_Reg lovrGraphics[] = {
|
|||
{ "flush", l_lovrGraphicsFlush },
|
||||
{ "points", l_lovrGraphicsPoints },
|
||||
{ "line", l_lovrGraphicsLine },
|
||||
{ "triangle", l_lovrGraphicsTriangle },
|
||||
{ "plane", l_lovrGraphicsPlane },
|
||||
{ "cube", l_lovrGraphicsCube },
|
||||
{ "box", l_lovrGraphicsBox },
|
||||
|
|
|
@ -32,7 +32,6 @@ typedef enum {
|
|||
typedef enum {
|
||||
BATCH_POINTS,
|
||||
BATCH_LINES,
|
||||
BATCH_TRIANGLES,
|
||||
BATCH_PLANE,
|
||||
BATCH_BOX,
|
||||
BATCH_ARC,
|
||||
|
@ -867,33 +866,6 @@ void lovrGraphicsLine(uint32_t count, float** vertices) {
|
|||
}
|
||||
}
|
||||
|
||||
void lovrGraphicsTriangle(DrawStyle style, Material* material, uint32_t count, float** vertices) {
|
||||
uint32_t indexCount = style == STYLE_LINE ? (4 * count / 3) : 0;
|
||||
uint16_t* indices;
|
||||
uint16_t baseVertex;
|
||||
|
||||
lovrGraphicsBatch(&(BatchRequest) {
|
||||
.type = BATCH_TRIANGLES,
|
||||
.params.triangles.style = style,
|
||||
.topology = style == STYLE_LINE ? DRAW_LINE_LOOP : DRAW_TRIANGLES,
|
||||
.material = material,
|
||||
.vertexCount = count,
|
||||
.vertices = vertices,
|
||||
.indexCount = indexCount,
|
||||
.indices = &indices,
|
||||
.baseVertex = &baseVertex
|
||||
});
|
||||
|
||||
if (style == STYLE_LINE) {
|
||||
for (uint32_t i = 0; i < count; i += 3) {
|
||||
*indices++ = 0xffff;
|
||||
*indices++ = baseVertex + i + 0;
|
||||
*indices++ = baseVertex + i + 1;
|
||||
*indices++ = baseVertex + i + 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lovrGraphicsPlane(DrawStyle style, Material* material, mat4 transform, float u, float v, float w, float h) {
|
||||
float* vertices = NULL;
|
||||
uint16_t* indices = NULL;
|
||||
|
|
|
@ -157,7 +157,6 @@ void lovrGraphicsClear(Color* color, float* depth, int* stencil);
|
|||
void lovrGraphicsDiscard(bool color, bool depth, bool stencil);
|
||||
void lovrGraphicsPoints(uint32_t count, float** vertices);
|
||||
void lovrGraphicsLine(uint32_t count, float** vertices);
|
||||
void lovrGraphicsTriangle(DrawStyle style, struct Material* material, uint32_t count, float** vertices);
|
||||
void lovrGraphicsPlane(DrawStyle style, struct Material* material, mat4 transform, float u, float v, float w, float h);
|
||||
void lovrGraphicsBox(DrawStyle style, struct Material* material, mat4 transform);
|
||||
void lovrGraphicsArc(DrawStyle style, ArcMode mode, struct Material* material, mat4 transform, float r1, float r2, int segments);
|
||||
|
|
Loading…
Reference in New Issue