1// Copyright (C) 2020 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 "qcoresettings.h"
5#include "qcoresettings_p.h"
6#include <Qt3DCore/private/corelogging_p.h>
7
8QT_BEGIN_NAMESPACE
9
10/*!
11 \class Qt3DCore::QCoreSettings
12 \brief The QCoreSettings class holds settings related to core data handling process.
13 \since 6.0
14 \inmodule Qt3DCore
15 \inherits Qt3DCore::QComponent
16
17 The QCoreSettings component should be set as a component of the scene root entity
18 (although it could be anywhere in the scene graph). There should be a single instance.
19
20 It can be used to control some of Qt 3D's behavior.
21*/
22
23/*!
24 \qmltype CoreSettings
25 \brief The CoreSettings class holds settings related to core data handling process.
26 \since 6.0
27 \inqmlmodule Qt3D.Core
28 \instantiates Qt3DCore::QCoreSettings
29
30 The CoreSettings component should be set as a component of the scene root entity
31 (although it could be anywhere in the scene graph). There should be a single instance.
32
33 It can be used to control some of Qt 3D's behavior.
34*/
35
36namespace Qt3DCore {
37
38QCoreSettingsPrivate::QCoreSettingsPrivate()
39 : QComponentPrivate()
40 , m_boundingVolumesEnabled(true)
41{
42}
43
44QCoreSettingsPrivate *QCoreSettingsPrivate::get(QCoreSettings *q)
45{
46 return q->d_func();
47}
48
49/*!
50 * Constructs a new QCoreSettings with \a parent.
51 */
52QCoreSettings::QCoreSettings(QNode *parent)
53 : QComponent(*new QCoreSettingsPrivate(), parent)
54{
55}
56
57/*!
58 * \internal
59 */
60QCoreSettings::~QCoreSettings()
61{
62}
63
64/*!
65\qmlproperty bool CoreSettings::boundingVolumesEnabled
66
67Holds whether bounding volumes handling is enabled. This is true by
68default. Disabling this allows to reduce the amount of computations
69performed each frame. If you are using picking or frustum culling you
70should keep this enabled (even when providing explicit bounding volumes
71sizes using BoundingVolume).
72*/
73/*!
74\property QCoreSettings::boundingVolumesEnabled
75
76Holds whether bounding volumes handling is enabled. This is true by
77default. Disabling this allows to reduce the amount of computations
78performed each frame. If you are using picking or frustum culling you
79should keep this enabled (even when providing explicit bounding volumes
80sizes using QBoundingVolume).
81*/
82bool QCoreSettings::boundingVolumesEnabled() const
83{
84 Q_D(const QCoreSettings);
85 return d->m_boundingVolumesEnabled;
86}
87
88void QCoreSettings::setBoundingVolumesEnabled(bool boundingVolumesEnabled)
89{
90 Q_D(QCoreSettings);
91 if (d->m_boundingVolumesEnabled == boundingVolumesEnabled)
92 return;
93 d->m_boundingVolumesEnabled = boundingVolumesEnabled;
94 emit boundingVolumesEnabledChanged(boundingVolumesEnabled);
95}
96
97} // namespace Qt3DCore
98
99QT_END_NAMESPACE
100
101#include "moc_qcoresettings.cpp"
102

source code of qt3d/src/core/aspect/qcoresettings.cpp