NCBI C++ ToolKit
vbogeom_base.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: vbogeom_base.cpp 43891 2019-09-16 13:50:00Z evgeniev $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Bob Falk
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
34 #include "vbogeom_base.hpp"
35 
37 
38 ///
39 /// CVboGeomBase
40 ///
41 
42 void CVboGeomBase::x_SetDrawMode(GLenum drawMode)
43 {
44  m_DrawMode = drawMode;
45 
49 }
50 
52 {
53  return m_VertexFormat;
54 }
55 
57 {
58  return m_SecondaryFormat;
59 }
60 
62 {
63  return m_VertexCount;
64 }
65 
67 {
68  if (data.empty()) {
70  m_VertexCount = 0;
71  }
72  else {
74  m_VertexCount = data.size();
75  x_SetBufferData(0, &data[0], data.size() * sizeof(data[0]));
76  }
77 }
78 
80 {
81  data.clear();
82 
84  data.resize(m_VertexCount);
85  x_GetBufferData(0, &data[0], data.size() * sizeof(data[0]));
86  }
87 }
88 
90 {
91  if (data.empty()) {
93  m_VertexCount = 0;
94  }
95  else {
97  m_VertexCount = data.size();
98  x_SetBufferData(0, &data[0], data.size() * sizeof(data[0]));
99  }
100 }
101 
103 {
104  data.clear();
105 
107  data.resize(m_VertexCount);
108  x_GetBufferData(0, &data[0], data.size() * sizeof(data[0]));
109  }
110 }
111 
112 void CVboGeomBase::SetColorBuffer(const vector<CRgbaColor>& data)
113 {
114  if (data.empty()) {
116  m_SecondaryCount = 0;
117  }
118  else {
120  m_SecondaryCount = data.size();
121  x_SetBufferData(1, &data[0], data.size() * sizeof(data[0]));
122  }
123 }
124 
125 void CVboGeomBase::GetColorBuffer(vector<CRgbaColor>& data) const
126 {
127  data.clear();
128 
130  data.resize(m_VertexCount);
131  x_GetBufferData(1, &data[0], data.size() * sizeof(data[0]));
132  }
133 }
134 
136 {
137  if (data.empty()) {
139  m_SecondaryCount = 0;
140  }
141  else {
143  m_SecondaryCount = data.size();
144  x_SetBufferData(1, &data[0], data.size() * sizeof(data[0]));
145  }
146 }
147 
149 {
150  data.clear();
151 
153  data.resize(m_VertexCount);
154  x_GetBufferData(1, &data[0], data.size() * sizeof(data[0]));
155  }
156 }
157 
158 void CVboGeomBase::SetTexCoordBuffer1D(const vector<float>& data)
159 {
160  if (data.empty()) {
162  m_SecondaryCount = 0;
163  }
164  else {
166  m_SecondaryCount = data.size();
167  x_SetBufferData(1, &data[0], data.size() * sizeof(data[0]));
168  }
169 }
170 
171 void CVboGeomBase::GetTexCoordBuffer1D(vector<float>& data) const
172 {
173  data.clear();
174 
176  data.resize(m_VertexCount);
177  x_GetBufferData(1, &data[0], data.size() * sizeof(data[0]));
178  }
179 }
180 
182 {
183  if (data.empty()) {
185  m_SecondaryCount = 0;
186  }
187  else {
189  m_SecondaryCount = data.size();
190  x_SetBufferData(1, &data[0], data.size() * sizeof(data[0]));
191  }
192 }
193 
195 {
196  data.clear();
197 
199  data.resize(m_VertexCount);
200  x_GetBufferData(1, &data[0], data.size() * sizeof(data[0]));
201  }
202 }
203 
204 ///
205 /// CNarrowTreeEdgeVboGeomBase
206 ///
207 
209 {
210  _ASSERT(false);
211 }
212 
214 {
215  return m_EdgeGeom ? m_EdgeGeom->GetVertexCount() : 0;
216 }
217 
219 {
220  _ASSERT(false);
221 }
222 
224 {
225  if (m_EdgeGeom)
226  m_EdgeGeom->GetVertexBuffer2D(data);
227  else
228  data.clear();
229 }
230 
232 {
233  _ASSERT(false);
234 }
235 
237 {
238  data.clear();
239  _ASSERT(false);
240 }
241 
242 void CNarrowTreeEdgeVboGeomBase::SetColorBuffer(const vector<CRgbaColor>& data)
243 {
244  _ASSERT(false);
245 }
246 
247 void CNarrowTreeEdgeVboGeomBase::GetColorBuffer(vector<CRgbaColor>& data) const
248 {
249  data.clear();
250  _ASSERT(false);
251 }
252 
254 {
255  _ASSERT(false);
256 }
257 
259 {
260  data.clear();
261  _ASSERT(false);
262 }
263 
265 {
266  _ASSERT(false);
267 }
268 
270 {
271  data.clear();
272  _ASSERT(false);
273 }
274 
276 {
277  _ASSERT(false);
278 }
279 
281 {
282  data.clear();
283  _ASSERT(false);
284 }
285 
286 ///
287 /// CFillerPointVboGeomBase
288 ///
289 
291 {
292  _ASSERT(false);
293 }
294 
296 {
297  return m_EdgeGeom ? m_EdgeGeom->GetVertexCount() / 4 : 0;
298 }
299 
301 {
302  _ASSERT(false);
303 }
304 
306 {
307  data.clear();
308 
309  if (m_EdgeGeom) {
310  vector<CVect2<float> > tmp;
311  m_EdgeGeom->GetVertexBuffer2D(tmp);
312  for (int i = 2; i < tmp.size() - 1; i += 4)
313  data.push_back(tmp[i]);
314  }
315 }
316 
318 {
319  _ASSERT(false);
320 }
321 
323 {
324  data.clear();
325  _ASSERT(false);
326 }
327 
328 void CFillerPointVboGeomBase::SetColorBuffer(const vector<CRgbaColor>& data)
329 {
330  _ASSERT(false);
331 }
332 
333 void CFillerPointVboGeomBase::GetColorBuffer(vector<CRgbaColor>& data) const
334 {
335  data.clear();
336  _ASSERT(false);
337 }
338 
340 {
341  _ASSERT(false);
342 }
343 
345 {
346  data.clear();
347 
348  if (m_EdgeGeom) {
349  vector<CVect4<unsigned char> > tmp;
350  m_EdgeGeom->GetColorBufferUC(tmp);
351  for (int i = 2; i < tmp.size() - 1; i += 4)
352  data.push_back(tmp[i]);
353  }
354 }
355 
357 {
358  _ASSERT(false);
359 }
360 
362 {
363  data.clear();
364  _ASSERT(false);
365 }
366 
368 {
369  _ASSERT(false);
370 }
371 
373 {
374  data.clear();
375  _ASSERT(false);
376 }
377 
static char tmp[3200]
Definition: utf8.c:42
char data[12]
Definition: iconv.c:80
virtual void x_SetDrawMode(GLenum drawMode)
CFillerPointVboGeomBase.
CIRef< IVboGeom > m_EdgeGeom
virtual void GetColorBufferUC(vector< CVect4< unsigned char > > &data) const
virtual void SetTexCoordBuffer1D(const vector< float > &data)
virtual void GetColorBuffer(vector< CRgbaColor > &data) const
virtual void SetColorBufferUC(const vector< CVect4< unsigned char > > &data)
virtual void GetTexCoordBuffer1D(vector< float > &data) const
size_t m_SecondaryCount
virtual void GetTexCoordBuffer1D(vector< float > &data) const
virtual size_t GetVertexCount() const
virtual void SetVertexBuffer2D(const vector< CVect2< float > > &data)
virtual void GetVertexBuffer2D(vector< CVect2< float > > &data) const
EVertexFormat m_VertexFormat
virtual void SetColorBufferUC(const vector< CVect4< unsigned char > > &data)
GLenum m_DrawMode
Drawmode based on how vertices are organized and buffer subtype: e.g.
virtual void x_SetDrawMode(GLenum drawMode)
CVboGeomBase.
ESecondaryFormat m_SecondaryFormat
virtual void x_SetDrawMode(GLenum drawMode)
CNarrowTreeEdgeVboGeomBase.
virtual void SetTexCoordBuffer1D(const vector< float > &data)
virtual void x_SetBufferData(int index, const void *data, size_t size)=0
ESecondaryFormat
Definition: ivbogeom.hpp:66
virtual void GetTexCoordBuffer1D(vector< float > &data) const
virtual void SetVertexBuffer3D(const vector< CVect3< float > > &data)
virtual void GetColorBuffer(vector< CRgbaColor > &data) const
virtual void GetVertexBuffer2D(vector< CVect2< float > > &data) const
virtual void GetTexCoordBuffer(vector< CVect2< float > > &data) const
CIRef< IVboGeom > m_EdgeGeom
virtual void SetVertexBuffer3D(const vector< CVect3< float > > &data)
virtual void SetVertexBuffer2D(const vector< CVect2< float > > &data)
virtual void GetColorBuffer(vector< CRgbaColor > &data) const
virtual void GetVertexBuffer2D(vector< CVect2< float > > &data) const
virtual void SetVertexBuffer3D(const vector< CVect3< float > > &data)
virtual void x_GetBufferData(int index, void *data, size_t size) const =0
virtual void GetVertexBuffer3D(vector< CVect3< float > > &data) const
virtual void SetVertexBuffer2D(const vector< CVect2< float > > &data)
virtual void GetVertexBuffer3D(vector< CVect3< float > > &data) const
virtual void GetVertexBuffer3D(vector< CVect3< float > > &data) const
virtual size_t GetVertexCount() const
virtual void SetColorBuffer(const vector< CRgbaColor > &data)
virtual void GetColorBufferUC(vector< CVect4< unsigned char > > &data) const
virtual void GetTexCoordBuffer(vector< CVect2< float > > &data) const
virtual void GetColorBufferUC(vector< CVect4< unsigned char > > &data) const
virtual size_t GetVertexCount() const
virtual EVertexFormat GetVertexFormat() const
virtual void SetColorBufferUC(const vector< CVect4< unsigned char > > &data)
virtual void SetColorBuffer(const vector< CRgbaColor > &data)
virtual void SetTexCoordBuffer(const vector< CVect2< float > > &data)
virtual void SetTexCoordBuffer1D(const vector< float > &data)
virtual void GetTexCoordBuffer(vector< CVect2< float > > &data) const
virtual void SetTexCoordBuffer(const vector< CVect2< float > > &data)
size_t m_VertexCount
virtual ESecondaryFormat GetSecondaryFormat() const
virtual void SetColorBuffer(const vector< CRgbaColor > &data)
virtual void SetTexCoordBuffer(const vector< CVect2< float > > &data)
@ kVertexFormatVertex3D
Definition: ivbogeom.hpp:62
@ kVertexFormatNone
Definition: ivbogeom.hpp:60
@ kVertexFormatVertex2D
Definition: ivbogeom.hpp:61
@ kSecondaryFormatNone
Definition: ivbogeom.hpp:67
@ kSecondaryFormatColorUChar
Definition: ivbogeom.hpp:69
@ kSecondaryFormatColorFloat
Definition: ivbogeom.hpp:68
@ kSecondaryFormatTexture2D
Definition: ivbogeom.hpp:70
@ kSecondaryFormatTexture1D
Definition: ivbogeom.hpp:71
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
int i
#define _ASSERT
Modified on Fri Jun 14 16:52:39 2024 by modify_doxy.py rev. 669887