diff options
author | Aras Pranckevicius <aras_p> | 2022-03-19 23:20:22 +0300 |
---|---|---|
committer | Aras Pranckevicius <aras@nesnausk.org> | 2022-03-23 13:58:21 +0300 |
commit | 3a1e6bc1d5807b732536c73170f11268fb398726 (patch) | |
tree | 41741ea988a65524056fe643f0f74be0c2980724 /source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh | |
parent | fc0a07da29edf79e2ad684c696fd03f382c51884 (diff) |
Fix T96430: new OBJ exporter wrong normals for non-uniform scale, and wrong face order for negative scale
The new 3.1+ OBJ exporter did not have correct logic when faced with
non-uniform & mirrored (negative on odd number of axes) object scale:
- Normals were not transformed correctly (should use inverse transpose of the matrix),
and were not normalized,
- Face order was not "flipped" when transform has negative scale on odd number of axes
(visible when using "face orientation" viewport overlay).
Cherry-picked from 8aa365745a78, with minor conflict fixes.
Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14343
Diffstat (limited to 'source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh')
-rw-r--r-- | source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh index f3ace140006..3ec670d2203 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh +++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh @@ -73,6 +73,8 @@ class OBJMesh : NonCopyable { * object's world transform matrix. */ float world_and_axes_transform_[4][4]; + float world_and_axes_normal_transform_[3][3]; + bool mirrored_transform_; /** * Total UV vertices in a mesh's texture map. @@ -113,6 +115,10 @@ class OBJMesh : NonCopyable { int tot_uv_vertices() const; int tot_normal_indices() const; int tot_edges() const; + bool is_mirrored_transform() const + { + return mirrored_transform_; + } /** * \return Total materials in the object. |