| 1 | // Copyright (C) 2023 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #include "qtrianglemeshshape_p.h" |
| 5 | |
| 6 | QT_BEGIN_NAMESPACE |
| 7 | |
| 8 | /*! |
| 9 | \qmltype TriangleMeshShape |
| 10 | \inqmlmodule QtQuick3D.Physics |
| 11 | \inherits CollisionShape |
| 12 | \since 6.4 |
| 13 | \brief A collision shape based on a 3D mesh. |
| 14 | |
| 15 | This type defines a shape based on the same 3D mesh file format used by |
| 16 | \l [QtQuick3D]{Model::source}{QtQuick3D.Model}. |
| 17 | |
| 18 | Objects that are controlled by the physics simulation cannot use TriangleMeshShape: It can only |
| 19 | be used with \l StaticRigidBody and \l {DynamicRigidBody::isKinematic}{kinematic bodies}. Use \l |
| 20 | ConvexMeshShape for non-kinematic dynamic bodies. |
| 21 | |
| 22 | \sa {Qt Quick 3D Physics Shapes and Bodies}{Shapes and Bodies overview documentation} |
| 23 | */ |
| 24 | |
| 25 | /*! |
| 26 | \qmlproperty url TriangleMeshShape::source |
| 27 | This property defines the location of the mesh file used to define the shape. |
| 28 | |
| 29 | Internally, TriangleMeshShape converts the mesh to an optimized data structure. This conversion |
| 30 | can be done in advance. See the \l{Qt Quick 3D Physics Cooking}{cooking overview documentation} |
| 31 | for details. |
| 32 | |
| 33 | \note If both the \l{TriangleMeshShape::}{geometry} and \l{TriangleMeshShape::}{source} |
| 34 | properties are set then only \l{TriangleMeshShape::}{geometry} will be used. |
| 35 | \sa TriangleMeshShape::geometry |
| 36 | */ |
| 37 | |
| 38 | /*! |
| 39 | \qmlproperty Geometry TriangleMeshShape::geometry |
| 40 | This property defines the geometry of a mesh used to define the shape. |
| 41 | \note If both the \l{TriangleMeshShape::}{geometry} and \l{TriangleMeshShape::}{source} |
| 42 | properties are set then only \l{TriangleMeshShape::}{geometry} will be used. |
| 43 | \sa TriangleMeshShape::source |
| 44 | \since 6.7 |
| 45 | */ |
| 46 | |
| 47 | QMeshShape::MeshType QTriangleMeshShape::shapeType() const |
| 48 | { |
| 49 | return QMeshShape::MeshType::TRIANGLE; |
| 50 | } |
| 51 | |
| 52 | bool QTriangleMeshShape::isStaticShape() const |
| 53 | { |
| 54 | return true; |
| 55 | } |
| 56 | |
| 57 | QT_END_NAMESPACE |
| 58 | |