From af0edd5e6d9a6a3d41eaffa32005bbc28cd80c17 Mon Sep 17 00:00:00 2001 From: Roz K Date: Tue, 27 Dec 2022 06:20:18 +0100 Subject: [PATCH] Add set_param_mat3. --- __init__.py | 5 +++++ cpp/render.hpp | 4 ++++ cpp/render/render_opengles.cpp | 11 +++++++++++ 3 files changed, 20 insertions(+) diff --git a/__init__.py b/__init__.py index c718750..6b4909d 100644 --- a/__init__.py +++ b/__init__.py @@ -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 diff --git a/cpp/render.hpp b/cpp/render.hpp index a2d4b54..603210c 100644 --- a/cpp/render.hpp +++ b/cpp/render.hpp @@ -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, diff --git a/cpp/render/render_opengles.cpp b/cpp/render/render_opengles.cpp index 746e67a..ed220eb 100644 --- a/cpp/render/render_opengles.cpp +++ b/cpp/render/render_opengles.cpp @@ -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(_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,