37 _checkValidity(engine);
39 _blob.reserve(param.
size);
43 functor.setProgressFunc([&
progress =
progress, w = CHUNK_PROGRESS_WEIGHT](
const auto& msg,
auto,
auto amount)
47 _finishTasks.emplace_back(_errorEvent.get_task());
48 _finishTasks.emplace_back(_chunkEvent.get_task().then(std::move(functor)));
49 _task = async::when_any(_finishTasks)
51 [&engine](async::when_any_result<
std::vector<async::task<ModelDescriptorPtr>>> results)
54 return results.tasks[results.index].get();
61 if (_blob.size() + blob.size() > _param.
size)
67 _blob.insert(_blob.end(), blob.begin(), blob.end());
69 _receivedBytes += blob.size();
70 std::stringstream msg;
71 msg <<
"Receiving " << _param.
getName() <<
" ...";
75 if (_blob.size() == _param.
size)
76 _chunkEvent.set({_param.
type, _param.
getName(), std::move(_blob)});
79 void AddModelFromBlobTask::_checkValidity(
Engine& engine)
81 if (_param.
type.empty() || _param.
size == 0)
85 if (!registry.isSupportedType(_param.
type))
async::cancellation_token _cancelToken
AddModelFromBlobTask(const BinaryParam ¶m, Engine &engine)
void appendBlob(const std::string &blob)
Provides an abstract implementation of a ray-tracing engine.
PLATFORM_API std::function< void()> triggerRender
Callback when a new frame shall be triggered. Currently called by event plugins Deflect and Rockets.
PLATFORM_API Scene & getScene()
Returns the scene.
PLATFORM_API const std::string & getName() const
getName gets the name of the model
void update(const std::string &operation, const float amount)
PLATFORM_API LoaderRegistry & getLoaderRegistry()
Get the registry for all supported loaders of this scene.
const TaskRuntimeError MISSING_PARAMS
const TaskRuntimeError UNSUPPORTED_TYPE
const TaskRuntimeError INVALID_BINARY_RECEIVE
std::string type
file extension or type (MESH, POINTS, CIRCUIT)
size_t size
size in bytes of file