mirror of https://github.com/bjornbytes/lovr.git
Fill accepts UV subrect to use;
This commit is contained in:
parent
a9e92b5185
commit
8d076f31c1
|
@ -796,7 +796,11 @@ static int l_lovrGraphicsStencil(lua_State* L) {
|
|||
|
||||
static int l_lovrGraphicsFill(lua_State* L) {
|
||||
Texture* texture = lua_isnoneornil(L, 1) ? NULL : luax_checktexture(L, 1);
|
||||
lovrGraphicsFill(texture);
|
||||
float u = luaL_optnumber(L, 2, 0.);
|
||||
float v = luaL_optnumber(L, 3, 0.);
|
||||
float w = luaL_optnumber(L, 4, 1. - u);
|
||||
float h = luaL_optnumber(L, 5, 1. - v);
|
||||
lovrGraphicsFill(texture, u, v, w, h);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -873,7 +873,7 @@ void lovrGraphicsPrint(const char* str, mat4 transform, float wrap, HorizontalAl
|
|||
lovrGraphicsPop();
|
||||
}
|
||||
|
||||
void lovrGraphicsFill(Texture* texture) {
|
||||
void lovrGraphicsFill(Texture* texture, float u, float v, float w, float h) {
|
||||
lovrGraphicsPushPipeline();
|
||||
lovrGraphicsSetDepthTest(COMPARE_NONE, false);
|
||||
lovrGraphicsDraw(&(DrawCommand) {
|
||||
|
@ -883,10 +883,10 @@ void lovrGraphicsFill(Texture* texture) {
|
|||
.mode = MESH_TRIANGLE_STRIP,
|
||||
.vertex.count = 4,
|
||||
.vertex.data = (float[]) {
|
||||
-1, 1, 0, 0, 0, 0, 0, 1,
|
||||
-1, -1, 0, 0, 0, 0, 0, 0,
|
||||
1, 1, 0, 0, 0, 0, 1, 1,
|
||||
1, -1, 0, 0, 0, 0, 1, 0
|
||||
-1, 1, 0, 0, 0, 0, u, v + h,
|
||||
-1, -1, 0, 0, 0, 0, u, v,
|
||||
1, 1, 0, 0, 0, 0, u + w, v + h,
|
||||
1, -1, 0, 0, 0, 0, u + w, v
|
||||
}
|
||||
});
|
||||
lovrGraphicsPopPipeline();
|
||||
|
|
|
@ -222,7 +222,7 @@ void lovrGraphicsCylinder(Material* material, float x1, float y1, float z1, floa
|
|||
void lovrGraphicsSphere(Material* material, mat4 transform, int segments);
|
||||
void lovrGraphicsSkybox(Texture* texture, float angle, float ax, float ay, float az);
|
||||
void lovrGraphicsPrint(const char* str, mat4 transform, float wrap, HorizontalAlign halign, VerticalAlign valign);
|
||||
void lovrGraphicsFill(Texture* texture);
|
||||
void lovrGraphicsFill(Texture* texture, float u, float v, float w, float h);
|
||||
#define lovrGraphicsStencil lovrGpuStencil
|
||||
#define lovrGraphicsCompute lovrGpuCompute
|
||||
|
||||
|
|
Loading…
Reference in New Issue