Allow to load uint32_t indices for geometry
[platform/core/uifw/dali-core.git] / dali / public-api / rendering / geometry.h
index 14ecb11..81e0421 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_GEOMETRY_H
 
 /*
- * Copyright (c) 2016 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.
 
 // EXTERNAL INCLUDES
 #include <cstddef> // std::size_t
+#include <cstdint> // uint16_t
 
 // INTERNAL INCLUDES
-#include <dali/public-api/object/handle.h> // Dali::Handle
+#include <dali/public-api/object/handle.h>                // Dali::Handle
 #include <dali/public-api/object/property-index-ranges.h> // DEFAULT_DERIVED_HANDLE_PROPERTY_START_INDEX
-#include <dali/public-api/rendering/property-buffer.h> // Dali::PropertyBuffer
+#include <dali/public-api/rendering/vertex-buffer.h>      // Dali::VertexBuffer
 
 namespace Dali
 {
+/**
+ * @addtogroup dali_core_rendering_effects
+ * @{
+ */
 
 namespace Internal DALI_INTERNAL
 {
@@ -39,28 +44,26 @@ class Geometry;
  *
  * @SINCE_1_1.43
  */
-class DALI_IMPORT_API Geometry : public BaseHandle
+class DALI_CORE_API Geometry : public BaseHandle
 {
 public:
-
   /**
-   * @brief Describes the type of geometry, used to determine how the coordinates will be used.
-   * @SINCE_1_1.43
+   * @brief Enumeration for the description of the type of geometry, used to determine how the coordinates will be used.
+   * @SINCE_1_1.45
    */
-  enum GeometryType
+  enum Type
   {
-    POINTS,        ///< Individual points                                                                                          @SINCE_1_1.43
-    LINES,         ///< Individual lines (made of 2 points each)                                                                   @SINCE_1_1.43
-    LINE_LOOP,     ///< A strip of lines (made of 1 point each) which also joins the first and last point                          @SINCE_1_1.43
-    LINE_STRIP,    ///< A strip of lines (made of 1 point each)                                                                    @SINCE_1_1.43
-    TRIANGLES,     ///< Individual triangles (made of 3 points each)                                                               @SINCE_1_1.43
-    TRIANGLE_FAN,  ///< A fan of triangles around a centre point (after the first triangle, following triangles need only 1 point) @SINCE_1_1.43
-    TRIANGLE_STRIP ///< A strip of triangles (after the first triangle, following triangles need only 1 point)                     @SINCE_1_1.43
+    POINTS,        ///< Individual points                                                                                          @SINCE_1_1.45
+    LINES,         ///< Individual lines (made of 2 points each)                                                                   @SINCE_1_1.45
+    LINE_LOOP,     ///< A strip of lines (made of 1 point each) which also joins the first and last point                          @SINCE_1_1.45
+    LINE_STRIP,    ///< A strip of lines (made of 1 point each)                                                                    @SINCE_1_1.45
+    TRIANGLES,     ///< Individual triangles (made of 3 points each)                                                               @SINCE_1_1.45
+    TRIANGLE_FAN,  ///< A fan of triangles around a centre point (after the first triangle, following triangles need only 1 point) @SINCE_1_1.45
+    TRIANGLE_STRIP ///< A strip of triangles (after the first triangle, following triangles need only 1 point)                     @SINCE_1_1.45
   };
 
-
   /**
-   * @brief Creates a new Geometry object
+   * @brief Creates a new Geometry object.
    *
    * @SINCE_1_1.43
    * @return A handle to a newly allocated Geometry object
@@ -68,112 +71,142 @@ public:
   static Geometry New();
 
   /**
-   * @brief Default constructor, creates an empty handle
+   * @brief Default constructor, creates an empty handle.
    *
    * @SINCE_1_1.43
    */
   Geometry();
 
   /**
-   * @brief Destructor
+   * @brief Destructor.
    *
    * @SINCE_1_1.43
    */
   ~Geometry();
 
   /**
-   * @brief Copy constructor, creates a new handle to the same object
+   * @brief Copy constructor, creates a new handle to the same object.
    *
    * @SINCE_1_1.43
    * @param[in] handle Handle to an object
    */
-  Geometry( const Geometry& handle );
+  Geometry(const Geometry& handle);
 
   /**
-   * @brief Downcast to a geometry.
-   * If not the returned handle is left uninitialized.
+   * @brief Downcasts to a geometry.
+   * If not, the returned handle is left uninitialized.
    *
    * @SINCE_1_1.43
    * @param[in] handle Handle to an object
-   * @return geometry Handle or an uninitialized handle
+   * @return Geometry handle or an uninitialized handle
    */
-  static Geometry DownCast( BaseHandle handle );
+  static Geometry DownCast(BaseHandle handle);
 
   /**
-   * @brief Assignment operator, changes this handle to point at the same object
+   * @brief Assignment operator, changes this handle to point at the same object.
    *
    * @SINCE_1_1.43
    * @param[in] handle Handle to an object
    * @return Reference to the assigned object
    */
-  Geometry& operator=( const Geometry& handle );
+  Geometry& operator=(const Geometry& handle);
 
   /**
-   * @brief Add a PropertyBuffer to be used as source of geometry vertices
+   * @brief Move constructor.
    *
-   * @SINCE_1_1.43
-   * @param[in] vertexBuffer PropertyBuffer to be used as source of geometry vertices
+   * @SINCE_1_9.22
+   * @param[in] rhs A reference to the moved handle
+   */
+  Geometry(Geometry&& rhs);
+
+  /**
+   * @brief Move assignment operator.
+   *
+   * @SINCE_1_9.22
+   * @param[in] rhs A reference to the moved handle
+   * @return A reference to this handle
+   */
+  Geometry& operator=(Geometry&& rhs);
+
+  /**
+   * @brief Adds a VertexBuffer to be used as source of geometry vertices.
+   *
+   * @SINCE_1_9.27
+   * @param[in] vertexBuffer VertexBuffer to be used as source of geometry vertices
    * @return Index of the newly added buffer, can be used with RemoveVertexBuffer to remove
    *         this buffer if no longer required
    */
-  std::size_t AddVertexBuffer( PropertyBuffer& vertexBuffer );
+  std::size_t AddVertexBuffer(VertexBuffer& vertexBuffer);
 
   /**
-   * @brief Retrieve the number of vertex buffers that have been added to this geometry
+   * @brief Retrieves the number of vertex buffers that have been added to this geometry.
    *
-   * @SINCE_1_1.43
+   * @SINCE_1_9.27
    * @return Number of vertex buffers that have been added to this geometry
    */
   std::size_t GetNumberOfVertexBuffers() const;
 
   /**
-   * @brief Remove a vertex buffer
-   * The index must be between 0 and GetNumberOfVertexBuffers()
+   * @brief Removes a vertex buffer.
+   * The index must be between 0 and GetNumberOfVertexBuffers().
    *
-   * @SINCE_1_1.43
+   * @SINCE_1_9.27
    * @param[in] index Index to the vertex buffer to remove
    */
-  void RemoveVertexBuffer( std::size_t index );
+  void RemoveVertexBuffer(std::size_t index);
 
   /**
-   * @brief Set a the index data to be used as a source of indices for the geometry
+   * @brief Sets the index data to be used as a source of indices for the geometry
    * Setting this buffer will cause the geometry to be rendered using indices.
-   * To unset call SetIndexBuffer with a null pointer or count 0
+   * To unset call SetIndexBuffer with a null pointer or count 0.
    *
    * @SINCE_1_1.43
    * @param[in] indices Array of indices
    * @param[in] count Number of indices in the array
    */
-  void SetIndexBuffer( const unsigned short* indices, size_t count );
+  void SetIndexBuffer(const uint16_t* indices, size_t count);
+
+  /**
+   * @brief Sets the 32bits index data to be used as a source of indices for the geometry
+   * Setting this buffer will cause the geometry to be rendered using indices.
+   * To unset call SetIndexBuffer with a null pointer or count 0.
+   *
+   * @SINCE_2_2.16
+   * @param[in] indices Array of indices with uint32_t elements.
+   * @param[in] count Number of indices in the array
+   */
+  void SetIndexBuffer(const uint32_t* indices, size_t count);
 
   /**
-   * @brief Set the type of primitives this geometry contains
+   * @brief Sets the type of primitives this geometry contains.
    *
    * @SINCE_1_1.43
    * @param[in] geometryType Type of primitives this geometry contains
    */
-  void SetGeometryType( GeometryType geometryType );
+  void SetType(Type geometryType);
 
   /**
-   * @brief Get the type of primitives this geometry contains
-   * Calling this function sets the property GEOMETRY_TYPE
+   * @brief Gets the type of primitives this geometry contains.
+   * Calling this function sets the property GEOMETRY_TYPE.
    *
    * @SINCE_1_1.43
    * @return Type of primitives this geometry contains
    */
-  GeometryType GetGeometryType() const;
+  Type GetType() const;
 
 public:
-
   /**
-   * @brief The constructor
+   * @brief The constructor.
    * @note  Not intended for application developers.
    * @SINCE_1_1.43
    * @param[in] pointer A pointer to a newly allocated Geometry
    */
-  explicit DALI_INTERNAL Geometry( Internal::Geometry* pointer );
+  explicit DALI_INTERNAL Geometry(Internal::Geometry* pointer);
 };
 
+/**
+ * @}
+ */
 } //namespace Dali
 
 #endif // DALI_GEOMETRY_H