Magnum::Shaders::PhongGL::Configuration class new in Git master

Configuration.

Public functions

auto flags() const -> Flags
Flags.
auto setFlags(Flags flags) -> Configuration&
Set flags.
auto lightCount() const -> UnsignedInt
Light count.
auto perDrawLightCount() const -> UnsignedInt
Per-draw light count.
auto setLightCount(UnsignedInt count, UnsignedInt perDrawCount) -> Configuration&
Set light count.
auto setLightCount(UnsignedInt count) -> Configuration&
Set light count.
auto jointCount() const -> UnsignedInt
Joint count.
auto perVertexJointCount() const -> UnsignedInt
Per-vertex joint count.
auto secondaryPerVertexJointCount() const -> UnsignedInt
Secondary per-vertex joint count.
auto setJointCount(UnsignedInt count, UnsignedInt perVertexCount, UnsignedInt secondaryPerVertexCount = 0) -> Configuration&
Set joint count.
auto materialCount() const -> UnsignedInt
Material count.
auto setMaterialCount(UnsignedInt count) -> Configuration&
Set material count.
auto drawCount() const -> UnsignedInt
Draw count.
auto setDrawCount(UnsignedInt count) -> Configuration&
Set draw count.
auto extraSource() const -> Containers::StringView
Extra source to use for extending shader behavior.
auto setExtraSource(Containers::StringView source) -> Configuration&
Set an extra source to use for extending shader behavior.
auto setExtraSource(Containers::String&& source) -> Configuration&

Function documentation

Configuration& Magnum::Shaders::PhongGL::Configuration::setFlags(Flags flags)

Set flags.

Returns Reference to self (for method chaining)

No flags are set by default.

Configuration& Magnum::Shaders::PhongGL::Configuration::setLightCount(UnsignedInt count, UnsignedInt perDrawCount)

Set light count.

Returns Reference to self (for method chaining)

If Flag::UniformBuffers isn't set, count corresponds to the range / array size accepted by setLightPosition() / setLightPositions(), setLightColor() / setLightColors(), setLightSpecularColor() / setLightSpecularColors() and setLightRange() / setLightRanges().

If Flag::UniformBuffers is set, count describes size of a PhongLightUniform buffer bound with bindLightBuffer(). Uniform buffers have a statically defined size and count*sizeof(PhongLightUniform) has to be within GL::AbstractShaderProgram::maxUniformBlockSize(), if Flag::ShaderStorageBuffers is set as well, the buffer is unbounded and count is ignored. The per-draw lights are specified via PhongDrawUniform::lightOffset and PhongDrawUniform::lightCount.

The perDrawCount parameter describes how many lights out of count get applied to each draw. Useful mainly in combination with Flag::LightCulling, without it can be used for conveniently reducing the light count without having to reduce sizes of the light arrays as well. Unless Flag::ShaderStorageBuffers is set, perDrawCount is expected to not be larger than count. If set to 0, no lighting calculations are performed and only the ambient contribution to the color is used. If perDrawCount is 0, count is expected to be zero as well.

Default value is 1 for both.

Configuration& Magnum::Shaders::PhongGL::Configuration::setLightCount(UnsignedInt count)

Set light count.

Returns Reference to self (for method chaining)

Same as calling setLightCount(UnsignedInt, UnsignedInt) with both parameters set to count.

UnsignedInt Magnum::Shaders::PhongGL::Configuration::jointCount() const

Joint count.

UnsignedInt Magnum::Shaders::PhongGL::Configuration::perVertexJointCount() const

Per-vertex joint count.

UnsignedInt Magnum::Shaders::PhongGL::Configuration::secondaryPerVertexJointCount() const

Secondary per-vertex joint count.

Configuration& Magnum::Shaders::PhongGL::Configuration::setJointCount(UnsignedInt count, UnsignedInt perVertexCount, UnsignedInt secondaryPerVertexCount = 0)

Set joint count.

Returns Reference to self (for method chaining)

