8#include <QtQuick3DRuntimeRender/private/qssgrendergraphobject_p.h>
9#include <QtQuick3DRuntimeRender/private/qssgrenderskin_p.h>
11#include <QtQuick3DUtils/private/qssgutils_p.h>
71 QQuick3DSkin::qmlAppendJoint,
72 QQuick3DSkin::qmlJointsCount,
73 QQuick3DSkin::qmlJointAt,
74 QQuick3DSkin::qmlClearJoints);
77#define POS4BONETRANS(x) (sizeof(float) * 16 * (x) * 2)
78#define POS4BONENORM(x) (sizeof(float) * 16 * ((x) * 2 + 1))
82 for (
int i = 0;
i < m_joints.size(); ++
i) {
83 if (m_joints.at(
i) == node) {
84 QMatrix4x4 jointGlobal = m_joints.at(
i)->sceneTransform();
85 if (m_inverseBindPoses.
size() >
i)
86 jointGlobal *= m_inverseBindPoses.
at(
i);
88 reinterpret_cast<const void *
>(jointGlobal.
constData()),
98void QQuick3DSkin::onJointDestroyed(
QObject *
object)
100 for (
int i = 0;
i < m_joints.size(); ++
i) {
101 if (m_joints.at(
i) ==
object) {
102 m_joints.removeAt(
i);
105 sizeof(
float) * 16 * 2);
114 if (joint ==
nullptr)
120 if (index < self->m_inverseBindPoses.
size())
129 [self, joint]() {
self->onJointChanged(joint); });
148 for (
const auto &joint :
std::as_const(
self->m_joints)) {
170 return m_inverseBindPoses;
175 if (m_inverseBindPoses == poses)
178 m_inverseBindPoses = poses;
180 for (
int i = 0;
i < m_joints.size(); ++
i) {
181 QMatrix4x4 jointGlobal = m_joints.at(
i)->sceneTransform();
182 if (m_inverseBindPoses.
size() >
i)
183 jointGlobal *= m_inverseBindPoses.
at(
i);
185 reinterpret_cast<const void *
>(jointGlobal.
constData()),
196void QQuick3DSkin::markDirty()
222 const int boneTexWidth =
qCeil(
qSqrt(m_joints.size() * 4 * 2));
223 const int textureSizeInBytes = boneTexWidth * boneTexWidth * 16;
224 m_boneData.
resize(textureSizeInBytes);
225 skinNode->setSize(
QSize(boneTexWidth, boneTexWidth));
226 skinNode->setTextureData(m_boneData);
227 skinNode->boneCount = m_joints.size();
char * data()
\macro QT_NO_CAST_FROM_BYTEARRAY
void resize(qsizetype size)
Sets the size of the byte array to size bytes.
QByteArray & remove(qsizetype index, qsizetype len)
Removes len bytes from the array, starting at index position pos, and returns a reference to the arra...
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
QMatrix3x3 normalMatrix() const
Returns the normal matrix corresponding to this 4x4 transformation.
const float * constData() const
Returns a constant pointer to the raw data of this matrix.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
void destroyed(QObject *=nullptr)
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointe...
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
QMatrix4x4 sceneTransform
void sceneTransformChanged()
\qmltype Object3D \inqmlmodule QtQuick3D \instantiates QQuick3DObject \inherits QtObject
virtual QSSGRenderGraphObject * updateSpatialNode(QSSGRenderGraphObject *node)
virtual void markAllDirty()
void setInverseBindPoses(const QList< QMatrix4x4 > &poses)
void inverseBindPosesChanged()
QSSGRenderGraphObject * updateSpatialNode(QSSGRenderGraphObject *node) override
void markAllDirty() override
QQmlListProperty< QQuick3DNode > joints
\qmlproperty List<QtQuick3D::Node> Skin::joints
QQuick3DSkin(QQuick3DObject *parent=nullptr)
\qmltype Skin \inherits Object3D \inqmlmodule QtQuick3D
QList< QMatrix4x4 > inverseBindPoses
void clear()
Clears the contents of the string and makes it null.
qsizetype size() const
Returns the number of characters in this string.
void push_back(QChar c)
This is an overloaded member function, provided for convenience. It differs from the above function o...
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
QString & append(QChar c)
Combined button and popup list for selecting options.
qfloat16 qSqrt(qfloat16 f)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent