7#include <QtQuick/qtquickglobal.h>
8#include <QtCore/QRectF>
27 AlwaysUploadPattern = 0,
36 DrawLineLoop = 0x0002,
37 DrawLineStrip = 0x0003,
38 DrawTriangles = 0x0004,
39 DrawTriangleStrip = 0x0005,
40 DrawTriangleFan = 0x0006
45 UnsignedByteType = 0x1401,
47 UnsignedShortType = 0x1403,
49 UnsignedIntType = 0x1405,
69 static Attribute create(
int pos,
int tupleSize,
int primitiveType,
bool isPosition =
false);
88 void set(
float nx,
float ny,
float ntx,
float nty) {
104 static const AttributeSet &defaultAttributes_Point2D();
105 static const AttributeSet &defaultAttributes_TexturedPoint2D();
106 static const AttributeSet &defaultAttributes_ColoredPoint2D();
111 int indexType = UnsignedShortType);
115 void setDrawingMode(
unsigned int mode);
116 inline unsigned int drawingMode()
const {
return m_drawing_mode; }
118 void allocate(
int vertexCount,
int indexCount = 0);
123 inline Point2D *vertexDataAsPoint2D();
124 inline TexturedPoint2D *vertexDataAsTexturedPoint2D();
125 inline ColoredPoint2D *vertexDataAsColoredPoint2D();
128 inline const Point2D *vertexDataAsPoint2D()
const;
129 inline const TexturedPoint2D *vertexDataAsTexturedPoint2D()
const;
130 inline const ColoredPoint2D *vertexDataAsColoredPoint2D()
const;
137 inline uint *indexDataAsUInt();
138 inline quint16 *indexDataAsUShort();
140 inline int sizeOfIndex()
const;
142 const void *indexData()
const;
143 inline const uint *indexDataAsUInt()
const;
144 inline const quint16 *indexDataAsUShort()
const;
154 void setIndexDataPattern(DataPattern
p);
157 void setVertexDataPattern(DataPattern
p);
160 void markIndexDataDirty();
161 void markVertexDataDirty();
163 float lineWidth()
const;
176 int m_index_data_offset;
180 uint m_owns_data : 1;
181 uint m_index_usage_pattern : 2;
182 uint m_vertex_usage_pattern : 2;
183 uint m_dirty_index_data : 1;
184 uint m_dirty_vertex_data : 1;
185 uint m_reserved_bits : 25;
187 float m_prealloc[16];
194 Q_ASSERT(m_index_type == UnsignedIntType);
195 return static_cast<uint *
>(indexData());
200 Q_ASSERT(m_index_type == UnsignedShortType);
201 return static_cast<quint16 *
>(indexData());
206 Q_ASSERT(m_index_type == UnsignedIntType);
207 return static_cast<const uint *
>(indexData());
212 Q_ASSERT(m_index_type == UnsignedShortType);
213 return static_cast<const quint16 *
>(indexData());
219 Q_ASSERT(m_attributes.stride == 2 *
sizeof(
float));
220 Q_ASSERT(m_attributes.attributes[0].tupleSize == 2);
221 Q_ASSERT(m_attributes.attributes[0].type == FloatType);
222 Q_ASSERT(m_attributes.attributes[0].position == 0);
229 Q_ASSERT(m_attributes.stride == 4 *
sizeof(
float));
230 Q_ASSERT(m_attributes.attributes[0].position == 0);
231 Q_ASSERT(m_attributes.attributes[0].tupleSize == 2);
232 Q_ASSERT(m_attributes.attributes[0].type == FloatType);
233 Q_ASSERT(m_attributes.attributes[1].position == 1);
234 Q_ASSERT(m_attributes.attributes[1].tupleSize == 2);
235 Q_ASSERT(m_attributes.attributes[1].type == FloatType);
242 Q_ASSERT(m_attributes.stride == 2 *
sizeof(
float) + 4 *
sizeof(
char));
243 Q_ASSERT(m_attributes.attributes[0].position == 0);
244 Q_ASSERT(m_attributes.attributes[0].tupleSize == 2);
245 Q_ASSERT(m_attributes.attributes[0].type == FloatType);
246 Q_ASSERT(m_attributes.attributes[1].position == 1);
247 Q_ASSERT(m_attributes.attributes[1].tupleSize == 4);
248 Q_ASSERT(m_attributes.attributes[1].type == UnsignedByteType);
255 Q_ASSERT(m_attributes.stride == 2 *
sizeof(
float));
256 Q_ASSERT(m_attributes.attributes[0].tupleSize == 2);
257 Q_ASSERT(m_attributes.attributes[0].type == FloatType);
258 Q_ASSERT(m_attributes.attributes[0].position == 0);
265 Q_ASSERT(m_attributes.stride == 4 *
sizeof(
float));
266 Q_ASSERT(m_attributes.attributes[0].position == 0);
267 Q_ASSERT(m_attributes.attributes[0].tupleSize == 2);
268 Q_ASSERT(m_attributes.attributes[0].type == FloatType);
269 Q_ASSERT(m_attributes.attributes[1].position == 1);
270 Q_ASSERT(m_attributes.attributes[1].tupleSize == 2);
271 Q_ASSERT(m_attributes.attributes[1].type == FloatType);
278 Q_ASSERT(m_attributes.stride == 2 *
sizeof(
float) + 4 *
sizeof(
char));
279 Q_ASSERT(m_attributes.attributes[0].position == 0);
280 Q_ASSERT(m_attributes.attributes[0].tupleSize == 2);
281 Q_ASSERT(m_attributes.attributes[0].type == FloatType);
282 Q_ASSERT(m_attributes.attributes[1].position == 1);
283 Q_ASSERT(m_attributes.attributes[1].tupleSize == 4);
284 Q_ASSERT(m_attributes.attributes[1].type == UnsignedByteType);
290 if (m_index_type == UnsignedShortType)
return 2;
291 else if (m_index_type == UnsignedByteType)
return 1;
292 else if (m_index_type == UnsignedIntType)
return 4;
\inmodule QtCore\reentrant
The QSGGeometry class provides low-level storage for graphics primitives in the \l{Qt Quick Scene Gra...
DataPattern
The DataPattern enum is used to specify the use pattern for the vertex and index data in a geometry o...
uint * indexDataAsUInt()
Convenience function to access the index data as a mutable array of 32-bit unsigned integers.
unsigned int drawingMode() const
Returns the drawing mode of this geometry.
DrawingMode
Specifies the drawing mode, also called primitive topology.
TexturedPoint2D * vertexDataAsTexturedPoint2D()
Convenience function to access the vertex data as a mutable array of QSGGeometry::TexturedPoint2D.
DataPattern vertexDataPattern() const
Returns the usage pattern for vertices in this geometry.
DataPattern indexDataPattern() const
Returns the usage pattern for indices in this geometry.
AttributeType
This enum identifies several attribute types.
const Attribute * attributes() const
Returns an array with the attributes of this geometry.
int attributeCount() const
Returns the number of attributes in the attrbute set used by this geometry.
const void * vertexData() const
Returns a pointer to the raw vertex data of this geometry object.
ColoredPoint2D * vertexDataAsColoredPoint2D()
Convenience function to access the vertex data as a mutable array of QSGGeometry::ColoredPoint2D.
int indexType() const
Returns the primitive type used for indices in this geometry object.
int sizeOfVertex() const
Returns the size in bytes of one vertex.
void * vertexData()
Returns a pointer to the raw vertex data of this geometry object.
int indexCount() const
Returns the number of indices in this geometry object.
Point2D * vertexDataAsPoint2D()
Convenience function to access the vertex data as a mutable array of QSGGeometry::Point2D.
quint16 * indexDataAsUShort()
Convenience function to access the index data as a mutable array of 16-bit unsigned integers.
int sizeOfIndex() const
Returns the byte size of the index type.
int vertexCount() const
Returns the number of vertices in this geometry object.
Combined button and popup list for selecting options.
GLboolean GLboolean GLboolean b
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
The QSGGeometry::AttributeSet describes how the vertices in a QSGGeometry are built up.
const Attribute * attributes
The QSGGeometry::Attribute describes a single vertex attribute in a QSGGeometry.
AttributeType attributeType
The QSGGeometry::ColoredPoint2D struct is a convenience struct for accessing 2D Points with a color.
void set(float nx, float ny, uchar nr, uchar ng, uchar nb, uchar na)
Sets the position of the vertex to x and y and the color to red, green, blue, and alpha.
The QSGGeometry::Point2D struct is a convenience struct for accessing 2D Points.
void set(float nx, float ny)
Sets the x and y values of this point to x and y.
The QSGGeometry::TexturedPoint2D struct is a convenience struct for accessing 2D Points with texture ...
void set(float nx, float ny, float ntx, float nty)
Sets the position of the vertex to x and y and the texture coordinate to tx and ty.