Avara3D 0.2.0
C++ API reference
VertexLayoutDesc.h
1//
2// VertexLayoutDesc.h
3// avara3d
4//
5// Created by Morgan Davis on 1/4/26.
6// Copyright © 2026 Morgan K Davis. All rights reserved.
7//
8
9#ifndef AVARA3D_MESH_VERTEXLAYOUTDESC_H
10#define AVARA3D_MESH_VERTEXLAYOUTDESC_H
11
12#include <cstdint>
13#include <span>
14
15#include "a3d/mesh/VertexLayout.h"
16
17namespace a3d {
18
19 enum class VertexAttribFormat : uint8_t {
20 F32x2,
21 F32x3,
22 F32x4,
23 // UN8x4
24 // I16x4N
25 };
26
27 enum class VertexSemantic : uint8_t {
28 Position,
29 Normal,
30 TexCoord0,
31 Color0,
32 };
33
34 struct VertexAttribDesc {
35 VertexSemantic semantic = VertexSemantic::Position;
36 uint8_t location = 0; // shader location
37 VertexAttribFormat format = VertexAttribFormat::F32x3;
38 uint16_t offset = 0; // byte offset in vertex
39 bool normalized = false;
40 };
41
42 struct VertexLayoutDesc {
43 uint16_t stride = 0;
44 std::span<const VertexAttribDesc> attribs = {};
45 };
46
47 const VertexLayoutDesc& GetVertexLayoutDesc(VertexLayout layout);
48
49}
50
51#endif // AVARA3D_MESH_VERTEXLAYOUTDESC_H