MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Kriya::ChimeraBuilder Class Reference

Declares the layers of a Chimera, in order, and starts feeding them. More...

#include <Chimera.hpp>

+ Collaboration diagram for MayaFlux::Kriya::ChimeraBuilder:

Classes

struct  Action
 

Public Member Functions

 ChimeraBuilder (std::shared_ptr< Buffers::TextureArrayBuffer > buffer, std::shared_ptr< BufferPipeline > pipeline)
 
ChimeraBuilder & enters_after (double seconds)
 Seconds after start() before the layer begins to be fed.
 
ChimeraBuilder & every (double seconds, std::function< void(Chimera &)> action)
 Call an action on the running Chimera every this many seconds.
 
ChimeraBuilder & every_n_frames (uint32_t frames)
 Refresh a ring or GPU image layer every this many frames.
 
ChimeraBuilder & fit (Portal::Graphics::FitMode mode)
 Fit frames of another extent into this layer in this way, instead of the buffer's.
 
ChimeraBuilder & from (const std::string &path)
 Fill the layer once with an image file, loaded now as RGBA.
 
ChimeraBuilder & from (Kakshya::ImageData image)
 Fill the layer once with a still image.
 
ChimeraBuilder & from (std::shared_ptr< Core::VKImage > image)
 Feed the layer by copying a GPU image every frame.
 
ChimeraBuilder & from (std::shared_ptr< Kakshya::DynamicVideoStream > ring)
 Feed the layer from a ring that is being recorded.
 
ChimeraBuilder & from (std::shared_ptr< Kakshya::TextureCollection > collection, double frame_rate=0.0)
 Feed the layer from a texture collection that is being appended to.
 
ChimeraBuilder & from_pipeline ()
 Feed the layer from the stream the pipeline records, read when start() runs.
 
std::shared_ptr< Buffers::TextureArrayBuffer > get_buffer () const
 The array buffer whose layers the builder feeds, for its mode, weights or push constants.
 
std::shared_ptr< BufferPipeline > get_pipeline () const
 The pipeline the builder records into.
 
ChimeraBuilder & lag (double seconds)
 Read the ring this many seconds behind its write head, at least two frames.
 
ChimeraBuilder & lag (Kinesis::TimeMap seconds)
 Read the ring behind its write head by a lag that varies with time, in seconds since the layer entered.
 
ChimeraBuilder & layer ()
 Open the next layer.
 
ChimeraBuilder & layer_data ()
 Create the per-layer buffer the shader reads as layerData.
 
ChimeraBuilder & level (double weight)
 Weight passed to the shader for the layer.
 
ChimeraBuilder & params (const glm::vec4 &values)
 Params for the layer in the buffer's per-layer data, such as placement.
 
ChimeraBuilder & record (BufferOperation &&operation)
 Add an operation to the builder's pipeline, ahead of the feeding.
 
ChimeraBuilder & render (Portal::Graphics::RenderConfig config)
 Draw the buffer this way once start() runs.
 
ChimeraBuilder & smooth (bool enable=true)
 Blend the two frames around a ring position, so slow or varying time does not step.
 
ChimeraBuilder & speed (double ratio)
 Play a layer without a lag at this multiple of the ring's frame rate.
 
Chimera start ()
 Start feeding every declared layer on the frame clock.
 
ChimeraBuilder & use_pipeline (std::shared_ptr< BufferPipeline > pipeline)
 Replace the builder's pipeline with one made elsewhere.
 

Private Member Functions

Chimera::Layer & current ()
 

Private Attributes

std::vector< Action > m_actions
 
std::shared_ptr< Buffers::TextureArrayBuffer > m_buffer
 
std::vector< Chimera::Layer > m_layers
 
std::shared_ptr< BufferPipeline > m_pipeline
 
std::optional< Portal::Graphics::RenderConfig > m_render
 

Detailed Description

Declares the layers of a Chimera, in order, and starts feeding them.

layer() opens a new layer and the calls after it describe that layer. A call made before any layer() describes the first.

auto chimera = MayaFlux::create_chimera(array)
.layer().from("res/eye.png").params({ 0.3F, 0.4F, 0.2F, 0.F })
.layer().from("res/mouth.png").params({ 0.5F, 0.7F, 0.3F, 0.F })
.layer().from(ring).lag(0.0)
.layer().from(ring).lag(0.5).smooth().level(0.6)
.start();
ChimeraBuilder & params(const glm::vec4 &values)
Params for the layer in the buffer's per-layer data, such as placement.
Definition Chimera.cpp:458
ChimeraBuilder & lag(double seconds)
Read the ring this many seconds behind its write head, at least two frames.
Definition Chimera.cpp:423
ChimeraBuilder & level(double weight)
Weight passed to the shader for the layer.
Definition Chimera.cpp:464
ChimeraBuilder & smooth(bool enable=true)
Blend the two frames around a ring position, so slow or varying time does not step.
Definition Chimera.cpp:440
ChimeraBuilder & from(std::shared_ptr< Kakshya::DynamicVideoStream > ring)
Feed the layer from a ring that is being recorded.
Definition Chimera.cpp:360
ChimeraBuilder & layer()
Open the next layer.
Definition Chimera.cpp:354
Chimera start()
Start feeding every declared layer on the frame clock.
Definition Chimera.cpp:470
Kriya::ChimeraBuilder create_chimera(std::shared_ptr< Buffers::TextureArrayBuffer > buffer)
Begin assembling the layers of a TextureArrayBuffer from what feeds each.
Definition Rigs.cpp:167

The builder holds one BufferPipeline, the one it was given or one it was made with, so what is recorded and what is assembled read as one chain:

auto chimera = MayaFlux::create_chimera(array)
.start();
static BufferOperation capture_to_stream(const std::shared_ptr< IO::IOManager > &io_manager, const IO::CameraConfig &config, uint64_t ring_frames=0, std::optional< Portal::Graphics::RenderConfig > live=std::nullopt, std::optional< Portal::Graphics::RenderConfig > display=std::nullopt)
Capture a camera straight into a dynamic video stream it creates.
ChimeraBuilder & record(BufferOperation &&operation)
Add an operation to the builder's pipeline, ahead of the feeding.
Definition Chimera.cpp:303
ChimeraBuilder & from_pipeline()
Feed the layer from the stream the pipeline records, read when start() runs.
Definition Chimera.cpp:335

Definition at line 190 of file Chimera.hpp.


The documentation for this class was generated from the following files: