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