| 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 | |
| 8 | QT_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 | \nativetype 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 | |
| 36 | namespace Qt3DCore { |
| 37 | |
| 38 | QCoreSettingsPrivate::QCoreSettingsPrivate() |
| 39 | : QComponentPrivate() |
| 40 | , m_boundingVolumesEnabled(true) |
| 41 | { |
| 42 | } |
| 43 | |
| 44 | QCoreSettingsPrivate *QCoreSettingsPrivate::get(QCoreSettings *q) |
| 45 | { |
| 46 | return q->d_func(); |
| 47 | } |
| 48 | |
| 49 | /*! |
| 50 | * Constructs a new QCoreSettings with \a parent. |
| 51 | */ |
| 52 | QCoreSettings::QCoreSettings(QNode *parent) |
| 53 | : QComponent(*new QCoreSettingsPrivate(), parent) |
| 54 | { |
| 55 | } |
| 56 | |
| 57 | /*! |
| 58 | * \internal |
| 59 | */ |
| 60 | QCoreSettings::~QCoreSettings() |
| 61 | { |
| 62 | } |
| 63 | |
| 64 | /*! |
| 65 | \qmlproperty bool CoreSettings::boundingVolumesEnabled |
| 66 | |
| 67 | Holds whether bounding volumes handling is enabled. This is true by |
| 68 | default. Disabling this allows to reduce the amount of computations |
| 69 | performed each frame. If you are using picking or frustum culling you |
| 70 | should keep this enabled (even when providing explicit bounding volumes |
| 71 | sizes using BoundingVolume). |
| 72 | */ |
| 73 | /*! |
| 74 | \property Qt3DCore::QCoreSettings::boundingVolumesEnabled |
| 75 | |
| 76 | Holds whether bounding volumes handling is enabled. This is true by |
| 77 | default. Disabling this allows to reduce the amount of computations |
| 78 | performed each frame. If you are using picking or frustum culling you |
| 79 | should keep this enabled (even when providing explicit bounding volumes |
| 80 | sizes using QBoundingVolume). |
| 81 | */ |
| 82 | bool QCoreSettings::boundingVolumesEnabled() const |
| 83 | { |
| 84 | Q_D(const QCoreSettings); |
| 85 | return d->m_boundingVolumesEnabled; |
| 86 | } |
| 87 | |
| 88 | void 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 | |
| 99 | QT_END_NAMESPACE |
| 100 | |
| 101 | #include "moc_qcoresettings.cpp" |
| 102 | |