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
qquick3dtexturedata.cpp
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
6#include <QtQuick3DUtils/private/qssgutils_p.h>
7#include <QtQuick3DRuntimeRender/private/qssgrendertexturedata_p.h>
8
10
221
227
232
237{
238 const Q_D(QQuick3DTextureData);
239 return d->textureData;
240
241}
242
251{
253 d->textureData = data;
254 d->textureDataDirty = true;
255 update();
256}
257
262{
263 const Q_D(QQuick3DTextureData);
264 return d->size;
265}
266
271{
273 d->size = size;
274 update();
275}
276
281{
282 const Q_D(QQuick3DTextureData);
283 return d->depth;
284}
285
291{
293 d->depth = depth;
294 update();
295}
296
301{
302 const Q_D(QQuick3DTextureData);
303 return d->format;
304}
305
317
324{
325 const Q_D(QQuick3DTextureData);
326 return d->hasTransparency;
327}
328
338{
340 d->hasTransparency = hasTransparency;
341 update();
342}
343
344
346{
347 switch (format) {
421 default:
423 }
424}
425
430{
432 if (!node) {
433 markAllDirty();
434 node = new QSSGRenderTextureData();
435 }
437 auto *textureData = static_cast<QSSGRenderTextureData*>(node);
438
439 bool changed = false;
440
441 // Use a dirty flag so we don't compare large buffer values
442 if (d->textureDataDirty) {
443 d->textureDataDirty = false;
444 textureData->setTextureData(d->textureData);
445 changed = true;
446 }
447
448 // Can't use qUpdateIfNeeded unfortunately
449 if (d->size != textureData->size()) {
450 textureData->setSize(d->size);
451 changed = true;
452 }
453
454 if (d->depth != textureData->depth()) {
455 textureData->setDepth(d->depth);
456 changed = true;
457 }
458
460 if (format != textureData->format()) {
461 textureData->setFormat(format);
462 changed = true;
463 }
464
465 if (d->hasTransparency != textureData->hasTransparancy()) {
466 textureData->setHasTransparency(d->hasTransparency);
467 changed = true;
468 }
469
470 if (changed)
472
474
475 return node;
476}
477
482
483
\inmodule QtCore
Definition qbytearray.h:57
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
Definition qbytearray.h:494
\qmltype Object3D \inqmlmodule QtQuick3D \instantiates QQuick3DObject \inherits QtObject
virtual QSSGRenderGraphObject * updateSpatialNode(QSSGRenderGraphObject *node)
virtual void markAllDirty()
\qmltype TextureData \inherits Object3D \inqmlmodule QtQuick3D \instantiates QQuick3DTextureData
QQuick3DTextureData(QQuick3DObject *parent=nullptr)
Format
Returns the color format of the texture data assigned in \l textureData property.
void setSize(const QSize &size)
Sets the size of the texture data in pixels.
void setTextureData(const QByteArray &data)
Sets the texture data.
void setDepth(int depth)
Sets the depth of the texture data in pixels.
void setHasTransparency(bool hasTransparency)
Set hasTransparency to true if the texture data has an active alpha channel with non-opaque values.
Format format() const
Returns the format of the texture data.
QSSGRenderGraphObject * updateSpatialNode(QSSGRenderGraphObject *node) override
const QByteArray textureData() const
Returns the current texture data defined by this item.
QSize size() const
Returns the size of the texture data in pixels.
bool hasTransparency() const
Returns true if the texture data has transparency.
void setFormat(Format format)
Sets the format of the texture data.
int depth() const
Returns the depth of the texture data in pixels.
\inmodule QtCore
Definition qsize.h:25
void ensureDebugObjectName(T *node, QObject *src)
Combined button and popup list for selecting options.
GLint GLenum GLsizei GLsizei GLsizei depth
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLsizei GLsizei GLenum format
static QSSGRenderTextureFormat::Format convertToBackendFormat(QQuick3DTextureData::Format format)
#define emit
Definition moc.h:23