From 370f6820aa4f5c78cac5ddf1a91f1d5d300e3f45 Mon Sep 17 00:00:00 2001 From: Christoph Haag Date: Thu, 20 Aug 2020 03:58:09 +0200 Subject: [PATCH] m: Generalize math_matrix_4x4_quad_model, making scaling a vec3 --- src/xrt/auxiliary/math/m_api.h | 6 +++--- src/xrt/auxiliary/math/m_base.cpp | 8 ++++---- src/xrt/compositor/main/comp_renderer.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/xrt/auxiliary/math/m_api.h b/src/xrt/auxiliary/math/m_api.h index c5e630cc5..44ae70a55 100644 --- a/src/xrt/auxiliary/math/m_api.h +++ b/src/xrt/auxiliary/math/m_api.h @@ -297,9 +297,9 @@ math_matrix_4x4_view_from_pose(const struct xrt_pose *pose, * @ingroup aux_math */ void -math_matrix_4x4_quad_model(const struct xrt_pose *pose, - const struct xrt_vec2 *size, - struct xrt_matrix_4x4 *result); +math_matrix_4x4_model(const struct xrt_pose *pose, + const struct xrt_vec3 *size, + struct xrt_matrix_4x4 *result); /* * diff --git a/src/xrt/auxiliary/math/m_base.cpp b/src/xrt/auxiliary/math/m_base.cpp index 0502c490f..c6a7db03d 100644 --- a/src/xrt/auxiliary/math/m_base.cpp +++ b/src/xrt/auxiliary/math/m_base.cpp @@ -293,14 +293,14 @@ math_matrix_4x4_view_from_pose(const struct xrt_pose *pose, } void -math_matrix_4x4_quad_model(const struct xrt_pose *pose, - const struct xrt_vec2 *size, - struct xrt_matrix_4x4 *result) +math_matrix_4x4_model(const struct xrt_pose *pose, + const struct xrt_vec3 *size, + struct xrt_matrix_4x4 *result) { Eigen::Vector3f position = copy(&pose->position); Eigen::Quaternionf orientation = copy(&pose->orientation); - auto scale = Eigen::Scaling(size->x, size->y, 1.0f); + auto scale = Eigen::Scaling(size->x, size->y, size->z); Eigen::Translation3f translation(position); Eigen::Affine3f transformation = translation * orientation * scale; diff --git a/src/xrt/compositor/main/comp_renderer.c b/src/xrt/compositor/main/comp_renderer.c index c66aafab3..eef201a6e 100644 --- a/src/xrt/compositor/main/comp_renderer.c +++ b/src/xrt/compositor/main/comp_renderer.c @@ -491,9 +491,9 @@ comp_renderer_set_quad_layer(struct comp_renderer *r, r->lr->layers[layer], image->sampler, get_image_view(image, data->flags, data->quad.sub.array_index)); + struct xrt_vec3 s = {data->quad.size.x, data->quad.size.y, 1.0f}; struct xrt_matrix_4x4 model_matrix; - math_matrix_4x4_quad_model(&data->quad.pose, &data->quad.size, - &model_matrix); + math_matrix_4x4_model(&data->quad.pose, &s, &model_matrix); comp_layer_set_model_matrix(r->lr->layers[layer], &model_matrix);