Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qssgfrustum_p.h
Go to the documentation of this file.
1// Copyright (C) 2025 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5
6#ifndef QSSGFRUSTUM_H
7#define QSSGFRUSTUM_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <QtQuick3DUtils/private/qssgplane_p.h>
21#include <QtQuick3DUtils/private/qssgbounds3_p.h>
22
23QT_BEGIN_NAMESPACE
24
25/**
26\brief Representation of a 6 plane frustum.
27
28*/
29class QSSGFrustum
30{
31public:
32 /**
33 \brief Performs AABB test on bounds
34 */
35 Q_ALWAYS_INLINE bool contains(const QSSGBounds3 &box) const;
36
37 QSSGPlane m_planes[6]; //!< The six planes of frustum
38};
39
40Q_ALWAYS_INLINE bool QSSGFrustum::contains(const QSSGBounds3 &box) const
41{
42 for (const auto &plane : m_planes) {
43 QVector3D p(plane.n.x() > 0 ? box.maximum.x() : box.minimum.x(),
44 plane.n.y() > 0 ? box.maximum.y() : box.minimum.y(),
45 plane.n.z() > 0 ? box.maximum.z() : box.minimum.z());
46 if (plane.distance(p) < 0)
47 return false;
48 }
49 return true;
50}
51
52QT_END_NAMESPACE
53
54#endif // QSSGFRUSTUM_H