1 | // Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #include "qlevelofdetailboundingsphere.h" |
5 | #include <QSharedData> |
6 | |
7 | QT_BEGIN_NAMESPACE |
8 | |
9 | namespace Qt3DRender { |
10 | |
11 | class QLevelOfDetailBoundingSpherePrivate: public QSharedData |
12 | { |
13 | public: |
14 | QLevelOfDetailBoundingSpherePrivate() |
15 | : QSharedData() |
16 | , m_radius(0.0f) |
17 | {} |
18 | |
19 | QLevelOfDetailBoundingSpherePrivate(QVector3D center, float radius) |
20 | : QSharedData() |
21 | , m_center(center) |
22 | , m_radius(radius) |
23 | {} |
24 | |
25 | ~QLevelOfDetailBoundingSpherePrivate() |
26 | {} |
27 | |
28 | QVector3D m_center; |
29 | float m_radius; |
30 | }; |
31 | |
32 | /*! |
33 | \class Qt3DRender::QLevelOfDetailBoundingSphere |
34 | \inmodule Qt3DRender |
35 | \since 5.9 |
36 | \brief The QLevelOfDetailBoundingSphere class provides a simple spherical volume, defined by its center and radius. |
37 | */ |
38 | |
39 | /*! |
40 | \qmltype LevelOfDetailBoundingSphere |
41 | \instantiates Qt3DRender::QLevelOfDetailBoundingSphere |
42 | \inherits Component3D |
43 | \inqmlmodule Qt3D.Render |
44 | \brief The LevelOfDetailBoundingSphere QML type provides a simple spherical volume, defined by its center and radius. |
45 | */ |
46 | |
47 | /*! |
48 | * \qmlproperty QVector3D LevelOfDetailBoundingSphere::center |
49 | * |
50 | * Specifies the center of the bounding sphere |
51 | */ |
52 | |
53 | /*! |
54 | * \property QLevelOfDetailBoundingSphere::center |
55 | * |
56 | * Specifies the center of the bounding sphere |
57 | */ |
58 | |
59 | /*! |
60 | * \qmlproperty qreal LevelOfDetailBoundingSphere::radius |
61 | * |
62 | * Specifies the radius of the bounding sphere |
63 | */ |
64 | |
65 | /*! |
66 | * \property QLevelOfDetailBoundingSphere::radius |
67 | * |
68 | * Specifies the radius of the bounding sphere |
69 | */ |
70 | |
71 | /*! |
72 | Constructs a new QLevelOfDetailBoundingSphere with the specified \a center and \a radius. |
73 | */ |
74 | QLevelOfDetailBoundingSphere::QLevelOfDetailBoundingSphere(QVector3D center, float radius) |
75 | : d_ptr(new QLevelOfDetailBoundingSpherePrivate(center, radius)) |
76 | { |
77 | } |
78 | |
79 | QLevelOfDetailBoundingSphere::QLevelOfDetailBoundingSphere(const QLevelOfDetailBoundingSphere &other) |
80 | : d_ptr(other.d_ptr) |
81 | { |
82 | } |
83 | |
84 | QLevelOfDetailBoundingSphere::~QLevelOfDetailBoundingSphere() |
85 | { |
86 | } |
87 | |
88 | QLevelOfDetailBoundingSphere &QLevelOfDetailBoundingSphere::operator =(const QLevelOfDetailBoundingSphere &other) |
89 | { |
90 | d_ptr = other.d_ptr; |
91 | return *this; |
92 | } |
93 | |
94 | QVector3D QLevelOfDetailBoundingSphere::center() const |
95 | { |
96 | return d_ptr->m_center; |
97 | } |
98 | |
99 | float QLevelOfDetailBoundingSphere::radius() const |
100 | { |
101 | return d_ptr->m_radius; |
102 | } |
103 | |
104 | bool QLevelOfDetailBoundingSphere::isEmpty() const |
105 | { |
106 | return d_ptr->m_radius <= 0.0f; |
107 | } |
108 | |
109 | bool QLevelOfDetailBoundingSphere::operator ==(const QLevelOfDetailBoundingSphere &other) const |
110 | { |
111 | return d_ptr->m_center == other.center() && other.d_ptr->m_radius == other.radius(); |
112 | } |
113 | |
114 | bool QLevelOfDetailBoundingSphere::operator !=(const QLevelOfDetailBoundingSphere &other) const |
115 | { |
116 | return !(*this == other); |
117 | } |
118 | |
119 | } // namespace Qt3DRender |
120 | |
121 | QT_END_NAMESPACE |
122 | |
123 | #include "moc_qlevelofdetailboundingsphere.cpp" |
124 |