The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

a/math: Move m_matrix_2x2 functions into their own header

+54 -50
-22
src/xrt/auxiliary/math/m_api.h
··· 429 429 */ 430 430 431 431 /*! 432 - * Multiply Matrix2x2. 433 - * 434 - * @relates xrt_matrix_2x2 435 - * @ingroup aux_math 436 - */ 437 - void 438 - math_matrix_2x2_multiply(const struct xrt_matrix_2x2 *left, 439 - const struct xrt_matrix_2x2 *right, 440 - struct xrt_matrix_2x2 *result_out); 441 - 442 - /*! 443 - * Transform a vec2 by a 2x2 matrix 444 - * 445 - * @see xrt_matrix_2x2 446 - * @ingroup aux_math 447 - */ 448 - void 449 - math_matrix_2x2_transform_vec2(const struct xrt_matrix_2x2 *left, 450 - const struct xrt_vec2 *right, 451 - struct xrt_vec2 *result_out); 452 - 453 - /*! 454 432 * Initialize a 3x3 matrix to the identity matrix 455 433 * 456 434 * @see xrt_matrix_3x3
-28
src/xrt/auxiliary/math/m_base.cpp
··· 518 518 * 519 519 */ 520 520 521 - extern "C" void 522 - math_matrix_2x2_multiply(const struct xrt_matrix_2x2 *left, 523 - const struct xrt_matrix_2x2 *right, 524 - struct xrt_matrix_2x2 *result_out) 525 - { 526 - const struct xrt_matrix_2x2 l = *left; 527 - const struct xrt_matrix_2x2 r = *right; 528 521 529 - // Initialisers: struct, union, v[4] 530 - struct xrt_matrix_2x2 result = {{{ 531 - l.v[0] * r.v[0] + l.v[1] * r.v[2], 532 - l.v[0] * r.v[1] + l.v[1] * r.v[3], 533 - l.v[2] * r.v[0] + l.v[3] * r.v[2], 534 - l.v[2] * r.v[1] + l.v[3] * r.v[3], 535 - }}}; 536 - 537 - *result_out = result; 538 - } 539 - 540 - extern "C" void 541 - math_matrix_2x2_transform_vec2(const struct xrt_matrix_2x2 *left, 542 - const struct xrt_vec2 *right, 543 - struct xrt_vec2 *result_out) 544 - { 545 - const struct xrt_matrix_2x2 l = *left; 546 - const struct xrt_vec2 r = *right; 547 - struct xrt_vec2 result = {l.v[0] * r.x + l.v[1] * r.y, l.v[2] * r.x + l.v[3] * r.y}; 548 - *result_out = result; 549 - } 550 522 551 523 extern "C" void 552 524 math_matrix_3x3_identity(struct xrt_matrix_3x3 *mat)
+52
src/xrt/auxiliary/math/m_matrix_2x2.h
··· 1 + // Copyright 2023, Collabora, Ltd. 2 + // SPDX-License-Identifier: BSL-1.0 3 + /*! 4 + * @file 5 + * @brief C matrix_2x2 math library. 6 + * @author Moses Turner <moses@collabora.com> 7 + * 8 + * @see xrt_matrix_2x2 9 + * @ingroup aux_math 10 + */ 11 + 12 + #pragma once 13 + 14 + #include "xrt/xrt_defines.h" 15 + 16 + #ifdef __cplusplus 17 + extern "C" { 18 + #endif 19 + 20 + static inline void 21 + math_matrix_2x2_multiply(const struct xrt_matrix_2x2 *left, 22 + const struct xrt_matrix_2x2 *right, 23 + struct xrt_matrix_2x2 *result_out) 24 + { 25 + const struct xrt_matrix_2x2 l = *left; 26 + const struct xrt_matrix_2x2 r = *right; 27 + 28 + // Initialisers: struct, union, v[4] 29 + struct xrt_matrix_2x2 result = {{{ 30 + l.v[0] * r.v[0] + l.v[1] * r.v[2], 31 + l.v[0] * r.v[1] + l.v[1] * r.v[3], 32 + l.v[2] * r.v[0] + l.v[3] * r.v[2], 33 + l.v[2] * r.v[1] + l.v[3] * r.v[3], 34 + }}}; 35 + 36 + *result_out = result; 37 + } 38 + 39 + static inline void 40 + math_matrix_2x2_transform_vec2(const struct xrt_matrix_2x2 *left, 41 + const struct xrt_vec2 *right, 42 + struct xrt_vec2 *result_out) 43 + { 44 + const struct xrt_matrix_2x2 l = *left; 45 + const struct xrt_vec2 r = *right; 46 + struct xrt_vec2 result = {l.v[0] * r.x + l.v[1] * r.y, l.v[2] * r.x + l.v[3] * r.y}; 47 + *result_out = result; 48 + } 49 + 50 + #ifdef __cplusplus 51 + } 52 + #endif
+1
src/xrt/compositor/main/comp_renderer.c
··· 20 20 #include "math/m_api.h" 21 21 #include "math/m_vec3.h" 22 22 #include "math/m_matrix_4x4_f64.h" 23 + #include "math/m_matrix_2x2.h" 23 24 #include "math/m_space.h" 24 25 25 26 #include "util/u_misc.h"
+1
src/xrt/compositor/render/render_resources.c
··· 10 10 11 11 #include "xrt/xrt_device.h" 12 12 #include "math/m_api.h" 13 + #include "math/m_matrix_2x2.h" 13 14 #include "math/m_vec2.h" 14 15 #include "render/render_interface.h" 15 16