Qt
6.x
The Qt SDK
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
26
QT_BEGIN_NAMESPACE
27
class
QSSGRenderTextureData
;
28
29
struct
QSSGTextureData
30
{
31
void
*
data
=
nullptr
;
32
quint32
dataSizeInBytes
= 0;
33
QSSGRenderTextureFormat
format
=
QSSGRenderTextureFormat::Unknown
;
34
};
35
36
struct
Q_QUICK3DRUNTIMERENDER_EXPORT
QSSGInputUtil
37
{
38
public
:
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.
51
struct
Q_QUICK3DRUNTIMERENDER_EXPORT
QSSGLoadedTexture
52
{
53
public
:
54
qint32
width
= 0;
55
qint32
height
= 0;
56
qint32
depth
= 0;
57
qint32
components
= 0;
58
void
*
data
=
nullptr
;
59
bool
ownsData =
true
;
60
QTextureFileData
textureFileData
;
61
QImage
image
;
62
quint32
dataSizeInBytes = 0;
63
QSSGRenderTextureFormat
format
=
QSSGRenderTextureFormat::RGBA8
;
64
// #TODO: There should be more ways to influence this (hints on the texture)
65
bool
isSRGB =
false
;
66
67
~QSSGLoadedTexture
();
68
void
setFormatFromComponents
()
69
{
70
switch
(
components
) {
71
case
1:
// undefined, but in this context probably luminance
72
format
=
QSSGRenderTextureFormat::R8
;
73
break
;
74
case
2:
75
format
=
QSSGRenderTextureFormat::RG8
;
76
break
;
77
case
3:
78
format
=
QSSGRenderTextureFormat::RGB8
;
79
break
;
80
81
default
:
82
// fallthrough intentional
83
case
4:
84
format
=
QSSGRenderTextureFormat::RGBA8
;
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
};
100
QT_END_NAMESPACE
101
102
#endif
QImage
\inmodule QtGui
Definition
qimage.h:37
QSSGRenderTextureData
Definition
qssgrendertexturedata_p.h:28
QSharedPointer
\inmodule QtCore
Definition
qsharedpointer_impl.h:256
QString
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition
qstring.h:127
QTextureFileData
Definition
qtexturefiledata_p.h:31
load
p1 load("image.bmp")
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qstandardpaths_haiku.cpp:21
QT_END_NAMESPACE
Definition
qsharedpointer.cpp:1545
depth
GLint GLenum GLsizei GLsizei GLsizei depth
Definition
qopengles2ext.h:603
height
GLint GLsizei GLsizei height
Definition
qopengles2ext.h:206
components
GLint GLenum GLint components
Definition
qopengles2ext.h:3216
width
GLint GLsizei width
Definition
qopengles2ext.h:206
data
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
Definition
qopengles2ext.h:206
format
GLint GLsizei GLsizei GLenum format
Definition
qopengles2ext.h:206
source
GLsizei GLsizei GLchar * source
Definition
qopengles2ext.h:952
FileType
FileType
Definition
qsvgiconengine.cpp:217
quint32
unsigned int quint32
Definition
qtypes.h:45
qint32
int qint32
Definition
qtypes.h:44
QSSGInputUtil
Definition
qssgrenderloadedtexture_p.h:37
QSSGInputUtil::FileType
FileType
Definition
qssgrenderloadedtexture_p.h:39
QSSGLoadedTexture
Definition
qssgrenderloadedtexture_p.h:52
QSSGLoadedTexture::textureFileData
QTextureFileData textureFileData
Definition
qssgrenderloadedtexture_p.h:60
QSSGLoadedTexture::image
QImage image
Definition
qssgrenderloadedtexture_p.h:61
QSSGLoadedTexture::setFormatFromComponents
void setFormatFromComponents()
Definition
qssgrenderloadedtexture_p.h:68
QSSGRenderTextureFormat
Definition
qssgrenderbasetypes_p.h:67
QSSGRenderTextureFormat::Unknown
@ Unknown
Definition
qssgrenderbasetypes_p.h:73
QSSGRenderTextureFormat::RGBA8
@ RGBA8
Definition
qssgrenderbasetypes_p.h:81
QSSGRenderTextureFormat::RG8
@ RG8
Definition
qssgrenderbasetypes_p.h:80
QSSGRenderTextureFormat::R8
@ R8
Definition
qssgrenderbasetypes_p.h:74
QSSGRenderTextureFormat::RGB8
@ RGB8
Definition
qssgrenderbasetypes_p.h:82
QSSGTextureData
Definition
qssgrenderloadedtexture_p.h:30
QSSGTextureData::dataSizeInBytes
quint32 dataSizeInBytes
Definition
qssgrenderloadedtexture_p.h:32
qtquick3d
src
runtimerender
resourcemanager
qssgrenderloadedtexture_p.h
Generated by
1.9.7