If Flag::UniformBuffers isn't set, count describes an upper bound on how many joint matrices get supplied to each draw with setJointMatrices() / setJointMatrix().

If Flag::UniformBuffers is set, count describes size of a TransformationUniform3D buffer bound with bindJointBuffer(). Uniform buffers have a statically defined size and count*sizeof(TransformationUniform3D) has to be within GL::AbstractShaderProgram::maxUniformBlockSize(), if Flag::ShaderStorageBuffers is set as well, the buffer is unbounded and count is ignored. The per-vertex joints index into the array offset by PhongDrawUniform::jointOffset.

The perVertexCount and secondaryPerVertexCount parameters describe how many components are taken from JointIds / Weights and SecondaryJointIds / SecondaryWeights attributes. Both values are expected to not be larger than 4, setting either of these to 0 means given attribute is not used at all. If both perVertexCount and secondaryPerVertexCount are set to 0, skinning is not performed. Unless Flag::ShaderStorageBuffers is set, if either of them is non-zero, count is expected to be non-zero as well.

Default value for all three is 0.

UnsignedInt Magnum::Shaders::PhongGL::Configuration::materialCount() const

Material count.

Configuration& Magnum::Shaders::PhongGL::Configuration::setMaterialCount(UnsignedInt count)

Set material count.

Returns Reference to self (for method chaining)

If Flag::UniformBuffers is set, describes size of a PhongMaterialUniform buffer bound with bindMaterialBuffer(). Uniform buffers have a statically defined size and count*sizeof(PhongMaterialUniform) has to be within GL::AbstractShaderProgram::maxUniformBlockSize(), if Flag::ShaderStorageBuffers is set as well, the buffer is unbounded and count is ignored. The per-draw materials are specified via PhongDrawUniform::materialId. Default value is 1.

If Flag::UniformBuffers isn't set, this value is ignored.

UnsignedInt Magnum::Shaders::PhongGL::Configuration::drawCount() const

Draw count.

Configuration& Magnum::Shaders::PhongGL::Configuration::setDrawCount(UnsignedInt count)

Set draw count.

Returns Reference to self (for method chaining)

If Flag::UniformBuffers is set, describes size of a TransformationUniform3D / PhongDrawUniform / TextureTransformationUniform buffer bound with bindTransformationBuffer(), bindDrawBuffer() and bindTextureTransformationBuffer(). Uniform buffers have a statically defined size and the maximum of count*sizeof(TransformationUniform3D), count*sizeof(PhongDrawUniform) and count*sizeof(TextureTransformationUniform) has to be within GL::AbstractShaderProgram::maxUniformBlockSize(), if Flag::ShaderStorageBuffers is set as well, the buffers are unbounded and count is ignored. The draw offset is set via setDrawOffset(). Default value is 1.

If Flag::UniformBuffers isn't set, this value is ignored.

Containers::StringView Magnum::Shaders::PhongGL::Configuration::extraSource() const

Extra source to use for extending shader behavior.

The returned view is Containers::StringViewFlag::NullTerminated, Containers::StringViewFlag::Global is set if a global null-terminated view was passed to setExtraSource().

Configuration& Magnum::Shaders::PhongGL::Configuration::setExtraSource(Containers::StringView source)

Set an extra source to use for extending shader behavior.

Returns Reference to self (for method chaining)

If the string is not empty, uses it along with other builtin shader sources. Macros defined in the file are then used to modify or extend shader behavior, see Extending builtin shaders with custom code for an introduction and Extending with custom code for a list of extension points for the PhongGL shader itself.

Calling this function multiple times replaces the previous source, doesn't add to it. Call the function with an empty string to remove any previously set extra source. By default there is no extra shader source added.

If the view is both Containers::StringViewFlag::Global and NullTerminated, it's directly referenced, otherwise a copy is made internally. For dynamic strings prefer to use the setExtraSource(Containers::String&&) overload to avoid copies.

Configuration& Magnum::Shaders::PhongGL::Configuration::setExtraSource(Containers::String&& source)

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