ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
binary_points.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Povl Filip Sonne-Frederiksen
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#pragma once
6
7// RUXP v1 — the binary point transport served by
8// `GET /api/v1/clouds/{name}/points?format=binary` (#283).
9//
10// The byte layout is normative in docs/gui/binary-points.md; this header is the
11// C++ side of that contract and must not drift from it. The client side is
12// apps/rux/frontend/src/viewport/binaryPoints.ts.
13//
14// Deliberately framework-free, like the rest of gui/api.hpp: a page of storage
15// records in, a buffer out.
16
17// ProjectDB is included rather than forward-declared: the page type this
18// header takes is the nested ProjectDB::CloudPage, which needs the complete
19// class. ProjectDB.hpp is itself forward-declaration-disciplined (STANDARDS
20// §2) — it pulls in the PCL point types and nothing heavier.
21#include <reusex/core/ProjectDB.hpp>
22
23#include <cstddef>
24#include <cstdint>
25#include <string_view>
26#include <vector>
27
28namespace rux::gui {
29
32inline constexpr uint16_t kRuxpVersion = 1;
33
35inline constexpr size_t kRuxpHeaderBase = 40;
37inline constexpr size_t kRuxpFieldSize = 16;
38
48inline constexpr uint32_t kRuxpFlagLod = 0x1U;
49
52inline constexpr uint32_t kRuxpKnownFlags = kRuxpFlagLod;
53
55enum class RuxpType : uint8_t { f32 = 1, u8 = 2, u32 = 3 };
56
76std::vector<uint8_t> encode_ruxp(const reusex::ProjectDB::CloudPage &page,
77 uint32_t flags = 0);
78
80bool ruxp_supports(std::string_view point_type);
81
82} // namespace rux::gui
constexpr size_t kRuxpHeaderBase
Fixed part of the header, before the field descriptors.
constexpr uint32_t kRuxpKnownFlags
Every flag bit this encoder will emit.
constexpr size_t kRuxpFieldSize
Bytes per field descriptor.
bool ruxp_supports(std::string_view point_type)
True when type is one encode_ruxp() knows how to lay out.
constexpr uint16_t kRuxpVersion
Format version written into every page.
RuxpType
Field value types, as written into a descriptor's type byte.
std::vector< uint8_t > encode_ruxp(const reusex::ProjectDB::CloudPage &page, uint32_t flags=0)
Encode one stored page as a RUXP v1 buffer.
constexpr uint32_t kRuxpFlagLod
flags bit 0 — this page is a level-of-detail view of the whole cloud rather than a contiguous window ...
A contiguous window of one cloud's stored records, still in storage layout — no PCL type has been inf...