1 | // Copyright (C) 2020 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #include "qquick3dskeleton_p.h" |
5 | #include "qquick3dobject_p.h" |
6 | #include "qquick3dnode_p_p.h" |
7 | |
8 | #include <QtQuick3DRuntimeRender/private/qssgrenderskeleton_p.h> |
9 | |
10 | QT_BEGIN_NAMESPACE |
11 | |
12 | /*! |
13 | \qmltype Skeleton |
14 | \inherits Node |
15 | \inqmlmodule QtQuick3D |
16 | \brief Defines a skeletal animation hierarchy. |
17 | |
18 | A skeleton defines how a model can be animated using \l {Vertex Skinning} |
19 | {skeletal animation}. It contains a hierarchy of \l {Joint} nodes. Each joint can be |
20 | transformed for a skinning animation. |
21 | |
22 | \qml |
23 | Skeleton { |
24 | id: qmlskeleton |
25 | Joint { |
26 | id: joint0 |
27 | index: 0 |
28 | skeletonRoot: qmlskeleton |
29 | Joint { |
30 | id: joint1 |
31 | index: 1 |
32 | skeletonRoot: qmlskeleton |
33 | } |
34 | } |
35 | } |
36 | \endqml |
37 | |
38 | \sa {Joint::skeletonRoot}, {Model::skeleton}, {Qt Quick 3D - Simple Skinning Example#skeleton-and-joint-hierarchy} |
39 | */ |
40 | |
41 | QQuick3DSkeleton::QQuick3DSkeleton(QQuick3DNode *parent) |
42 | : QQuick3DNode(*(new QQuick3DNodePrivate(QQuick3DNodePrivate::Type::Skeleton)), parent) |
43 | { |
44 | } |
45 | |
46 | QQuick3DSkeleton::~QQuick3DSkeleton() |
47 | { |
48 | } |
49 | |
50 | QSSGRenderGraphObject *QQuick3DSkeleton::updateSpatialNode(QSSGRenderGraphObject *node) |
51 | { |
52 | if (!node) |
53 | node = new QSSGRenderSkeleton(); |
54 | |
55 | QQuick3DNode::updateSpatialNode(node); |
56 | |
57 | auto skeletonNode = static_cast<QSSGRenderSkeleton *>(node); |
58 | |
59 | return skeletonNode; |
60 | } |
61 | |
62 | QT_END_NAMESPACE |
63 |