-
Notifications
You must be signed in to change notification settings - Fork 253
/
Copy pathbuffer.h
197 lines (163 loc) · 7.89 KB
/
buffer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
/********************************************************************
* Copyright (C) 2015 Liangliang Nan <[email protected]>
* https://3d.bk.tudelft.nl/liangliang/
*
* This file is part of Easy3D. If it is useful in your research/work,
* I would be grateful if you show your appreciation by citing it:
* ------------------------------------------------------------------
* Liangliang Nan.
* Easy3D: a lightweight, easy-to-use, and efficient C++ library
* for processing and rendering 3D data.
* Journal of Open Source Software, 6(64), 3255, 2021.
* ------------------------------------------------------------------
*
* Easy3D is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License Version 3
* as published by the Free Software Foundation.
*
* Easy3D is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
********************************************************************/
#ifndef EASY3D_RENDERER_BUFFER_H
#define EASY3D_RENDERER_BUFFER_H
#include <easy3d/renderer/state.h>
#include <string>
namespace easy3d {
class Model;
class Graph;
class PointCloud;
class SurfaceMesh;
class PolyMesh;
class Drawable;
class PointsDrawable;
class LinesDrawable;
class TrianglesDrawable;
/// \brief Functions for updating render buffers.
/// \namespace easy3d::buffer
namespace buffer {
/// \name The generic API for render buffer update
//@{
// -------------------------------------------------------------------------------------------------------------
/**
* @brief Update render buffers of a drawable. Coloring determined by the drawable's coloring scheme.
* @param model The model.
* @param drawable The drawable.
*/
void update(Model* model, Drawable* drawable);
//@}
/// \name Render buffer update for PointCloud
//@{
// PointCloud -------------------------------------------------------------------------------------------------
/**
* @brief Update render buffers for the default "vertices" drawable of a point cloud.
* Coloring determined by the drawable's coloring scheme.
* @param model The model.
* @param drawable The drawable.
*/
void update(PointCloud* model, PointsDrawable* drawable);
/**
* @brief Update render buffers for a vector field defined on a point cloud.
* @param model The model.
* @param drawable The drawable.
* @param field The name of the vector field.
* @param scale The length scale of the vectors w.r.t. (0.01 * radius) of the model's bounding sphere.
*/
void update(PointCloud *model, LinesDrawable *drawable, const std::string& field, float scale);
//@}
/// \name Render buffer update for SurfaceMesh
//@{
// SurfaceMesh ------------------------------------------------------------------------------------------------
/**
* @brief Update render buffers for the default "vertices" drawable of a surface mesh.
* Coloring determined by the drawable's coloring scheme.
* @param model The model.
* @param drawable The drawable.
*/
void update(SurfaceMesh* model, PointsDrawable* drawable);
/**
* @brief Update render buffers for the default "edges" drawable of a surface mesh.
* Coloring determined by the drawable's coloring scheme.
* @param model The model.
* @param drawable The drawable.
*/
void update(SurfaceMesh* model, LinesDrawable* drawable);
/**
* @brief Update render buffers for the default "faces" drawable of a surface mesh.
* Coloring determined by the drawable's coloring scheme.
* @param model The model.
* @param drawable The drawable.
*/
void update(SurfaceMesh* model, TrianglesDrawable* drawable);
/**
* @brief Update render buffers for a vector field defined on a surface mesh.
* @param model The model.
* @param drawable The The drawable for visualizing the vector field.
* @param field The name of the vector field.
* @param location The location where the vector field is defined.
* @param scale The scale of the vector length w.r.t. the average edge length of the surface mesh.
*/
void update(SurfaceMesh *model, LinesDrawable *drawable, const std::string& field, State::Location location, float scale);
//@}
/// \name Render buffer update for Graph
//@{
// Graph ------------------------------------------------------------------------------------------------------
/**
* @brief Update render buffers for the default "vertices" drawable of a graph.
* Coloring determined by the drawable's coloring scheme.
* @param model The model.
* @param drawable The drawable.
*/
void update(Graph* model, PointsDrawable* drawable);
/**
* @brief Update render buffers for the default "edges" drawable of a graph.
* Coloring determined by the drawable's coloring scheme.
* @param model The model.
* @param drawable The drawable.
*/
void update(Graph* model, LinesDrawable* drawable);
//@}
/// \name Render buffer update for PolyMesh
//@{
// PolyMesh ------------------------------------------------------------------------------------------------
/**
* @brief Update render buffers for the default "vertices" drawable of a polyhedral mesh.
* Coloring determined by the drawable's coloring scheme.
* @param model The model.
* @param drawable The drawable.
*/
void update(PolyMesh* model, PointsDrawable* drawable);
/**
* @brief Update render buffers for the default "edges" drawable of a polyhedral mesh.
* Coloring determined by the drawable's coloring scheme.
* @param model The model.
* @param drawable The drawable.
*/
void update(PolyMesh* model, LinesDrawable* drawable);
/**
* @brief Update render buffers for the default "faces" drawables of a polyhedral mesh.
* @note Interior and boundary faces are rendered using two drawables. Thus, this function has an extra
* parameter to specify for which drawable the renderer buffers are be updated.
* @param model The model.
* @param drawable The drawable.
* @param border \c true for the boundary drawable and \c false for the interior drawable.
*/
void update(PolyMesh* model, TrianglesDrawable* drawable, bool border);
/**
* @brief Update render buffers for a vector field defined on a polyhedral mesh.
* @param model The model.
* @param drawable The drawable for visualizing the vector field.
* @param field The name of the vector field.
* @param location The location where the vector field is defined.
* @param scale The scale of the vector length w.r.t. the average edge length of the polyhedral mesh.
* \note Only the scalar fields on border faces and vertices are supported.
*/
void update(PolyMesh *model, LinesDrawable *drawable, const std::string& field, State::Location location, float scale);
//@}
} // namespaces buffer
} // namespaces easy3d
#endif // EASY3D_RENDERER_BUFFER_H