Avara3D 0.2.0
C++ API reference
DrawPacket.h
1//
2// DrawPacket.h
3// avara3d
4//
5// Created by Morgan Davis on 12/28/25.
6// Copyright © 2026 Morgan K Davis. All rights reserved.
7//
8
9#ifndef AVARA3D_RENDER_DRAWPACKET_H
10#define AVARA3D_RENDER_DRAWPACKET_H
11
12#include <optional>
13
14#include "a3d/Math.h"
15#include "a3d/mesh/Line.h"
16#include "a3d/render/PipelineDesc.h"
17#include "a3d/visual/Ground.h"
18
19namespace a3d {
20
21 class Material;
22 class MeshElement;
23 class Node;
24
25 // [Internal Types]
26
27 struct BackgroundPass {
28 PipelineId pipelineId = INVALID_PIPELINE_ID;
29 PipelineDesc desc = {};
30 std::shared_ptr<Material> material = nullptr; // gross
31 math::quat orientation = math::quat(1.0f);
32 };
33
34 struct GroundPass {
35 PipelineId pipelineId = INVALID_PIPELINE_ID;
36 PipelineDesc desc = {};
37 std::optional<Ground> ground = {};
38 };
39
40 struct LinesPass {
41 PipelineId pipelineId = INVALID_PIPELINE_ID;
42 PipelineDesc desc = {};
43 math::mat4 model = math::mat4(1.0f); // identity for world-space lines
44 std::vector<Line> lines = {};
45 };
46
47 struct DrawItem {
48 PassKind pass = PassKind::MainOpaque;
49 PipelineId pipelineId = INVALID_PIPELINE_ID;
50 PipelineDesc desc = {};
51 uint32_t elementIndex = 0;
52 MeshElement* element = nullptr;
53 Material* material = nullptr;
54 math::vec4 tint = math::vec4(0.0f); // RGB color, a blend strength
55 math::mat4 model = math::mat4(1.0);
56 float depth = 0.0f;
57 int renderOrder = 0;
58 uint64_t batchKey = 0;
59 uint32_t sequence = 0;
60 bool transparent = false;
61 };
62
63 struct DrawPacket {
64 BackgroundPass backgroundPass = {};
65 GroundPass groundPass = {};
66 std::vector<DrawItem> mainPassItems = {};
67 // opaqueItems
68 // maskItems
69 // transparentItems
70 std::vector<DrawItem> wireframePassItems = {};
71 LinesPass linesPass = {};
72 std::vector<Node*> lightNodes = {};
73 };
74
75}
76
77#endif // AVARA3D_RENDER_DRAWPACKET_H