Debian Codegraph @

modules/lsp-runtime-lib/include/lsp-plug.in/fmt/obj/IObjHandler.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 апр. 2017 г.
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_IOBJHANDLER_H_
23 #define LSP_PLUG_IN_FMT_OBJ_IOBJHANDLER_H_
24
25 #include <lsp-plug.in/runtime/version.h>
26 #include <lsp-plug.in/runtime/LSPString.h>
27 #include <lsp-plug.in/common/types.h>
28 #include <lsp-plug.in/common/status.h>
29
30 #include <lsp-plug.in/fmt/obj/const.h>
31
32 namespace lsp
33 {
34 namespace obj
35 {
36 /** File contents handler interface
37 *
38 */
39 class IObjHandler
40 {
41 public:
42 virtual ~IObjHandler();
43
44 public:
45 /** Start object
46 *
47 * @param name object name
48 * @return status of operation
49 */
50 virtual status_t begin_object(const char *name);
51
52 /** Start object
53 *
54 * @param name object name
55 * @return status of operation
56 */
57 virtual status_t begin_object(const LSPString *name);
58
59 /** End object
60 *
61 * @return status of operation
62 */
63 virtual status_t end_object();
64
65 /**
66 * This callback is called when there is no more data at the input
67 * and allows to post-process/finalize loaded data structures
68 * @return status of operation
69 */
70 virtual status_t end_of_data();
71
72 /** Add vertex
73 *
74 * @param x vertex X coordinate
75 * @param y vertex Y coordinate
76 * @param z vertex Z coordinate
77 * @param w vertex W coordinate
78 * @return number of added vertex or negative error code
79 */
80 virtual ssize_t add_vertex(float x, float y, float z, float w);
81
82 /** Add parameter vertex
83 *
84 * @param x vertex X coordinate
85 * @param y vertex Y coordinate
86 * @param z vertex Z coordinate
87 * @param w vertex W coordinate
88 * @return number of added vertex or negative error code
89 */
90 virtual ssize_t add_param_vertex(float x, float y, float z, float w);
91
92 /** Add normal
93 *
94 * @param nx normal x
95 * @param ny normal y
96 * @param nz normal z
97 * @param nw normal w
98 * @return number of added normal or negative error code
99 */
100 virtual ssize_t add_normal(float nx, float ny, float nz, float nw);
101
102 /** Add texture vertex
103 *
104 * @param u texture U coordinate
105 * @param v texture V coordinate
106 * @param w texture W coordinate
107 * @return number of added texture vertex or negative error code
108 */
109 virtual ssize_t add_texture_vertex(float u, float v, float w);
110
111 /** Add face
112 *
113 * @param vv array of vertex indexes starting with 0 (negative value if not present)
114 * @param vn array of normal indexes starting with 0 (negative value if not present)
115 * @param vt array of texture vertex indexes starting with 0 (negative value if not present)
116 * @param n number of elements in vv, vn and vt
117 * @return number of added face or negative error code
118 */
119 virtual ssize_t add_face(const index_t *vv, const index_t *vn, const index_t *vt, size_t n);
120
121 /** Add points
122 *
123 * @param vv array of vertex indexes starting with 1 (0 if not present)
124 * @param n number of elements in vv
125 * @return number of added points object or negative error code
126 */
127 virtual ssize_t add_points(const index_t *vv, size_t n);
128
129 /** Add line
130 *
131 * @param vv array of vertex indexes starting with 0 (negative value if not present)
132 * @param vt array of texture vertex indexes starting with 0 (negative value if not present)
133 * @param n number of elements in vv
134 * @return number of added line or negative error code
135 */
136 virtual ssize_t add_line(const index_t *vv, const index_t *vt, size_t n);
137 };
138
139 } /* namespace obj */
140 } /* namespace lsp */
141
142 #endif /* LSP_PLUG_IN_FMT_OBJ_IOBJHANDLER_H_ */