snark
vertex_buffer.h
1 // This file is part of snark, a generic and flexible library
2 // for robotics research.
3 //
4 // Copyright (C) 2011 The University of Sydney
5 //
6 // snark is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 3 of the License, or (at your option) any later version.
10 //
11 // snark is distributed in the hope that it will be useful, but WITHOUT ANY
12 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
14 // for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with snark. If not, see <http://www.gnu.org/licenses/>.
18 
20 
21 #ifndef SNARK_GRAPHICS_APPLICATIONS_VIEWPOINTS_VERTEX_BUFFER_H_
22 #define SNARK_GRAPHICS_APPLICATIONS_VIEWPOINTS_VERTEX_BUFFER_H_
23 
24 #include <Qt3D/qvector3darray.h>
25 #include <Qt3D/qcolor4ub.h>
26 
27 namespace snark { namespace graphics { namespace qt3d {
28 
31 {
32  public:
33  vertex_buffer( std::size_t size );
34 
35  void addVertex( const QVector3D& point, const QColor4ub& color, unsigned int block = 0 );
36 
37  const QVector3DArray& points() const;
38  const QArray<QColor4ub>& color() const;
39  const unsigned int size() const;
40  const unsigned int index() const;
41 
42  protected:
43  QVector3DArray m_points;
44  QArray<QColor4ub> m_color;
45  unsigned int m_readIndex;
46  unsigned int m_writeIndex;
47  unsigned int m_readSize;
48  unsigned int m_writeSize;
49  unsigned int m_bufferSize;
50  unsigned int m_block;
51 };
52 
53 } } } // namespace snark { namespace graphics { namespace qt3d {
54 
55 #endif /*SNARK_GRAPHICS_APPLICATIONS_VIEWPOINTS_VERTEX_BUFFER_H_*/