Magnum::Shaders::MeshVisualizerGL3D class new in Git master

3D mesh visualization OpenGL shader

Visualizes wireframe, per-vertex/per-instance object ID, primitive ID or tangent space of 3D meshes. You need to provide the Position attribute in your triangle mesh at the very least. Use setProjectionMatrix(), setTransformationMatrix(), setColor() and others to configure the shader.

The shader expects that you enable wireframe visualization, tangent space visualization or object/primitive ID visualization by passing an appropriate Flag to Configuration::setFlags() — there's no default behavior with nothing enabled.

Wireframe visualization

Wireframe visualization is done by enabling Flag::Wireframe. It is done either using geometry shaders or with help of additional vertex information. If you have geometry shaders available, you don't need to do anything else except calling setViewportSize() to correctly size the wireframe — without this, the mesh will be rendered in a single color.

If you don't have geometry shaders, you need to enable Flag::NoGeometryShader (done by default in OpenGL ES 2.0) and use only non-indexed triangle meshes (see MeshTools::duplicate() for a possible solution). Additionally, if you have OpenGL < 3.1 or OpenGL ES 2.0, you need to provide also the VertexIndex attribute.

If using geometry shaders on OpenGL ES, NV_shader_noperspective_interpolation is optionally used for improving line appearance. On desktop OpenGL this is done implicitly.

If you want to render just the wireframe on top of an existing mesh, call setColor() with 0x00000000_rgbaf. Alpha / transparency is supported by the shader implicitly, but to have it working on the framebuffer, you need to enable GL::Renderer::Feature::Blending and set up the blending function. See GL::Renderer::setBlendFunction() for details.

Example setup with a geometry shader (desktop GL, OpenGL ES 3.2)

Common mesh setup:

struct Vertex {
    Vector3 position;
};
Vertex data[60]{
    // ...
};

GL::Buffer vertices;
vertices.setData(data, GL::BufferUsage::StaticDraw);

GL::Mesh mesh;
mesh.addVertexBuffer(vertices, 0, Shaders::MeshVisualizerGL3D::Position{});

Common rendering setup:

Matrix4 transformationMatrix = Matrix4::translation(Vector3::zAxis(-5.0f));
Matrix4 projectionMatrix =
    Matrix4::perspectiveProjection(35.0_degf, 1.0f, 0.001f, 100.0f);

Shaders::MeshVisualizerGL3D shader{Shaders::MeshVisualizerGL3D::Configuration{}
    .setFlags(Shaders::MeshVisualizerGL3D::Flag::Wireframe)};
shader.setColor(0x2f83cc_rgbf)
    .setWireframeColor(0xdcdcdc_rgbf)
    .setViewportSize(Vector2{GL::defaultFramebuffer.viewport().size()})
    .setTransformationMatrix(transformationMatrix)
    .setProjectionMatrix(projectionMatrix)
    .draw(mesh);

Example setup for indexed meshes without a geometry shader

The vertices have to be converted to a non-indexed array first. Mesh setup:

Containers::StridedArrayView1D<const UnsignedInt> indices;
Containers::StridedArrayView1D<const Vector3> indexedPositions;

/* De-indexing the position array */
GL::Buffer vertices{MeshTools::duplicate(indices, indexedPositions)};

GL::Mesh mesh;
mesh.addVertexBuffer(vertices, 0, Shaders::MeshVisualizerGL3D::Position{});

Rendering setup:

Matrix4 transformationMatrix, projectionMatrix;

Shaders::MeshVisualizerGL3D shader{Shaders::MeshVisualizerGL3D::Configuration{}
    .setFlags(Shaders::MeshVisualizerGL3D::Flag::Wireframe|
              Shaders::MeshVisualizerGL3D::Flag::NoGeometryShader)};
shader.setColor(0x2f83cc_rgbf)
    .setWireframeColor(0xdcdcdc_rgbf)
    .setTransformationMatrix(transformationMatrix)
    .setProjectionMatrix(projectionMatrix)
    .draw(mesh);

Wireframe visualization of non-indexed meshes without a geometry shader on older hardware

You need to provide also the VertexIndex attribute. Mesh setup in addition to the above:

Containers::Array<Float> vertexIndex{Containers::arraySize(data)};
std::iota(vertexIndex.begin(), vertexIndex.end(), 0.0f);

GL::Buffer vertexIndices;
vertexIndices.setData(vertexIndex, GL::BufferUsage::StaticDraw);

mesh.addVertexBuffer(vertexIndices, 0, Shaders::MeshVisualizerGL3D::VertexIndex{});

Rendering setup the same as above.

Tangent space visualization

On platforms with geometry shaders (desktop GL, OpenGL ES 3.2), the shader is able to visualize tangent, bitangent and normal direction via colored lines coming out of vertices (red, green and blue for tangent, bitangent and normal, respectively). This can be enabled together with wireframe, object ID, vertex ID or primitive ID visualization, however note that when both are enabled, the lines are not antialiased to avoid depth ordering artifacts between faces and lines.

For tangents and normals, you need to provide the Tangent and Normal attributes and enable Flag::TangentDirection and Flag::NormalDirection, respectively. If any of the attributes isn't present, its data are implicitly zero and thus the direction isn't shown — which means you don't need to worry about having two active variants of the shader and switching between either depending on whether tangents are present or not.

For bitangents however, there are two possible representations — the more efficient one is via a fourth component in the tangent attribute that indicates tangent space handedness, in which case you'll be using the Tangent4 attribute instead of Tangent, and enable Flag::BitangentFromTangentDirection. The other, more obvious but less efficient representation, is a dedicated Bitangent attribute (in which case you'll enable Flag::BitangentDirection). Note that these two are mutually exclusive, so you need to choose either of them based on what given mesh contains. Example for the first case:

struct Vertex {
    Vector3 position;
    Vector4 tangent;
    Vector3 normal;
};
Vertex data[60]{
    // ...
};

GL::Buffer vertices;
vertices.setData(data);

GL::Mesh mesh;
mesh.addVertexBuffer(vertices, 0,
    Shaders::MeshVisualizerGL3D::Position{},
    Shaders::MeshVisualizerGL3D::Tangent4{},
    Shaders::MeshVisualizerGL3D::Normal{});

Rendering setup:

Matrix4 transformationMatrix, projectionMatrix;

Shaders::MeshVisualizerGL3D shader{Shaders::MeshVisualizerGL3D::Configuration{}
    .setFlags(Shaders::MeshVisualizerGL3D::Flag::TangentDirection|
              Shaders::MeshVisualizerGL3D::Flag::BitangentFromTangentDirection|
              Shaders::MeshVisualizerGL3D::Flag::NormalDirection)};
shader.setViewportSize(Vector2{GL::defaultFramebuffer.viewport().size()})
    .setTransformationMatrix(transformationMatrix)
    .setProjectionMatrix(projectionMatrix)
    .setNormalMatrix(transformationMatrix.normalMatrix())
    .setLineLength(0.3f)
    .draw(mesh);

Object, vertex and primitive ID visualization

If the mesh contains a per-vertex (or instanced) ObjectId, it can be visualized by enabling Flag::InstancedObjectId. For the actual visualization you need to provide a color map using bindColorMapTexture() and use setColorMapTransformation() to map given range of discrete IDs to the $ [0, 1] $ texture range. Various colormap presets are in the DebugTools::ColorMap namespace. Example usage:

const auto map = DebugTools::ColorMap::turbo();
const Vector2i size{Int(map.size()), 1};

GL::Texture2D colorMapTexture;
colorMapTexture
    .setMinificationFilter(SamplerFilter::Linear)
    .setMagnificationFilter(SamplerFilter::Linear)
    .setWrapping(SamplerWrapping::ClampToEdge)
    .setStorage(1, GL::TextureFormat::RGBA8, size)
    .setSubImage(0, {}, ImageView2D{PixelFormat::RGB8Srgb, size, map});

Shaders::MeshVisualizerGL3D shader{Shaders::MeshVisualizerGL3D::Configuration{}
    .setFlags(Shaders::MeshVisualizerGL3D::Flag::InstancedObjectId)};
shader.setColorMapTransformation(0.0f, 1.0f/Math::max(objectIds))
    .setTransformationMatrix(transformationMatrix)
    .setProjectionMatrix(projectionMatrix)
    .bindColorMapTexture(colorMapTexture)
    .draw(mesh);

Consistently with the other shaders, textured object ID is also supported if Flag::ObjectIdTexture is enabled. In that case you need to provide also the TextureCoordinates attribute and bind an integer texture via bindObjectIdTexture(). Flag::TextureTransformation then enables texture transformation and Flag::TextureArrays texture arrays for the object ID texture.

If you enable Flag::VertexId, the shader will use the color map to visualize how are vertices shared among primitives. That's useful for inspecting mesh connectivity — primitives sharing vertices will have a smooth color map transition while duplicated vertices will cause a sharp edge. This relies on the gl_VertexID GLSL builtin.

The Flag::PrimitiveId then visualizes the order in which primitives are drawn. That's useful for example to see to see how well is the mesh optimized for a post-transform vertex cache. This by default relies on the gl_PrimitiveID GLSL builtin; with Flag::PrimitiveIdFromVertexId it's emulated using gl_VertexID, expecting you to draw a non-indexed triangle mesh. You can use MeshTools::duplicate() (and potentially MeshTools::generateIndices()) to conveniently convert the mesh to a non-indexed MeshPrimitive::Triangles.

Skinning

To render skinned meshes, bind up to two sets of up to four-component joint ID and weight attributes to JointIds / SecondaryJointIds and Weights / SecondaryWeights, set an appropriate joint count and per-vertex primary and secondary joint count in Configuration::setJointCount() and upload appropriate joint matrices with setJointMatrices(). The usage is similar for all shaders, see Skinning for an example. Currently, the mesh visualizer supports only transforming the mesh vertices for feature parity with other shaders, no skinning-specific visualization feature is implemented.

To avoid having to compile multiple shader variants for different joint matrix counts, set the maximum used joint count in Configuration::setJointCount() and then upload just a prefix via setJointMatrices(). Similarly, to avoid multiple variants for different per-vertex joint counts, enable Flag::DynamicPerVertexJointCount, set the maximum per-vertex joint count in Configuration::setJointCount() and then adjust the actual per-draw joint count with setPerVertexJointCount().

Instanced rendering

Enabling Flag::InstancedTransformation will turn the shader into an instanced one. It'll take per-instance transformation from the TransformationMatrix attribute, applying it before the matrix set by setTransformationMatrix(). If one of Flag::TangentDirection, Flag::BitangentDirection or Flag::NormalDirection is set, additionally also a normal matrix from the NormalMatrix attribute is taken, applied before the matrix set by setNormalMatrix(). The snippet below shows adding a buffer with per-instance transformation to a mesh, including a normal matrix attribute for correct TBN visualization:

struct {
    Matrix4 transformation;
    Matrix3x3 normal;
} instanceData[] {
    {Matrix4::translation({1.0f, 2.0f, 0.0f}), {}},
    {Matrix4::translation({2.0f, 1.0f, 0.0f}), {}},
    {Matrix4::translation({3.0f, 0.0f, 1.0f}), {}},
    // ...
};
for(auto& instance: instanceData)
    instance.normal = instance.transformation.normalMatrix();

mesh.setInstanceCount(Containers::arraySize(instanceData))
    .addVertexBufferInstanced(GL::Buffer{instanceData}, 1, 0,
        Shaders::MeshVisualizerGL3D::TransformationMatrix{},
        Shaders::MeshVisualizerGL3D::NormalMatrix{});

If Flag::ObjectIdTexture is used and Flag::InstancedTextureOffset is enabled, the TextureOffset attribute (or TextureOffsetLayer in case Flag::TextureArrays is enabled as well) then can supply per-instance texture offset (or offset and layer).

For instanced skinning the joint buffer is assumed to contain joint transformations for all instances. By default all instances use the same joint transformations, seting setPerInstanceJointCount() will cause the shader to offset the per-vertex joint IDs with gl_InstanceID*perInstanceJointCount.

Uniform buffers

See Using uniform buffers for a high-level overview that applies to all shaders. In this particular case, the shader needs a separate ProjectionUniform3D and TransformationUniform3D buffer bound with bindProjectionBuffer() and bindTransformationBuffer(), respectively. To maximize use of the limited uniform buffer memory, materials are supplied separately in a MeshVisualizerMaterialUniform buffer bound with bindMaterialBuffer() and then referenced via materialId from a MeshVisualizerDrawUniform3D buffer bound with bindDrawBuffer(); for optional texture transformation a per-draw TextureTransformationUniform buffer bound with bindTextureTransformationBuffer() can be supplied as well. A uniform buffer setup equivalent to the wireframe case at the top would look like this — note that setViewportSize() is an immediate uniform here as well, as it's assumed to be set globally and rarely changed:

GL::Buffer projectionUniform, materialUniform, transformationUniform,
    drawUniform;
projectionUniform.setData({
    Shaders::ProjectionUniform3D{}
        .setProjectionMatrix(projectionMatrix)
});
materialUniform.setData({
    Shaders::MeshVisualizerMaterialUniform{}
        .setColor(0x2f83cc_rgbf)
        .setWireframeColor(0xdcdcdc_rgbf)
});
transformationUniform.setData({
    Shaders::TransformationUniform3D{}
        .setTransformationMatrix(transformationMatrix)
});
drawUniform.setData({
    Shaders::MeshVisualizerDrawUniform3D{}
        .setMaterialId(0)
});

Shaders::MeshVisualizerGL3D shader{Shaders::MeshVisualizerGL3D::Configuration{}
    .setFlags(Shaders::MeshVisualizerGL3D::Flag::Wireframe|
              Shaders::MeshVisualizerGL3D::Flag::UniformBuffers)
};
shader
    .setViewportSize(Vector2{GL::defaultFramebuffer.viewport().size()})
    .bindProjectionBuffer(projectionUniform)
    .bindMaterialBuffer(materialUniform)
    .bindTransformationBuffer(transformationUniform)
    .bindDrawBuffer(drawUniform)
    .draw(mesh);

For a multidraw workflow enable Flag::MultiDraw, supply desired material and draw count via Configuration::setMaterialCount() and setDrawCount() and specify material references for every draw. The usage is similar for all shaders, see Multidraw and reducing driver overhead for an example.

For skinning, joint matrices are supplied via a TransformationUniform3D buffer bound with bindJointBuffer(). In an instanced scenario the per-instance joint count is supplied via MeshVisualizerDrawUniform3D::perInstanceJointCount, a per-draw joint offset for the multidraw scenario is supplied via MeshVisualizerDrawUniform3D::jointOffset. Altogether for a particular draw, each per-vertex joint ID is offset with gl_InstanceID*perInstanceJointCount + jointOffset. The setPerVertexJointCount() stays as an immediate uniform in the UBO and multidraw scenario as well, as it is tied to a particular mesh layout and thus doesn't need to vary per draw.

Derived classes

class Magnum::Shaders::MeshVisualizerGL3D::CompileState new in Git master
Asynchronous compilation state.

Public types

class CompileState new in Git master
Asynchronous compilation state.
class Configuration new in Git master
Configuration.
enum (anonymous): UnsignedInt { ColorOutput = GenericGL3D::ColorOutput }
enum class Flag: UnsignedInt { Wireframe = 1 << 0, NoGeometryShader = 1 << 1, ObjectId = 1 << 12 new in Git master, InstancedObjectId = (1 << 2)|ObjectId new in 2020.06, ObjectIdTexture = (1 << 14)|ObjectId new in Git master, VertexId = 1 << 3 new in 2020.06, PrimitiveId = 1 << 4 new in 2020.06, PrimitiveIdFromVertexId = (1 << 5)|PrimitiveId new in 2020.06, TangentDirection = 1 << 6 new in 2020.06, BitangentFromTangentDirection = 1 << 7 new in 2020.06, BitangentDirection = 1 << 8 new in 2020.06, NormalDirection = 1 << 9 new in 2020.06, InstancedTransformation = 1 << 13 new in Git master, TextureTransformation = 1 << 15 new in Git master, InstancedTextureOffset = (1 << 16)|TextureTransformation new in Git master, UniformBuffers = 1 << 10 new in Git master, ShaderStorageBuffers = UniformBuffers|(1 << 19) new in Git master, MultiDraw = UniformBuffers|(1 << 11) new in Git master, TextureArrays = 1 << 17 new in Git master, DynamicPerVertexJointCount = 1 << 18 new in Git master }
Flag.
using Position = GenericGL3D::Position
Vertex position.
using Tangent = GenericGL3D::Tangent new in 2020.06
Tangent direction.
using Tangent4 = GenericGL3D::Tangent4 new in 2020.06
Tangent direction with a bitangent sign.
using Bitangent = GenericGL3D::Bitangent new in 2020.06
Bitangent direction.
using Normal = GenericGL3D::Normal new in 2020.06
Normal direction.
using TextureCoordinates = GenericGL3D::TextureCoordinates new in Git master
2D texture coordinates
using JointIds = GenericGL3D::JointIds new in Git master
Joint ids.
using Weights = GenericGL3D::Weights new in Git master
Weights.
using SecondaryJointIds = GenericGL3D::SecondaryJointIds new in Git master
Secondary joint ids.
using SecondaryWeights = GenericGL3D::SecondaryWeights new in Git master
Secondary weights.
using VertexIndex = GL::Attribute<4, Float>
Vertex index.
using ObjectId = GenericGL3D::ObjectId new in 2020.06
(Instanced) object ID
using TransformationMatrix = GenericGL3D::TransformationMatrix new in Git master
(Instanced) transformation matrix
using NormalMatrix = GenericGL3D::NormalMatrix new in Git master
(Instanced) normal matrix
using TextureOffset = GenericGL3D::TextureOffset new in Git master
(Instanced) texture offset for an object ID texture
using TextureOffsetLayer = GenericGL3D::TextureOffsetLayer new in Git master
(Instanced) texture offset and layer for an object ID texture
using Flags = Containers::EnumSet<Flag>
Flags.

Public static functions

static auto compile(const Configuration& configuration) -> CompileState new in Git master
Compile asynchronously.
static auto compile(Flags flags) -> CompileState deprecated in Git master
Compile asynchronously.
static auto compile(Flags flags, UnsignedInt materialCount, UnsignedInt drawCount) -> CompileState deprecated in Git master
Compile for a multi-draw scenario asynchronously.

Constructors, destructors, conversion operators

MeshVisualizerGL3D(const Configuration& configuration) explicit new in Git master
Constructor.
MeshVisualizerGL3D() deprecated in 2020.06 explicit
Constructor.
MeshVisualizerGL3D(Flags flags) deprecated in Git master explicit
Constructor.
MeshVisualizerGL3D(Flags flags, UnsignedInt materialCount, UnsignedInt drawCount) deprecated in Git master explicit
Construct for a multi-draw scenario.
MeshVisualizerGL3D(CompileState&& state) explicit new in Git master
Finalize an asynchronous compilation.
MeshVisualizerGL3D(NoCreateT) explicit noexcept
Construct without creating the underlying OpenGL object.
MeshVisualizerGL3D(const MeshVisualizerGL3D&) deleted
Copying is not allowed.
MeshVisualizerGL3D(MeshVisualizerGL3D&&) defaulted noexcept
Move constructor.

Public functions

auto operator=(const MeshVisualizerGL3D&) -> MeshVisualizerGL3D& deleted
Copying is not allowed.
auto operator=(MeshVisualizerGL3D&&) -> MeshVisualizerGL3D& defaulted noexcept
Move assignment.
auto flags() const -> Flags
Flags.
auto jointCount() const -> UnsignedInt new in Git master
Joint count.
auto perVertexJointCount() const -> UnsignedInt new in Git master
Per-vertex joint count.
auto secondaryPerVertexJointCount() const -> UnsignedInt new in Git master
Secondary per-vertex joint count.
auto materialCount() const -> UnsignedInt new in Git master
Material count.
auto drawCount() const -> UnsignedInt new in Git master
Draw count.
auto setPerVertexJointCount(UnsignedInt count, UnsignedInt secondaryCount = 0) -> MeshVisualizerGL3D& new in Git master
Set dynamic per-vertex skinning joint count.

Uniform setters

Used only if Flag::UniformBuffers is not set.

auto setTransformationProjectionMatrix(const Matrix4& matrix) -> MeshVisualizerGL3D& deprecated in 2020.06
Set transformation and projection matrix.
auto setTransformationMatrix(const Matrix4& matrix) -> MeshVisualizerGL3D&
Set transformation matrix.
auto setProjectionMatrix(const Matrix4& matrix) -> MeshVisualizerGL3D&
Set projection matrix.
auto setNormalMatrix(const Matrix3x3& matrix) -> MeshVisualizerGL3D& new in 2020.06
Set transformation matrix.
auto setTextureMatrix(const Matrix3& matrix) -> MeshVisualizerGL3D& new in Git master
Set texture coordinate transformation matrix for an object ID texture.
auto setTextureLayer(UnsignedInt layer) -> MeshVisualizerGL3D& new in Git master
Set texture array layer for an object ID texture.
auto setViewportSize(const Vector2& size) -> MeshVisualizerGL3D&
Set viewport size.
auto setObjectId(UnsignedInt id) -> MeshVisualizerGL3D& new in Git master
Set object ID.
auto setColor(const Color4& color) -> MeshVisualizerGL3D&
Set base object color.
auto setWireframeColor(const Color4& color) -> MeshVisualizerGL3D&
Set wireframe color.
auto setWireframeWidth(Float width) -> MeshVisualizerGL3D&
Set wireframe width.
auto setColorMapTransformation(Float offset, Float scale) -> MeshVisualizerGL3D& new in 2020.06
Set color map transformation.
auto setLineWidth(Float width) -> MeshVisualizerGL3D& new in 2020.06
Set line width.
auto setLineLength(Float length) -> MeshVisualizerGL3D& new in 2020.06
Set line length.
auto setSmoothness(Float smoothness) -> MeshVisualizerGL3D&
Set line smoothness.
auto setJointMatrices(const Containers::ArrayView<const Matrix4> matrices) -> MeshVisualizerGL3D& new in Git master
Set joint matrices.
auto setJointMatrices(std::initializer_list<Matrix4> matrices) -> MeshVisualizerGL3D& new in Git master
auto setJointMatrix(UnsignedInt id, const Matrix4& matrix) -> MeshVisualizerGL3D& new in Git master
Set joint matrix for given joint.
auto setPerInstanceJointCount(UnsignedInt count) -> MeshVisualizerGL3D& new in Git master
Set per-instance joint count.

Texture binding

auto bindColorMapTexture(GL::Texture2D& texture) -> MeshVisualizerGL3D& new in 2020.06
Bind a color map texture.
auto bindObjectIdTexture(GL::Texture2D& texture) -> MeshVisualizerGL3D& new in Git master
Bind an object ID texture.
auto bindObjectIdTexture(GL::Texture2DArray& texture) -> MeshVisualizerGL3D& new in Git master
Bind an object ID array texture.

Enum documentation

enum Magnum::Shaders::MeshVisualizerGL3D::(anonymous): UnsignedInt

Enumerators
ColorOutput

Color shader output. Generic output, present always. Expects three- or four-component floating-point or normalized buffer attachment.

enum class Magnum::Shaders::MeshVisualizerGL3D::Flag: UnsignedInt

Flag.

Enumerators
Wireframe

Visualize wireframe. On OpenGL ES 2.0 and WebGL this also enables Flag::NoGeometryShader.

NoGeometryShader

Don't use a geometry shader for wireframe visualization. If enabled, you might need to provide also the VertexIndex attribute in the mesh. On OpenGL ES 2.0 and WebGL enabled alongside Flag::Wireframe.

Mutually exclusive with Flag::TangentDirection, Flag::BitangentFromTangentDirection, Flag::BitangentDirection and Flag::NormalDirection — those need a geometry shader always.

ObjectId new in Git master

Visualize object ID set via setObjectId() or MeshVisualizerDrawUniform3D::objectId. Since the ID is uniform for the whole draw, this feature is mainly useful in multidraw scenarios or when combined with Flag::InstancedObjectId. Mutually exclusive with Flag::VertexId and Flag::PrimitiveId.

InstancedObjectId new in 2020.06

Visualize instanced object ID. You need to provide the ObjectId attribute in the mesh, which then gets summed with the ID coming from setObjectId() or MeshVisualizerDrawUniform3D::objectId. Implicitly enables Flag::ObjectId. Mutually exclusive with Flag::VertexId and Flag::PrimitiveId.

ObjectIdTexture new in Git master

Object ID texture. Retrieves object IDs from a texture bound with bindObjectIdTexture(), outputting a sum of the object ID texture, the ID coming from setObjectId() or MeshVisualizerDrawUniform3D::objectId and possibly also the per-vertex ID, if Flag::InstancedObjectId is enabled as well. Implicitly enables Flag::ObjectId.

VertexId new in 2020.06

Visualize vertex ID (gl_VertexID). Useful for visualizing mesh connectivity — primitives sharing vertices will have a smooth color map transition while duplicated vertices will cause a sharp edge. Mutually exclusive with Flag::InstancedObjectId and Flag::PrimitiveId.

PrimitiveId new in 2020.06

Visualize primitive ID (gl_PrimitiveID). Useful for visualizing how well is the mesh optimized for a post-transform vertex cache. Mutually exclusive with Flag::InstancedObjectId and Flag::VertexId. See also Flag::PrimitiveIdFromVertexId.

PrimitiveIdFromVertexId new in 2020.06

Visualize primitive ID on a non-indexed triangle mesh using gl_VertexID/3. Implicitly enables Flag::PrimitiveId, mutually exclusive with Flag::InstancedObjectId. Usable on OpenGL < 3.2, OpenGL ES < 3.2 and WebGL where gl_PrimitiveID is not available.

TangentDirection new in 2020.06

Visualize tangent direction with red lines pointing out of vertices. You need to provide the Tangent or Tangent4 attribute in the mesh. Mutually exclusive with Flag::NoGeometryShader (as this needs a geometry shader always).

BitangentFromTangentDirection new in 2020.06

Visualize bitangent direction with green lines pointing out of vertices. You need to provide both Normal and Tangent4 attributes in the mesh, alternatively you can provide the Bitangent attribute and enable Flag::BitangentDirection instead. Mutually exclusive with Flag::NoGeometryShader (as this needs a geometry shader always).

BitangentDirection new in 2020.06

Visualize bitangent direction with green lines pointing out of vertices. You need to provide the Bitangent attribute in the mesh, alternatively you can provide both Normal and Tangent4 attributes and enable Flag::BitangentFromTangentDirection instead. Mutually exclusive with Flag::NoGeometryShader (as this needs a geometry shader always).

NormalDirection new in 2020.06

Visualize normal direction with blue lines pointing out of vertices. You need to provide the Normal attribute in the mesh. Mutually exclusive with Flag::NoGeometryShader (as this needs a geometry shader always).

InstancedTransformation new in Git master

Instanced transformation. Retrieves a per-instance transformation and normal matrix from the TransformationMatrix / NormalMatrix attributes and uses them together with matrices coming from setTransformationMatrix() and setNormalMatrix() or TransformationUniform3D::transformationMatrix and MeshVisualizerDrawUniform3D::normalMatrix (first the per-instance, then the uniform matrix). See Instanced rendering for more information.

TextureTransformation new in Git master

Enable texture coordinate transformation for an object ID texture. If this flag is set, the shader expects that Flag::ObjectIdTexture is enabled as well.

InstancedTextureOffset new in Git master

Instanced texture offset for an object ID texture. Retrieves a per-instance offset vector from the TextureOffset attribute and uses it together with the matrix coming from setTextureMatrix() or TextureTransformationUniform::rotationScaling and TextureTransformationUniform::offset (first the per-instance vector, then the uniform matrix). Instanced texture scaling and rotation is not supported at the moment, you can specify that only via the uniform setTextureMatrix(). Implicitly enables Flag::TextureTransformation. See Instanced rendering for more information.

If Flag::TextureArrays is set as well, a three-component TextureOffsetLayer attribute can be used instead of TextureOffset to specify per-instance texture layer, which gets added to the uniform layer numbers set by setTextureLayer() or TextureTransformationUniform::layer.

UniformBuffers new in Git master

Use uniform buffers. Expects that uniform data are supplied via bindProjectionBuffer(), bindTransformationBuffer(), bindDrawBuffer() and bindMaterialBuffer() instead of direct uniform setters.

ShaderStorageBuffers new in Git master

Use shader storage buffers. Superset of functionality provided by Flag::UniformBuffers, compared to it doesn't have any size limits on Configuration::setJointCount(), setMaterialCount() and setDrawCount() in exchange for potentially more costly access and narrower platform support.

MultiDraw new in Git master

Enable multidraw functionality. Implies Flag::UniformBuffers and combines the value from setDrawOffset() with the gl_DrawID builtin, which makes draws submitted via GL::AbstractShaderProgram::draw(const Containers::Iterable<MeshView>&) and related APIs pick up per-draw parameters directly, without having to rebind the uniform buffers or specify setDrawOffset() before each draw. In a non-multidraw scenario, gl_DrawID is 0, which means a shader with this flag enabled can be used for regular draws as well.

TextureArrays new in Git master

Use 2D texture arrays for an object ID texture. Expects that the texture is supplied via bindObjectIdTexture(GL::Texture2DArray&) and the layer is set via setTextureLayer() or TextureTransformationUniform::layer. If Flag::InstancedTextureOffset is set as well and a three-component TextureOffsetLayer attribute is used instead of TextureOffset, the per-instance and uniform layer numbers are added together.

DynamicPerVertexJointCount new in Git master

Dynamic per-vertex joint count for skinning. Uses only the first M / N primary / secondary components defined by setPerVertexJointCount() instead of all primary / secondary components defined by Configuration::setJointCount() at shader compilation time. Useful in order to avoid having a shader permutation defined for every possible joint count. Unfortunately it's not possible to make use of default values for unspecified input components as the last component is always 1.0 instead of 0.0, on the other hand dynamically limiting the joint count can reduce the time spent executing the vertex shader compared to going through the full set of per-vertex joints always.

Typedef documentation

typedef GenericGL3D::Position Magnum::Shaders::MeshVisualizerGL3D::Position

Vertex position.

Generic attribute, Vector3.

typedef GenericGL3D::Tangent Magnum::Shaders::MeshVisualizerGL3D::Tangent new in 2020.06

Tangent direction.

Generic attribute, Vector3. Use either this or the Tangent4 attribute. Used only if Flag::TangentDirection is enabled.

typedef GenericGL3D::Tangent4 Magnum::Shaders::MeshVisualizerGL3D::Tangent4 new in 2020.06

Tangent direction with a bitangent sign.

Generic attribute, Vector4. Use either this or the Tangent attribute. Used only if Flag::TangentDirection or Flag::BitangentFromTangentDirection is enabled.

typedef GenericGL3D::Bitangent Magnum::Shaders::MeshVisualizerGL3D::Bitangent new in 2020.06

Bitangent direction.

Generic attribute, Vector3. Use either this or the Tangent4 attribute. Used only if Flag::BitangentDirection is enabled.

typedef GenericGL3D::Normal Magnum::Shaders::MeshVisualizerGL3D::Normal new in 2020.06

Normal direction.

Generic attribute, Vector3. Used only if Flag::NormalDirection is enabled.

typedef GenericGL3D::TextureCoordinates Magnum::Shaders::MeshVisualizerGL3D::TextureCoordinates new in Git master

2D texture coordinates

Generic attribute, Vector2. Used only if Flag::ObjectIdTexture is enabled.

typedef GenericGL3D::JointIds Magnum::Shaders::MeshVisualizerGL3D::JointIds new in Git master

Joint ids.

Generic attribute, Vector4ui. Used only if perVertexJointCount() isn't 0.

typedef GenericGL3D::Weights Magnum::Shaders::MeshVisualizerGL3D::Weights new in Git master

Weights.

Generic attribute, Vector4. Used only if perVertexJointCount() isn't 0.

typedef GenericGL3D::SecondaryJointIds Magnum::Shaders::MeshVisualizerGL3D::SecondaryJointIds new in Git master

Secondary joint ids.

Generic attribute, Vector4ui. Used only if secondaryPerVertexJointCount() isn't 0.

typedef GenericGL3D::SecondaryWeights Magnum::Shaders::MeshVisualizerGL3D::SecondaryWeights new in Git master

Secondary weights.

Generic attribute, Vector4. Used only if secondaryPerVertexJointCount() isn't 0.

typedef GL::Attribute<4, Float> Magnum::Shaders::MeshVisualizerGL3D::VertexIndex

Vertex index.

Float, used only in OpenGL < 3.1 and OpenGL ES 2.0 if Flag::Wireframe is enabled. This attribute (modulo 3) specifies index of given vertex in triangle, i.e. 0.0f for first, 1.0f for second, 2.0f for third. In OpenGL 3.1, OpenGL ES 3.0 and newer this value is provided via the gl_VertexID shader builtin, so the attribute is not needed.

typedef GenericGL3D::ObjectId Magnum::Shaders::MeshVisualizerGL3D::ObjectId new in 2020.06

(Instanced) object ID

Generic attribute, UnsignedInt. Used only if Flag::InstancedObjectId is set.

typedef GenericGL3D::TextureOffset Magnum::Shaders::MeshVisualizerGL3D::TextureOffset new in Git master

(Instanced) texture offset for an object ID texture

Generic attribute, Vector2. Used only if Flag::InstancedTextureOffset is set.

typedef GenericGL3D::TextureOffsetLayer Magnum::Shaders::MeshVisualizerGL3D::TextureOffsetLayer new in Git master

(Instanced) texture offset and layer for an object ID texture

Generic attribute, Vector3, with the last component interpreted as an integer. Use either this or the TextureOffset attribute. First two components used only if Flag::InstancedTextureOffset is set, third component only if Flag::TextureArrays is set.

typedef Containers::EnumSet<Flag> Magnum::Shaders::MeshVisualizerGL3D::Flags

Flags.

Function documentation

static CompileState Magnum::Shaders::MeshVisualizerGL3D::compile(const Configuration& configuration) new in Git master

Compile asynchronously.

Compared to MeshVisualizerGL3D(const Configuration&) can perform an asynchronous compilation and linking. See Async shader compilation and linking for more information.

static CompileState Magnum::Shaders::MeshVisualizerGL3D::compile(Flags flags)

Compile asynchronously.

static CompileState Magnum::Shaders::MeshVisualizerGL3D::compile(Flags flags, UnsignedInt materialCount, UnsignedInt drawCount)

Compile for a multi-draw scenario asynchronously.

Magnum::Shaders::MeshVisualizerGL3D::MeshVisualizerGL3D() explicit

Constructor.

Magnum::Shaders::MeshVisualizerGL3D::MeshVisualizerGL3D(Flags flags) explicit

Constructor.

Magnum::Shaders::MeshVisualizerGL3D::MeshVisualizerGL3D(Flags flags, UnsignedInt materialCount, UnsignedInt drawCount) explicit

Construct for a multi-draw scenario.

Magnum::Shaders::MeshVisualizerGL3D::MeshVisualizerGL3D(CompileState&& state) explicit new in Git master

Finalize an asynchronous compilation.

Takes an asynchronous compilation state returned by compile() and forms a ready-to-use shader object. See Async shader compilation and linking for more information.

Magnum::Shaders::MeshVisualizerGL3D::MeshVisualizerGL3D(NoCreateT) explicit noexcept

Construct without creating the underlying OpenGL object.

The constructed instance is equivalent to a moved-from state. Useful in cases where you will overwrite the instance later anyway. Move another object over it to make it useful.

This function can be safely used for constructing (and later destructing) objects even without any OpenGL context being active. However note that this is a low-level and a potentially dangerous API, see the documentation of NoCreate for alternatives.

Flags Magnum::Shaders::MeshVisualizerGL3D::flags() const

Flags.

UnsignedInt Magnum::Shaders::MeshVisualizerGL3D::jointCount() const new in Git master

Joint count.

If Flag::UniformBuffers is not set, this is the number of joint matrices accepted by setJointMatrices() / setJointMatrix(). If Flag::UniformBuffers is set, this is the statically defined size of the TransformationUniform3D uniform buffer bound with bindJointBuffer(). Has no use if Flag::ShaderStorageBuffers is set.

UnsignedInt Magnum::Shaders::MeshVisualizerGL3D::perVertexJointCount() const new in Git master

Per-vertex joint count.

Returns the value set with Configuration::setJointCount(). If Flag::DynamicPerVertexJointCount is set, the count can be additionally modified per-draw using setPerVertexJointCount().

UnsignedInt Magnum::Shaders::MeshVisualizerGL3D::secondaryPerVertexJointCount() const new in Git master

Secondary per-vertex joint count.

Returns the value set with Configuration::setJointCount(). If Flag::DynamicPerVertexJointCount is set, the count can be additionally modified per-draw using setPerVertexJointCount().

UnsignedInt Magnum::Shaders::MeshVisualizerGL3D::materialCount() const new in Git master

Material count.

Statically defined size of the MeshVisualizerMaterialUniform uniform buffer bound with bindMaterialBuffer(). Has use only if Flag::UniformBuffers is set and Flag::ShaderStorageBuffers is not set.

UnsignedInt Magnum::Shaders::MeshVisualizerGL3D::drawCount() const new in Git master

Draw count.

Statically defined size of each of the TransformationUniform3D and MeshVisualizerDrawUniform3D uniform buffers, bound with bindTransformationBuffer() and bindDrawBuffer(). Has use only if Flag::UniformBuffers is set and Flag::ShaderStorageBuffers is not set.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::setPerVertexJointCount(UnsignedInt count, UnsignedInt secondaryCount = 0) new in Git master

Set dynamic per-vertex skinning joint count.

Returns Reference to self (for method chaining)

Allows reducing the count of iterated joints for a particular draw call, making it possible to use a single shader with meshes that contain different count of per-vertex joints. See Flag::DynamicPerVertexJointCount for more information. As the joint count is tied to the mesh layout, this is a per-draw-call setting even in case of Flag::UniformBuffers instead of being a value in MeshVisualizerDrawUniform3D. Initial value is same as perVertexJointCount() and secondaryPerVertexJointCount().

Expects that Flag::DynamicPerVertexJointCount is set, count is not larger than perVertexJointCount() and secondaryCount not larger than secondaryPerVertexJointCount().

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::setTransformationProjectionMatrix(const Matrix4& matrix)

Set transformation and projection matrix.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::setTransformationMatrix(const Matrix4& matrix)

Set transformation matrix.

Returns Reference to self (for method chaining)

Initial value is an identity matrix. If Flag::InstancedTransformation is set, the per-instance transformation coming from the TransformationMatrix attribute is applied first, before this one.

Expects that Flag::UniformBuffers is not set, in that case fill TransformationUniform3D::transformationMatrix and call bindTransformationBuffer() instead.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::setProjectionMatrix(const Matrix4& matrix)

Set projection matrix.

Returns Reference to self (for method chaining)

Initial value is an identity matrix. (i.e., an orthographic projection of the default $ [ -\boldsymbol{1} ; \boldsymbol{1} ] $ cube).

Expects that Flag::UniformBuffers is not set, in that case fill ProjectionUniform3D::projectionMatrix and call bindProjectionBuffer() instead.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::setNormalMatrix(const Matrix3x3& matrix) new in 2020.06

Set transformation matrix.

Returns Reference to self (for method chaining)

Expects that Flag::TangentDirection, Flag::BitangentDirection or Flag::NormalDirection is enabled. The matrix doesn't need to be normalized, as renormalization is done per-fragment anyway. Initial value is an identity matrix. If Flag::InstancedTransformation is set, the per-instance normal matrix coming from the NormalMatrix attribute is applied first, before this one.

Expects that Flag::UniformBuffers is not set, in that case fill MeshVisualizerDrawUniform3D::normalMatrix and call bindDrawBuffer() instead.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::setTextureMatrix(const Matrix3& matrix) new in Git master

Set texture coordinate transformation matrix for an object ID texture.

Returns Reference to self (for method chaining)

Expects that the shader was created with Flag::TextureTransformation enabled. Initial value is an identity matrix. If Flag::InstancedTextureOffset is set, the per-instance offset coming from the TextureOffset attribute is applied first, before this matrix.

Expects that Flag::UniformBuffers is not set, in that case fill TextureTransformationUniform::rotationScaling and TextureTransformationUniform::offset and call bindTextureTransformationBuffer() instead.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::setTextureLayer(UnsignedInt layer) new in Git master

Set texture array layer for an object ID texture.

Returns Reference to self (for method chaining)

Expects that the shader was created with Flag::TextureArrays enabled. Initial value is 0. If Flag::InstancedTextureOffset is set and a three-component TextureOffsetLayer attribute is used instead of TextureOffset, this value is added to the layer coming from the third component.

Expects that Flag::UniformBuffers is not set, in that case fill TextureTransformationUniform::layer and call bindTextureTransformationBuffer() instead.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::setViewportSize(const Vector2& size)

Set viewport size.

Returns Reference to self (for method chaining)

Has effect only if Flag::Wireframe is enabled and geometry shaders are used; or if Flag::TangentDirection, Flag::BitangentDirection or Flag::NormalDirection is enabled, otherwise it does nothing. Initial value is a zero vector.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::setObjectId(UnsignedInt id) new in Git master

Set object ID.

Returns Reference to self (for method chaining)

Expects that Flag::ObjectId is enabled. Initial value is 0. If Flag::InstancedObjectId is enabled as well, this value is added to the ID coming from the ObjectId attribute.

Expects that Flag::UniformBuffers is not set, in that case fill MeshVisualizerDrawUniform3D::objectId and call bindDrawBuffer() instead.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::setColor(const Color4& color)

Set base object color.

Returns Reference to self (for method chaining)

Initial value is 0xffffffff_rgbaf. Expects that either Flag::Wireframe or Flag::InstancedObjectId / Flag::PrimitiveId / Flag::PrimitiveIdFromVertexId is enabled. In case of the latter, the color is multiplied with the color map coming from bindColorMapTexture().

Expects that Flag::UniformBuffers is not set, in that case fill MeshVisualizerMaterialUniform::color and call bindMaterialBuffer() instead.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::setWireframeColor(const Color4& color)

Set wireframe color.

Returns Reference to self (for method chaining)

Initial value is 0x000000ff_rgbaf. Expects that Flag::Wireframe is enabled.

Expects that Flag::UniformBuffers is not set, in that case fill MeshVisualizerMaterialUniform::wireframeColor and call bindMaterialBuffer() instead.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::setWireframeWidth(Float width)

Set wireframe width.

Returns Reference to self (for method chaining)

The value is in screen space (depending on setViewportSize()), initial value is 1.0f. Expects that Flag::Wireframe is enabled.

Expects that Flag::UniformBuffers is not set, in that case fill MeshVisualizerMaterialUniform::wireframeWidth and call bindMaterialBuffer() instead.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::setColorMapTransformation(Float offset, Float scale) new in 2020.06

Set color map transformation.

Returns Reference to self (for method chaining)

Offset and scale applied to the input value coming either from the ObjectId attribute or gl_PrimitiveID, resulting value is then used to fetch a color from a color map bound with bindColorMapTexture(). Initial value is 1.0f/512.0f and 1.0/256.0f, meaning that for a 256-entry colormap the first 256 values get an exact color from it and the next values will be either clamped to last color or repeated depending on the color map texture wrapping mode. Expects that either Flag::InstancedObjectId or Flag::PrimitiveId / Flag::PrimitiveIdFromVertexId is enabled.

Expects that Flag::UniformBuffers is not set, in that case fill MeshVisualizerMaterialUniform::colorMapOffset and MeshVisualizerMaterialUniform::colorMapScale and call bindMaterialBuffer() instead.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::setLineWidth(Float width) new in 2020.06

Set line width.

Returns Reference to self (for method chaining)

The value is in screen space (depending on setViewportSize()), initial value is 1.0f. Expects that Flag::TangentDirection, Flag::BitangentFromTangentDirection, Flag::BitangentDirection or Flag::NormalDirection is enabled.

Expects that Flag::UniformBuffers is not set, in that case fill MeshVisualizerMaterialUniform::lineWidth and call bindMaterialBuffer() instead.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::setLineLength(Float length) new in 2020.06

Set line length.

Returns Reference to self (for method chaining)

The value is in object space, initial value is 1.0f. Expects that Flag::TangentDirection, Flag::BitangentFromTangentDirection, Flag::BitangentDirection or Flag::NormalDirection is enabled.

Expects that Flag::UniformBuffers is not set, in that case fill MeshVisualizerMaterialUniform::lineLength and call bindMaterialBuffer() instead.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::setSmoothness(Float smoothness)

Set line smoothness.

Returns Reference to self (for method chaining)

The value is in screen space (depending on setViewportSize()), initial value is 2.0f. Expects that Flag::Wireframe, Flag::TangentDirection, Flag::BitangentFromTangentDirection, Flag::BitangentDirection or Flag::NormalDirection is enabled.

