v2.0.0
Loading...
Searching...
No Matches
polylineobject.h
Go to the documentation of this file.
1//=============================================================================================================
22
23#ifndef DISP3DLIB_POLYLINEOBJECT_H
24#define DISP3DLIB_POLYLINEOBJECT_H
25
26//=============================================================================================================
27// INCLUDES
28//=============================================================================================================
29
30#include "../disp3D_global.h"
31
32#include "../core/rendertypes.h"
33
34//=============================================================================================================
35// QT INCLUDES
36//=============================================================================================================
37
38#include <QByteArray>
39#include <QColor>
40#include <QString>
41#include <QVector>
42
43#include <memory>
44
45//=============================================================================================================
46// EIGEN INCLUDES
47//=============================================================================================================
48
49#include <Eigen/Core>
50
51//=============================================================================================================
52// FORWARD DECLARATIONS
53//=============================================================================================================
54
55
56//=============================================================================================================
57// DEFINE CLASS
58//=============================================================================================================
59
60// Deliberately at global scope, matching DipoleObject and NetworkObject. The
61// other renderables in this directory are not namespaced either.
62
63namespace DISP3DLIB
64{
65
66//=============================================================================================================
79{
80public:
81 //=========================================================================================================
86
87 //=========================================================================================================
92
93 //=========================================================================================================
102 void setPoints(const QVector<Eigen::Vector3f>& vecPoints);
103
104 //=========================================================================================================
108 void clear();
109
110 //=========================================================================================================
116 void setRadius(float fRadius);
117
118 //=========================================================================================================
128 void setGradient(const QColor& startColor, const QColor& endColor);
129
130 //=========================================================================================================
135
139 const RenderKey& renderKey() const
140 {
141 return m_renderKey;
142 }
143
144 //=========================================================================================================
148 int indexCount() const
149 {
150 return m_iIndexCount;
151 }
152
153 //=========================================================================================================
157 int instanceCount() const
158 {
159 return m_iInstanceCount;
160 }
161
162 //=========================================================================================================
166 bool isVisible() const
167 {
168 return m_bVisible;
169 }
170
171 //=========================================================================================================
177 void setVisible(bool bVisible)
178 {
179 m_bVisible = bVisible;
180 }
181
182 //=========================================================================================================
186 bool hasData() const
187 {
188 return m_iInstanceCount > 0;
189 }
190
191private:
192 //=========================================================================================================
196 void createSegmentGeometry();
197
198 //=========================================================================================================
202 void buildInstances();
203
204 // Instance layout shared with DipoleObject and NetworkObject so that the
205 // Dipole pipeline can render this object unchanged.
206 struct InstanceData
207 {
208 float model[16];
209 float color[4];
210 float isSelected;
211 };
212
213 struct VertexData
214 {
215 float x, y, z;
216 float nx, ny, nz;
217 };
218
219 QVector<Eigen::Vector3f> m_vecPoints;
220
221 QByteArray m_vertexData;
222 QByteArray m_indexData;
223 QByteArray m_instanceData;
224
225 int m_iIndexCount;
226 int m_iInstanceCount;
227
228 float m_fRadius;
229 QColor m_startColor;
230 QColor m_endColor;
231
232 bool m_bVisible;
233 quint64 m_geometryGeneration = 0;
234 quint64 m_instanceGeneration = 0;
235
236 RenderKey m_renderKey;
237};
238
239} // namespace DISP3DLIB
240
241#endif // DISP3DLIB_POLYLINEOBJECT_H
Library export/import macros and namespace marker for the disp3D library.
#define DISP3DSHARED_EXPORT
Lightweight render-related enums (ShaderMode, VisualizationMode) shared across disp3D.
3-D brain visualisation using the Qt RHI rendering backend.
CPU streams of an instanced mesh: one shape (vertices, indices) drawn once per instance.
Identity of a renderable in the renderer's GPU resource cache.
const RenderKey & renderKey() const
void setVisible(bool bVisible)
void setRadius(float fRadius)
InstancedStreams streams() const
void setGradient(const QColor &startColor, const QColor &endColor)
void setPoints(const QVector< Eigen::Vector3f > &vecPoints)