mirror of
https://github.com/bjornbytes/lovr.git
synced 2024-07-02 12:33:52 +00:00
luax_checkuniform supports samplers;
This commit is contained in:
parent
2b093b5828
commit
4589ce66d0
|
@ -18,8 +18,6 @@ int luax_checkuniform(lua_State* L, int index, const Uniform* uniform, void* des
|
||||||
components *= components;
|
components *= components;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO samplers/textures
|
|
||||||
|
|
||||||
if (blob) {
|
if (blob) {
|
||||||
size_t elements = count * components;
|
size_t elements = count * components;
|
||||||
const char* s = elements == 1 ? "" : "s";
|
const char* s = elements == 1 ? "" : "s";
|
||||||
|
@ -55,7 +53,8 @@ int luax_checkuniform(lua_State* L, int index, const Uniform* uniform, void* des
|
||||||
switch (uniform->type) {
|
switch (uniform->type) {
|
||||||
case UNIFORM_FLOAT: *((float*) dest + i) = luaL_checknumber(L, -1); break;
|
case UNIFORM_FLOAT: *((float*) dest + i) = luaL_checknumber(L, -1); break;
|
||||||
case UNIFORM_INT: *((int*) dest + i) = luaL_checkinteger(L, -1); break;
|
case UNIFORM_INT: *((int*) dest + i) = luaL_checkinteger(L, -1); break;
|
||||||
default: lovrThrow(""); // TODO
|
case UNIFORM_SAMPLER: *((Texture**) dest + i) = luax_checktype(L, -1, Texture); break;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
}
|
}
|
||||||
|
@ -64,7 +63,8 @@ int luax_checkuniform(lua_State* L, int index, const Uniform* uniform, void* des
|
||||||
switch (uniform->type) {
|
switch (uniform->type) {
|
||||||
case UNIFORM_FLOAT: *((float*) dest + i) = luaL_checknumber(L, index + i); break;
|
case UNIFORM_FLOAT: *((float*) dest + i) = luaL_checknumber(L, index + i); break;
|
||||||
case UNIFORM_INT: *((int*) dest + i) = luaL_checkinteger(L, index + i); break;
|
case UNIFORM_INT: *((int*) dest + i) = luaL_checkinteger(L, index + i); break;
|
||||||
default: lovrThrow(""); // TODO
|
case UNIFORM_SAMPLER: *((Texture**) dest + i) = luax_checktype(L, index + i, Texture); break;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue