Add mat4_mul_vec3.
This commit is contained in:
parent
dfc2bbc408
commit
1e56cc1c28
11
__init__.py
11
__init__.py
@ -181,6 +181,17 @@ def mat4_lookat(ret, position, lookat):
|
||||
assert len(ret) == 16 and len(position) == 3 and len(lookat) == 3
|
||||
_mat4_lookat(_mat4(ret), _vec3(position), _vec3(lookat))
|
||||
|
||||
_mat4_mul_vec3 = _lib.rk_mat4_mul_vec3
|
||||
_mat4_mul_vec3.argtypes = (
|
||||
_vec3_t, # ret
|
||||
_mat4_t, # a
|
||||
_vec3_t, # b
|
||||
ctypes.c_float) # w
|
||||
|
||||
def mat4_mul_vec3(ret, a, b, w):
|
||||
assert len(ret) == 3 and len(a) == 16 and len(b) == 3
|
||||
_mat4_mul_vec3(_vec3(ret), _mat4(a), _vec3(b), w)
|
||||
|
||||
_mat4_mul_vec4 = _lib.rk_mat4_mul_vec4
|
||||
_mat4_mul_vec4.argtypes = (
|
||||
_vec4_t, # ret
|
||||
|
@ -54,6 +54,14 @@ void rk_mat4_lookat(
|
||||
ret = glm::lookAtRH(position, lookat, glm::vec3(0.0f, 0.0f, 1.0f));
|
||||
}
|
||||
|
||||
void rk_mat4_mul_vec3(
|
||||
rk_vec3 & ret,
|
||||
rk_mat4 const & a,
|
||||
rk_vec3 const & b,
|
||||
float const w) {
|
||||
ret = glm::vec3(a * glm::vec4(b, w));
|
||||
}
|
||||
|
||||
void rk_mat4_mul_vec4(
|
||||
rk_vec4 & ret,
|
||||
rk_mat4 const & a,
|
||||
|
@ -53,6 +53,12 @@ RK_EXPORT void rk_mat4_lookat(
|
||||
rk_vec3 const & position,
|
||||
rk_vec3 const & lookat);
|
||||
|
||||
RK_EXPORT void rk_mat4_mul_vec3(
|
||||
rk_vec3 & ret,
|
||||
rk_mat4 const & a,
|
||||
rk_vec3 const & b,
|
||||
float const w);
|
||||
|
||||
RK_EXPORT void rk_mat4_mul_vec4(
|
||||
rk_vec4 & ret,
|
||||
rk_mat4 const & a,
|
||||
|
Loading…
Reference in New Issue
Block a user