73 if (attr.component_modality == modality) {
74 if (attr.offset_in_vertex % 4 != 0) {
77 return attr.offset_in_vertex / 4;
89 uint32_t max_offset = 0;
90 uint32_t last_size = 0;
94 max_offset = std::max(max_offset, attr.offset_in_vertex);
95 if (attr.offset_in_vertex == max_offset) {
96 last_size = attr_size;
123 .offset_in_vertex = 0,
124 .name =
"position" });
127 .offset_in_vertex = 12,
131 .offset_in_vertex = 24,
135 .offset_in_vertex = 28,
139 .offset_in_vertex = 36,
143 .offset_in_vertex = 48,
144 .name =
"tangent" });
168 .offset_in_vertex = 0,
169 .name =
"position" });
172 .offset_in_vertex = 12,
176 .offset_in_vertex = 24,
177 .name =
"thickness" });
180 .offset_in_vertex = 28,
184 .offset_in_vertex = 36,
188 .offset_in_vertex = 48,
189 .name =
"tangent" });
215 .offset_in_vertex = 0,
216 .name =
"position" });
219 .offset_in_vertex = 12,
223 .offset_in_vertex = 24,
227 .offset_in_vertex = 28,
231 .offset_in_vertex = 36,
235 .offset_in_vertex = 48,
236 .name =
"tangent" });
261 .offset_in_vertex = 0,
262 .name =
"position" });
264 .offset_in_vertex = 12,
267 .offset_in_vertex = 24,
270 .offset_in_vertex = 36,
273 .offset_in_vertex = 48,
274 .name =
"tangent" });
287 layout.
stride_bytes =
static_cast<uint32_t
>(
sizeof(glm::vec3) +
sizeof(glm::vec2));
291 .offset_in_vertex = 0,
292 .name =
"position" });
296 .offset_in_vertex =
static_cast<uint32_t
>(
sizeof(glm::vec3)),
297 .name =
"texcoord" });
314 return sizeof(glm::vec3);
317 return sizeof(glm::vec2);
320 return sizeof(glm::vec4);
324 return sizeof(double);
DataModality
Data modality types for cross-modal analysis.
@ AUDIO_MULTICHANNEL
Multi-channel audio.
@ AUDIO_1D
1D audio signal
@ SCALAR_F32
Single-channel float data.
std::string name
Optional name for debugging/introspection e.g., "position", "normal", "texCoord".
uint32_t offset_in_vertex
Byte offset of this attribute within one vertex e.g., position at 0, normal at 12,...
DataModality component_modality
Semantic type of this attribute e.g., VERTEX_POSITIONS_3D → vec3, TEXTURE_COORDS_2D → vec2.
Semantic description of a single vertex attribute.
static VertexLayout for_raw(uint32_t stride=60)
Factory: layout for raw vertex data with common attributes.
uint32_t stride_bytes
Total bytes per vertex (stride in Vulkan terms) e.g., 3 floats (position) + 3 floats (normal) = 24 by...
uint32_t vertex_count
Total number of vertices in this buffer.
static VertexLayout for_lines(uint32_t stride=60)
Factory: layout for LineVertex (position, color, thickness, uv, normal, tangent)
static VertexLayout for_textured_quad(uint32_t vertex_count=4)
Factory: Create layout for textured quad primitives (position, texcoord).
static uint32_t modality_size_bytes(DataModality mod)
Get size in bytes for a given modality Mirrors VKBuffer::get_format() logic.
void compute_stride()
Helper: compute stride from attributes if not explicitly set.
static VertexLayout for_meshes(uint32_t stride=60)
Factory: layout for MeshVertex (position, color, weight, uv, normal, tangent)
std::optional< uint32_t > find_word_offset(DataModality modality) const
Word offset of the attribute matching the given modality, if any.
std::vector< VertexAttributeLayout > attributes
All attributes that make up one vertex Ordered by shader location (0, 1, 2, ...)
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.