Blender V5.3
abc_axis_conversion.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2016 Kévin Dietrich & Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4#pragma once
5
9
11
12namespace blender {
13
14struct Object;
15
16namespace io::alembic {
17
18/* TODO(kevin): for now keeping these transformations hardcoded to make sure
19 * everything works properly, and also because Alembic is almost exclusively
20 * used in Y-up software, but eventually they'll be set by the user in the UI
21 * like other importers/exporters do, to support other axis. */
22
23/* Copy from Y-up to Z-up. */
24
25BLI_INLINE void copy_zup_from_yup(float zup[3], const float yup[3])
26{
27 const float old_yup1 = yup[1]; /* in case zup == yup */
28 zup[0] = yup[0];
29 zup[1] = -yup[2];
30 zup[2] = old_yup1;
31}
32
33BLI_INLINE void copy_zup_from_yup(short zup[3], const short yup[3])
34{
35 const short old_yup1 = yup[1]; /* in case zup == yup */
36 zup[0] = yup[0];
37 zup[1] = -yup[2];
38 zup[2] = old_yup1;
39}
40
41/* Copy from Z-up to Y-up. */
42
43BLI_INLINE void copy_yup_from_zup(float yup[3], const float zup[3])
44{
45 const float old_zup1 = zup[1]; /* in case yup == zup */
46 yup[0] = zup[0];
47 yup[1] = zup[2];
48 yup[2] = -old_zup1;
49}
50
51BLI_INLINE void copy_yup_from_zup(short yup[3], const short zup[3])
52{
53 const short old_zup1 = zup[1]; /* in case yup == zup */
54 yup[0] = zup[0];
55 yup[1] = zup[2];
56 yup[2] = -old_zup1;
57}
58
59/* Names are given in (dst, src) order, just like
60 * the parameters of copy_m44_axis_swap(). */
61
66
71void create_swapped_rotation_matrix(float rot_x_mat[3][3],
72 float rot_y_mat[3][3],
73 float rot_z_mat[3][3],
74 const float euler[3],
75 AbcAxisSwapMode mode);
76
81void copy_m44_axis_swap(float dst_mat[4][4], float src_mat[4][4], AbcAxisSwapMode mode);
82
87
93 float r_yup_mat[4][4],
94 AbcMatrixMode mode,
95 Object *proxy_from);
96
97} // namespace io::alembic
98} // namespace blender
#define BLI_INLINE
void create_swapped_rotation_matrix(float rot_x_mat[3][3], float rot_y_mat[3][3], float rot_z_mat[3][3], const float euler[3], AbcAxisSwapMode mode)
BLI_INLINE void copy_yup_from_zup(float yup[3], const float zup[3])
void copy_m44_axis_swap(float dst_mat[4][4], float src_mat[4][4], AbcAxisSwapMode mode)
BLI_INLINE void copy_zup_from_yup(float zup[3], const float yup[3])
void create_transform_matrix(Object *obj, float r_yup_mat[4][4], AbcMatrixMode mode, Object *proxy_from)
BMesh Iterators.