Remove animatable property-buffer API. 67/40167/4
authorFrancisco Santos <f1.santos@samsung.com>
Fri, 29 May 2015 16:16:03 +0000 (17:16 +0100)
committerFrancisco Santos <f1.santos@samsung.com>
Wed, 3 Jun 2015 13:33:28 +0000 (14:33 +0100)
Change-Id: I7fd36a6d530b1272f66025fd834239dcde6c71ed

automated-tests/src/dali/dali-test-suite-utils/mesh-builder.cpp
automated-tests/src/dali/utc-Dali-PropertyBuffer.cpp
dali/internal/event/common/property-buffer-impl.cpp
dali/internal/event/common/property-buffer-impl.h
dali/public-api/object/property-buffer.cpp
dali/public-api/object/property-buffer.h

index 92d6ca6..facb98e 100644 (file)
@@ -51,8 +51,7 @@ PropertyBuffer CreatePropertyBuffer()
   texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
   texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
 
-  PropertyBuffer vertexData = PropertyBuffer::New( PropertyBuffer::STATIC,
-                                                   texturedQuadVertexFormat, 4 );
+  PropertyBuffer vertexData = PropertyBuffer::New( texturedQuadVertexFormat, 4 );
   return vertexData;
 }
 
@@ -73,10 +72,10 @@ Geometry CreateQuadGeometryFromBuffer( PropertyBuffer vertexData )
     { Vector2( halfQuadSize,  halfQuadSize), Vector2(1.f, 1.f) } };
   vertexData.SetData(texturedQuadVertexData);
 
-  unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 };
+  unsigned int indexData[6] = { 0, 3, 1, 0, 2, 3 };
   Property::Map indexFormat;
-  indexFormat["indices"] = Property::UNSIGNED_INTEGER; // Should be Unsigned Short
-  PropertyBuffer indices = PropertyBuffer::New( PropertyBuffer::STATIC, indexFormat, 3 );
+  indexFormat["indices"] = Property::UNSIGNED_INTEGER;
+  PropertyBuffer indices = PropertyBuffer::New( indexFormat, sizeof(indexData)/sizeof(indexData[0]) );
   indices.SetData(indexData);
 
   Geometry geometry = Geometry::New();
index 900d76e..3f4f84b 100644 (file)
@@ -48,8 +48,7 @@ int UtcDaliPropertyBufferNew01(void)
   texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
   texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
 
-  PropertyBuffer propertyBuffer = PropertyBuffer::New( PropertyBuffer::STATIC,
-                                                       texturedQuadVertexFormat, 4 );
+  PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat, 4 );
 
   DALI_TEST_EQUALS( (bool)propertyBuffer, true, TEST_LOCATION );
   END_TEST;
@@ -71,8 +70,7 @@ int UtcDaliPropertyBufferDownCast01(void)
   texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
   texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
 
-  PropertyBuffer propertyBuffer = PropertyBuffer::New( PropertyBuffer::STATIC,
-                                                       texturedQuadVertexFormat, 4 );
+  PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat, 4 );
 
   BaseHandle handle(propertyBuffer);
   PropertyBuffer propertyBuffer2 = PropertyBuffer::DownCast(handle);
@@ -143,7 +141,7 @@ int UtcDaliPropertyBufferConstraint02(void)
 
   tet_infoline("Test that a uniform map propertyBuffer property can be constrained");
 
-  Shader shader = Shader::New("VertexSource", "FragmentSource");
+  Shader shader = Shader::New( "VertexSource", "FragmentSource" );
   Material material = Material::New( shader );
   material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
@@ -305,8 +303,7 @@ int UtcDaliPropertyBufferSetData01(void)
   texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
   texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
 
-  PropertyBuffer propertyBuffer = PropertyBuffer::New( PropertyBuffer::STATIC,
-                                                       texturedQuadVertexFormat, 4 );
+  PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat, 4 );
   DALI_TEST_EQUALS( (bool)propertyBuffer, true, TEST_LOCATION );
 
   const float halfQuadSize = .5f;
