Stellarium 0.12.4
Main Page
Namespaces
Classes
Coding Style
Scripting
Plugins
Renderer
File Structure
File List
File Members
core
renderer
StelQGLInterleavedArrayVertexBufferBackend.hpp
1
2
/*
3
* Stellarium
4
* Copyright (C) 2012 Ferdinand Majerech
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
19
*/
20
21
#ifndef _STELQGLINTERLEAVEDARRAYVERTEXBUFFERBACKEND_HPP_
22
#define _STELQGLINTERLEAVEDARRAYVERTEXBUFFERBACKEND_HPP_
23
24
#include <cstring>
25
26
#include "VecMath.hpp"
27
#include "
StelProjectorType.hpp
"
28
#include "StelVertexBuffer.hpp"
29
#include "StelVertexBufferBackend.hpp"
30
#include "StelVertexAttribute.hpp"
31
32
42
class
StelQGLInterleavedArrayVertexBufferBackend
:
public
StelVertexBufferBackend
43
{
44
private
:
45
static
const
int
VERTEX_ALIGN = 16;
46
public
:
47
virtual
~
StelQGLInterleavedArrayVertexBufferBackend
();
48
49
virtual
void
addVertex
(
const
void
*
const
vertexInPtr);
50
51
virtual
void
getVertex
(
const
int
index,
void
*
const
vertexOutPtr)
const
;
52
53
virtual
void
setVertex
(
const
int
index,
const
void
*
const
vertexInPtr)
54
{
55
std::memcpy(
vertices
+ index *
vertexStride
, vertexInPtr,
vertexBytes
);
56
}
57
58
virtual
void
lock
()
59
{
60
locked
=
true
;
61
}
62
63
virtual
void
unlock
()
64
{
65
locked
=
false
;
66
}
67
68
virtual
void
clear
()
69
{
70
vertexCount
= 0;
71
}
72
82
void
projectVertices
(
StelProjector
* projector,
83
class
StelQGLIndexBuffer
* indexBuffer);
84
86
int
length
()
const
87
{
88
return
vertexCount
;
89
}
90
92
PrimitiveType
getPrimitiveType
()
const
93
{
94
return
primitiveType
;
95
}
96
97
protected
:
99
bool
locked
;
100
102
PrimitiveType
primitiveType
;
103
105
int
vertexCount
;
106
108
int
vertexCapacity
;
109
111
int
vertexBytes
;
112
116
int
vertexStride
;
117
127
char
*
vertices
;
128
136
bool
usingProjectedPositions
;
137
143
Vec3f
*
projectedPositions
;
144
146
int
projectedPositionsCapacity
;
147
154
StelQGLInterleavedArrayVertexBufferBackend
(
const
PrimitiveType type,
155
const
QVector<StelVertexAttribute>&
attributes
);
156
};
157
158
#endif // _STELQGLINTERLEAVEDARRAYVERTEXBUFFERBACKEND_HPP_
Generated on Wed Sep 25 2013 22:30:30 for Stellarium by
1.8.3.1