Warning: That file was not part of the compilation database. It may have many parsing errors.
1 | /**************************************************************************** |
---|---|
2 | ** |
3 | ** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the documentation of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:FDL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Free Documentation License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Free |
19 | ** Documentation License version 1.3 as published by the Free Software |
20 | ** Foundation and appearing in the file included in the packaging of |
21 | ** this file. Please review the following information to ensure |
22 | ** the GNU Free Documentation License version 1.3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. |
24 | ** $QT_END_LICENSE$ |
25 | ** |
26 | ****************************************************************************/ |
27 | |
28 | /*! |
29 | \page qt3drender-geometry.html |
30 | \title Qt 3D Render Geometry |
31 | |
32 | \brief Presents the classes provided by the Qt 3D Render aspect to specify |
33 | data to the renderer, typically containing geometry. |
34 | |
35 | Qt 3D Render provides a generic way of storing geometry data and specifying |
36 | how it should be read by the renderer. |
37 | |
38 | \list |
39 | \li \l {Buffer} |
40 | \li \l {Attribute} |
41 | \li \l {Geometry} |
42 | \li \l {GeometryRenderer} |
43 | \endlist |
44 | |
45 | \section2 Buffer |
46 | |
47 | The Qt3DRender::QBuffer class stores the raw data. This acts purely as an |
48 | array of memory. In most cases a Qt3DRender::QBuffer will be used |
49 | indirectly by being referenced by one or more Qt3DRender::QAttributes. |
50 | However there are times when a QBuffer may be used directly as the value |
51 | property of a QParameter when dealing with Uniform Buffer Objects (UBO) or |
52 | Shader Storage Buffer Objects (SSBO). |
53 | |
54 | \code |
55 | Buffer { |
56 | id: vertexBuffer |
57 | type: Buffer.VertexBuffer |
58 | data: buildVertexBufferData() |
59 | } |
60 | \endcode |
61 | |
62 | \section2 Attribute |
63 | |
64 | Qt3DRender::QAttribute specifies how data contained in the referenced |
65 | buffer should be extracted and passed to an input of a vertex shader. It |
66 | references a Qt3DRender::QBuffer and can specify the layout of the |
67 | attributes by definining the vertex size, the data type, the stride between |
68 | two vertices and a starting offset. The type of the attribute will also |
69 | define whether it is to be used as a vertex buffer or as an index buffer. |
70 | This allows you complete flexibility of how you structure your data in |
71 | buffers. It is possible to use separate buffers for each vertex attribute, |
72 | an interleaved buffer containing data for all attributes or a combination |
73 | of separate and interleaved buffers. |
74 | |
75 | \code |
76 | Attribute { |
77 | attributeType: Attribute.VertexAttribute |
78 | vertexBaseType: Attribute.Float |
79 | vertexSize: 3 |
80 | byteOffset: 0 |
81 | byteStride: 9 * 4 |
82 | count: 4 |
83 | name: defaultPositionAttributeName() |
84 | buffer: vertexBuffer |
85 | } |
86 | \endcode |
87 | |
88 | \section2 Geometry |
89 | |
90 | A Qt3DRender::QGeometry aggregates various attributes to form a piece of |
91 | geometry. Usually a proper geometry will provide an attribute for vertex |
92 | positions, an attribute for vertex normals and an attribute for texture |
93 | coordinates. If you want your geometry to also work with normal mapped |
94 | materials it will need to provide a consistent set of vertex tangent |
95 | vectors too. |
96 | |
97 | \code |
98 | Geometry { |
99 | Attribute { |
100 | attributeType: Attribute.VertexAttribute |
101 | vertexBaseType: Attribute.Float |
102 | vertexSize: 3 |
103 | byteOffset: 0 |
104 | byteStride: 9 * 4 |
105 | count: 4 |
106 | name: defaultPositionAttributeName() |
107 | buffer: vertexBuffer |
108 | } |
109 | |
110 | Attribute { |
111 | attributeType: Attribute.VertexAttribute |
112 | vertexBaseType: Attribute.Float |
113 | vertexSize: 3 |
114 | byteOffset: 3 * 4 |
115 | byteStride: 9 * 4 |
116 | count: 4 |
117 | name: defaultNormalAttributeName() |
118 | buffer: vertexBuffer |
119 | } |
120 | \endcode |
121 | |
122 | \section2 GeometryRenderer |
123 | |
124 | Qt3DRender::QGeometryRenderer is a QComponent which when aggregated by a |
125 | QEntity allows to draw the Qt3DRender::QGeometry it references. It provides |
126 | properties to control the draw call such as the number of instances to be |
127 | drawn, the starting instance, the type of |
128 | Qt3DRender::QGeometryRenderer::PrimitiveType to be used, etc. A |
129 | Qt3DRender::QGeometryRenderer is translated into a draw call to the |
130 | underlying graphics API. |
131 | |
132 | \code |
133 | GeometryRenderer { |
134 | instanceCount: 1 |
135 | indexOffset: 0 |
136 | firstInstance: 0 |
137 | primitiveType: GeometryRenderer.Triangles |
138 | geometry: Geometry { ... } |
139 | } |
140 | \endcode |
141 | |
142 | */ |
143 |
Warning: That file was not part of the compilation database. It may have many parsing errors.