Magnum::Ui::BaseLayer::Shared class

Shared state for the base layer.

Contains style data. You'll most likely instantiate the class through BaseLayerGL::Shared. In order to update or draw the layer it's expected that setStyle() was called.

Base classes

class Magnum::Ui::AbstractVisualLayer::Shared
Base shared state for visual data layers.

Derived classes

class Shared
Shared state for the OpenGL implementation of the base layer.

Public types

class Configuration
Configuration of a base layer shared state.

Public functions

auto styleUniformCount() const -> UnsignedInt
Style uniform count.
auto flags() const -> BaseLayerSharedFlags
Flags.
auto setStyle(const BaseLayerCommonStyleUniform& commonUniform, Containers::ArrayView<const BaseLayerStyleUniform> uniforms, const Containers::StridedArrayView1D<const Vector4>& paddings) -> Shared&
Set style data with implicit mapping between styles and uniforms.
auto setStyle(const BaseLayerCommonStyleUniform& commonUniform, std::initializer_list<BaseLayerStyleUniform> uniforms, std::initializer_list<Vector4> paddings) -> Shared&
auto setStyle(const BaseLayerCommonStyleUniform& commonUniform, Containers::ArrayView<const BaseLayerStyleUniform> uniforms, const Containers::StridedArrayView1D<const UnsignedInt>& styleToUniform, const Containers::StridedArrayView1D<const Vector4>& stylePaddings) -> Shared&
Set style data.
auto setStyle(const BaseLayerCommonStyleUniform& commonUniform, std::initializer_list<BaseLayerStyleUniform> uniforms, std::initializer_list<UnsignedInt> styleToUniform, std::initializer_list<Vector4> stylePaddings) -> Shared&

Function documentation

UnsignedInt Magnum::Ui::BaseLayer::Shared::styleUniformCount() const

Style uniform count.

Size of the style uniform buffer excluding dynamic styles. May or may not be the same as styleCount(). For dynamic styles, the style uniform count is the same as dynamicStyleCount().

Shared& Magnum::Ui::BaseLayer::Shared::setStyle(const BaseLayerCommonStyleUniform& commonUniform, Containers::ArrayView<const BaseLayerStyleUniform> uniforms, const Containers::StridedArrayView1D<const Vector4>& paddings)

Set style data with implicit mapping between styles and uniforms.

Parameters
commonUniform Common style uniform data
uniforms Style uniforms
paddings Padding inside the node in order left, top, right, bottom corresponding to style uniforms
Returns Reference to self (for method chaining)

The uniforms view is expected to have the same size as styleUniformCount(). The paddings view is expected to either have the same size as styleCount() or be empty, in which case all paddings are implicitly zero.

Can only be called if styleUniformCount() and styleCount() were set to the same value in Configuration passed to the constructor, otherwise you have to additionally provide a mapping from styles to uniforms using setStyle(const BaseLayerCommonStyleUniform&, Containers::ArrayView<const BaseLayerStyleUniform>, const Containers::StridedArrayView1D<const UnsignedInt>&, const Containers::StridedArrayView1D<const Vector4>&) instead.

Calling this function causes LayerState::NeedsDataUpdate to be set on all layers that are constructed using this shared instance. If dynamicStyleCount() is non-zero, LayerState::NeedsCommonDataUpdate is set as well to trigger an upload of changed dynamic style uniform data.

Shared& Magnum::Ui::BaseLayer::Shared::setStyle(const BaseLayerCommonStyleUniform& commonUniform, std::initializer_list<BaseLayerStyleUniform> uniforms, std::initializer_list<Vector4> paddings)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Shared& Magnum::Ui::BaseLayer::Shared::setStyle(const BaseLayerCommonStyleUniform& commonUniform, Containers::ArrayView<const BaseLayerStyleUniform> uniforms, const Containers::StridedArrayView1D<const UnsignedInt>& styleToUniform, const Containers::StridedArrayView1D<const Vector4>& stylePaddings)

Set style data.

Parameters
commonUniform Common style uniform data
uniforms Style uniforms
styleToUniform Style to style uniform mapping
stylePaddings Per-style padding inside the node in order left, top, right, bottom
Returns Reference to self (for method chaining)

The uniforms view is expected to have the same size as styleUniformCount(), the styleToUniform view the same size as styleCount(). All uniform indices are expected to be less than styleUniformCount().

The stylePaddings view is expected to either have the same size as styleCount() or be empty, in which case all paddings are implicitly zero.

Value of styleToUniform[i] should give back an index into the uniforms array for style i. If styleUniformCount() and styleCount() is the same and the mapping is implicit, you can use the setStyle(const BaseLayerCommonStyleUniform&, Containers::ArrayView<const BaseLayerStyleUniform>, const Containers::StridedArrayView1D<const Vector4>&) convenience overload instead.

Calling this function causes LayerState::NeedsDataUpdate to be set on all layers that are constructed using this shared instance. If dynamicStyleCount() is non-zero, LayerState::NeedsCommonDataUpdate is set as well to trigger an upload of changed dynamic style uniform data.

Shared& Magnum::Ui::BaseLayer::Shared::setStyle(const BaseLayerCommonStyleUniform& commonUniform, std::initializer_list<BaseLayerStyleUniform> uniforms, std::initializer_list<UnsignedInt> styleToUniform, std::initializer_list<Vector4> stylePaddings)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.