ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
gaussian_splat.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// PLY header inspection for INRIA-format 3D Gaussian Splatting files (#322).
8//
9// A trained splat is opaque bytes to everything downstream — `ProjectDB`
10// stores it, the GUI streams it, the browser renders it — but *something* has
11// to establish that the bytes really are a splat before any of that happens.
12// A point cloud written by `rux export ply` is a perfectly valid PLY, and
13// handing one to a splat renderer produces an empty viewport and no clue why.
14//
15// This header is that check, and it lives in `core` (not in the app or in
16// `gsplat`) because `ProjectDB::save_gaussian_splat()` is the choke point: the
17// file is validated on the way *into* the project, so a stored splat is a
18// splat by construction and no reader has to re-litigate it.
19//
20// Deliberately dependency-free: no PCL, no OpenCV, no sqlite. Just the ASCII
21// header at the front of the file.
22
23#include <cstddef>
24#include <cstdint>
25#include <string_view>
26
27namespace reusex::core {
28
31 std::uint64_t gaussian_count = 0;
34 int sh_degree = 0;
35};
36
42inline constexpr std::size_t kGaussianSplatHeaderProbeBytes = 64 * 1024;
43
55
56} // namespace reusex::core
constexpr std::size_t kGaussianSplatHeaderProbeBytes
How many bytes from the head of a file are enough to find end_header.
GaussianSplatHeader parse_gaussian_splat_ply_header(std::string_view head)
Parse the PLY header in head and verify it is an INRIA splat file.
What the PLY header of an INRIA 3D Gaussian Splatting file says.
int sh_degree
Spherical-harmonic degree, derived from the number of f_rest_* properties: 3 * ((degree + 1)^2 - 1) o...