Addition of update geometry properties and quads 62/36462/4
authorDavid Steele <david.steele@partner.samsung.com>
Fri, 6 Mar 2015 15:32:15 +0000 (15:32 +0000)
committerDavid Steele <david.steele@partner.samsung.com>
Wed, 11 Mar 2015 19:48:27 +0000 (19:48 +0000)
Change-Id: Ib8e72b4388012a427a701ca3c5e16e6e8a2b69a9

dali/internal/update/common/property-boolean.h [new file with mode: 0644]
dali/internal/update/common/scene-graph-property-buffer.cpp
dali/internal/update/common/scene-graph-property-buffer.h
dali/internal/update/geometry/scene-graph-geometry.cpp
dali/internal/update/geometry/scene-graph-geometry.h

diff --git a/dali/internal/update/common/property-boolean.h b/dali/internal/update/common/property-boolean.h
new file mode 100644 (file)
index 0000000..2181466
--- /dev/null
@@ -0,0 +1,132 @@
+#ifndef __DALI_INTERNAL_SCENE_GRAPH_BOOLEAN_PROPERTY_H__
+#define __DALI_INTERNAL_SCENE_GRAPH_BOOLEAN_PROPERTY_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/math/boolean.h>
+#include <dali/public-api/object/property.h>
+#include <dali/public-api/object/property-input.h>
+#include <dali/public-api/object/property-types.h>
+#include <dali/internal/common/buffer-index.h>
+#include <dali/internal/event/common/property-input-impl.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace SceneGraph
+{
+
+/**
+ * A Boolean non-animatable property.
+ */
+class PropertyBoolean : public PropertyInputImpl
+{
+public:
+
+  /**
+   * Create an non-animatable property.
+   * @param [in] initialValue The initial value of the property.
+   */
+  PropertyBoolean( bool initialValue )
+  : mValue( initialValue ),
+    mDirtyFlag( true )
+  {
+  }
+
+  /**
+   * Virtual destructor.
+   */
+  virtual ~PropertyBoolean()
+  {
+  }
+
+  /**
+   * Clear the dirty flag
+   */
+  void Clear()
+  {
+    mDirtyFlag = false;
+  }
+
+  /**
+   * @copydoc Dali::Internal::PropertyInputImpl::GetType()
+   */
+  virtual Dali::Property::Type GetType() const
+  {
+    return Dali::PropertyTypes::Get<bool>();
+  }
+
+  /**
+   * @copydoc Dali::Internal::PropertyInputImpl::InputInitialized()
+   */
+  virtual bool InputInitialized() const
+  {
+    return true;
+  }
+
+  /**
+   * @copydoc Dali::Internal::PropertyInputImpl::InputChanged()
+   */
+  virtual bool InputChanged() const
+  {
+    return mDirtyFlag;
+  }
+
+  /**
+   * @copydoc Dali::PropertyInput::GetBoolean()
+   */
+  virtual const bool& GetBoolean( BufferIndex bufferIndex ) const
+  {
+    return mValue;
+  }
+
+  /**
+   * Flag that the property has been Set during the current frame.
+   */
+  void OnSet()
+  {
+    mDirtyFlag = true;
+  }
+
+private:
+
+  // Undefined
+  PropertyBoolean(const PropertyBoolean& property);
+
+  // Undefined
+  PropertyBoolean& operator=(const PropertyBoolean& rhs);
+
+public:
+  boolean mValue; ///< The property value
+
+private:
+  boolean mDirtyFlag;
+};
+
+} // namespace SceneGraph
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_SCENE_GRAPH_BOOLEAN_PROPERTY_H__
index b1a1396..dcdf83a 100644 (file)
@@ -31,6 +31,36 @@ PropertyBuffer::~PropertyBuffer()
 {
 }
 
