mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +00:00
m: Generalize math_matrix_4x4_quad_model, making scaling a vec3
This commit is contained in:
parent
8a17481301
commit
370f6820aa
|
@ -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);
|
||||
|
||||
/*
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue