class new in Git master
#include <Magnum/Shaders/MeshVisualizerGL.h>
MeshVisualizerGL3D 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 setTransformationProjectionMatrix(), 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 the constructor — there's no default behavior with nothing enabled.
Wireframe visualization
Wireframe visualization is done by enabling Flag::
If you don't have geometry shaders, you need to enable Flag::
If using geometry shaders on OpenGL ES, NV_
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::
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::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::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::
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::
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::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::
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::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::
If you enable Flag::gl_VertexID
GLSL builtin.
The Flag::gl_PrimitiveID
GLSL builtin; with Flag::gl_VertexID
, expecting you to draw a non-indexed triangle mesh. You can use MeshTools::
Instanced rendering
Enabling Flag::
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::
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. To maximize use of the limited uniform buffer memory, materials are supplied separately in a MeshVisualizerMaterialUniform and then referenced via materialId from a MeshVisualizerDrawUniform3D. 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::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::
Public types
- 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, MultiDraw = UniformBuffers|(1 << 11) new in Git master, TextureArrays = 1 << 17 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 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.
Constructors, destructors, conversion operators
- MeshVisualizerGL3D(Flags flags) explicit
- Constructor.
- MeshVisualizerGL3D() deprecated in 2020.06 explicit
- Constructor.
- MeshVisualizerGL3D(Flags flags, UnsignedInt materialCount, UnsignedInt drawCount) explicit
- Construct for a multi-draw scenario.
- 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 materialCount() const -> UnsignedInt new in Git master
- Material count.
- auto drawCount() const -> UnsignedInt new in Git master
- Draw count.
Uniform setters
Used only if Flag::
- 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.
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 |
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:: Mutually exclusive with Flag:: |
ObjectId new in Git master |
Visualize object ID set via setObjectId() or MeshVisualizerDrawUniform3D:: |
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:: |
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:: |
VertexId new in 2020.06 |
Visualize vertex ID ( |
PrimitiveId new in 2020.06 |
Visualize primitive ID ( |
PrimitiveIdFromVertexId new in 2020.06 |
Visualize primitive ID on a non-indexed triangle mesh using |
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:: |
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 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:: |
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:: |
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:: |
TextureTransformation new in Git master |
Enable texture coordinate transformation for an object ID texture. If this flag is set, the shader expects that Flag:: |
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:: If Flag:: |
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. |
MultiDraw new in Git master |
Enable multidraw functionality. Implies Flag:: |
TextureArrays new in Git master |
Use 2D texture arrays for an object ID texture. Expects that the texture is supplied via bindObjectIdTexture(GL:: |
Typedef documentation
typedef GenericGL3D:: Position Magnum:: Shaders:: MeshVisualizerGL3D:: Position
Vertex position.
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::
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::
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::
typedef GenericGL3D:: Normal Magnum:: Shaders:: MeshVisualizerGL3D:: Normal new in 2020.06
Normal direction.
Generic attribute, Vector3. Used only if Flag::
typedef GenericGL3D:: TextureCoordinates Magnum:: Shaders:: MeshVisualizerGL3D:: TextureCoordinates new in Git master
2D texture coordinates
Generic attribute, Vector2. Used only if Flag::
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::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, Magnum::
typedef GenericGL3D:: TransformationMatrix Magnum:: Shaders:: MeshVisualizerGL3D:: TransformationMatrix new in Git master
(Instanced) transformation matrix
Generic attribute, Magnum::
typedef GenericGL3D:: NormalMatrix Magnum:: Shaders:: MeshVisualizerGL3D:: NormalMatrix new in Git master
(Instanced) normal matrix
Generic attribute, Magnum::
typedef GenericGL3D:: TextureOffset Magnum:: Shaders:: MeshVisualizerGL3D:: TextureOffset new in Git master
(Instanced) texture offset for an object ID texture
Generic attribute, Magnum::
typedef GenericGL3D:: TextureOffsetLayer Magnum:: Shaders:: MeshVisualizerGL3D:: TextureOffsetLayer new in Git master
(Instanced) texture offset and layer for an object ID texture
Generic attribute, Magnum::
Function documentation
Magnum:: Shaders:: MeshVisualizerGL3D:: MeshVisualizerGL3D(Flags flags) explicit
Constructor.
Parameters | |
---|---|
flags | Flags |
At least Flag::
While this function is meant mainly for the classic uniform scenario (without Flag::materialCount
and drawCount
set to 1
.
Magnum:: Shaders:: MeshVisualizerGL3D:: MeshVisualizerGL3D() explicit
Constructor.
Magnum:: Shaders:: MeshVisualizerGL3D:: MeshVisualizerGL3D(Flags flags,
UnsignedInt materialCount,
UnsignedInt drawCount) explicit
Construct for a multi-draw scenario.
Parameters | |
---|---|
flags | Flags |
materialCount | Size of a MeshVisualizerMaterialUniform buffer bound with bindMaterialBuffer() |
drawCount | Size of a ProjectionUniform3D / TransformationUniform3D / MeshVisualizerMaterialUniform buffer bound with bindProjectionBuffer(), bindTransformationBuffer() and bindDrawBuffer() |
At least Flag::
If flags
contains Flag::materialCount
and drawCount
describe the uniform buffer sizes as these are required to have a statically defined size. The draw offset is then set via setDrawOffset() and the per-draw materials are specified via MeshVisualizerDrawUniform3D::
If flags
don't contain Flag::materialCount
and drawCount
is ignored and the constructor behaves the same as MeshVisualizerGL3D(Flags).
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.
UnsignedInt Magnum:: Shaders:: MeshVisualizerGL3D:: materialCount() const new in Git master
Material count.
Statically defined size of the MeshVisualizerMaterialUniform uniform buffer. Has use only if Flag::
UnsignedInt Magnum:: Shaders:: MeshVisualizerGL3D:: drawCount() const new in Git master
Draw count.
Statically defined size of each of the TransformationProjectionUniform3D and MeshVisualizerDrawUniform3D uniform buffers. Has use only if Flag::
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::
Expects that Flag::
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 cube).
Expects that Flag::
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::
Expects that Flag::
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::
Expects that Flag::
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::0
. If Flag::
Expects that Flag::
MeshVisualizerGL3D& Magnum:: Shaders:: MeshVisualizerGL3D:: setViewportSize(const Vector2& size)
Set viewport size.
Returns | Reference to self (for method chaining) |
---|
Has effect only if Flag::
MeshVisualizerGL3D& Magnum:: Shaders:: MeshVisualizerGL3D:: setObjectId(UnsignedInt id) new in Git master
Set object ID.
Returns | Reference to self (for method chaining) |
---|
Expects that Flag::0
. If Flag::
Expects that Flag::
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::
Expects that Flag::
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::
Expects that Flag::
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::
Expects that Flag::
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::
Expects that Flag::
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::
Expects that Flag::
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::
Expects that Flag::
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::
Expects that Flag::
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::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::gl_DrawID
is added to this value, which makes each draw submitted via GL::
MeshVisualizerGL3D& Magnum:: Shaders:: MeshVisualizerGL3D:: bindProjectionBuffer(GL:: Buffer& buffer) new in Git master
Set a projection uniform buffer.
Returns | Reference to self (for method chaining) |
---|
Expects that Flag::
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
Set a transformation uniform buffer.
Returns | Reference to self (for method chaining) |
---|
Expects that Flag::
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
Set a draw uniform buffer.
Returns | Reference to self (for method chaining) |
---|
Expects that Flag::
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
Set a texture transformation uniform buffer for an object ID texture.
Returns | Reference to self (for method chaining) |
---|
Expects that both Flag::
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
Set a material uniform buffer.
Returns | Reference to self (for method chaining) |
---|
Expects that Flag::
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:: 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::
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::
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::
Debug& operator<<(Debug& debug,
MeshVisualizerGL3D:: Flag value)
Debug output operator.
Debug& operator<<(Debug& debug,
MeshVisualizerGL3D:: Flags value)
Debug output operator.