Skip to content

Commit 40f949d

Browse files
committed
scene: add api change
1 parent 6379e13 commit 40f949d

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

library/private/scene_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class scene_impl : public scene
3535
scene& add(const std::vector<std::filesystem::path>& filePath) override;
3636
scene& add(const std::vector<std::string>& filePathStrings) override;
3737
scene& add(const mesh_t& mesh) override;
38-
scene& add(const double startTime, const double endTime, MeshCallback&& callback) override;
38+
scene& add(std::vector<double> times, MeshCallback&& callback) override;
3939
scene& clear() override;
4040
int addLight(const light_state_t& lightState) const override;
4141
int getLightCount() const override;

library/public/scene.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class F3D_EXPORT scene
7272
/**
7373
* Add and load provided mesh into the scene
7474
*/
75-
virtual scene& add(std::pair<double> timeRange, MeshCallback&& callback) = 0;
75+
virtual scene& add(std::vector<double> times, MeshCallback&& callback) = 0;
7676

7777
///@{
7878
/**

library/src/scene_impl.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,9 @@ scene& scene_impl::add(const std::vector<fs::path>& filePaths)
296296
}
297297

298298
//----------------------------------------------------------------------------
299-
scene& scene_impl::add(const double startTime, const double endTime, MeshCallback&& callback)
299+
scene& scene_impl::add(std::vector<double> times, MeshCallback&& callback)
300300
{
301-
if (startTime > endTime)
301+
if (times[1] < times[0])
302302
{
303303
throw scene::load_failure_exception("startTime must be less than or equal to endTime");
304304
}
@@ -314,7 +314,7 @@ scene& scene_impl::add(const double startTime, const double endTime, MeshCallbac
314314
vtkMesh->SetFaces(mesh.face_sides, mesh.face_indices);
315315
};
316316

317-
vtkSource->SetAnimatedMesh(startTime, endTime, std::move(wrappedCallback));
317+
vtkSource->SetAnimatedMesh(times[0], times[1], std::move(wrappedCallback));
318318

319319
auto importer = vtkSmartPointer<vtkF3DGenericImporter>::New();
320320
importer->SetInternalReader(vtkSource);

library/testing/TestSDKSceneTemporalFromMemory.cxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ int TestSDKSceneTemporalFromMemory([[maybe_unused]] int argc, [[maybe_unused]] c
3030
const std::vector<unsigned int> faceSides{ 3, 3 };
3131
const std::vector<unsigned int> faceIndices{ 0, 1, 2, 1, 3, 2 };
3232

33-
auto meshCallback = [&](double time) -> f3d::mesh_t
34-
{
33+
auto meshCallback = [&](double time) -> f3d::mesh_t {
3534
if (time < 0.5)
3635
{
3736
return f3d::mesh_t{ basePoints, normals, tcoords, faceSides, faceIndices };
@@ -42,7 +41,7 @@ int TestSDKSceneTemporalFromMemory([[maybe_unused]] int argc, [[maybe_unused]] c
4241
}
4342
};
4443

45-
test("add animated mesh with callback", [&]() { sce.add(0.0, 1.0, meshCallback); });
44+
test("add animated mesh with callback", [&]() { sce.add({ 0.0, 1.0 }, meshCallback); });
4645

4746
test("animation time range", [&]() {
4847
auto range = sce.animationTimeRange();

0 commit comments

Comments
 (0)