[Tizen] Add navigation-mesh-header for hit-test 08/302308/1
authorhuiyu.eun <huiyu.eun@samsung.com>
Tue, 5 Dec 2023 07:07:39 +0000 (16:07 +0900)
committerhuiyu.eun <huiyu.eun@samsung.com>
Tue, 5 Dec 2023 08:04:57 +0000 (17:04 +0900)
Change-Id: Ibc229c382d38cb418cacbaa72899baee66d474e9
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
dali-scene3d/internal/algorithm/navigation-mesh-header.h [new file with mode: 0644]
dali-scene3d/internal/event/collider-mesh-processor-impl.cpp
dali-scene3d/internal/file.list
dali-scene3d/public-api/algorithm/navigation-mesh.h
dali-scene3d/public-api/controls/model/model.h
dali-scene3d/public-api/file.list
dali-scene3d/public-api/loader/navigation-mesh-factory.h
dali-scene3d/public-api/model-components/model-node.h

diff --git a/dali-scene3d/internal/algorithm/navigation-mesh-header.h b/dali-scene3d/internal/algorithm/navigation-mesh-header.h
new file mode 100644 (file)
index 0000000..812cdb1
--- /dev/null
@@ -0,0 +1,58 @@
+#ifndef DALI_SCENE3D_NAVIGATION_MESH_HEADER_H
+#define DALI_SCENE3D_NAVIGATION_MESH_HEADER_H
+/*
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// EXTERNAL INCLUDES
+#include <inttypes.h>
+
+namespace Dali::Scene3D::Internal::Algorithm
+{
+/**
+ * @struct NavigationMeshHeader
+ *
+ * Base header structure contains only the version field. It will allow adding changes to the
+ * exporter while maintaining backward compatibility.
+ */
+struct NavigationMeshHeader
+{
+  uint32_t checksum; ///< Checksum (used to test for endianness, tested by reader )
+  uint32_t version;  ///< Version of the API
+};
+
+/**
+ * @struct NavigationMeshHeader_V10
+ *
+ * Extension of header for version 1.0 of NavigationMesh binary file
+ */
+struct NavigationMeshHeader_V10 : public NavigationMeshHeader
+{
+  uint32_t dataOffset; ///< Offset where data starts (depends on endianness)
+
+  uint32_t vertexCount;      ///< total count of vertices
+  uint32_t vertexDataOffset; ///< offset into data array where vertices start
+
+  uint32_t edgeCount;      ///< total count of edges
+  uint32_t edgeDataOffset; ///< offset into data array where edges are stored
+
+  uint32_t polyCount;      ///< total number of polys
+  uint32_t polyDataOffset; ///< offset into data array where edges are stored
+
+  float gravityVector[3]; /// Gravity vector for the data (down vector)
+};
+
+}
+#endif // DALI_SCENE3D_NAVIGATION_MESH_HEADER_H
index d8ce462..5d45d4d 100644 (file)
@@ -85,7 +85,7 @@ public:
       std::vector<ColliderMeshData> meshData;
       IterateThroughChildren(sceneView, meshData);
 
-      auto renderTask  = touchEvent.GetRenderTask();
+      auto renderTask  = Stage::GetCurrent().GetRenderTaskList().GetTask(0);
       auto cameraActor = renderTask.GetCameraActor();
 
       const auto& result = touchEvent.GetScreenPosition(0);