+//@todo MESH_REWORK Remove when we have working property buffers
+PropertyBuffer* PropertyBuffer::NewQuadVertices()
+{
+  PropertyBuffer* propertyBuffer = new PropertyBuffer();
+  propertyBuffer->mVertexSize = sizeof(Vector4);
+  propertyBuffer->mData.Resize( propertyBuffer->mVertexSize * 4 );
+  Vector4* vertices = reinterpret_cast<Vector4*>(propertyBuffer->mData[0]);
+
+  vertices[ 0 ] = Vector4( -0.5f, -0.5f, 1.0f, 0.0f );
+  vertices[ 1 ] = Vector4(  0.5f, -0.5f, 1.0f, 1.0f );
+  vertices[ 2 ] = Vector4( -0.5f,  0.5f, 0.0f, 0.0f );
+  vertices[ 3 ] = Vector4(  0.5f,  0.5f, 0.0f, 1.0f );
+
+  return propertyBuffer;
+}
+
+//@todo MESH_REWORK Remove when we have working property buffers
+PropertyBuffer* PropertyBuffer::NewQuadIndices()
+{
+  PropertyBuffer* propertyBuffer = new PropertyBuffer();
+
+  propertyBuffer->mVertexSize = sizeof( unsigned short );
+  propertyBuffer->mData.Resize( propertyBuffer->mVertexSize * 6 );
+  unsigned short* indices = reinterpret_cast<unsigned short*>(propertyBuffer->mData[0]);
+
+  indices[0] = 0;  indices[1] = 3;  indices[2] = 1;
+  indices[3] = 0;  indices[4] = 2;  indices[5] = 3;
+
+  return propertyBuffer;
+}
 
 } // namespace SceneGraph
 } // namespace Internal
index bbc1425..b930f2f 100644 (file)
@@ -17,6 +17,9 @@
  * limitations under the License.
  */
 
+#include <dali/public-api/common/dali-vector.h>
+#include <dali/public-api/math/vector4.h>
+
 namespace Dali
 {
 namespace Internal
@@ -44,7 +47,11 @@ public:
   ~PropertyBuffer();
 
 private:
-  // Data
+
+  // @todo MESH_REWORK - TEMPORARY TYPES - REMOVE WHEN WE HAVE WORKING BUFFERS
+  typedef Dali::Vector< char > CharBuffer;
+  CharBuffer  mData;
+  std::size_t mVertexSize;
 };
 
 } // namespace SceneGraph
index 6a07a39..8ae76a6 100644 (file)
@@ -24,7 +24,10 @@ namespace SceneGraph
 {
 
 Geometry::Geometry()
-: mGeometryType(Dali::Geometry::TRIANGLES)
+: mCenter(),
+  mHalfExtents(),
+  mGeometryType(Dali::Geometry::TRIANGLES),
+  mRequiresDepthTest(false)
 {
   // @todo MESH_REWORK Remove this code when we have working property buffers
   // @todo It's also the wrong place to do this temporary work
index 86da67d..0830833 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <dali/public-api/geometry/geometry.h>
 #include <dali/internal/common/event-to-update.h>
+#include <dali/internal/update/common/animatable-property.h>
 #include <dali/internal/update/common/double-buffered.h>
 #include <dali/internal/update/common/property-owner.h>
 #include <dali/internal/update/common/scene-graph-property-buffer.h>
@@ -101,7 +102,12 @@ public: // GeometryDataProvider
 private:
   VertexBuffers mVertexBuffers; ///< The vertex buffers
   OwnerPointer<PropertyBuffer> mIndexBuffer;  ///< The index buffer if required
-  GeometryType mGeometryType;   ///< The type of geometry (tris/lines etc)
+
+private: // Properties
+  AnimatableProperty<Vector3> mCenter;
+  AnimatableProperty<Vector3> mHalfExtents;
+  GeometryType                mGeometryType;   ///< The type of geometry (tris/lines etc)
+  AnimatableProperty<bool>    mRequiresDepthTest;
 };
 
 inline void AddVertexBufferMessage( EventToUpdate& eventToUpdate, const Geometry& geometry, PropertyBuffer& vertexBuffer )