Blender  V3.3
abc_axis_conversion.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2016 Kévin Dietrich & Blender Foundation. All rights reserved. */
3 #pragma once
4 
9 #include "BLI_compiler_compat.h"
10 
11 struct Object;
12 
13 namespace blender::io::alembic {
14 
15 /* TODO(kevin): for now keeping these transformations hardcoded to make sure
16  * everything works properly, and also because Alembic is almost exclusively
17  * used in Y-up software, but eventually they'll be set by the user in the UI
18  * like other importers/exporters do, to support other axis. */
19 
20 /* Copy from Y-up to Z-up. */
21 
22 BLI_INLINE void copy_zup_from_yup(float zup[3], const float yup[3])
23 {
24  const float old_yup1 = yup[1]; /* in case zup == yup */
25  zup[0] = yup[0];
26  zup[1] = -yup[2];
27  zup[2] = old_yup1;
28 }
29 
30 BLI_INLINE void copy_zup_from_yup(short zup[3], const short yup[3])
31 {
32  const short old_yup1 = yup[1]; /* in case zup == yup */
33  zup[0] = yup[0];
34  zup[1] = -yup[2];
35  zup[2] = old_yup1;
36 }
37 
38 /* Copy from Z-up to Y-up. */
39 
40 BLI_INLINE void copy_yup_from_zup(float yup[3], const float zup[3])
41 {
42  const float old_zup1 = zup[1]; /* in case yup == zup */
43  yup[0] = zup[0];
44  yup[1] = zup[2];
45  yup[2] = -old_zup1;
46 }
47 
48 BLI_INLINE void copy_yup_from_zup(short yup[3], const short zup[3])
49 {
50  const short old_zup1 = zup[1]; /* in case yup == zup */
51  yup[0] = zup[0];
52  yup[1] = zup[2];
53  yup[2] = -old_zup1;
54 }
55 
56 /* Names are given in (dst, src) order, just like
57  * the parameters of copy_m44_axis_swap(). */
58 
59 typedef enum {
63 
68 void create_swapped_rotation_matrix(float rot_x_mat[3][3],
69  float rot_y_mat[3][3],
70  float rot_z_mat[3][3],
71  const float euler[3],
72  AbcAxisSwapMode mode);
73 
78 void copy_m44_axis_swap(float dst_mat[4][4], float src_mat[4][4], AbcAxisSwapMode mode);
79 
80 typedef enum {
84 
90  float r_yup_mat[4][4],
91  AbcMatrixMode mode,
92  Object *proxy_from);
93 
94 } // namespace blender::io::alembic
#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)