score
Home
Classes
Namespaces
Files
Loading...
Searching...
No Matches
PlyParser.hpp
1
#pragma once
2
3
#include <ossia/dataflow/geometry_port.hpp>
4
5
#include <span>
6
#include <string_view>
7
8
namespace
Threedim::PrimitiveCloud
9
{
10
11
// Cheap header-only sniff: is the PLY file at `path` shaped like a
12
// primitive cloud (no `face` element, or has columns outside the
13
// standard mesh set {x,y,z,nx,ny,nz,red,green,blue,alpha,s,t,u,v})?
14
// Reads only the textual header, doesn't load row data.
15
bool
ply_is_splat_shaped(std::string_view path);
16
17
// Parse `path` and produce a primitive_cloud_component. The component's
18
// raw_data is a single tightly-packed buffer of the PLY rows: each row
19
// is a struct of the columns in their PLY-declared order, std430-style
20
// natural alignment (each float at +4, each int at +4, each uchar at
21
// +1 with no inter-field padding — but the row stride is rounded to
22
// the largest field alignment within the row, see
23
// internal::row_stride_for).
24
//
25
// Returns nullptr if the PLY is not splat-shaped, or if parsing fails.
26
//
27
// Every scalar column is listed in `columns` (name, PLY scalar type, byte
28
// offset in the row), so a consumer can read any layout by column name.
29
//
30
// Sets format_id from the column layout:
31
// - exactly the 62 float32 columns of the INRIA export, in its order
32
// -> "3dgs.classic" / "Splat3DGS"
33
// - the same followed by filter_3D (Mip-Splatting, GOF)
34
// -> "3dgs.mip" / "SplatMip"
35
// - the same with scale_0/1 and no scale_2 (2DGS)
36
// -> "2dgs.surfel" / "Splat2DGS"
37
// - any other layout with x/y/z, f_dc_0..2, opacity, scale_0..2 and
38
// rot_0..3 (no normals, SH degree 0 to 2, reordered, extra columns,
39
// double or integer columns): "3dgs", with no struct type
40
// - else empty (the user wires the chain by hand or saves a preset)
41
ossia::primitive_cloud_component_ptr parse_ply(std::string_view path);
42
43
}
// namespace Threedim::PrimitiveCloud