[dali_2.3.28] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / public-api / algorithm / navigation-mesh.h
index 638c26d..34088dd 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_SCENE3D_NAVIGATION_MESH_H
 
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -25,6 +25,7 @@
 
 #include <cinttypes>
 #include <cstdio>
+#include <limits>
 #include <memory>
 
 // INTERNAL INCLUDES
@@ -151,12 +152,12 @@ public:
   /**
    * @brief Looks for the floor under specified position
    * @param[in] position Position to investigate
-   * @param[in] outPosition Position on the floor in found
-   * @param[out] faceIndex Index of NavigationMesh face associated with floor
+   * @param[out] outPosition Position on the floor in found
+   * @param[out] outFaceIndex Index of NavigationMesh face associated with floor
    *
    * @return True if floor has been found, False otherwise
    */
-  bool FindFloor(const Dali::Vector3& position, Dali::Vector3& outPosition, FaceIndex& faceIndex);
+  bool FindFloor(const Dali::Vector3& position, Dali::Vector3& outPosition, FaceIndex& outFaceIndex);
 
   /**
    * @brief Looks for a floor starting from specified face
@@ -251,6 +252,16 @@ public:
    */
   Dali::Vector3 GetGravityVector() const;
 
+  /**
+   * @brief Performs ray/face intersect test
+   * @param[in] origin Origin of ray
+   * @param[in] direction Direction of ray
+   *
+   * @SINCE_2_2.53
+   * @return Valid FaceIndex on hit or NULL_FACE on miss
+   */
+  [[nodiscard]] FaceIndex RayFaceIntersect(const Vector3& origin, const Vector3& direction) const;
+
   static constexpr FaceIndex NULL_FACE{std::numeric_limits<FaceIndex>::max()}; ///< Represents null face
   static constexpr EdgeIndex NULL_EDGE{std::numeric_limits<EdgeIndex>::max()}; ///< Represents null edge
 
@@ -259,5 +270,13 @@ public:
 
   std::unique_ptr<NavigationMeshImpl> mImpl;
 };
+
+// Alias name for collider mesh
+// TODO: currently ColliderMesh is NavigationMesh however
+//       there should be separation from data and algorithms.
+//       Both, NavigationMesh and ColliderMesh use the same
+//       data structures but differ in the way they use data.
+using ColliderMesh = NavigationMesh;
+
 } // namespace Dali::Scene3D::Algorithm
 #endif // DALI_SCENE3D_NAVIGATION_MESH_H