Add set_param_mat3.

This commit is contained in:
Roz K 2022-12-27 06:20:18 +01:00
parent ad2e89f684
commit af0edd5e6d
Signed by: roz
GPG Key ID: 51FBF4E483E1C822
3 changed files with 20 additions and 0 deletions

View File

@ -365,6 +365,11 @@ set_param_vec3.argtypes = (
ctypes.c_uint, # layout
_vec3_p) # value
set_param_mat3 = _engine.rk_set_param_mat3
set_param_mat3.argtypes = (
ctypes.c_uint, # layout
_mat3_p) # value
select_texture = _engine.rk_select_texture
select_texture.argtypes = (
ctypes.c_uint, # slot

View File

@ -147,6 +147,10 @@ RK_EXPORT void rk_set_param_vec3(
rk_param_t param,
rk_vec3 const & value);
RK_EXPORT void rk_set_param_mat3(
rk_param_t param,
rk_mat3 const & value);
RK_EXPORT void rk_select_texture(
rk_uint slot,
rk_texture_t texture,

View File

@ -569,6 +569,17 @@ void rk_set_param_vec3(
}
}
void rk_set_param_mat3(
rk_param_t _param,
rk_mat3 const & value) {
GLint const param = reinterpret_cast<intptr_t>(_param) - 1;
if (rk_current_shader && param > -1) {
glVertexAttrib3fv(param + 0, glm::value_ptr(value[0]));
glVertexAttrib3fv(param + 1, glm::value_ptr(value[1]));
glVertexAttrib3fv(param + 2, glm::value_ptr(value[2]));
}
}
void rk_select_texture(
rk_uint slot,
rk_texture_t _texture,