Debian Codegraph @

modules/lsp-runtime-lib/include/lsp-plug.in/fmt/obj/const.h

raw
1 /*
2 * Copyright (C) 2025 Linux Studio Plugins Project <https://lsp-plug.in/>
3 * (C) 2025 Vladimir Sadovnikov <[email protected]>
4 *
5 * This file is part of lsp-runtime-lib
6 * Created on: 21 апр. 2020 г.
7 *
8 * lsp-runtime-lib is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * any later version.
12 *
13 * lsp-runtime-lib is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with lsp-runtime-lib. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22 #ifndef LSP_PLUG_IN_FMT_OBJ_CONST_H_
23 #define LSP_PLUG_IN_FMT_OBJ_CONST_H_
24
25 #include <lsp-plug.in/runtime/version.h>
26 #include <lsp-plug.in/runtime/LSPString.h>
27 #include <lsp-plug.in/common/endian.h>
28 #include <lsp-plug.in/common/types.h>
29 #include <lsp-plug.in/common/status.h>
30
31 #include <lsp-plug.in/lltl/darray.h>
32
33 namespace lsp
34 {
35 namespace obj
36 {
37 enum event_type_t
38 {
39 EV_NONE, ///< No event, some error occurred
40 EV_OBJECT, ///< Start of the new object
41 EV_VERTEX, ///< New vertex coordinates
42 EV_PVERTEX, ///< New parametrized vertex coordinates
43 EV_NORMAL, ///< New normal coordinates
44 EV_TEXCOORD, ///< New textrue coordinates
45 EV_FACE, ///< Face event
46 EV_LINE, ///< Line event
47 EV_POINT, ///< Point event
48 };
49
50 enum compressed_event_type_t
51 {
52 CEV_OBJECT,
53 CEV_VERTEX2,
54 CEV_VERTEX3,
55 CEV_VERTEX4,
56 CEV_PVERTEX2,
57 CEV_PVERTEX3,
58 CEV_PVERTEX4,
59 CEV_NORMAL2,
60 CEV_NORMAL3,
61 CEV_NORMAL4,
62 CEV_TEXCOORD1,
63 CEV_TEXCOORD2,
64 CEV_TEXCOORD3,
65 CEV_FACE,
66 CEV_FACE_T,
67 CEV_FACE_N,
68 CEV_FACE_NF,
69 CEV_FACE_TN,
70 CEV_FACE_TNF,
71 CEV_LINE,
72 CEV_LINE_T,
73 CEV_POINT,
74 CEV_EOF,
75
76 CEV_BITS = 5,
77 };
78
79 typedef ssize_t index_t;
80
81 typedef struct event_t
82 {
83 event_type_t type;
84
85 union
86 {
87 struct { float x, y, z, w; } vertex;
88 struct { float dx, dy, dz, dw; } normal;
89 struct { float u, v, w; } texcoord;
90 };
91 LSPString name;
92
93 lltl::darray<index_t> ivertex; // Indexes of vertices
94 lltl::darray<index_t> inormal; // Indexes of normals
95 lltl::darray<index_t> itexcoord; // Indexes of texture coordinates
96 } event_t;
97
98 #pragma pack(push, 1)
99 typedef struct compressed_header_t
100 {
101 uint32_t signature;
102 uint8_t version;
103 uint8_t float_bits;
104 uint8_t pad[2];
105 } compressed_header_t;
106 #pragma pack(pop)
107
108 constexpr uint32_t COMPRESSED_SIGNATURE = __IF_LEBE(0x4a424f43, 0x434f424a); /* COBJ */
109 constexpr size_t MIN_FLOAT_BUF_BITS = 4;
110 constexpr size_t MAX_FLOAT_BUF_BITS = 16;
111 } /* namesoace obj */
112 } /* namespace lsp */
113
114
115 #endif /* LSP_PLUG_IN_FMT_OBJ_CONST_H_ */