index 3bd0085..2c827e1 100644 (file)
@@ -1,6 +1,7 @@
 set(scene3d_internal_dir "${scene3d_dir}/internal")
 
 set(scene3d_src_files ${scene3d_src_files}
+        ${scene3d_internal_dir}/algorithm/navigation-mesh-impl.cpp
        ${scene3d_internal_dir}/common/environment-map-load-task.cpp
        ${scene3d_internal_dir}/common/model-cache-manager.cpp
        ${scene3d_internal_dir}/common/model-load-task.cpp
index 62e4a08..5ad68ff 100644 (file)
@@ -257,7 +257,6 @@ public:
    * @param[in] origin Origin of ray
    * @param[in] direction Direction of ray
    *
-   * @SINCE_2_3.0
    * @return Valid FaceIndex on hit or NULL_FACE on miss
    */
   [[nodiscard]] FaceIndex RayFaceIntersect(const Vector3& origin, const Vector3& direction) const;
index 31185b8..ec3e1b9 100644 (file)
@@ -385,7 +385,6 @@ public:
    * The return value of True, indicates that the hover event should be consumed.
    * Otherwise the signal will be emitted on the next sensitive parent of the actor.
    *
-   * @SINCE_2_3.0
    * @return The signal to connect to
    */
   MeshHitSignalType& MeshHitSignal();
index 363c45c..e84481d 100644 (file)
@@ -1,6 +1,7 @@
 set(scene3d_public_api_dir "${scene3d_dir}/public-api")
 
 set(scene3d_src_files ${scene3d_src_files}
+        ${scene3d_public_api_dir}/algorithm/navigation-mesh.cpp
        ${scene3d_public_api_dir}/controls/model/model.cpp
        ${scene3d_public_api_dir}/controls/scene-view/scene-view.cpp
        ${scene3d_public_api_dir}/light/light.cpp
@@ -33,6 +34,7 @@ set(scene3d_src_files ${scene3d_src_files}
        ${scene3d_public_api_dir}/loader/skinning-details.cpp
        ${scene3d_public_api_dir}/loader/string-callback.cpp
        ${scene3d_public_api_dir}/loader/utils.cpp
+        ${scene3d_public_api_dir}/loader/navigation-mesh-factory.cpp
        ${scene3d_public_api_dir}/loader/view-projection.cpp
        ${scene3d_public_api_dir}/model-components/material.cpp
        ${scene3d_public_api_dir}/model-components/model-node.cpp
@@ -43,4 +45,4 @@ set(scene3d_src_files ${scene3d_src_files}
        ${scene3d_public_api_dir}/model-motion/motion-index/motion-property-index.cpp
        ${scene3d_public_api_dir}/model-motion/motion-index/motion-transform-index.cpp
        ${scene3d_public_api_dir}/model-motion/motion-value.cpp
-)
\ No newline at end of file
+)
index b3dd576..269b1c5 100644 (file)
@@ -51,7 +51,6 @@ public:
    *
    * List of faces contains indices into the vertex list
    *
-   * @SINCE_2_3.0
    * @param[in] vertices List of Vector3 vertices
    * @param[in] vertexNormals List of Vector3 vertices
    * @param[in] faceIndices List of faces
@@ -66,7 +65,6 @@ public:
    *
    * This function reduces number of array copys when called from NUI.
    *
-   * @SINCE_2_3.0
    * @param[in] vertices Pointer to C-style array of vertices
    * @param[in] vertexCount Number of vertices
    * @param[in] vertexNormals to C-style array of vertex normals
@@ -82,7 +80,6 @@ public:
    * The binary data returned by the function can be used
    * as an input for NavigationMeshFactory::CreateFromBuffer()
    *
-   * @SINCE_2_3.0
    * @param[in] navigationMesh Navigation mesh to serialize
    * @return Buffer containing serialized mesh data
    */
index 6d75411..e7ae582 100644 (file)
@@ -214,7 +214,6 @@ public: // Public Method
    *
    * To remove collider mesh empty unique_ptr must be passed.
    *
-   * @SINCE_2_3.0
    * @param[in] colliderMesh r-value to unique pointer of ColliderMesh
    */
   void SetColliderMesh(std::unique_ptr<Algorithm::ColliderMesh>&& colliderMesh);
@@ -226,7 +225,6 @@ public: // Public Method
    * collider mesh is associated. Calling GetColliderMesh() without
    * previous check may produce undefined behaviour.
    *
-   * @SINCE_2_3.0
    * @return Associated collider mesh
    */
   const Algorithm::ColliderMesh& GetColliderMesh();
@@ -234,7 +232,6 @@ public: // Public Method
   /**
    * @brief Determines whether there is a valid collider mesh set
    *
-   * @SINCE_2_3.0
    * @return True if collider mesh is set, False otherwise
    */
   [[nodiscard]] bool HasColliderMesh() const;