Visual Computing Library  devel
Loading...
Searching...
No Matches
ply.h
1/*****************************************************************************
2 * VCLib *
3 * Visual Computing Library *
4 * *
5 * Copyright(C) 2021-2026 *
6 * Visual Computing Lab *
7 * ISTI - Italian National Research Council *
8 * *
9 * All rights reserved. *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the Mozilla Public License Version 2.0 as published *
13 * by the Mozilla Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * Mozilla Public License Version 2.0 *
20 * (https://www.mozilla.org/en-US/MPL/2.0/) for more details. *
21 ****************************************************************************/
22
23#ifndef VCL_IO_MESH_PLY_DETAIL_PLY_H
24#define VCL_IO_MESH_PLY_DETAIL_PLY_H
25
26#include <vclib/base.h>
27
28#include <list>
29
30namespace vcl::detail {
31
32// put all these enumeration names inside a ply namespace, to avoid collisions
33
34namespace ply {
35
36typedef enum { ASCII, BINARY_LITTLE_ENDIAN, BINARY_BIG_ENDIAN, UNKNOWN } Format;
37
38typedef enum { VERTEX, FACE, EDGE, TRISTRIP, MATERIAL, OTHER } ElementType;
39
40typedef enum { RGB, RGBA } ColorMode;
41
42typedef enum {
43 unknown = -1,
44 x,
45 y,
46 z,
47 nx,
48 ny,
49 nz,
50 red,
51 green,
52 blue,
53 alpha,
54 quality,
55 texture_u,
56 texture_v,
57 material_index,
58 vertex_indices,
59 texcoord,
60 vertex1,
61 vertex2,
62 // material properties (base color is red, green, blue, alpha)
63 name,
64 metallic,
65 roughness,
66 emissive_red,
67 emissive_green,
68 emissive_blue,
69 alpha_mode,
70 alpha_cutoff,
71 normal_scale,
72 occlusion_strength,
73 double_sided,
74 base_color_texture,
75 metallic_roughness_texture,
76 normal_texture,
77 occlusion_texture,
78 emissive_texture
79} PropertyName;
80
81using PropertyType = PrimitiveType;
82
83} // namespace ply
84
85struct PlyProperty
86{
87 ply::PropertyName name;
88 ply::PropertyType type;
89 bool list = false;
90 ply::PropertyType listSizeType;
91 std::string unknownPropertyName; // when a property is not recognized
92};
93
94struct PlyElement
95{
96 ply::ElementType type;
97 std::list<PlyProperty> properties;
98 uint elementCount;
99 std::string unknownElementType; // when an element is not recognized
100};
101
102} // namespace vcl::detail
103
104#endif // VCL_IO_MESH_PLY_DETAIL_PLY_H
PrimitiveType
A simple type that enumerates the main primitive types.
Definition base.h:71