36 glm::vec2
uv { 0.0F };
37 glm::vec3
normal { 0.0F, 0.0F, 1.0F };
41static_assert(
sizeof(Vertex) == 60,
42 "Vertex layout changed — must match VertexLayout::for_raw() stride and the other 60-byte vertex types");
44static_assert(offsetof(Vertex, position) == 0,
"position must be at offset 0");
45static_assert(offsetof(Vertex, color) == 12,
"color must be at offset 12");
46static_assert(offsetof(Vertex, scalar) == 24,
"scalar must be at offset 24");
47static_assert(offsetof(Vertex, uv) == 28,
"uv must be at offset 28");
48static_assert(offsetof(Vertex, normal) == 36,
"normal must be at offset 36");
49static_assert(offsetof(Vertex, tangent) == 48,
"tangent must be at offset 48");
65 glm::vec3
color = glm::vec3(1.0F);
67 glm::vec2
uv = glm::vec2(0.0F);
68 glm::vec3
normal = glm::vec3(0.0F, 0.0F, 1.0F);
69 glm::vec3
tangent = glm::vec3(1.0F, 0.0F, 0.0F);
86 glm::vec3
color = glm::vec3(1.0F);
88 glm::vec2
uv = glm::vec2(0.0F);
89 glm::vec3
normal = glm::vec3(0.0F, 0.0F, 1.0F);
90 glm::vec3
tangent = glm::vec3(1.0F, 0.0F, 0.0F);
119 glm::vec2
uv = glm::vec2(0.0F);
120 glm::vec3
normal = glm::vec3(0.0F, 0.0F, 1.0F);
121 glm::vec3
tangent = glm::vec3(1.0F, 0.0F, 0.0F);
125 "PointVertex layout changed — update VertexLayout::for_points(), VertexAccess write helpers, and shaders");
127 "LineVertex layout changed — update VertexLayout::for_lines(), VertexAccess write helpers, and shaders");
129 "MeshVertex layout changed — must match PointVertex/LineVertex stride for FieldOperator compatibility");
131static_assert(offsetof(
MeshVertex, position) == 0,
"position must be at offset 0");
132static_assert(offsetof(
MeshVertex, color) == 12,
"color must be at offset 12");
133static_assert(offsetof(
MeshVertex,
weight) == 24,
"weight must be at offset 24");
134static_assert(offsetof(
MeshVertex, uv) == 28,
"uv must be at offset 28");
135static_assert(offsetof(
MeshVertex, normal) == 36,
"normal must be at offset 36");
136static_assert(offsetof(
MeshVertex, tangent) == 48,
"tangent must be at offset 48");
156 if constexpr (std::is_same_v<T, PointVertex>) {
158 }
else if constexpr (std::is_same_v<T, LineVertex>) {
160 }
else if constexpr (std::is_same_v<T, MeshVertex>) {
162 }
else if constexpr (std::is_same_v<T, Vertex>) {
165 static_assert(!std::is_same_v<T, T>,
166 "vertex_layout_for: unrecognised vertex type");
184 glm::vec2 size_range = { 8.0F, 12.0F })
noexcept
189 .size = glm::mix(size_range.x, size_range.y, s.
scalar),
190 .uv = glm::vec2(0.0F),
204 glm::vec2 thickness_range = { 1.0F, 2.0F })
noexcept
209 .thickness = glm::mix(thickness_range.x, thickness_range.y, s.
scalar),
210 .uv = glm::vec2(0.0F),
226 glm::vec2 weight_range = { 0.0F, 1.0F })
noexcept
231 .weight = glm::mix(weight_range.x, weight_range.y, s.
scalar),
232 .uv = glm::vec2(0.0F),
245 std::span<const Vertex> vertices,
246 glm::vec2 size_range = { 8.0F, 12.0F });
255 std::span<const Vertex> vertices,
256 glm::vec2 thickness_range = { 1.0F, 2.0F });
265 std::span<const Vertex> vertices,
266 glm::vec2 weight_range = { 0.0F, 1.0F });
VertexLayout vertex_layout_for()
Deduce a VertexLayout from a vertex struct type.
LineVertex to_line_vertex(const Vertex &s, glm::vec2 thickness_range={ 1.0F, 2.0F }) noexcept
Project raw Vertex to LineVertex.
std::vector< LineVertex > to_line_vertices(std::span< const Vertex > vertices, glm::vec2 thickness_range)
Batch-project raw Vertex vector to LineVertex.
MeshVertex to_mesh_vertex(const Vertex &s, glm::vec2 weight_range={ 0.0F, 1.0F }) noexcept
Project raw Vertex to MeshVertex.
PointVertex to_point_vertex(const Vertex &s, glm::vec2 size_range={ 8.0F, 12.0F }) noexcept
Project raw Vertex to PointVertex.
std::vector< PointVertex > to_point_vertices(std::span< const Vertex > vertices, glm::vec2 size_range)
Batch-project raw Vertex vector to PointVertex.
std::vector< MeshVertex > to_mesh_vertices(std::span< const Vertex > vertices, glm::vec2 weight_range)
Batch-project raw Vertex vector to MeshVertex.
Vertex type for line primitives (LINE_LIST / LINE_STRIP topology)
Vertex type for indexed triangle mesh primitives (TRIANGLE_LIST topology)
Vertex type for point primitives (POINT_LIST topology)
Vertex layout for textured quad geometry (position + UV).
static VertexLayout for_raw(uint32_t stride=60)
Factory: layout for raw vertex data with common attributes.
static VertexLayout for_lines(uint32_t stride=60)
Factory: layout for LineVertex (position, color, thickness, uv, normal, tangent)
static VertexLayout for_meshes(uint32_t stride=60)
Factory: layout for MeshVertex (position, color, weight, uv, normal, tangent)
static VertexLayout for_points(uint32_t stride=60)
Factory: layout for PointVertex (position, color, size, uv, normal, tangent)
Complete description of vertex data layout in a buffer.
float scalar
Normalised scalar; maps to size / thickness / weight at offset 24.
glm::vec2 uv
Texture coordinates; zero unless set by UV generation.
Type-neutral vertex carrying the universal 60-byte attribute layout.