Expects that Flag::UniformBuffers is not set, in that case fill MeshVisualizerMaterialUniform::smoothness and call bindMaterialBuffer() instead.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::setJointMatrices(const Containers::ArrayView<const Matrix4> matrices) new in Git master

Set joint matrices.

Returns Reference to self (for method chaining)

Initial values are identity transformations. Expects that the size of the matrices array is not larger than jointCount().

Expects that Flag::UniformBuffers is not set, in that case fill TransformationUniform3D::transformationMatrix and call bindJointBuffer() instead.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::setJointMatrices(std::initializer_list<Matrix4> matrices) new in Git master

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

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::setJointMatrix(UnsignedInt id, const Matrix4& matrix) new in Git master

Set joint matrix for given joint.

Returns Reference to self (for method chaining)

Unlike setJointMatrices() updates just a single joint matrix. Expects that id is less than jointCount().

Expects that Flag::UniformBuffers is not set, in that case fill TransformationUniform3D::transformationMatrix and call bindJointBuffer() instead.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::setPerInstanceJointCount(UnsignedInt count) new in Git master

Set per-instance joint count.

Returns Reference to self (for method chaining)

Offset added to joint IDs in the JointIds and SecondaryJointIds in instanced draws. Should be less than jointCount(). Initial value is 0, meaning every instance will use the same joint matrices, setting it to a non-zero value causes the joint IDs to be interpreted as gl_InstanceID*count + jointId.

Expects that Flag::UniformBuffers is not set, in that case fill MeshVisualizerDrawUniform3D::perInstanceJointCount and call bindDrawBuffer() instead.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::setDrawOffset(UnsignedInt offset) new in Git master

Set a draw offset.

Returns Reference to self (for method chaining)

Specifies which item in the TransformationUniform3D and MeshVisualizerDrawUniform3D buffers bound with bindTransformationBuffer() and bindDrawBuffer() should be used for current draw. Expects that Flag::UniformBuffers is set and offset is less than drawCount(). Initial value is 0, if drawCount() is 1, the function is a no-op as the shader assumes draw offset to be always zero.

If Flag::MultiDraw is set, gl_DrawID is added to this value, which makes each draw submitted via GL::AbstractShaderProgram::draw(const Containers::Iterable<MeshView>&) pick up its own per-draw parameters.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::bindProjectionBuffer(GL::Buffer& buffer) new in Git master

Bind a projection uniform / shader storage buffer.

Returns Reference to self (for method chaining)

Expects that Flag::UniformBuffers is set. The buffer is expected to contain at least one instance of ProjectionUniform3D. At the very least you need to call also bindTransformationBuffer(), bindDrawBuffer() and bindMaterialBuffer().

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::bindProjectionBuffer(GL::Buffer& buffer, GLintptr offset, GLsizeiptr size) new in Git master

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

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::bindTransformationBuffer(GL::Buffer& buffer) new in Git master

Bind a transformation uniform / shader storage buffer.

Returns Reference to self (for method chaining)

Expects that Flag::UniformBuffers is set. The buffer is expected to contain drawCount() instances of TransformationUniform3D. At the very least you need to call also bindDrawBuffer() and bindMaterialBuffer().

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::bindTransformationBuffer(GL::Buffer& buffer, GLintptr offset, GLsizeiptr size) new in Git master

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

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::bindDrawBuffer(GL::Buffer& buffer) new in Git master

Bind a draw uniform / shader storage buffer.

Returns Reference to self (for method chaining)

Expects that Flag::UniformBuffers is set. The buffer is expected to contain drawCount() instances of MeshVisualizerDrawUniform3D. At the very least you need to call also bindProjectionBuffer(), bindTransformationBuffer() and bindMaterialBuffer().

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::bindDrawBuffer(GL::Buffer& buffer, GLintptr offset, GLsizeiptr size) new in Git master

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

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::bindTextureTransformationBuffer(GL::Buffer& buffer) new in Git master

Bind a texture transformation uniform / shader storage buffer for an object ID texture.

Returns Reference to self (for method chaining)

Expects that both Flag::UniformBuffers and Flag::TextureTransformation is set. The buffer is expected to contain drawCount() instances of TextureTransformationUniform.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::bindTextureTransformationBuffer(GL::Buffer& buffer, GLintptr offset, GLsizeiptr size) new in Git master

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

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::bindMaterialBuffer(GL::Buffer& buffer) new in Git master

Bind a material uniform / shader storage buffer.

Returns Reference to self (for method chaining)

Expects that Flag::UniformBuffers is set. The buffer is expected to contain materialCount() instances of MeshVisualizerMaterialUniform. At the very least you need to call also bindProjectionBuffer(), bindTransformationBuffer() and bindDrawBuffer().

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::bindMaterialBuffer(GL::Buffer& buffer, GLintptr offset, GLsizeiptr size) new in Git master

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

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::bindJointBuffer(GL::Buffer& buffer) new in Git master

Bind a joint matrix uniform / shader storage buffer.

Returns Reference to self (for method chaining)

Expects that Flag::UniformBuffers is set. The buffer is expected to contain jointCount() instances of TransformationUniform3D.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::bindJointBuffer(GL::Buffer& buffer, GLintptr offset, GLsizeiptr size) new in Git master

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

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::bindColorMapTexture(GL::Texture2D& texture) new in 2020.06

Bind a color map texture.

Returns Reference to self (for method chaining)

See also setColorMapTransformation(). Expects that either Flag::InstancedObjectId or Flag::PrimitiveId / Flag::PrimitiveIdFromVertexId is enabled.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::bindObjectIdTexture(GL::Texture2D& texture) new in Git master

Bind an object ID texture.

Returns Reference to self (for method chaining)

Expects that the shader was created with Flag::ObjectIdTexture enabled. If Flag::TextureArrays is enabled as well, use bindObjectIdTexture(GL::Texture2DArray&) instead. The texture needs to have an unsigned integer format.

MeshVisualizerGL3D& Magnum::Shaders::MeshVisualizerGL3D::bindObjectIdTexture(GL::Texture2DArray& texture) new in Git master

Bind an object ID array texture.

Returns Reference to self (for method chaining)

Expects that the shader was created with both Flag::ObjectIdTexture and Flag::TextureArrays enabled. If Flag::UniformBuffers is not enabled, the layer is set via setTextureLayer(); if Flag::UniformBuffers is enabled, Flag::TextureTransformation has to be enabled as well and the layer is set via TextureTransformationUniform::layer.

Debug& operator<<(Debug& debug, MeshVisualizerGL3D::Flag value)

Debug output operator.

Debug& operator<<(Debug& debug, MeshVisualizerGL3D::Flags value)

Debug output operator.