diff options
Diffstat (limited to 'source/blender/io/alembic/intern')
-rw-r--r-- | source/blender/io/alembic/intern/abc_customdata.h | 8 | ||||
-rw-r--r-- | source/blender/io/alembic/intern/abc_reader_mesh.cc | 4 | ||||
-rw-r--r-- | source/blender/io/alembic/intern/abc_reader_object.cc | 14 | ||||
-rw-r--r-- | source/blender/io/alembic/intern/abc_reader_object.h | 6 | ||||
-rw-r--r-- | source/blender/io/alembic/intern/abc_util.cc | 26 | ||||
-rw-r--r-- | source/blender/io/alembic/intern/abc_util.h | 10 | ||||
-rw-r--r-- | source/blender/io/alembic/intern/alembic_capi.cc | 12 |
7 files changed, 41 insertions, 39 deletions
diff --git a/source/blender/io/alembic/intern/abc_customdata.h b/source/blender/io/alembic/intern/abc_customdata.h index 74a6ca41a85..0ddba866016 100644 --- a/source/blender/io/alembic/intern/abc_customdata.h +++ b/source/blender/io/alembic/intern/abc_customdata.h @@ -48,8 +48,8 @@ struct CDStreamConfig { Mesh *mesh; void *(*add_customdata_cb)(Mesh *mesh, const char *name, int data_type); - float weight; - float time; + double weight; + Alembic::Abc::chrono_t time; int timesample_index; bool use_vertex_interpolation; Alembic::AbcGeom::index_t index; @@ -79,8 +79,8 @@ struct CDStreamConfig { pack_uvs(false), mesh(NULL), add_customdata_cb(NULL), - weight(0.0f), - time(0.0f), + weight(0.0), + time(0.0), index(0), ceil_index(0), modifier_error_message(NULL) 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; diff --git a/source/blender/io/alembic/intern/abc_reader_object.cc b/source/blender/io/alembic/intern/abc_reader_object.cc index dac0890e7c5..a698eeca8f1 100644 --- a/source/blender/io/alembic/intern/abc_reader_object.cc +++ b/source/blender/io/alembic/intern/abc_reader_object.cc @@ -97,7 +97,9 @@ void AbcObjectReader::object(Object *ob) m_object = ob; } -static Imath::M44d blend_matrices(const Imath::M44d &m0, const Imath::M44d &m1, const float weight) +static Imath::M44d blend_matrices(const Imath::M44d &m0, + const Imath::M44d &m1, + const double weight) { float mat0[4][4], mat1[4][4], ret[4][4]; @@ -108,16 +110,16 @@ static Imath::M44d blend_matrices(const Imath::M44d &m0, const Imath::M44d &m1, convert_matrix_datatype(m0, mat0); convert_matrix_datatype(m1, mat1); - interp_m4_m4m4(ret, mat0, mat1, weight); + interp_m4_m4m4(ret, mat0, mat1, static_cast<float>(weight)); return convert_matrix_datatype(ret); } -Imath::M44d get_matrix(const IXformSchema &schema, const float time) +Imath::M44d get_matrix(const IXformSchema &schema, const chrono_t time) { Alembic::AbcGeom::index_t i0, i1; Alembic::AbcGeom::XformSample s0, s1; - const float weight = get_weight_and_index( + const double weight = get_weight_and_index( time, schema.getTimeSampling(), schema.getNumSamples(), i0, i1); schema.get(s0, Alembic::AbcGeom::ISampleSelector(i0)); @@ -148,7 +150,7 @@ bool AbcObjectReader::topology_changed(const Mesh * /*existing_mesh*/, return false; } -void AbcObjectReader::setupObjectTransform(const float time) +void AbcObjectReader::setupObjectTransform(const chrono_t time) { bool is_constant = false; float transform_from_alembic[4][4]; @@ -214,7 +216,7 @@ Alembic::AbcGeom::IXform AbcObjectReader::xform() } void AbcObjectReader::read_matrix(float r_mat[4][4] /* local matrix */, - const float time, + const chrono_t time, const float scale, bool &is_constant) { diff --git a/source/blender/io/alembic/intern/abc_reader_object.h b/source/blender/io/alembic/intern/abc_reader_object.h index 5898d1bd529..6c57f32045b 100644 --- a/source/blender/io/alembic/intern/abc_reader_object.h +++ b/source/blender/io/alembic/intern/abc_reader_object.h @@ -143,7 +143,7 @@ class AbcObjectReader { const Alembic::Abc::ISampleSelector &sample_sel); /** Reads the object matrix and sets up an object transform if animated. */ - void setupObjectTransform(float time); + void setupObjectTransform(chrono_t time); void addCacheModifier(); @@ -154,13 +154,13 @@ class AbcObjectReader { void incref(); void decref(); - void read_matrix(float r_mat[4][4], float time, float scale, bool &is_constant); + void read_matrix(float r_mat[4][4], chrono_t time, float scale, bool &is_constant); protected: /** Determine whether we can inherit our parent's XForm. */ void determine_inherits_xform(); }; -Imath::M44d get_matrix(const Alembic::AbcGeom::IXformSchema &schema, float time); +Imath::M44d get_matrix(const Alembic::AbcGeom::IXformSchema &schema, chrono_t time); } // namespace blender::io::alembic diff --git a/source/blender/io/alembic/intern/abc_util.cc b/source/blender/io/alembic/intern/abc_util.cc index a253cb62a6d..90f73d25c22 100644 --- a/source/blender/io/alembic/intern/abc_util.cc +++ b/source/blender/io/alembic/intern/abc_util.cc @@ -73,7 +73,7 @@ Imath::M44d convert_matrix_datatype(float mat[4][4]) for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { - m[i][j] = mat[i][j]; + m[i][j] = static_cast<double>(mat[i][j]); } } @@ -112,35 +112,35 @@ bool has_property(const Alembic::Abc::ICompoundProperty &prop, const std::string return prop.getPropertyHeader(name) != nullptr; } -using index_time_pair_t = std::pair<Alembic::AbcCoreAbstract::index_t, float>; +using index_time_pair_t = std::pair<Alembic::AbcCoreAbstract::index_t, Alembic::AbcGeom::chrono_t>; -float get_weight_and_index(float time, - const Alembic::AbcCoreAbstract::TimeSamplingPtr &time_sampling, - int samples_number, - Alembic::AbcGeom::index_t &i0, - Alembic::AbcGeom::index_t &i1) +double get_weight_and_index(Alembic::AbcGeom::chrono_t time, + const Alembic::AbcCoreAbstract::TimeSamplingPtr &time_sampling, + int samples_number, + Alembic::AbcGeom::index_t &i0, + Alembic::AbcGeom::index_t &i1) { samples_number = std::max(samples_number, 1); index_time_pair_t t0 = time_sampling->getFloorIndex(time, samples_number); i0 = i1 = t0.first; - if (samples_number == 1 || (fabs(time - t0.second) < 0.0001f)) { - return 0.0f; + if (samples_number == 1 || (fabs(time - t0.second) < 0.0001)) { + return 0.0; } index_time_pair_t t1 = time_sampling->getCeilIndex(time, samples_number); i1 = t1.first; if (i0 == i1) { - return 0.0f; + return 0.0; } - const float bias = (time - t0.second) / (t1.second - t0.second); + const double bias = (time - t0.second) / (t1.second - t0.second); - if (fabs(1.0f - bias) < 0.0001f) { + if (fabs(1.0 - bias) < 0.0001) { i0 = i1; - return 0.0f; + return 0.0; } return bias; diff --git a/source/blender/io/alembic/intern/abc_util.h b/source/blender/io/alembic/intern/abc_util.h index a8479b3d27b..4db90820757 100644 --- a/source/blender/io/alembic/intern/abc_util.h +++ b/source/blender/io/alembic/intern/abc_util.h @@ -79,11 +79,11 @@ void get_min_max_time(const Alembic::AbcGeom::IObject &object, bool has_property(const Alembic::Abc::ICompoundProperty &prop, const std::string &name); -float get_weight_and_index(float time, - const Alembic::AbcCoreAbstract::TimeSamplingPtr &time_sampling, - int samples_number, - Alembic::AbcGeom::index_t &i0, - Alembic::AbcGeom::index_t &i1); +double get_weight_and_index(Alembic::AbcCoreAbstract::chrono_t time, + const Alembic::AbcCoreAbstract::TimeSamplingPtr &time_sampling, + int samples_number, + Alembic::AbcGeom::index_t &i0, + Alembic::AbcGeom::index_t &i1); AbcObjectReader *create_reader(const Alembic::AbcGeom::IObject &object, ImportSettings &settings); diff --git a/source/blender/io/alembic/intern/alembic_capi.cc b/source/blender/io/alembic/intern/alembic_capi.cc index c9c982aad6c..fe459ce4370 100644 --- a/source/blender/io/alembic/intern/alembic_capi.cc +++ b/source/blender/io/alembic/intern/alembic_capi.cc @@ -497,7 +497,7 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa chrono_t min_time = std::numeric_limits<chrono_t>::max(); chrono_t max_time = std::numeric_limits<chrono_t>::min(); - ISampleSelector sample_sel(0.0f); + ISampleSelector sample_sel(0.0); std::vector<AbcObjectReader *>::iterator iter; for (iter = data->readers.begin(); iter != data->readers.end(); ++iter) { AbcObjectReader *reader = *iter; @@ -555,7 +555,7 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa i = 0; for (iter = data->readers.begin(); iter != data->readers.end(); ++iter) { AbcObjectReader *reader = *iter; - reader->setupObjectTransform(0.0f); + reader->setupObjectTransform(0.0); *data->progress = 0.7f + 0.3f * (++i / size); *data->do_update = true; @@ -724,7 +724,7 @@ bool ABC_import(bContext *C, /* ************************************************************************** */ -void ABC_get_transform(CacheReader *reader, float r_mat_world[4][4], float time, float scale) +void ABC_get_transform(CacheReader *reader, float r_mat_world[4][4], double time, float scale) { if (!reader) { return; @@ -775,7 +775,7 @@ static AbcObjectReader *get_abc_reader(CacheReader *reader, Object *ob, const ch return abc_reader; } -static ISampleSelector sample_selector_for_time(float time) +static ISampleSelector sample_selector_for_time(chrono_t time) { /* kFloorIndex is used to be compatible with non-interpolating * properties; they use the floor. */ @@ -785,7 +785,7 @@ static ISampleSelector sample_selector_for_time(float time) Mesh *ABC_read_mesh(CacheReader *reader, Object *ob, Mesh *existing_mesh, - const float time, + const double time, const char **err_str, const int read_flag, const char *velocity_name, @@ -804,7 +804,7 @@ Mesh *ABC_read_mesh(CacheReader *reader, bool ABC_mesh_topology_changed(CacheReader *reader, Object *ob, const Mesh *existing_mesh, - const float time, + const double time, const char **err_str) { AbcObjectReader *abc_reader = get_abc_reader(reader, ob, err_str); |