Monad Engine da02fba2
> Undercity Codex_
Loading...
Searching...
No Matches
VertexLayout.h File Reference

Describes the memory layout of a single vertex in a VBO. More...

#include <cstdint>
#include <vector>
#include "graphics/GLForward.h"
+ Include dependency graph for VertexLayout.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mnd::VertexElement
 Describes one interleaved vertex attribute within a VBO. More...
 
struct  mnd::VertexLayout
 Complete description of how vertex data is packed in a VBO. More...
 

Namespaces

namespace  mnd
 

Detailed Description

Describes the memory layout of a single vertex in a VBO.

A VertexLayout is a list of VertexElements — each element maps one interleaved field (position, UV, normal …) to a numbered shader attribute.

The layout is created by Builder factory methods together with the vertex data and is then stored inside Mesh. When Mesh::Bind() is called, GraphicsAPI reads the layout to issue the matching glVertexAttribPointer calls, connecting the raw buffer bytes to the GLSL attribute slots.

Example interleaved vertex (pos + normal + UV) looks like:

| x y z | nx ny nz | u v | ← one vertex, stride = 8 floats
^--- offset 0 ---^--- offset 12 ---^--- offset 24
See also
Builder, Mesh, GraphicsAPI::BindMesh

Definition in file VertexLayout.h.