Mipmap level parameter
[platform/core/uifw/dali-core.git] / dali / internal / render / renderers / render-geometry.h
index 7ac3e75..7a34462 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef DALI_INTERNAL_SCENE_GRAPH_RENDER_GEOMETRY_H
-#define DALI_INTERNAL_SCENE_GRAPH_RENDER_GEOMETRY_H
+#ifndef DALI_INTERNAL_RENDER_GEOMETRY_H
+#define DALI_INTERNAL_RENDER_GEOMETRY_H
 
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
  */
 
 #include <dali/public-api/common/dali-vector.h>
+#include <dali/public-api/rendering/geometry.h>
 #include <dali/devel-api/common/owner-container.h>
-#include <dali/integration-api/gl-defines.h>
+#include <dali/internal/common/owner-pointer.h>
 #include <dali/internal/common/buffer-index.h>
 #include <dali/internal/common/owner-pointer.h>
 #include <dali/integration-api/gl-abstraction.h>
-#include <dali/internal/update/rendering/scene-graph-geometry.h>
+#include <dali/integration-api/gl-defines.h>
 
 namespace Dali
 {
@@ -36,32 +37,23 @@ class GpuBuffer;
 namespace Render
 {
 class PropertyBuffer;
-}
-
-namespace SceneGraph
-{
 
 /**
  * This class encapsulates the GPU buffers. It is used to upload vertex data
  * to it's GPU buffers, to bind all the buffers and to setup/teardown vertex attribute
  * bindings
  */
-class RenderGeometry
+class Geometry
 {
 public:
+  typedef Dali::Geometry::Type Type;
+
+  Geometry();
 
-  typedef SceneGraph::Geometry::GeometryType GeometryType;
-  /**
-   * Constructor. Creates a render geometry object with no GPU buffers.
-   * @param[in] center The center of the geometry
-   * @param[in] geometryType The geometry type
-   * @param[in] requiresDepthTest True if geometry requires depth testing, false otherwise
-   */
-  RenderGeometry( GeometryType geometryType, bool requiresDepthTest );
   /**
    * Destructor
    */
-  ~RenderGeometry();
+  ~Geometry();
 
   /**
    * Called on Gl Context created
@@ -76,9 +68,14 @@ public:
   /**
    * Adds a property buffer to the geometry
    * @param[in] dataProvider The PropertyBuffer data provider
-   * @param[in] isIndexBuffer True if the property buffer is intended to be used as an index buffer
    */
-  void AddPropertyBuffer( Render::PropertyBuffer* propertyBuffer, bool isIndexBuffer );
+  void AddPropertyBuffer( Render::PropertyBuffer* propertyBuffer );
+
+  /**
+   * Set the data for the index buffer to be used by the geometry
+   * @param[in] indices A vector containing the indices
+   */
+  void SetIndexBuffer( Dali::Vector<unsigned short>& indices );
 
   /**
    * Removes a PropertyBuffer from the geometry
@@ -112,57 +109,43 @@ public:
    * Sets the geometry type
    * @param[in] type The new geometry type
    */
-  void SetGeometryType( GeometryType type )
+  void SetType( Type type )
   {
     mGeometryType = type;
   }
 
   /**
-   * Sets if the geometry requires depth testing
-   * @param[in] requiresDepthTest True if depth testing is required, false otherwise
-   */
-  void SetRequiresDepthTest( bool requiresDepthTest )
-  {
-    mRequiresDepthTest = requiresDepthTest;
-  }
-
-  /**
-   * Check if geometry requires depth testing
-   * @return True if depth testing is required, false otherwise
-   */
-  bool RequiresDepthTest() const
-  {
-    return mRequiresDepthTest;
-  }
-
-  /**
    * Upload the geometry if it has changed, set up the attributes and perform
    * the Draw call corresponding to the geometry type
    * @param[in] context The GL context
    * @param[in] bufferIndex The current buffer index
    * @param[in] attributeLocation The location for the attributes in the shader
+   * @param[in] elementBufferOffset The index of first element to draw if index buffer bound
+   * @param[in] elementBufferCount Number of elements to draw if index buffer bound, uses whole buffer when 0
    */
   void UploadAndDraw(Context& context,
                      BufferIndex bufferIndex,
-                     Vector<GLint>& attributeLocation );
+                     Vector<GLint>& attributeLocation,
+                     size_t elementBufferOffset,
+                     size_t elementBufferCount );
 
 private:
 
   // PropertyBuffers
-  Render::PropertyBuffer* mIndexBuffer;
-  Vector<Render::PropertyBuffer*> mVertexBuffers;
+  Vector< Render::PropertyBuffer* > mVertexBuffers;
 
-  GeometryType  mGeometryType;
+  Dali::Vector< unsigned short> mIndices;
+  OwnerPointer< GpuBuffer > mIndexBuffer;
+  Type mGeometryType;
 
   // Booleans
-  bool mRequiresDepthTest : 1;
+  bool mIndicesChanged : 1;
   bool mHasBeenUpdated : 1;
   bool mAttributesChanged : 1;
-
 };
 
-} // namespace SceneGraph
+} // namespace Render
 } // namespace Internal
 } // namespace Dali
 
-#endif // DALI_INTERNAL_SCENE_GRAPH_SAMPLER_DATA_PROVIDER_H
+#endif // DALI_INTERNAL_RENDER_GEOMETRY_H