MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ refresh()

void MayaFlux::Portal::Forma::internal::TextSlice::refresh ( )

Write the current state to the target. No-op once the target is gone.

Definition at line 99 of file TextSlice.cpp.

100{
101 Text::GlyphAtlas* atlas = m_run.atlas();
102 if (!atlas || !alive()) {
103 return;
104 }
105
106 auto vertices = m_run.vertices(map(), 0);
107 vertices.insert(vertices.end(), m_tail.begin(), m_tail.end());
108
109 const auto gpu = atelier().atlas_image(*atlas).sync(*atlas);
110
111 const bool replaced = gpu && gpu != m_bound_image;
112 const bool superseded = replaced && m_bound_image;
113 if (replaced) {
114 m_target.bind_texture(0, gpu);
115 m_bound_image = gpu;
116 }
117
118 m_target.submit(vertices);
119
120 if (superseded) {
121 reflow_others(this, atlas);
122 }
123}
void submit(const std::vector< uint8_t > &bytes) const
Replace this target's geometry.
Definition Target.cpp:51
void bind_texture(uint32_t array_index, const std::shared_ptr< Core::VKImage > &image) const
Bind a texture in the buffer's texture array.
Definition Target.cpp:63
Text::AtlasImage & atlas_image(const Text::GlyphAtlas &atlas)
The GPU image of atlas, shared by every text slice drawing from it.
Definition Atelier.hpp:98
std::shared_ptr< Core::VKImage > m_bound_image
Definition TextSlice.hpp:74
std::vector< Kakshya::MeshVertex > m_tail
Definition TextSlice.hpp:73
Text::GlyphMap map() const noexcept
Layout pixels to NDC for the current bounds.
Definition TextSlice.cpp:85
std::shared_ptr< Core::VKImage > sync(GlyphAtlas &atlas)
Bring the image up to date with atlas.
Definition AtlasImage.cpp:9
std::vector< Kakshya::MeshVertex > vertices(const GlyphMap &map, uint32_t slot)
Vertices for the background, if any, then every glyph.
Definition TextRun.cpp:86
GlyphAtlas * atlas() const
The atlas the run draws from: params().atlas, else the default.
Definition TextRun.cpp:38
Atelier & atelier()
Accessor for the process-wide Atelier.
Definition Atelier.hpp:304

References alive(), MayaFlux::Portal::Forma::internal::atelier(), MayaFlux::Portal::Text::TextRun::atlas(), MayaFlux::Portal::Forma::internal::Atelier::atlas_image(), MayaFlux::Portal::Forma::FormaTarget::bind_texture(), m_bound_image, m_run, m_tail, m_target, map(), MayaFlux::Portal::Forma::FormaTarget::submit(), MayaFlux::Portal::Text::AtlasImage::sync(), and MayaFlux::Portal::Text::TextRun::vertices().

Referenced by assign(), set(), set_bounds(), and set_tail().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: