2 * Copyright (c) 2024 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <dali-scene3d/public-api/algorithm/navigation-mesh.h>
21 #include <dali-scene3d/internal/algorithm/navigation-mesh-impl.h>
25 namespace Dali::Scene3D::Algorithm
27 NavigationMesh::NavigationMesh(NavigationMeshImpl* impl)
32 NavigationMesh::~NavigationMesh() = default;
34 [[nodiscard]] uint32_t NavigationMesh::GetFaceCount() const
36 return mImpl->GetFaceCount();
39 [[nodiscard]] uint32_t NavigationMesh::GetEdgeCount() const
41 return mImpl->GetEdgeCount();
44 [[nodiscard]] uint32_t NavigationMesh::GetVertexCount() const
46 return mImpl->GetVertexCount();
49 bool NavigationMesh::FindFloor(const Dali::Vector3& position, Dali::Vector3& outPosition, FaceIndex& outFaceIndex)
51 return mImpl->FindFloor(position, outPosition, outFaceIndex);
54 bool NavigationMesh::FindFloorForFace(const Dali::Vector3& position, FaceIndex faceIndex, bool dontCheckNeighbours, Dali::Vector3& outPosition)
56 return mImpl->FindFloorForFace(position, faceIndex, dontCheckNeighbours, outPosition);
59 [[nodiscard]] const NavigationMesh::Face* NavigationMesh::GetFace(FaceIndex index) const
61 return mImpl->GetFace(index);
64 [[nodiscard]] const NavigationMesh::Edge* NavigationMesh::GetEdge(EdgeIndex index) const
66 return mImpl->GetEdge(index);
69 [[nodiscard]] const NavigationMesh::Vertex* NavigationMesh::GetVertex(VertexIndex index) const
71 return mImpl->GetVertex(index);
74 void NavigationMesh::SetSceneTransform(const Dali::Matrix& transform)
76 mImpl->SetTransform(transform);
79 Dali::Vector3 NavigationMesh::PointSceneToLocal(const Dali::Vector3& point) const
81 return mImpl->PointSceneToLocal(point);
84 Dali::Vector3 NavigationMesh::PointLocalToScene(const Dali::Vector3& point) const
86 return mImpl->PointLocalToScene(point);
89 Dali::Vector3 NavigationMesh::GetGravityVector() const
91 return mImpl->GetGravityVector();
94 FaceIndex NavigationMesh::RayFaceIntersect(const Vector3& origin, const Vector3& direction) const
96 Internal::Algorithm::NavigationRay ray;
98 ray.direction = direction;
100 auto result = mImpl->RayCastIntersect(ray);
103 return result.faceIndex;
108 } // namespace Dali::Scene3D::Algorithm