[dali_2.3.24] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / public-api / loader / blend-shape-details.h
index 168fb09..7788532 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef DALI_SCENE3D_LOADER_BLEND_SHAPE_DETAILS_H
 #define DALI_SCENE3D_LOADER_BLEND_SHAPE_DETAILS_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/api.h"
-
 // EXTERNAL INCLUDES
+#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/object/weak-handle.h>
+#include <dali/public-api/rendering/shader.h>
+#include <limits> ///< for std::numeric_limits
 #include <string>
-#include "dali/public-api/actors/actor.h"
-#include "dali/public-api/rendering/shader.h"
 
-namespace Dali
-{
-namespace Scene3D
-{
-namespace Loader
+// INTERNAL INCLUDES
+#include <dali-scene3d/public-api/api.h>
+
+namespace Dali::Scene3D::Loader
 {
 struct MeshDefinition;
 struct MeshGeometry;
 
 struct DALI_SCENE3D_API BlendShapes
 {
+  using Index                          = uint32_t;
+  static constexpr Index INVALID_INDEX = std::numeric_limits<Index>::max();
+
   enum class Version
   {
     VERSION_1_0,
@@ -53,28 +55,38 @@ struct DALI_SCENE3D_API BlendShapes
     };
   };
 
+  struct BlendShapeData
+  {
+    std::vector<std::string> names;
+    std::vector<float>       weights;
+    std::vector<float>       unnormalizeFactors;
+    Version                  version{Scene3D::Loader::BlendShapes::Version::INVALID};
+    uint32_t                 bufferOffset{0};
+    int32_t                  components{0x0};
+    Dali::WeakHandle<Actor>  mActor;
+  };
+
   // shader properties - animatable (uniforms)
-  static const std::string NUMBER_OF_BLEND_SHAPES; ///< Integer number of blend shapes loaded.
-  static const std::string UNNORMALIZE_FACTOR;     ///< Scalar(s) for position components of blend shapes; Version 1.0: float array (1 per blend shape); Version 2.0: single float.
-  static const std::string COMPONENT_SIZE;         ///< Integer offset from one component (positions / normals / tangents) of a blend shape to the next.
+  static const char* NUMBER_OF_BLEND_SHAPES; ///< Integer number of blend shapes loaded.
+  static const char* UNNORMALIZE_FACTOR;     ///< Scalar(s) for position components of blend shapes; Version 1.0: float array (1 per blend shape); Version 2.0: single float.
+  static const char* COMPONENT_SIZE;         ///< Integer offset from one component (positions / normals / tangents) of a blend shape to the next.
 
   // shader properties - read-only (not available as uniforms)
-  static const std::string COMPONENTS; ///< Integer bitmask of the blend shape components that the shader uses; refer to the Components enum.
+  static const char* COMPONENTS; ///< Integer bitmask of the blend shape components that the shader uses; refer to the Components enum.
 
   // actor property (instance) - animatable (uniforms)
-  static const std::string WEIGHTS_UNIFORM; ///< The weight of each blend shape in a float array
+  static const char* WEIGHTS_UNIFORM; ///< The weight of each blend shape in a float array
 
   /**
    * @brief Registers properties based on the mesh definition (and geometry) and identified by the above string constants,
-   *  on the given @a shader and @a actor.
+   *  on the given @a renderer and @a actor.
+   * @SINCE_2_0.7
    */
-  static void ConfigureProperties(const std::pair<MeshDefinition, MeshGeometry>& mesh, Shader shader, Actor actor);
+  static void ConfigureProperties(const BlendShapeData& data, Renderer renderer);
 
   BlendShapes() = delete;
 };
 
-} // namespace Loader
-} // namespace Scene3D
-} // namespace Dali
+} // namespace Dali::Scene3D::Loader
 
 #endif // DALI_SCENE3D_LOADER_BLEND_SHAPE_DETAILS_H