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
qssgrenderloadedtexture_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 QSSG_RENDER_LOADED_TEXTURE_H
6#define QSSG_RENDER_LOADED_TEXTURE_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/private/qssgrenderbasetypes_p.h>
20#include <QtQuick3DRuntimeRender/private/qtquick3druntimerenderglobal_p.h>
21
22#include <QtGui/QImage>
23
24#include <private/qtexturefiledata_p.h>
25
28
35
36struct Q_QUICK3DRUNTIMERENDER_EXPORT QSSGInputUtil
37{
38public:
39 enum FileType { UnknownFile, ImageFile, TextureFile, HdrFile };
40 static QSharedPointer<QIODevice> getStreamForFile(const QString &inPath,
41 bool inQuiet = false,
42 QString *outPath = nullptr);
43 static QSharedPointer<QIODevice> getStreamForTextureFile(const QString &inPath,
44 bool inQuiet = false,
45 QString *outPath = nullptr,
46 FileType *outFileType = nullptr);
47};
48
49
50// Utility class used for loading image data from disk.
51struct Q_QUICK3DRUNTIMERENDER_EXPORT QSSGLoadedTexture
52{
53public:
58 void *data = nullptr;
59 bool ownsData = true;
62 quint32 dataSizeInBytes = 0;
64 // #TODO: There should be more ways to influence this (hints on the texture)
65 bool isSRGB = false;
66
69 {
70 switch (components) {
71 case 1: // undefined, but in this context probably luminance
73 break;
74 case 2:
76 break;
77 case 3:
79 break;
80
81 default:
82 // fallthrough intentional
83 case 4:
85 break;
86 }
87 }
88
89 // Returns true if this image has a pixel less than 255.
90 bool scanForTransparency() const;
91
92 static QSSGLoadedTexture *load(const QString &inPath,
93 const QSSGRenderTextureFormat &inFormat,
94 bool inFlipY = true);
95 static QSSGLoadedTexture *loadQImage(const QString &inPath, qint32 flipVertical);
96 static QSSGLoadedTexture *loadCompressedImage(const QString &inPath);
97 static QSSGLoadedTexture *loadHdrImage(const QSharedPointer<QIODevice> &source, const QSSGRenderTextureFormat &inFormat);
98 static QSSGLoadedTexture *loadTextureData(QSSGRenderTextureData *textureData);
99};
101
102#endif
\inmodule QtGui
Definition qimage.h:37
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
p1 load("image.bmp")
Combined button and popup list for selecting options.
GLint GLenum GLsizei GLsizei GLsizei depth
GLint GLsizei GLsizei height
GLint GLenum GLint components
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLsizei width
GLint GLsizei GLsizei GLenum format
GLsizei GLsizei GLchar * source
unsigned int quint32
Definition qtypes.h:50
int qint32
Definition qtypes.h:49
QTextureFileData textureFileData