Route element value to a DataWriteProcessor each frame.
232{
234 if (!rec) {
236 "Bridge::write: unknown element id {}", ref.second);
237 return;
238 }
239
241 rec->outbound_tasks.push_back(
name);
242
243 auto bulk = rec->bulk_reader;
244 auto reader = rec->reader;
245
246 if (bulk) {
247 auto routine = [](Vruta::TaskScheduler&,
248 std::function<std::vector<float>()>
b,
249 std::shared_ptr<Buffers::DataWriteProcessor> proc)
250 -> Vruta::GraphicsRoutine {
252 while (!p.should_terminate) {
254 co_await Kriya::FrameDelay { .frames_to_wait = 1 };
255 }
256 };
258 std::make_shared<Vruta::GraphicsRoutine>(
259 routine(
m_scheduler, std::move(bulk), std::move(target))),
261 } else {
262 auto routine = [](Vruta::TaskScheduler&,
263 std::function<float()> r,
264 std::shared_ptr<Buffers::DataWriteProcessor> proc)
265 -> Vruta::GraphicsRoutine {
267 while (!p.should_terminate) {
268 proc->set_data(std::vector<Kakshya::DataVariant> {
Kakshya::DataVariant { std::vector<float> { r() } } });
269 co_await Kriya::FrameDelay { .frames_to_wait = 1 };
270 }
271 };
273 std::make_shared<Vruta::GraphicsRoutine>(
274 routine(
m_scheduler, std::move(reader), std::move(target))),
276 }
277}
#define MF_ERROR(comp, ctx,...)
void add_task(const std::shared_ptr< Routine > &routine, const std::string &name="", bool initialize=false)
Add a routine to the scheduler based on its processing token.
@ Init
Engine/subsystem initialization.
@ Portal
High-level user-facing API layer.
std::variant< std::vector< double >, std::vector< float >, std::vector< uint8_t >, std::vector< uint16_t >, std::vector< uint32_t >, std::vector< std::complex< float > >, std::vector< std::complex< double > >, std::vector< glm::vec2 >, std::vector< glm::vec3 >, std::vector< glm::vec4 >, std::vector< glm::mat4 > > DataVariant
Multi-type data storage for different precision needs.
GetPromiseBase< Vruta::graphics_promise > GetGraphicsPromise
Graphics domain promise accessor.