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
qquick3dmorphtarget.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
5
6#include <QtQuick3DRuntimeRender/private/qssgrendermorphtarget_p.h>
7#include <QtQml/QQmlFile>
8
10
33
37
47{
48 return m_weight;
49}
50
69QQuick3DMorphTarget::MorphTargetAttributes QQuick3DMorphTarget::attributes() const
70{
71 return m_attributes;
72}
73
75{
76 m_dirtyAttributes = 0xffffffff;
78}
79
81{
82 if (m_weight == weight)
83 return;
84
85 m_weight = weight;
87 markDirty(WeightDirty);
88}
89
90void QQuick3DMorphTarget::setAttributes(MorphTargetAttributes attributes)
91{
92 if (m_attributes == attributes)
93 return;
94
95 m_attributes = attributes;
96 m_numAttribs = 0;
97 int flags = attributes;
98 while (flags) {
99 m_numAttribs += flags & 0x1;
100 flags >>= 1;
101 }
103 markDirty(MorphTargetAttributesDirty);
104}
105
107{
108 if (!node) {
109 markAllDirty();
110 node = new QSSGRenderMorphTarget();
111 }
113 auto modelNode = static_cast<QSSGRenderMorphTarget *>(node);
114 if (m_dirtyAttributes & WeightDirty)
115 modelNode->weight = m_weight;
116 if (m_dirtyAttributes & MorphTargetAttributesDirty)
117 modelNode->attributes = QSSGRenderMorphTarget::InputAttributes(int(m_attributes));
118
119 m_dirtyAttributes = 0;
120
121 return modelNode;
122}
123
124void QQuick3DMorphTarget::markDirty(QQuick3DMorphTarget::QSSGMorphTargetDirtyType type)
125{
126 if (!(m_dirtyAttributes & quint32(type))) {
127 m_dirtyAttributes |= quint32(type);
128 update();
129 }
130}
131
132size_t QQuick3DMorphTarget::numAttribs()
133{
134 return m_numAttribs;
135}
136
QSSGRenderGraphObject * updateSpatialNode(QSSGRenderGraphObject *node) override
void setAttributes(QQuick3DMorphTarget::MorphTargetAttributes attributes)
MorphTargetAttributes attributes
QQuick3DMorphTarget(QQuick3DObject *parent=nullptr)
\qmltype MorphTarget \inherits Object \inqmlmodule QtQuick3D
void setWeight(float castsShadows)
\qmltype Object3D \inqmlmodule QtQuick3D \instantiates QQuick3DObject \inherits QtObject
virtual QSSGRenderGraphObject * updateSpatialNode(QSSGRenderGraphObject *node)
virtual void markAllDirty()
Combined button and popup list for selecting options.
GLuint GLuint GLfloat weight
GLenum type
GLbitfield flags
#define emit
unsigned int quint32
Definition qtypes.h:50
Definition moc.h:23