Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/collada/TransformReader.cpp
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/collada/TransformReader.cpp')
-rw-r--r--source/blender/collada/TransformReader.cpp176
1 files changed, 87 insertions, 89 deletions
diff --git a/source/blender/collada/TransformReader.cpp b/source/blender/collada/TransformReader.cpp
index 6a557ea8120..8ee31f80405 100644
--- a/source/blender/collada/TransformReader.cpp
+++ b/source/blender/collada/TransformReader.cpp
@@ -25,129 +25,127 @@
TransformReader::TransformReader(UnitConverter *conv) : unit_converter(conv)
{
- /* pass */
+ /* pass */
}
-void TransformReader::get_node_mat(
- float mat[4][4],
- COLLADAFW::Node *node,
- std::map<COLLADAFW::UniqueId, Animation> *animation_map,
- Object *ob)
+void TransformReader::get_node_mat(float mat[4][4],
+ COLLADAFW::Node *node,
+ std::map<COLLADAFW::UniqueId, Animation> *animation_map,
+ Object *ob)
{
- get_node_mat(mat, node, animation_map, ob, NULL);
+ get_node_mat(mat, node, animation_map, ob, NULL);
}
-void TransformReader::get_node_mat(
- float mat[4][4],
- COLLADAFW::Node *node,
- std::map<COLLADAFW::UniqueId, Animation> *animation_map,
- Object *ob,
- float parent_mat[4][4])
+void TransformReader::get_node_mat(float mat[4][4],
+ COLLADAFW::Node *node,
+ std::map<COLLADAFW::UniqueId, Animation> *animation_map,
+ Object *ob,
+ float parent_mat[4][4])
{
- float cur[4][4];
- float copy[4][4];
-
- unit_m4(mat);
-
- for (unsigned int i = 0; i < node->getTransformations().getCount(); i++) {
-
- COLLADAFW::Transformation *tm = node->getTransformations()[i];
- COLLADAFW::Transformation::TransformationType type = tm->getTransformationType();
-
- switch (type) {
- case COLLADAFW::Transformation::MATRIX:
- // When matrix AND Trans/Rot/Scale are defined for a node,
- // then this is considered as redundant information.
- // So if we find a Matrix we use that and return.
- dae_matrix_to_mat4(tm, mat);
- if (parent_mat) {
- mul_m4_m4m4(mat, parent_mat, mat);
- }
- return;
- case COLLADAFW::Transformation::TRANSLATE:
- dae_translate_to_mat4(tm, cur);
- break;
- case COLLADAFW::Transformation::ROTATE:
- dae_rotate_to_mat4(tm, cur);
- break;
- case COLLADAFW::Transformation::SCALE:
- dae_scale_to_mat4(tm, cur);
- break;
- case COLLADAFW::Transformation::LOOKAT:
- fprintf(stderr, "|! LOOKAT transformations are not supported yet.\n");
- break;
- case COLLADAFW::Transformation::SKEW:
- fprintf(stderr, "|! SKEW transformations are not supported yet.\n");
- break;
- }
-
- copy_m4_m4(copy, mat);
- mul_m4_m4m4(mat, copy, cur);
-
- if (animation_map) {
- // AnimationList that drives this Transformation
- const COLLADAFW::UniqueId& anim_list_id = tm->getAnimationList();
-
- // store this so later we can link animation data with ob
- Animation anim = {ob, node, tm};
- (*animation_map)[anim_list_id] = anim;
- }
- }
-
- if (parent_mat) {
- mul_m4_m4m4(mat, parent_mat, mat);
- }
+ float cur[4][4];
+ float copy[4][4];
+
+ unit_m4(mat);
+
+ for (unsigned int i = 0; i < node->getTransformations().getCount(); i++) {
+
+ COLLADAFW::Transformation *tm = node->getTransformations()[i];
+ COLLADAFW::Transformation::TransformationType type = tm->getTransformationType();
+
+ switch (type) {
+ case COLLADAFW::Transformation::MATRIX:
+ // When matrix AND Trans/Rot/Scale are defined for a node,
+ // then this is considered as redundant information.
+ // So if we find a Matrix we use that and return.
+ dae_matrix_to_mat4(tm, mat);
+ if (parent_mat) {
+ mul_m4_m4m4(mat, parent_mat, mat);
+ }
+ return;
+ case COLLADAFW::Transformation::TRANSLATE:
+ dae_translate_to_mat4(tm, cur);
+ break;
+ case COLLADAFW::Transformation::ROTATE:
+ dae_rotate_to_mat4(tm, cur);
+ break;
+ case COLLADAFW::Transformation::SCALE:
+ dae_scale_to_mat4(tm, cur);
+ break;
+ case COLLADAFW::Transformation::LOOKAT:
+ fprintf(stderr, "|! LOOKAT transformations are not supported yet.\n");
+ break;
+ case COLLADAFW::Transformation::SKEW:
+ fprintf(stderr, "|! SKEW transformations are not supported yet.\n");
+ break;
+ }
+
+ copy_m4_m4(copy, mat);
+ mul_m4_m4m4(mat, copy, cur);
+
+ if (animation_map) {
+ // AnimationList that drives this Transformation
+ const COLLADAFW::UniqueId &anim_list_id = tm->getAnimationList();
+
+ // store this so later we can link animation data with ob
+ Animation anim = {ob, node, tm};
+ (*animation_map)[anim_list_id] = anim;
+ }
+ }
+
+ if (parent_mat) {
+ mul_m4_m4m4(mat, parent_mat, mat);
+ }
}
void TransformReader::dae_rotate_to_mat4(COLLADAFW::Transformation *tm, float m[4][4])
{
- COLLADAFW::Rotate *ro = (COLLADAFW::Rotate *)tm;
- COLLADABU::Math::Vector3& axis = ro->getRotationAxis();
- const float angle = (float)DEG2RAD(ro->getRotationAngle());
- const float ax[] = {(float)axis[0], (float)axis[1], (float)axis[2]};
- // float quat[4];
- // axis_angle_to_quat(quat, axis, angle);
- // quat_to_mat4(m, quat);
- axis_angle_to_mat4(m, ax, angle);
+ COLLADAFW::Rotate *ro = (COLLADAFW::Rotate *)tm;
+ COLLADABU::Math::Vector3 &axis = ro->getRotationAxis();
+ const float angle = (float)DEG2RAD(ro->getRotationAngle());
+ const float ax[] = {(float)axis[0], (float)axis[1], (float)axis[2]};
+ // float quat[4];
+ // axis_angle_to_quat(quat, axis, angle);
+ // quat_to_mat4(m, quat);
+ axis_angle_to_mat4(m, ax, angle);
}
void TransformReader::dae_translate_to_mat4(COLLADAFW::Transformation *tm, float m[4][4])
{
- COLLADAFW::Translate *tra = (COLLADAFW::Translate *)tm;
- COLLADABU::Math::Vector3& t = tra->getTranslation();
+ COLLADAFW::Translate *tra = (COLLADAFW::Translate *)tm;
+ COLLADABU::Math::Vector3 &t = tra->getTranslation();
- unit_m4(m);
+ unit_m4(m);
- m[3][0] = (float)t[0];
- m[3][1] = (float)t[1];
- m[3][2] = (float)t[2];
+ m[3][0] = (float)t[0];
+ m[3][1] = (float)t[1];
+ m[3][2] = (float)t[2];
}
void TransformReader::dae_scale_to_mat4(COLLADAFW::Transformation *tm, float m[4][4])
{
- COLLADABU::Math::Vector3& s = ((COLLADAFW::Scale *)tm)->getScale();
- float size[3] = {(float)s[0], (float)s[1], (float)s[2]};
- size_to_mat4(m, size);
+ COLLADABU::Math::Vector3 &s = ((COLLADAFW::Scale *)tm)->getScale();
+ float size[3] = {(float)s[0], (float)s[1], (float)s[2]};
+ size_to_mat4(m, size);
}
void TransformReader::dae_matrix_to_mat4(COLLADAFW::Transformation *tm, float m[4][4])
{
- unit_converter->dae_matrix_to_mat4_(m, ((COLLADAFW::Matrix *)tm)->getMatrix());
+ unit_converter->dae_matrix_to_mat4_(m, ((COLLADAFW::Matrix *)tm)->getMatrix());
}
void TransformReader::dae_translate_to_v3(COLLADAFW::Transformation *tm, float v[3])
{
- dae_vector3_to_v3(((COLLADAFW::Translate *)tm)->getTranslation(), v);
+ dae_vector3_to_v3(((COLLADAFW::Translate *)tm)->getTranslation(), v);
}
void TransformReader::dae_scale_to_v3(COLLADAFW::Transformation *tm, float v[3])
{
- dae_vector3_to_v3(((COLLADAFW::Scale *)tm)->getScale(), v);
+ dae_vector3_to_v3(((COLLADAFW::Scale *)tm)->getScale(), v);
}
void TransformReader::dae_vector3_to_v3(const COLLADABU::Math::Vector3 &v3, float v[3])
{
- v[0] = v3.x;
- v[1] = v3.y;
- v[2] = v3.z;
+ v[0] = v3.x;
+ v[1] = v3.y;
+ v[2] = v3.z;
}