Geometry Batching
[platform/core/uifw/dali-core.git] / dali / internal / update / rendering / scene-graph-texture-set.h
index 2d0da55..efa1524 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 // INTERNAL INCLUDES
-#include <dali/devel-api/rendering/texture-set.h>
+#include <dali/public-api/rendering/texture-set.h>
 #include <dali/internal/common/buffer-index.h>
 #include <dali/internal/common/message.h>
 #include <dali/internal/event/common/event-thread-services.h>
@@ -32,12 +32,12 @@ class ResourceManager;
 
 namespace Render
 {
-class Sampler;
+struct Sampler;
+class NewTexture;
 }
 namespace SceneGraph
 {
 class Renderer;
-class Sampler;
 
 class TextureSet
 {
@@ -80,6 +80,13 @@ public:
   void SetSampler( size_t index, Render::Sampler* sampler );
 
   /**
+   * Set the texture at position "index"
+   * @param[in] index The index of the texture
+   * @param[in] texture The texture
+   */
+  void SetTexture( size_t index, Render::NewTexture* texture );
+
+  /**
    * Return whether any texture in the texture set has an alpha channel
    * @return true if at least one texture in the texture set has an alpha channel, false otherwise
    */
@@ -139,6 +146,24 @@ public:
     return mTextureId.Size();
   }
 
+  /**
+   * Get the number of NewTextures in the texture set
+   * @return The number of NewTextures
+   */
+  size_t GetNewTextureCount()
+  {
+    return mTextures.Size();
+  }
+
+  /**
+   * Get the pointer to  a NewTexture in the TextureSet
+   * @param[in] index The index of the texture in the textures array
+   * @return the pointer to the NewTexture in that position
+   */
+  Render::NewTexture* GetNewTexture( size_t index )
+  {
+    return mTextures[index];
+  }
 
 private:
 
@@ -156,6 +181,7 @@ private:
 private: // Data
 
   Vector< Render::Sampler* >      mSamplers;                    ///< List of samplers used by each texture. Not owned
+  Vector< Render::NewTexture* >   mTextures;                    ///< List of NewTextures. Not owned
   Vector< ResourceId >            mTextureId;                   ///< List of texture ids
   Vector<Renderer*>               mRenderers;                   ///< List of renderers using the TextureSet
   bool                            mResourcesReady;              ///< if the textures are ready to be used for rendering
@@ -175,6 +201,17 @@ inline void SetImageMessage( EventThreadServices& eventThreadServices, const Tex
   new (slot) LocalType( &textureSet, &TextureSet::SetImage, index, resourceId );
 }
 
+inline void SetTextureMessage( EventThreadServices& eventThreadServices, const TextureSet& textureSet, size_t index, Render::NewTexture* texture )
+{
+  typedef MessageValue2< TextureSet, size_t, Render::NewTexture* > LocalType;
+
+  // Reserve some memory inside the message queue
+  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new (slot) LocalType( &textureSet, &TextureSet::SetTexture, index, texture );
+}
+
 inline void SetSamplerMessage( EventThreadServices& eventThreadServices, const TextureSet& textureSet, size_t index, Render::Sampler* sampler )
 {
   typedef MessageValue2< TextureSet, size_t, Render::Sampler* > LocalType;