scene/tables/table.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // SPDX-License-Identifier: BSD-3-Clause | ||
| 2 | #pragma once | ||
| 3 | |||
| 4 | #include <cstddef> | ||
| 5 | #include <cstdint> | ||
| 6 | #include <span> | ||
| 7 | |||
| 8 | #include "chrono_batch_render/scene/records/render_tables.h" | ||
| 9 | #include "chrono_batch_render/stage/publish/header.h" | ||
| 10 | #include "chrono_batch_render/stage/publish/table.h" | ||
| 11 | |||
| 12 | namespace chrono::batch_render { | ||
| 13 | |||
| 14 | enum class TableId : uint32_t { | ||
| 15 | Transforms, | ||
| 16 | Imageables, | ||
| 17 | Meshes, | ||
| 18 | MeshPoints, | ||
| 19 | Points, | ||
| 20 | PointsMoved, | ||
| 21 | Curves, | ||
| 22 | CurvesMoved, | ||
| 23 | Tangents, | ||
| 24 | Textures, | ||
| 25 | Instances, | ||
| 26 | Slots, | ||
| 27 | Cameras, | ||
| 28 | Products, | ||
| 29 | }; | ||
| 30 | |||
| 31 | 6634 | class RenderTable : public Table { | |
| 32 | public: | ||
| 33 | 485 | virtual void Describe(RenderTables&) const {} | |
| 34 | }; | ||
| 35 | |||
| 36 | 799 | class RenderHeader : public SnapshotHeader { | |
| 37 | public: | ||
| 38 | 1812 | const RenderTables& Tables() const { | |
| 39 | 735 | return m_tables; | |
| 40 | } | ||
| 41 | |||
| 42 | 10464 | void Describe(const Table& table) override { | |
| 43 | 10464 | if (const auto* render = dynamic_cast<const RenderTable*>(&table)) { | |
| 44 | 10393 | render->Describe(m_tables); | |
| 45 | } | ||
| 46 | 10464 | } | |
| 47 | |||
| 48 | 1167 | std::span<const std::byte> Seal(const AuthoredData& data, uint32_t worldCount) override { | |
| 49 | 1167 | m_tables.prims = {.schema = data.prims.schema, | |
| 50 | 1167 | .world = data.prims.world, | |
| 51 | 1167 | .flags = data.prims.flags, | |
| 52 | 1167 | .slots = data.prims.slots, | |
| 53 | 1167 | .apis = data.prims.apis, | |
| 54 | 1167 | .rows = data.rows, | |
| 55 | 1167 | .parent = data.prims.parent, | |
| 56 | 1167 | .count = data.primCount}; | |
| 57 | 1167 | m_tables.worldCount = worldCount; | |
| 58 | 1167 | return std::as_bytes(std::span(&m_tables, 1)); | |
| 59 | } | ||
| 60 | |||
| 61 | private: | ||
| 62 | RenderTables m_tables{}; | ||
| 63 | }; | ||
| 64 | |||
| 65 | } | ||
| 66 |