Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qssgrenderbasetypes_p.h
Go to the documentation of this file.
1// Copyright (C) 2008-2012 NVIDIA Corporation.
2// Copyright (C) 2019 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
4
5#ifndef QSSGRENDERBASETYPES_P_H
6#define QSSGRENDERBASETYPES_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQuick3DUtils/qtquick3dutilsexports.h>
20
21#include <QtGui/QVector2D>
22#include <QtGui/QVector3D>
23#include <QtGui/QVector4D>
24#include <QtGui/QMatrix4x4>
25#include <QtGui/QMatrix3x3>
26#include <QFloat16>
27
28#include <cmath>
29
31
32enum class QSSGRenderComponentType // stored in mesh files, the values must not change, must match Mesh::ComponentType
33{
34 UnsignedInt8 = 1,
35 Int8,
37 Int16,
39 Int32,
41 Int64,
42 Float16,
43 Float32,
45};
46
47enum class QSSGRenderDrawMode // stored in mesh files, the values must not change, must match Mesh::DrawMode
48{
49 Points = 1,
51 LineLoop, // Not supported
52 Lines,
56};
57
58enum class QSSGRenderWinding // stored in mesh files, the values must not change, must match Mesh::Winding
59{
60 Clockwise = 1,
62};
63
64struct Q_QUICK3DUTILS_EXPORT QSSGRenderTextureFormat
65{
66 static constexpr quint8 DepthTextureFlag = 1u << 6;
67 static constexpr quint8 CompressedTextureFlag = 1u << 7;
68
69 enum Format : quint8 {
70 // Non-compressed formats
111
112 // Depth textures
113 Depth16 = DepthTextureFlag + 1,
117
118 // Compressed formats
119 RGBA_DXT1 = CompressedTextureFlag + 1,
168 };
170
172
173 [[nodiscard]] constexpr bool isCompressedTextureFormat() const noexcept
174 {
175 return (format & CompressedTextureFlag);
176 }
177
178 [[nodiscard]] constexpr bool isUncompressedTextureFormat() const noexcept
179 {
180 return !isCompressedTextureFormat();
181 }
182
183 [[nodiscard]] bool isDepthTextureFormat() const noexcept
184 {
185 return (format & DepthTextureFlag);
186 }
187
188 [[nodiscard]] const char *toString() const;
189
190 [[nodiscard]] qint32 getSizeofFormat() const noexcept;
191
192 [[nodiscard]] qint32 getNumberOfComponent() const noexcept;
193
194 void decodeToFloat(void *inPtr, qint32 byteOfs, float *outPtr) const;
195 void encodeToPixel(float *inPtr, void *outPtr, qint32 byteOfs) const;
196
197 bool operator==(const QSSGRenderTextureFormat &other) const { return format == other.format; }
198 bool operator!=(const QSSGRenderTextureFormat &other) const { return format != other.format; }
199};
200
202{
203 None = 0,
204 Nearest,
205 Linear
206};
207
209{
210 Unknown = 0,
213 Repeat
214};
215
217{
218 Unknown = 0,
219 Back,
220 Front,
221 Disabled,
222 FrontAndBack, // Not exposed in the front-end
223};
224
226{
228 Always,
229 Never,
231};
232
233template<typename TDataType>
235{
236 TDataType x;
237 TDataType y;
238 QSSGRenderGenericVec2(TDataType _x, TDataType _y) : x(_x), y(_y) {}
240 bool operator==(const QSSGRenderGenericVec2 &inOther) const { return x == inOther.x && y == inOther.y; }
241};
242
243template<typename TDataType>
245{
246 TDataType x;
247 TDataType y;
248 TDataType z;
249 QSSGRenderGenericVec3(TDataType _x, TDataType _y, TDataType _z) : x(_x), y(_y), z(_z) {}
251 bool operator==(const QSSGRenderGenericVec3 &inOther) const
252 {
253 return x == inOther.x && y == inOther.y && z == inOther.z;
254 }
255};
256
257template<typename TDataType>
259{
260 TDataType x;
261 TDataType y;
262 TDataType z;
263 TDataType w;
264 QSSGRenderGenericVec4(TDataType _x, TDataType _y, TDataType _z, TDataType _w) : x(_x), y(_y), z(_z), w(_w) {}
266 bool operator==(const QSSGRenderGenericVec4 &inOther) const
267 {
268 return x == inOther.x && y == inOther.y && z == inOther.z && w == inOther.w;
269 }
270};
271
273{
275 {
277 Integer, // qint32,
278 IntegerVec2, // qint32_2,
279 IntegerVec3, // qint32_3,
280 IntegerVec4, // qint32_4,
281 Boolean, // bool
282 BooleanVec2, // bool_2,
283 BooleanVec3, // bool_3,
284 BooleanVec4, // bool_4,
285 Float, // float,
286 Vec2, // QVector2D,
287 Vec3, // QVector3D,
288 Vec4, // QVector4D,
289 UnsignedInteger, // quint32,
290 UnsignedIntegerVec2, // quint32_2,
291 UnsignedIntegerVec3, // quint32_3,
292 UnsignedIntegerVec4, // quint32_4,
293 Matrix3x3, // QMatrix3x3,
294 Matrix4x4, // QMatrix4x4,
295 Rgba, // QColor
296 Size, // QSize
297 SizeF, // QSizeF
298 Point, // QPoint
299 PointF, // QPointF
300 Rect, // QRect
301 RectF, // QRectF
302 Quaternion, // QQuaternion
304 };
305
309 using bvec2 = QSSGRenderGenericVec2<bool>;
310 using bvec3 = QSSGRenderGenericVec3<bool>;
311 using bvec4 = QSSGRenderGenericVec4<bool>;
312 using ivec2 = QSSGRenderGenericVec2<qint32>;
313 using ivec3 = QSSGRenderGenericVec3<qint32>;
314 using ivec4 = QSSGRenderGenericVec4<qint32>;
315 using uvec2 = QSSGRenderGenericVec2<quint32>;
316 using uvec3 = QSSGRenderGenericVec3<quint32>;
317 using uvec4 = QSSGRenderGenericVec4<quint32>;
318}
319
321{
322 Unknown = 0,
323 Diffuse,
324 Specular,
326 Bump,
327 Normal,
328 Emissive,
331};
332
334{
335 PosX,
336 NegX,
337 PosY,
338 NegY,
339 PosZ,
340 NegZ
341};
342
343using QSSGRenderTextureCubeFaceT = std::underlying_type_t<QSSGRenderTextureCubeFace>;
344
345// Same order as expected by QRHI!
351
354
355class Q_QUICK3DUTILS_EXPORT QSSGBaseTypeHelpers
356{
357 QSSGBaseTypeHelpers() = default;
358public:
359 // Enum as string
360 static const char *toString(QSSGRenderTextureCubeFace value);
361 static const char *toString(QSSGRenderTextureTypeValue value);
362 static const char *toString(QSSGDepthDrawMode value);
363 static const char *toString(QSSGRenderWinding value);
364 static const char *toString(QSSGCullFaceMode value);
365 static const char *toString(QSSGRenderComponentType value);
367 static const char *toString(QSSGRenderTextureCoordOp value);
368 static const char *toString(QSSGRenderTextureFilterOp value);
369
370 static const char *displayName(QSSGRenderTextureCubeFace face);
371
372 static size_t getSizeOfType(QSSGRenderComponentType type);
373
374 // Note: These will wrap around
379
381};
382
384
385#endif // QSSGRENDERBASETYPES_P_H
static constexpr QSSGRenderTextureCubeFace next(QSSGRenderTextureCubeFace face)
static constexpr QSSGRenderTextureCubeFace prev(QSSGRenderTextureCubeFace face)
static constexpr QSSGRenderTextureCubeFaceT indexOfCubeFace(QSSGRenderTextureCubeFace face) noexcept
The QVector2D class represents a vector or vertex in 2D space.
Definition qvectornd.h:31
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
The QVector4D class represents a vector or vertex in 4D space.
Definition qvectornd.h:330
QSSGRenderGenericVec3< quint32 > uvec3
QSSGRenderGenericVec2< bool > bvec2
QSSGRenderGenericVec3< qint32 > ivec3
QSSGRenderGenericVec2< quint32 > uvec2
QSSGRenderGenericVec4< quint32 > uvec4
QSSGRenderGenericVec4< bool > bvec4
QSSGRenderGenericVec2< qint32 > ivec2
QSSGRenderGenericVec4< qint32 > ivec4
QSSGRenderGenericVec3< bool > bvec3
Combined button and popup list for selecting options.
static QString displayName(CGDirectDisplayID displayID)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat z
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLenum face
GLfloat GLfloat f
GLenum type
GLint GLsizei GLsizei GLenum format
GLint y
static constexpr QSSGRenderTextureCubeFace QSSGRenderTextureCubeFaces[]
QSSGRenderTextureCubeFace
QSSGRenderTextureCoordOp
QSSGRenderTextureFilterOp
constexpr QSSGRenderTextureCubeFaceT QSSGRenderTextureCubeFaceMask
QSSGRenderTextureTypeValue
QSSGRenderComponentType
constexpr QSSGRenderTextureCubeFace QSSGRenderTextureCubeFaceNone
std::underlying_type_t< QSSGRenderTextureCubeFace > QSSGRenderTextureCubeFaceT
unsigned int quint32
Definition qtypes.h:50
int qint32
Definition qtypes.h:49
unsigned char quint8
Definition qtypes.h:46
QSharedPointer< T > other(t)
[5]
char * toString(const MyType &t)
[31]
QSSGRenderGenericVec2(TDataType _x, TDataType _y)
bool operator==(const QSSGRenderGenericVec2 &inOther) const
QSSGRenderGenericVec3(TDataType _x, TDataType _y, TDataType _z)
bool operator==(const QSSGRenderGenericVec3 &inOther) const
bool operator==(const QSSGRenderGenericVec4 &inOther) const
QSSGRenderGenericVec4(TDataType _x, TDataType _y, TDataType _z, TDataType _w)
bool isDepthTextureFormat() const noexcept
bool operator!=(const QSSGRenderTextureFormat &other) const
constexpr bool isCompressedTextureFormat() const noexcept
constexpr QSSGRenderTextureFormat(Format f)
constexpr bool isUncompressedTextureFormat() const noexcept