[dali_2.3.24] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / public-api / loader / node-definition.h
index 0e9a5d7..c1cea09 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef DALI_SCENE3D_LOADER_NODE_DEFINITION_H_
 #define DALI_SCENE3D_LOADER_NODE_DEFINITION_H_
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * 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.
  *
  */
 
-// INTERNAL INCLUDES
-#include "dali-scene3d/public-api/loader/customization.h"
-#include "dali-scene3d/public-api/loader/matrix-stack.h"
-#include "dali-scene3d/public-api/loader/resource-bundle.h"
-
 // EXTERNAL INCLUDES
+#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/math/matrix.h>
+#include <dali/public-api/math/quaternion.h>
+#include <dali/public-api/math/vector4.h>
 #include <functional>
 #include <memory>
 #include <string>
-#include "dali/public-api/actors/actor.h"
-#include "dali/public-api/math/matrix.h"
-#include "dali/public-api/math/quaternion.h"
-#include "dali/public-api/math/vector4.h"
+
+// INTERNAL INCLUDES
+#include <dali-scene3d/public-api/loader/customization.h>
+#include <dali-scene3d/public-api/loader/matrix-stack.h>
+#include <dali-scene3d/public-api/loader/resource-bundle.h>
+#include <dali-scene3d/public-api/loader/shader-manager.h>
+#include <dali-scene3d/public-api/model-components/model-node.h>
 
 namespace Dali
 {
@@ -41,6 +43,7 @@ class ViewProjection;
 
 /**
  * @brief Interface to report (const) resource ids to.
+ * @SINCE_2_0.7
  */
 class DALI_SCENE3D_API IResourceReceiver
 {
@@ -52,6 +55,7 @@ public:
 
 /**
  * @brief Interface to report modifiable resource ids to.
+ * @SINCE_2_0.7
  * @note These are supposed to be transient. Obviously, the references collected
  *  this way must not outlive the objects that they came from.
  */
@@ -67,6 +71,7 @@ public:
  * @brief Intermediate representation for a constraint that shall be
  *  set up after the Actors were created. The target of the constraint
  *  is the node definition that carries it.
+ * @SINCE_2_0.7
  */
 struct DALI_SCENE3D_API ConstraintDefinition
 {
@@ -97,36 +102,41 @@ struct DALI_SCENE3D_API Transforms
 
 /**
  * @brief Information about a skeleton and the shader that needs to be configured with it.
+ * @SINCE_2_0.7
  * @note Multiple skeletons shalt not share the same shader.
  */
 struct DALI_SCENE3D_API SkinningShaderConfigurationRequest
 {
-  Index  mSkeletonIdx;
-  Shader mShader;
+  Index          mSkeletonIdx;
+  Shader         mShader;
+  ModelPrimitive mPrimitive;
 
   bool operator<(const SkinningShaderConfigurationRequest& other) const
   {
-    return mShader < other.mShader;
+    return mShader < other.mShader || (mShader == other.mShader && mPrimitive < other.mPrimitive);
   }
 };
 
 /**
  * @brief Needed to configure blend shape properties.
+ * @SINCE_2_0.7
  */
 struct DALI_SCENE3D_API BlendshapeShaderConfigurationRequest
 {
-  std::string mNodeName;
-  Index       mMeshIdx;
-  Shader      mShader;
+  std::string    mNodeName;
+  Index          mMeshIdx;
+  Shader         mShader;
+  ModelPrimitive mPrimitive;
 
   bool operator<(const BlendshapeShaderConfigurationRequest& other) const
   {
-    return mShader < other.mShader;
+    return mShader < other.mShader || (mShader == other.mShader && mPrimitive < other.mPrimitive);
   }
 };
 
 /**
  * @brief Request for creating a constraint, output from NodeDefinition::OnCreate.
+ * @SINCE_2_0.7
  */
 struct DALI_SCENE3D_API ConstraintRequest
 {
@@ -138,6 +148,7 @@ struct DALI_SCENE3D_API ConstraintRequest
  * @brief Defines a node, consisting of a name, a transform, a size, a list of child nodes,
  *  and slots for customization and rendering logic, which are mutually exclusive in the
  *  current implementation.
+ * @SINCE_2_0.7
  */
 struct DALI_SCENE3D_API NodeDefinition
 {
@@ -147,8 +158,9 @@ public: // TYPES
   struct CreateParams
   {
   public: // input
-    const ResourceBundle& mResources;
-    Transforms&           mXforms;
+    ResourceBundle&                         mResources;
+    Transforms&                             mXforms;
+    Dali::Scene3D::Loader::ShaderManagerPtr mShaderManager;
 
   public: // output
     std::vector<ConstraintRequest>                    mConstrainables;
@@ -167,7 +179,7 @@ public: // TYPES
     virtual bool GetExtents(const ResourceBundle& resources, Vector3& min, Vector3& max) const;
     virtual void RegisterResources(IResourceReceiver& receiver) const;
     virtual void ReflectResources(IResourceReflector& reflector);
-    virtual void OnCreate(const NodeDefinition& node, CreateParams& params, Actor& actor) const;
+    virtual void OnCreate(const NodeDefinition& nodeDefinition, CreateParams& params, ModelNode& node) const;
   };
 
   struct CustomizationDefinition
@@ -215,19 +227,22 @@ public: // TYPES
 
 public: // METHODS
   /**
-   * @brief Creates a DALi Actor from this definition only.
+   * @brief Creates a ModelNode from this definition only.
+   * @SINCE_2_0.7
    * @note Not recursive.
    */
-  Actor CreateActor(CreateParams& params);
+  ModelNode CreateModelNode(CreateParams& params);
 
   /**
    * @brief Gets local space matrix of this node
+   * @SINCE_2_1.32
    * @return Matrix of local space.
    */
   Matrix GetLocalSpace() const;
 
   /**
    * @brief Retrieves minimum and maximum position of this node in local space.
+   * @SINCE_2_1.32
    * @param[in] resources ResourceBundle that contains mesh information of this node.
    * @param[out] min Minimum position of the mesh of this node.
    * @param[out] max Maximum position of the mesh of this node.
@@ -237,18 +252,31 @@ public: // METHODS
 
   /**
    * @brief Retrieves Scale Factor uniform name.
+   *
    * This uniform name can be used to change scale factor for ibl.
+   * @SINCE_2_1.32
    * @return std::string_view of the scale factor uniform name.
    */
   static std::string_view GetIblScaleFactorUniformName();
 
   /**
    * @brief Retrieves ibl Ydirection uniform name.
+   *
    * This uniform name can be used to flip y direction of ibl in shader.
+   * @SINCE_2_1.32
    * @return std::string_view of the YDirection uniform name.
    */
   static std::string_view GetIblYDirectionUniformName();
 
+  /**
+   * @brief Retrieves ibl MaxLod uniform name.
+   *
+   * This uniform name can be used to set max lod of ibl in shader.
+   * @SINCE_2_2.19
+   * @return std::string_view of the Max Lod uniform name.
+   */
+  static std::string_view GetIblMaxLodUniformName();
+
 public: // DATA
   static const char* ORIGINAL_MATRIX_PROPERTY_NAME;
 
@@ -282,11 +310,12 @@ public: // METHODS
   bool GetExtents(const ResourceBundle& resources, Vector3& min, Vector3& max) const override;
   void RegisterResources(IResourceReceiver& receiver) const override;
   void ReflectResources(IResourceReflector& reflector) override;
-  void OnCreate(const NodeDefinition& node, NodeDefinition::CreateParams& params, Actor& actor) const override;
+  void OnCreate(const NodeDefinition& nodeDefinition, NodeDefinition::CreateParams& params, ModelNode& node) const override;
 };
 
 /**
  * @brief Parameters for an Arc node.
+ * @SINCE_2_0.7
  */
 class DALI_SCENE3D_API ArcRenderable : public ModelRenderable
 {
@@ -300,7 +329,7 @@ public: // DATA
 public: // METHODS
   static void GetEndVectorWithDiffAngle(float startAngle, float endAngle, Vector2& endVector);
 
-  void OnCreate(const NodeDefinition& node, NodeDefinition::CreateParams& params, Actor& actor) const override;
+  void OnCreate(const NodeDefinition& nodeDefinition, NodeDefinition::CreateParams& params, ModelNode& node) const override;
 };
 
 } // namespace Loader