class
#include <Magnum/GL/MeshView.h>
MeshView Mesh view.
Allows different interpretation of given Mesh data via different vertex or index count and offset. It is then possible to reuse one mesh buffer configuration for different views. Mesh primitive, index type, attribute bindings and attached buffers are reused from original mesh.
The same rules as in Mesh apply, i.e. if the view has non-zero index count, it is treated as indexed mesh, otherwise it is treated as non-indexed mesh. If both index and vertex count is zero, the view is treated as empty and no draw commands are issued when calling AbstractShaderProgram::
You must ensure that the original mesh remains available for whole view lifetime.
Public static functions
-
static void draw(AbstractShaderProgram& shader,
Containers::
ArrayView<const Containers:: Reference<MeshView>> meshes) deprecated in 2020.06 - Draw multiple meshes at once.
-
static void draw(AbstractShaderProgram&& shader,
Containers::
ArrayView<const Containers:: Reference<MeshView>> meshes) deprecated in 2020.06 -
static void draw(AbstractShaderProgram& shader,
std::
initializer_list<Containers:: Reference<MeshView>> meshes) deprecated in 2020.06 -
static void draw(AbstractShaderProgram&& shader,
std::
initializer_list<Containers:: Reference<MeshView>> meshes) deprecated in 2020.06
Constructors, destructors, conversion operators
Public functions
- auto mesh() -> Mesh&
- Original mesh.
- auto mesh() const -> const Mesh&
- auto count() const -> Int
- Vertex/index count.
- auto setCount(Int count) -> MeshView&
- Set vertex/index count.
- auto baseVertex() const -> Int
- Base vertex.
- auto setBaseVertex(Int baseVertex) -> MeshView&
- Set base vertex.
- auto indexOffset() const -> Int new in Git master
- Index offset.
- auto setIndexOffset(Int offset, UnsignedInt start, UnsignedInt end) -> MeshView& new in Git master
- Set index offset.
- auto setIndexRange(Int offset, UnsignedInt start, UnsignedInt end) -> MeshView& deprecated in Git master
- Set index offset.
- auto setIndexOffset(Int offset) -> MeshView& new in Git master
- Set index offset.
- auto setIndexRange(Int offset) -> MeshView& deprecated in Git master
- Set index offset.
- auto instanceCount() const -> Int
- Instance count.
- auto setInstanceCount(Int count) -> MeshView&
- Set instance count.
- auto baseInstance() const -> UnsignedInt
- Base instance.
- auto setBaseInstance(UnsignedInt baseInstance) -> MeshView&
- Set base instance.
- auto draw(AbstractShaderProgram& shader) -> MeshView& deprecated in 2020.06
- Draw the mesh.
- auto draw(AbstractShaderProgram&& shader) -> MeshView& deprecated in 2020.06
- auto draw(AbstractShaderProgram& shader, TransformFeedback& xfb, UnsignedInt stream = 0) -> MeshView& deprecated in 2020.06
- Draw the mesh with vertices coming out of transform feedback.
- auto draw(AbstractShaderProgram&& shader, TransformFeedback& xfb, UnsignedInt stream = 0) -> MeshView& deprecated in 2020.06
Function documentation
static void Magnum:: GL:: MeshView:: draw(AbstractShaderProgram& shader,
Containers:: ArrayView<const Containers:: Reference<MeshView>> meshes)
Draw multiple meshes at once.
static void Magnum:: GL:: MeshView:: draw(AbstractShaderProgram&& shader,
Containers:: ArrayView<const Containers:: Reference<MeshView>> meshes)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
static void Magnum:: GL:: MeshView:: draw(AbstractShaderProgram& shader,
std:: initializer_list<Containers:: Reference<MeshView>> meshes)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
static void Magnum:: GL:: MeshView:: draw(AbstractShaderProgram&& shader,
std:: initializer_list<Containers:: Reference<MeshView>> meshes)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
MeshView& Magnum:: GL:: MeshView:: setCount(Int count)
Set vertex/index count.
Returns | Reference to self (for method chaining) |
---|
Ignored when calling AbstractShaderProgram::
MeshView& Magnum:: GL:: MeshView:: setBaseVertex(Int baseVertex)
Set base vertex.
Returns | Reference to self (for method chaining) |
---|
Sets number of vertices of which the vertex buffer will be offset when drawing. Ignored when calling AbstractShaderProgram::0
.
MeshView& Magnum:: GL:: MeshView:: setIndexOffset(Int offset,
UnsignedInt start,
UnsignedInt end) new in Git master
Set index offset.
Parameters | |
---|---|
offset | First index |
start | Minimum array index contained in the buffer |
end | Maximum array index contained in the buffer |
Returns | Reference to self (for method chaining) |
The offset gets multiplied by index type size and added to the base offset that was specified in Mesh::start
and end
parameters may help to improve memory access performance, as only a portion of vertex buffer needs to be acccessed. On OpenGL ES 2.0 this function behaves the same as setIndexOffset(Int), as index range functionality is not available there. Ignored when calling AbstractShaderProgram::
Expects that the original mesh is indexed.
MeshView& Magnum:: GL:: MeshView:: setIndexRange(Int offset,
UnsignedInt start,
UnsignedInt end)
Set index offset.
MeshView& Magnum:: GL:: MeshView:: setIndexOffset(Int offset) new in Git master
Set index offset.
Returns | Reference to self (for method chaining) |
---|
The offset gets multiplied by index type size and added to the base offset that was specified in Mesh::
Expects that the original mesh is indexed.
MeshView& Magnum:: GL:: MeshView:: setIndexRange(Int offset)
Set index offset.
MeshView& Magnum:: GL:: MeshView:: setInstanceCount(Int count)
Set instance count.
Returns | Reference to self (for method chaining) |
---|
Default is 1
.
MeshView& Magnum:: GL:: MeshView:: setBaseInstance(UnsignedInt baseInstance)
Set base instance.
Returns | Reference to self (for method chaining) |
---|
Ignored when calling AbstractShaderProgram::0
.
MeshView& Magnum:: GL:: MeshView:: draw(AbstractShaderProgram& shader)
Draw the mesh.
MeshView& Magnum:: GL:: MeshView:: draw(AbstractShaderProgram&& shader)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
MeshView& Magnum:: GL:: MeshView:: draw(AbstractShaderProgram& shader,
TransformFeedback& xfb,
UnsignedInt stream = 0)
Draw the mesh with vertices coming out of transform feedback.
MeshView& Magnum:: GL:: MeshView:: draw(AbstractShaderProgram&& shader,
TransformFeedback& xfb,
UnsignedInt stream = 0)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.