1 #ifndef DALI_SCENE3D_LOADER_NAVIGATION_MESH_FACTORY_H
2 #define DALI_SCENE3D_LOADER_NAVIGATION_MESH_FACTORY_H
5 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 #include <dali/public-api/rendering/geometry.h>
22 #include <dali/public-api/rendering/texture.h>
25 #include <dali-scene3d/public-api/algorithm/navigation-mesh.h>
26 #include <dali-scene3d/public-api/api.h>
28 namespace Dali::Scene3D::Loader
30 struct DALI_SCENE3D_API NavigationMeshFactory
34 * @brief Creates NavigationMesh object from file
36 * @param[in] filename file to load
37 * @return Valid NavigationMesh or nullptr
39 static std::unique_ptr<Algorithm::NavigationMesh> CreateFromFile(std::string filename);
42 * @brief Creates NavigationMesh object from binary buffer
44 * @param[in] buffer buffer with data
45 * @return Valid NavigationMesh or nullptr
47 static std::unique_ptr<Algorithm::NavigationMesh> CreateFromBuffer(const std::vector<uint8_t>& buffer);
50 * @brief Creates new mesh from lists of vertices and faces
52 * List of faces contains indices into the vertex list
55 * @param[in] vertices List of Vector3 vertices
56 * @param[in] vertexNormals List of Vector3 vertices
57 * @param[in] faceIndices List of faces
58 * @return Valid NavigationMesh or nullptr
60 static std::unique_ptr<Algorithm::NavigationMesh> CreateFromVertexFaceList(const std::vector<Vector3>& vertices, const std::vector<Vector3>& vertexNormals, const std::vector<uint32_t>& faceIndices);
63 * @brief Creates new mesh from lists of vertices and faces
65 * List of faces contains indices into the vertex list
67 * This function reduces number of array copys when called from NUI.
70 * @param[in] vertices Pointer to C-style array of vertices
71 * @param[in] vertexCount Number of vertices
72 * @param[in] vertexNormals to C-style array of vertex normals
73 * @param[in] faceIndices Pointer to C-style array of face elements indices
74 * @param[in] indexCount Number of indices
75 * @return Valid NavigationMesh or nullptr
77 static std::unique_ptr<Algorithm::NavigationMesh> CreateFromVertexFaceList(const Vector3* vertices, const Vector3* vertexNormals, uint32_t vertexCount, const uint32_t* faceIndices, uint32_t indexCount);
80 * @brief Serializes mesh data to the binary format.
82 * The binary data returned by the function can be used
83 * as an input for NavigationMeshFactory::CreateFromBuffer()
86 * @param[in] navigationMesh Navigation mesh to serialize
87 * @return Buffer containing serialized mesh data
89 static std::vector<uint8_t> GetMeshBinary(const Dali::Scene3D::Algorithm::NavigationMesh& navigationMesh);
91 } // namespace Dali::Scene3D::Loader
93 #endif // DALI_SCENE3D_INTERNAL_LOADER_NAVIGATION_MESH_FACTORY_H