1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef CORE_UTIL_FRUSTUM_UTIL_H
16 #define CORE_UTIL_FRUSTUM_UTIL_H
17 
18 #include <base/containers/string_view.h>
19 #include <base/namespace.h>
20 #include <core/namespace.h>
21 #include <core/util/intf_frustum_util.h>
22 
BASE_BEGIN_NAMESPACE()23 BASE_BEGIN_NAMESPACE()
24 namespace Math {
25 class Mat4X4;
26 class Vec3;
27 } // namespace Math
28 struct Uid;
29 BASE_END_NAMESPACE()
30 
CORE_BEGIN_NAMESPACE()31 CORE_BEGIN_NAMESPACE()
32 class FrustumUtil final : public IFrustumUtil {
33 public:
34     Frustum CreateFrustum(const BASE_NS::Math::Mat4X4& matrix) const override;
35     bool SphereFrustumCollision(
36         const Frustum& frustum, const BASE_NS::Math::Vec3 pos, const float radius) const override;
37 
38     const IInterface* GetInterface(const BASE_NS::Uid& uid) const override;
39     IInterface* GetInterface(const BASE_NS::Uid& uid) override;
40 
41     void Ref() override;
42     void Unref() override;
43 };
44 
GetName(const IFrustumUtil *)45 inline constexpr BASE_NS::string_view GetName(const IFrustumUtil*)
46 {
47     return "IFrustumUtil";
48 }
49 CORE_END_NAMESPACE()
50 #endif // CORE_UTIL_FRUSTUM_UTIL_H