diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-04-08 18:57:35 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-04-08 18:57:35 +0300 |
commit | f3a475a76721a8333396ce1801124a15278b4d1f (patch) | |
tree | 94e78d60f2bc631ada663c3afc2fef0e01280733 /source/blender/io/alembic/intern/abc_reader_mesh.cc | |
parent | 8b7cd1ed2a17e40661101eea4adae99e8e3d02e9 (diff) |
Cleanup: CacheFile, use double precision for time
Both the Alembic and USD libraries use double precision floating
point numbers internally to store time. However the Alembic I/O
code defaulted to floats even though Blender's Scene FPS, which is
generally used for look ups, is stored using a double type. Such
downcasts could lead to imprecise lookups, and would cause
compilation warnings (at least on MSVC).
This modifies the Alembic exporter and importer to make use of
doubles for the current scene time, and only downcasting to float
at the very last steps (e.g. for vertex interpolation). For the
importer, doubles are also used for computing interpolation weights,
as it is based on a time offset.
Although the USD code already used doubles internally, floats were used
at the C API level. Those were replaced as well.
Differential Revision: https://developer.blender.org/D13855
Diffstat (limited to 'source/blender/io/alembic/intern/abc_reader_mesh.cc')
-rw-r--r-- | source/blender/io/alembic/intern/abc_reader_mesh.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/io/alembic/intern/abc_reader_mesh.cc b/source/blender/io/alembic/intern/abc_reader_mesh.cc index 47f4dd2ea5d..f2daae4b90b 100644 --- a/source/blender/io/alembic/intern/abc_reader_mesh.cc +++ b/source/blender/io/alembic/intern/abc_reader_mesh.cc @@ -121,7 +121,7 @@ struct AbcMeshData { static void read_mverts_interp(MVert *mverts, const P3fArraySamplePtr &positions, const P3fArraySamplePtr &ceil_positions, - const float weight) + const double weight) { float tmp[3]; for (int i = 0; i < positions->size(); i++) { @@ -129,7 +129,7 @@ static void read_mverts_interp(MVert *mverts, const Imath::V3f &floor_pos = (*positions)[i]; const Imath::V3f &ceil_pos = (*ceil_positions)[i]; - interp_v3_v3v3(tmp, floor_pos.getValue(), ceil_pos.getValue(), weight); + interp_v3_v3v3(tmp, floor_pos.getValue(), ceil_pos.getValue(), static_cast<float>(weight)); copy_zup_from_yup(mvert.co, tmp); mvert.bweight = 0; |