@@ -352,8 +349,7 @@ int UtcDaliPropertyBufferSetData02(void)
   texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
   texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
 
-  PropertyBuffer propertyBuffer = PropertyBuffer::New( PropertyBuffer::STATIC,
-                                                       texturedQuadVertexFormat, 4 );
+  PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat, 4 );
   DALI_TEST_EQUALS( (bool)propertyBuffer, true, TEST_LOCATION );
 
   const float halfQuadSize = .5f;
@@ -421,9 +417,7 @@ int UtcDaliPropertyBufferSetSize01(void)
   texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
   texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
 
-  PropertyBuffer propertyBuffer = PropertyBuffer::New( PropertyBuffer::STATIC,
-                                                       texturedQuadVertexFormat,
-                                                       4u );
+  PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat, 4u );
   DALI_TEST_EQUALS( (bool)propertyBuffer, true, TEST_LOCATION );
 
   size_t size = propertyBuffer.GetSize();
index 759fb1d..5fbae8c 100644 (file)
@@ -183,26 +183,11 @@ void PropertyBuffer::SetData( const void* data )
                               new SceneGraph::PropertyBuffer::BufferType( mBuffer ) );
 }
 
-Dali::Property::Index PropertyBuffer::GetPropertyIndex( const std::string name, std::size_t index )
-{
-  //TODO: MESH_REWORK
-  DALI_ASSERT_ALWAYS( false && "MESH_REWORK" );
-  return 0;
-}
-
 const SceneGraph::PropertyBuffer* PropertyBuffer::GetPropertyBufferSceneObject() const
 {
   return mSceneObject;
 }
 
-void PropertyBuffer::SetType( Dali::PropertyBuffer::Type type )
-{
-  DALI_ASSERT_DEBUG( mType == Dali::PropertyBuffer::TYPE_COUNT && "Type can only be set once." );
-  DALI_ASSERT_DEBUG( type != Dali::PropertyBuffer::TYPE_COUNT && "Type must be set to a valid value." );
-
-  mType = type;
-}
-
 void PropertyBuffer::SetFormat( Dali::Property::Map& format )
 {
   DALI_ASSERT_ALWAYS( format.Count() && "Format cannot be empty." );
@@ -385,7 +370,6 @@ PropertyBuffer::PropertyBuffer()
 : mSceneObject( NULL ),
   mBufferFormat( NULL ),
   mSize( 0 ),
-  mType( Dali::PropertyBuffer::TYPE_COUNT ),
   mOnStage( false )
 {
 }
index c42d35f..9723872 100644 (file)
@@ -89,15 +89,6 @@ public:
   const SceneGraph::PropertyBuffer* GetPropertyBufferSceneObject() const;
 
   /**
-   * @brief Set the type of PropertyBuffer
-   *
-   * @pre Has not been set yet
-   *
-   * @param[in] type of PropertyBuffer
-   */
-  void SetType( Dali::PropertyBuffer::Type type );
-
-  /**
    * @brief Set the format of the PropertyBuffer
    *
    * @pre Has not been set yet
@@ -241,7 +232,6 @@ private: // data
   Property::Map mFormat;  ///< Format of the property buffer
   const SceneGraph::PropertyBufferMetadata::Format* mBufferFormat;  ///< Metadata for the format of the property buffer
   unsigned int mSize; ///< Number of elements in the buffer
-  Dali::PropertyBuffer::Type mType; ///< Type of propertyBuffer
   Dali::Vector< char > mBuffer; // Data of the property-buffer
 
   bool mOnStage;  ///< Flag to know if the object is on stage
index 995134a..779b862 100644 (file)
 namespace Dali
 {
 
-PropertyBuffer PropertyBuffer::New( Type type, Dali::Property::Map& bufferFormat, std::size_t size )
+PropertyBuffer PropertyBuffer::New( Dali::Property::Map& bufferFormat, std::size_t size )
 {
   Internal::PropertyBufferPtr propertyBuffer = Internal::PropertyBuffer::New();
 
-  propertyBuffer->SetType( type );
   propertyBuffer->SetFormat( bufferFormat );
   propertyBuffer->SetSize( size );
 
@@ -76,11 +75,6 @@ void PropertyBuffer::SetData( void* data )
   GetImplementation(*this).SetData( data );
 }
 
-Dali::Property::Index PropertyBuffer::GetPropertyIndex( const std::string name, std::size_t index )
-{
-  return GetImplementation(*this).GetPropertyIndex( name, index );
-}
-
 PropertyBuffer::PropertyBuffer( Internal::PropertyBuffer* pointer )
 : Handle( pointer )
 {
index de802f9..fa4c72a 100644 (file)
@@ -54,14 +54,14 @@ class PropertyBuffer;
  *  Property::Map texturedQuadVertexFormat;
  *  texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
  *  texturedQuadVertexFormat["aTexCoord"] = Property::VECTOR2;
- *  PropertyBuffer texturedQuadVertices = PropertyBuffer::New( PropertyBuffer::STATIC, texturedQuadVertexFormat, 4 );
+ *  PropertyBuffer texturedQuadVertices = PropertyBuffer::New( texturedQuadVertexFormat, 4 );
  *  texturedQuadVertices.SetData(texturedQuadVertexData);
  *
  *  // Create indices
- *  unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 };
+ *  unsigned int indexData[6] = { 0, 3, 1, 0, 2, 3 };
  *  Property::Map indexFormat;
  *  indexFormat["indices"] = Property::UNSIGNED_INTEGER;
- *  PropertyBuffer indices = PropertyBuffer::New( PropertyBuffer::STATIC, indexFormat, 6 );
+ *  PropertyBuffer indices = PropertyBuffer::New( indexFormat, 6 );
  *  indices.SetData(indexData);
  *
  *  // Create the geometry object
@@ -75,16 +75,6 @@ class DALI_IMPORT_API PropertyBuffer : public Handle
 public:
 
   /**
-   * @brief Type of property buffer
-   */
-  enum Type
-  {
-    STATIC,     ///< The property buffer properties will not be animatable
-    ANIMATABLE, ///< The property buffer properties will be animatable
-    TYPE_COUNT, ///< Number of different types
-  };
-
-  /**
    * @brief An enumeration of properties belonging to the PropertyBuffer class.
    */
   struct Property
@@ -101,12 +91,11 @@ public:
    *
    * Static property buffers use less memory.
    *
-   * @param[in] type Type of property buffer, will make properties animatable or not
    * @param[in] bufferFormat Map of names and types that describes the components of the buffer
    * @param[in] size The number of elements in the property buffer
    * @return Handle to a newly allocated PropertyBuffer
    */
-  static PropertyBuffer New( Type type, Dali::Property::Map& bufferFormat, std::size_t size );
+  static PropertyBuffer New( Dali::Property::Map& bufferFormat, std::size_t size );
 
   /**
    * @brief Default constructor, creates an empty handle
@@ -180,21 +169,6 @@ public:
    */
   void SetData( void* data );
 
-  /**
-   * @brief Get the property index for a value in the buffer
-   *
-   * @param[in] name Name of the component
-   * @param[in] index Index of the object in the buffer
-   *
-   * Indices are calculated as follows:
-   *   NumberOfComponents * index + OffsetOf( name )
-   * Example:
-   *   For a PropertyBuffer with 2 components {"position", "normal"}
-   *   The Property::Index for the property "position" in the 20th object would be:
-   *     Property::Index( 2 * 19 + 0 ) => Property::Index( 38 )
-   */
-  Dali::Property::Index GetPropertyIndex( const std::string name, std::size_t index );
-
 public:
   /**
    * @brief The constructor