1 /* 2 * Copyright (c) 2022 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()23BASE_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()31CORE_BEGIN_NAMESPACE() 32 class FrustumUtil final : public IFrustumUtil { 33 public: 34 Frustum CreateFrustum(const BASE_NS::Math::Mat4X4& matrix) const override; 35 bool SphereFrustumCollision(const Frustum& frustum, BASE_NS::Math::Vec3 pos, float radius) const override; 36 37 const IInterface* GetInterface(const BASE_NS::Uid& uid) const override; 38 IInterface* GetInterface(const BASE_NS::Uid& uid) override; 39 40 void Ref() override; 41 void Unref() override; 42 }; 43 GetName(const IFrustumUtil *)44inline constexpr BASE_NS::string_view GetName(const IFrustumUtil*) 45 { 46 return "IFrustumUtil"; 47 } 48 CORE_END_NAMESPACE() 49 #endif // CORE_UTIL_FRUSTUM_UTIL_H