Rendering API clean-up 49/64949/10
authorFerran Sole <ferran.sole@samsung.com>
Wed, 6 Apr 2016 09:41:28 +0000 (10:41 +0100)
committerFerran Sole <ferran.sole@samsung.com>
Mon, 18 Apr 2016 07:22:16 +0000 (08:22 +0100)
Change-Id: I282a24900e667bdc29ba45cf95d7e22457df137c

56 files changed:
automated-tests/src/dali-toolkit/utc-Dali-ControlRenderer.cpp
automated-tests/src/dali-toolkit/utc-Dali-RendererFactory.cpp
dali-toolkit/devel-api/controls/renderer-factory/control-renderer.h
dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp
dali-toolkit/internal/controls/bubble-effect/bubble-actor.cpp
dali-toolkit/internal/controls/bubble-effect/bubble-actor.h
dali-toolkit/internal/controls/bubble-effect/bubble-effect.h
dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp
dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.h
dali-toolkit/internal/controls/model3d-view/model3d-view-impl.cpp
dali-toolkit/internal/controls/model3d-view/model3d-view-impl.h
dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp
dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.h
dali-toolkit/internal/controls/renderers/border/border-renderer.cpp
dali-toolkit/internal/controls/renderers/color/color-renderer.cpp
dali-toolkit/internal/controls/renderers/debug/debug-renderer.cpp
dali-toolkit/internal/controls/renderers/gradient/gradient-renderer.cpp
dali-toolkit/internal/controls/renderers/image-atlas-manager.cpp
dali-toolkit/internal/controls/renderers/image-atlas-manager.h
dali-toolkit/internal/controls/renderers/image/image-renderer.cpp
dali-toolkit/internal/controls/renderers/image/image-renderer.h
dali-toolkit/internal/controls/renderers/npatch/npatch-renderer.cpp
dali-toolkit/internal/controls/renderers/npatch/npatch-renderer.h
dali-toolkit/internal/controls/renderers/renderer-factory-impl.cpp
dali-toolkit/internal/controls/renderers/svg/svg-rasterize-thread.cpp
dali-toolkit/internal/controls/renderers/svg/svg-rasterize-thread.h
dali-toolkit/internal/controls/renderers/svg/svg-renderer.cpp
dali-toolkit/internal/controls/renderers/svg/svg-renderer.h
dali-toolkit/internal/controls/scrollable/bouncing-effect-actor.cpp
dali-toolkit/internal/filters/blur-two-pass-filter.cpp
dali-toolkit/internal/text/decorator/text-decorator.cpp
dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager-impl.cpp
dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager-impl.h
dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.cpp
dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.h
dali-toolkit/internal/text/rendering/atlas/atlas-manager-impl.cpp
dali-toolkit/internal/text/rendering/atlas/atlas-manager-impl.h
dali-toolkit/internal/text/rendering/atlas/atlas-manager.cpp
dali-toolkit/internal/text/rendering/atlas/atlas-manager.h
dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp
dali-toolkit/internal/transition-effects/cube-transition-effect-impl.cpp
node-addon/build/tizen/CMakeLists.txt
plugins/dali-script-v8/file.list
plugins/dali-script-v8/src/actors/actor-api.cpp
plugins/dali-script-v8/src/dali-wrapper.cpp
plugins/dali-script-v8/src/rendering/material-api.cpp [deleted file]
plugins/dali-script-v8/src/rendering/material-api.h [deleted file]
plugins/dali-script-v8/src/rendering/material-wrapper.h [deleted file]
plugins/dali-script-v8/src/rendering/renderer-api.cpp
plugins/dali-script-v8/src/rendering/renderer-api.h
plugins/dali-script-v8/src/rendering/renderer-wrapper.cpp
plugins/dali-script-v8/src/rendering/texture-set-api.cpp [new file with mode: 0644]
plugins/dali-script-v8/src/rendering/texture-set-api.h [new file with mode: 0644]
plugins/dali-script-v8/src/rendering/texture-set-wrapper.cpp [moved from plugins/dali-script-v8/src/rendering/material-wrapper.cpp with 51% similarity]
plugins/dali-script-v8/src/rendering/texture-set-wrapper.h [new file with mode: 0644]
plugins/dali-script-v8/src/shared/base-wrapped-object.h

index 28bb29a..9a89c9c 100644 (file)
@@ -18,7 +18,7 @@
 #include <stdlib.h>
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali/devel-api/rendering/renderer.h>
 #include <stdlib.h>
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali/devel-api/rendering/renderer.h>
-#include <dali/devel-api/rendering/material.h>
+#include <dali/devel-api/rendering/texture-set.h>
 #include <dali/devel-api/rendering/shader.h>
 #include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h>
 
 #include <dali/devel-api/rendering/shader.h>
 #include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h>
 
index 6707da6..45550c2 100644 (file)
@@ -19,7 +19,7 @@
 #include <dali-toolkit-test-suite-utils.h>
 #include <toolkit-event-thread-callback.h>
 #include <dali/devel-api/rendering/renderer.h>
 #include <dali-toolkit-test-suite-utils.h>
 #include <toolkit-event-thread-callback.h>
 #include <dali/devel-api/rendering/renderer.h>
-#include <dali/devel-api/rendering/material.h>
+#include <dali/devel-api/rendering/texture-set.h>
 #include <dali/devel-api/rendering/shader.h>
 #include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h>
 
 #include <dali/devel-api/rendering/shader.h>
 #include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h>
 
@@ -187,7 +187,6 @@ void TestControlRendererRender( ToolkitTestApplication& application,
   controlRenderer.SetOnStage( actor );
 
   DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
   controlRenderer.SetOnStage( actor );
 
   DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
-  DALI_TEST_CHECK( actor.GetRendererAt(0u).GetMaterial().GetNumberOfTextures() == expectedSamplers );
 
   application.SendNotification();
   application.Render();
 
   application.SendNotification();
   application.Render();
@@ -915,8 +914,6 @@ int UtcDaliRendererFactoryGetSvgRenderer(void)
   application.Render();
 
   DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
   application.Render();
 
   DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
-  // texture is not added until the rasterization completed.
-  DALI_TEST_CHECK( actor.GetRendererAt(0u).GetMaterial().GetNumberOfTextures() == 0 );
 
   EventThreadCallback* eventTrigger = EventThreadCallback::Get();
   CallbackBase* callback = eventTrigger->GetCallback();
 
   EventThreadCallback* eventTrigger = EventThreadCallback::Get();
   CallbackBase* callback = eventTrigger->GetCallback();
@@ -925,8 +922,6 @@ int UtcDaliRendererFactoryGetSvgRenderer(void)
   CallbackBase::Execute( *callback );
 
   DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
   CallbackBase::Execute( *callback );
 
   DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
-  DALI_TEST_CHECK( actor.GetRendererAt(0u).GetMaterial().GetNumberOfTextures() == 1 );
-
 
   // waiting for the resource uploading
   application.SendNotification();
 
   // waiting for the resource uploading
   application.SendNotification();
@@ -1040,7 +1035,6 @@ int UtcDaliRendererFactoryResetRenderer3(void)
   application.Render();
 
   DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
   application.Render();
 
   DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
-  DALI_TEST_CHECK( actor.GetRendererAt(0u).GetMaterial().GetNumberOfTextures() == 1 );
 
   // reset the renderer to renderer a svg image
   factory.ResetRenderer( controlRenderer, actor, TEST_SVG_FILE_NAME, ImageDimensions( 100, 100 ) );
 
   // reset the renderer to renderer a svg image
   factory.ResetRenderer( controlRenderer, actor, TEST_SVG_FILE_NAME, ImageDimensions( 100, 100 ) );
@@ -1048,8 +1042,6 @@ int UtcDaliRendererFactoryResetRenderer3(void)
   application.Render();
 
   DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
   application.Render();
 
   DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
-  // texture is not added until the rasterization completed.
-  DALI_TEST_CHECK( actor.GetRendererAt(0u).GetMaterial().GetNumberOfTextures() == 0 );
 
   EventThreadCallback* eventTrigger = EventThreadCallback::Get();
   CallbackBase* callback = eventTrigger->GetCallback();
 
   EventThreadCallback* eventTrigger = EventThreadCallback::Get();
   CallbackBase* callback = eventTrigger->GetCallback();
@@ -1057,7 +1049,5 @@ int UtcDaliRendererFactoryResetRenderer3(void)
   eventTrigger->WaitingForTrigger( 1 );// waiting until the svg image is rasterized.
   CallbackBase::Execute( *callback );
 
   eventTrigger->WaitingForTrigger( 1 );// waiting until the svg image is rasterized.
   CallbackBase::Execute( *callback );
 
-  DALI_TEST_CHECK( actor.GetRendererAt(0u).GetMaterial().GetNumberOfTextures() == 1 );
-
   END_TEST;
 }
   END_TEST;
 }
index e95d906..be5db96 100644 (file)
@@ -35,7 +35,7 @@ class ControlRenderer;
 /**
  * @brief ControlRenderer provides renderer for rendering the controls. A control may have multiple ControlRenders.
  *
 /**
  * @brief ControlRenderer provides renderer for rendering the controls. A control may have multiple ControlRenders.
  *
- * ControlRenderers reuses geometry, shader etc. across controls and manages the renderer and material to exist only when control is on-stage.
+ * ControlRenderers reuses geometry, shader etc. across controls and manages the renderer and texture sets to exist only when control is on-stage.
  * It also responds to actor size and color change, and provides the clipping at the renderer level.
  * Note: The control renderer responds to the the Actor::COLOR by blending it with the 'Multiply' operator.
  */
  * It also responds to actor size and color change, and provides the clipping at the renderer level.
  * Note: The control renderer responds to the the Actor::COLOR by blending it with the 'Multiply' operator.
  */
index 474a16e..ab3a9c9 100644 (file)
@@ -83,8 +83,6 @@ const char* const BLOOM_SATURATION_PROPERTY_NAME = "uBloomSaturation";
 const char* const IMAGE_INTENSITY_PROPERTY_NAME = "uImageIntensity";
 const char* const IMAGE_SATURATION_PROPERTY_NAME = "uImageSaturation";
 
 const char* const IMAGE_INTENSITY_PROPERTY_NAME = "uImageIntensity";
 const char* const IMAGE_SATURATION_PROPERTY_NAME = "uImageSaturation";
 
-const char* const EFFECT_IMAGE_NAME( "sEffect" );
-
 ///////////////////////////////////////////////////////
 //
 // Bloom shaders
 ///////////////////////////////////////////////////////
 //
 // Bloom shaders
@@ -393,16 +391,8 @@ void BloomView::AllocateResources()
 
     // use the completed blur in the first buffer and composite with the original child actors render
     mCompositeImageActor.SetImage( mRenderTargetForRenderingChildren );
 
     // use the completed blur in the first buffer and composite with the original child actors render
     mCompositeImageActor.SetImage( mRenderTargetForRenderingChildren );
-    Material material = mCompositeImageActor.GetRendererAt(0).GetMaterial();
-    int textureIndex = material.GetTextureIndex( EFFECT_IMAGE_NAME );
-    if( textureIndex == -1 )
-    {
-      material.AddTexture( mBlurExtractTarget, EFFECT_IMAGE_NAME );
-    }
-    else
-    {
-      material.SetTextureImage( textureIndex, mBlurExtractTarget );
-    }
+    TextureSet textureSet = mCompositeImageActor.GetRendererAt(0).GetTextures();
+    textureSet.SetImage( 1u, mBlurExtractTarget );
 
     // set up target actor for rendering result, i.e. the blurred image
     mTargetImageActor.SetImage(mOutputRenderTarget);
 
     // set up target actor for rendering result, i.e. the blurred image
     mTargetImageActor.SetImage(mOutputRenderTarget);
index e1ef66c..f42b72b 100644 (file)
@@ -50,7 +50,7 @@ BubbleActor::BubbleActor( unsigned int numberOfBubble,
   mActor = Actor::New();
 }
 
   mActor = Actor::New();
 }
 
-void BubbleActor::MakeRenderable( Geometry geometry, Material material  )
+void BubbleActor::MakeRenderable( Geometry geometry, TextureSet textureSet, Shader shader  )
 {
   if( mRenderer )
   {
 {
   if( mRenderer )
   {
@@ -58,7 +58,8 @@ void BubbleActor::MakeRenderable( Geometry geometry, Material material  )
     return;
   }
 
     return;
   }
 
-  mRenderer = Renderer::New( geometry, material );
+  mRenderer = Renderer::New( geometry, shader );
+  mRenderer.SetTextures( textureSet );
 
   mActor.AddRenderer( mRenderer );
   mActor.SetSize( mMovementArea );
 
   mActor.AddRenderer( mRenderer );
   mActor.SetSize( mMovementArea );
index 357cddf..6d5ef93 100644 (file)
@@ -61,9 +61,10 @@ public:
   /**
    * Prepare for the rendering: create and add renderer, and register properties
    * @param[in] geometry The geometry to be used by the renderer
   /**
    * Prepare for the rendering: create and add renderer, and register properties
    * @param[in] geometry The geometry to be used by the renderer
-   * @param[in] material The material to be used by the renderer
+   * @param[in] textureSet The texture set to be used by the renderer
+   * @param[in] textureSet The shader set to be used by the renderer
    */
    */
-  void MakeRenderable( Geometry geometry, Material material  );
+  void MakeRenderable( Geometry geometry, TextureSet textureSet, Shader shader  );
 
   /**
    * Return the mesh actor which is used to display the bubbles
 
   /**
    * Return the mesh actor which is used to display the bubbles
index 9d0e24f..9fc065a 100644 (file)
@@ -32,7 +32,7 @@ namespace Internal
 {
 
 /**
 {
 
 /**
- * Create the shader to be used by the material
+ * Create the shader to be used by the renderer
  * @param[in] numberOfBubble How many groups of uniforms are used to control the bubble movement.
  * @return A handle to the newly created shader.
  */
  * @param[in] numberOfBubble How many groups of uniforms are used to control the bubble movement.
  * @return A handle to the newly created shader.
  */
@@ -108,7 +108,7 @@ inline Shader CreateBubbleShader( unsigned int numBubble )
   {\n
     // Get the emit pisition color, and Mix with the actor color
     mediump vec4 fragColor = texture2D(sBackground, vEffectTexCoord)*uColor;\n
   {\n
     // Get the emit pisition color, and Mix with the actor color
     mediump vec4 fragColor = texture2D(sBackground, vEffectTexCoord)*uColor;\n
-    // Apply the shape defined by the texture contained in the material
+    // Apply the shape defined by the texture contained sBubbleShape
     // And make the opacity being 0.7, and animate from 0.7 to 0 during the last 1/3 of movement
     fragColor.a  *= texture2D(sBubbleShape, vTexCoord).a * ( 2.1 - max( vPercentage*2.1, 1.4 ) );\n
     gl_FragColor = fragColor;\n
     // And make the opacity being 0.7, and animate from 0.7 to 0 during the last 1/3 of movement
     fragColor.a  *= texture2D(sBubbleShape, vTexCoord).a * ( 2.1 - max( vPercentage*2.1, 1.4 ) );\n
     gl_FragColor = fragColor;\n
index 392fa9c..836a26d 100644 (file)
@@ -142,9 +142,9 @@ void BubbleEmitter::OnInitialize()
 
   Shader bubbleShader = CreateBubbleShader (mNumBubblePerActor );
 
 
   Shader bubbleShader = CreateBubbleShader (mNumBubblePerActor );
 
-  mMaterial = Material::New( bubbleShader );
-  mMaterial.AddTexture( mEffectImage, "sBackground" );
-  mMaterial.AddTexture( mShapeImage,  "sBubbleShape" );
+  mTextureSet = TextureSet::New();
+  mTextureSet.SetImage( 0u, mEffectImage );
+  mTextureSet.SetImage( 1u, mShapeImage );
 
   mBubbleActors.resize( mNumActor );
 
 
   mBubbleActors.resize( mNumActor );
 
@@ -152,7 +152,7 @@ void BubbleEmitter::OnInitialize()
   for(unsigned int i=0; i < mNumActor; i++ )
   {
     mBubbleActors[i] = new BubbleActor( mNumBubblePerActor, mMovementArea );
   for(unsigned int i=0; i < mNumActor; i++ )
   {
     mBubbleActors[i] = new BubbleActor( mNumBubblePerActor, mMovementArea );
-    (mBubbleActors[i])->MakeRenderable( mMeshGeometry, mMaterial );
+    (mBubbleActors[i])->MakeRenderable( mMeshGeometry, mTextureSet, bubbleShader );
     mBubbleRoot.Add( (mBubbleActors[i])->GetMeshActor() );
   }
 
     mBubbleRoot.Add( (mBubbleActors[i])->GetMeshActor() );
   }
 
@@ -200,7 +200,7 @@ void BubbleEmitter::SetBackground( Image bgImage, const Vector3& hsvDelta )
 
 void BubbleEmitter::SetShapeImage( Image shapeImage )
 {
 
 void BubbleEmitter::SetShapeImage( Image shapeImage )
 {
-  mMaterial.SetTextureImage( 1, shapeImage );
+  mTextureSet.SetImage( 1, shapeImage );
 }
 
 void BubbleEmitter::SetBubbleScale( float scale )
 }
 
 void BubbleEmitter::SetBubbleScale( float scale )
index 1509248..ef94386 100644 (file)
@@ -158,7 +158,7 @@ private:
   CameraActor                 mCameraActor;         ///< The render task views the scene from the perspective of this actor.
 
   Geometry                    mMeshGeometry;         ///< The mesh geometry which contains the vertices and indices data
   CameraActor                 mCameraActor;         ///< The render task views the scene from the perspective of this actor.
 
   Geometry                    mMeshGeometry;         ///< The mesh geometry which contains the vertices and indices data
-  Material                    mMaterial;             ///< The material which controls the bubble display
+  TextureSet                  mTextureSet;           ///< The texture set which controls the bubble display
   std::vector<BubbleActorPtr> mBubbleActors;         ///< The meshActor vector, its size is mNumShader.
 
   Vector2                     mMovementArea;        ///< The size of the bubble moving area, usually the same size as the background image actor.
   std::vector<BubbleActorPtr> mBubbleActors;         ///< The meshActor vector, its size is mNumShader.
 
   Vector2                     mMovementArea;        ///< The size of the bubble moving area, usually the same size as the background image actor.
index 7799287..75af670 100644 (file)
@@ -313,7 +313,7 @@ void Model3dView::SetProperty( BaseObject* object, Property::Index index, const
       }
       case Toolkit::Model3dView::Property::MATERIAL_URL:
       {
       }
       case Toolkit::Model3dView::Property::MATERIAL_URL:
       {
-        if( value.Get(impl.mMaterialUrl) )
+        if( value.Get(impl.mTextureSetUrl) )
         {
           impl.LoadMaterial();
           impl.CreateMaterial();
         {
           impl.LoadMaterial();
           impl.CreateMaterial();
@@ -377,7 +377,7 @@ Property::Value Model3dView::GetProperty( BaseObject* object, Property::Index in
       }
       case Toolkit::Model3dView::Property::MATERIAL_URL:
       {
       }
       case Toolkit::Model3dView::Property::MATERIAL_URL:
       {
-        value = impl.mMaterialUrl;
+        value = impl.mTextureSetUrl;
         break;
       }
       case Toolkit::Model3dView::Property::IMAGES_URL:
         break;
       }
       case Toolkit::Model3dView::Property::IMAGES_URL:
@@ -449,8 +449,8 @@ void Model3dView::OnInitialize()
   //Create empty versions of the geometry and material so we always have a Renderer
   Geometry mesh = Geometry::New();
   Shader shader = Shader::New( SIMPLE_VERTEX_SHADER, SIMPLE_FRAGMENT_SHADER, (Shader::ShaderHints)(Shader::HINT_REQUIRES_SELF_DEPTH_TEST | Shader::HINT_MODIFIES_GEOMETRY) );
   //Create empty versions of the geometry and material so we always have a Renderer
   Geometry mesh = Geometry::New();
   Shader shader = Shader::New( SIMPLE_VERTEX_SHADER, SIMPLE_FRAGMENT_SHADER, (Shader::ShaderHints)(Shader::HINT_REQUIRES_SELF_DEPTH_TEST | Shader::HINT_MODIFIES_GEOMETRY) );
-  Material material = Material::New( shader );
-  mRenderer = Renderer::New( mesh, material );
+  mRenderer = Renderer::New( mesh, shader );
+
 }
 
 void Model3dView::LoadGeometry()
 }
 
 void Model3dView::LoadGeometry()
@@ -482,7 +482,7 @@ void Model3dView::LoadMaterial()
   std::streampos fileSize;
   Dali::Vector<char> fileContent;
 
   std::streampos fileSize;
   Dali::Vector<char> fileContent;
 
-  if( FileLoader::ReadFile(mMaterialUrl, fileSize, fileContent, FileLoader::TEXT) )
+  if( FileLoader::ReadFile(mTextureSetUrl, fileSize, fileContent, FileLoader::TEXT) )
   {
     mObjLoader.LoadMaterial(fileContent.Begin(), fileSize, mTexture0Url, mTexture1Url, mTexture2Url);
   }
   {
     mObjLoader.LoadMaterial(fileContent.Begin(), fileSize, mTexture0Url, mTexture1Url, mTexture2Url);
   }
@@ -573,11 +573,12 @@ void Model3dView::CreateMaterial()
     mShader = Shader::New( SIMPLE_VERTEX_SHADER, SIMPLE_FRAGMENT_SHADER, (Shader::ShaderHints)(Shader::HINT_REQUIRES_SELF_DEPTH_TEST | Shader::HINT_MODIFIES_GEOMETRY) );
   }
 
     mShader = Shader::New( SIMPLE_VERTEX_SHADER, SIMPLE_FRAGMENT_SHADER, (Shader::ShaderHints)(Shader::HINT_REQUIRES_SELF_DEPTH_TEST | Shader::HINT_MODIFIES_GEOMETRY) );
   }
 
-  mMaterial = Material::New( mShader );
+  mTextureSet = TextureSet::New();
 
   if( mRenderer )
   {
 
   if( mRenderer )
   {
-    mRenderer.SetMaterial( mMaterial );
+    mRenderer.SetTextures( mTextureSet );
+    mRenderer.SetShader( mShader );
     mRenderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, Renderer::NONE);
   }
 
     mRenderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, Renderer::NONE);
   }
 
@@ -586,7 +587,7 @@ void Model3dView::CreateMaterial()
 
 void Model3dView::LoadTextures()
 {
 
 void Model3dView::LoadTextures()
 {
-  if( !mMaterial )
+  if( !mTextureSet )
     return ;
 
   if( mTexture0Url != "" )
     return ;
 
   if( mTexture0Url != "" )
@@ -597,7 +598,7 @@ void Model3dView::LoadTextures()
     Image tex0 = ResourceImage::New( imgUrl );
     if( tex0 )
     {
     Image tex0 = ResourceImage::New( imgUrl );
     if( tex0 )
     {
-      mMaterial.AddTexture( tex0, "sDiffuse" );
+      mTextureSet.SetImage( 0u, tex0 );
     }
   }
 
     }
   }
 
@@ -609,7 +610,7 @@ void Model3dView::LoadTextures()
     Image tex1 = ResourceImage::New( imgUrl );
     if (tex1)
     {
     Image tex1 = ResourceImage::New( imgUrl );
     if (tex1)
     {
-      mMaterial.AddTexture( tex1, "sNormal" );
+      mTextureSet.SetImage( 1u, tex1 );
     }
   }
 
     }
   }
 
@@ -621,7 +622,7 @@ void Model3dView::LoadTextures()
     Image tex2 = ResourceImage::New( imgUrl );
     if( tex2 )
     {
     Image tex2 = ResourceImage::New( imgUrl );
     if( tex2 )
     {
-      mMaterial.AddTexture( tex2, "sGloss" );
+      mTextureSet.SetImage( 2u, tex2 );
     }
   }
 }
     }
   }
 }
index 2202409..8e44911 100644 (file)
@@ -150,7 +150,7 @@ private:
 
   //Properties
   std::string mObjUrl;
 
   //Properties
   std::string mObjUrl;
-  std::string mMaterialUrl;
+  std::string mTextureSetUrl;
   std::string mImagesUrl;
   std::string mTexture0Url;
   std::string mTexture1Url;
   std::string mImagesUrl;
   std::string mTexture0Url;
   std::string mTexture1Url;
@@ -166,7 +166,7 @@ private:
 
   //Render members
   Shader mShader;
 
   //Render members
   Shader mShader;
-  Material mMaterial;
+  TextureSet mTextureSet;
   Geometry mMesh;
   Renderer mRenderer;
 };
   Geometry mMesh;
   Renderer mRenderer;
 };
index 19e8421..2fea479 100644 (file)
@@ -47,9 +47,6 @@ const char * const CUSTOM_SHADER( "shader" );
 const char * const CUSTOM_VERTEX_SHADER( "vertexShader" );
 const char * const CUSTOM_FRAGMENT_SHADER( "fragmentShader" );
 
 const char * const CUSTOM_VERTEX_SHADER( "vertexShader" );
 const char * const CUSTOM_FRAGMENT_SHADER( "fragmentShader" );
 
-// name of the texture in material
-const char * const TEXTURE_NAME( "sTexture" );
-
 // properties set on shader, these properties have the constant value in regardless of the page status
 const char * const PROPERTY_SPINE_SHADOW ( "uSpineShadowParameter" ); // uniform for both spine and turn effect
 
 // properties set on shader, these properties have the constant value in regardless of the page status
 const char * const PROPERTY_SPINE_SHADOW ( "uSpineShadowParameter" ); // uniform for both spine and turn effect
 
@@ -292,35 +289,37 @@ PageTurnView::Page::Page()
 
 void PageTurnView::Page::SetImage( Image image  )
 {
 
 void PageTurnView::Page::SetImage( Image image  )
 {
-  if( material.GetNumberOfTextures() > 0  )
-  {
-    material.SetTextureImage( 0u, image );
-  }
-  else
+  if( !textureSet )
   {
   {
-    material.AddTexture(image, TEXTURE_NAME);
+    textureSet = TextureSet::New();
   }
   }
+
+  textureSet.SetImage( 0u, image );
 }
 
 }
 
-void PageTurnView::Page::UseEffect(Shader shader)
+void PageTurnView::Page::UseEffect(Shader newShader)
 {
 {
-  if( material )
-  {
-    material.SetShader( shader );
-  }
-  else
+  shader = newShader;
+  if( renderer )
   {
   {
-    material = Material::New( shader );
+    renderer.SetShader( shader );
   }
 }
 
   }
 }
 
-void PageTurnView::Page::UseEffect(Shader shader, Geometry geometry)
+void PageTurnView::Page::UseEffect(Shader newShader, Geometry geometry)
 {
 {
-  UseEffect( shader );
+  UseEffect( newShader );
 
   if( !renderer )
   {
 
   if( !renderer )
   {
-    renderer = Renderer::New( geometry, material );
+    renderer = Renderer::New( geometry, shader );
+
+    if( !textureSet )
+    {
+      textureSet = TextureSet::New();
+    }
+
+    renderer.SetTextures( textureSet );
     actor.AddRenderer( renderer );
   }
 }
     actor.AddRenderer( renderer );
   }
 }
index e17f2a0..1f4bc16 100644 (file)
@@ -64,16 +64,16 @@ protected:
 
     /**
      * Apply an effect onto the page actor.
 
     /**
      * Apply an effect onto the page actor.
-     * @param[in] shader The shader for rendering effect.
+     * @param[in] newShader The shader for rendering effect.
      */
      */
-    void UseEffect(Shader shader);
+    void UseEffect(Shader newShader);
 
     /**
      * Apply an effect onto the page actor.
 
     /**
      * Apply an effect onto the page actor.
-     * @param[in] shader The shader for rendering effect.
+     * @param[in] newShader The shader for rendering effect.
      * @param[in] geometry The geometry for rendering effect.
      */
      * @param[in] geometry The geometry for rendering effect.
      */
-    void UseEffect(Shader shader, Geometry geometry);
+    void UseEffect(Shader newShader, Geometry geometry);
 
     /**
      * Change the page turning direction.
 
     /**
      * Change the page turning direction.
@@ -105,7 +105,8 @@ protected:
     void SetCurrentCenter( const Vector2& value );
 
     Actor actor;                              ///< The page actor
     void SetCurrentCenter( const Vector2& value );
 
     Actor actor;                              ///< The page actor
-    Material material;                        ///< The material of the actor
+    Shader shader;                            ///< The shader used by the actor
+    TextureSet textureSet;                    ///< The set of textures used by the actor
     Renderer renderer;                        ///< The renderer of the actor
     bool isTurnBack;                          ///< The turning direction
     Property::Index propertyPanDisplacement;  ///< The horizontal displacement of the pan
     Renderer renderer;                        ///< The renderer of the actor
     bool isTurnBack;                          ///< The turning direction
     Property::Index propertyPanDisplacement;  ///< The horizontal displacement of the pan
index 6432ae0..9ae46a1 100644 (file)
@@ -174,8 +174,10 @@ void BorderRenderer::InitializeRenderer()
     mFactoryCache.SaveGeometry( RendererFactoryCache::BORDER_GEOMETRY, geometry );
   }
 
     mFactoryCache.SaveGeometry( RendererFactoryCache::BORDER_GEOMETRY, geometry );
   }
 
-  Material material = Material::New( GetBorderShader() );
-  mImpl->mRenderer = Renderer::New( geometry, material );
+
+  Shader shader = GetBorderShader();
+  mImpl->mRenderer = Renderer::New( geometry, shader  );
+
 }
 
 void BorderRenderer::SetBorderColor(const Vector4& color)
 }
 
 void BorderRenderer::SetBorderColor(const Vector4& color)
@@ -209,9 +211,8 @@ void BorderRenderer::RequireAntiAliasing( bool antiAliasing )
     mAntiAliasing = antiAliasing;
     if( mImpl->mRenderer )
     {
     mAntiAliasing = antiAliasing;
     if( mImpl->mRenderer )
     {
-      Material material =  mImpl->mRenderer.GetMaterial();
-      Shader shader = GetBorderShader();
-      material.SetShader( shader );
+      Shader borderShader( GetBorderShader() );
+      mImpl->mRenderer.SetShader( borderShader );
       if( mAntiAliasing )
       {
         mImpl->mRenderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::ON );
       if( mAntiAliasing )
       {
         mImpl->mRenderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::ON );
index ddc41f5..abdee4e 100644 (file)
@@ -131,8 +131,7 @@ void ColorRenderer::InitializeRenderer()
     mFactoryCache.SaveShader( RendererFactoryCache::COLOR_SHADER, shader );
   }
 
     mFactoryCache.SaveShader( RendererFactoryCache::COLOR_SHADER, shader );
   }
 
-  Material material = Material::New( shader );
-  mImpl->mRenderer = Renderer::New( geometry, material );
+  mImpl->mRenderer = Renderer::New( geometry, shader );
 
   mBlendColorIndex = mImpl->mRenderer.RegisterProperty( COLOR_NAME, mBlendColor );
   if( mBlendColor.a < 1.f )
 
   mBlendColorIndex = mImpl->mRenderer.RegisterProperty( COLOR_NAME, mBlendColor );
   if( mBlendColor.a < 1.f )
index 7ab33c7..6c3c58a 100644 (file)
@@ -92,9 +92,8 @@ void DebugRenderer::InitializeRenderer()
   {
     Geometry geometry = CreateQuadWireframeGeometry();
     Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
   {
     Geometry geometry = CreateQuadWireframeGeometry();
     Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
-    Material material = Material::New( shader );
-    mImpl->mRenderer = Renderer::New( geometry,
-                                      material );
+
+    mImpl->mRenderer = Renderer::New( geometry, shader);
     mFactoryCache.CacheDebugRenderer( mImpl->mRenderer );
   }
 }
     mFactoryCache.CacheDebugRenderer( mImpl->mRenderer );
   }
 }
index e11f3ff..f1838ae 100644 (file)
@@ -69,7 +69,6 @@ const char * const SPREAD_REPEAT("repeat");
 
 // uniform names
 const char * const UNIFORM_ALIGNMENT_MATRIX_NAME( "uAlignmentMatrix" );
 
 // uniform names
 const char * const UNIFORM_ALIGNMENT_MATRIX_NAME( "uAlignmentMatrix" );
-const char * const UNIFORM_TEXTULRE_NAME("sTexture");
 
 // default offset value
 const unsigned int DEFAULT_OFFSET_MINIMUM = 0.0f;
 
 // default offset value
 const unsigned int DEFAULT_OFFSET_MINIMUM = 0.0f;
@@ -316,16 +315,17 @@ void GradientRenderer::InitializeRenderer()
     mFactoryCache.SaveShader( shaderType, shader );
   }
 
     mFactoryCache.SaveShader( shaderType, shader );
   }
 
-  Material material;
-  material = Material::New( shader );
-  mImpl->mRenderer = Renderer::New( geometry, material );
-
+  //Set up the texture set
+  TextureSet textureSet = TextureSet::New();
   Dali::BufferImage lookupTexture = mGradient->GenerateLookupTexture();
   Dali::BufferImage lookupTexture = mGradient->GenerateLookupTexture();
-  Sampler sampler = Sampler::New();
+  textureSet.SetImage( 0u, lookupTexture );
   Dali::WrapMode::Type wrap = GetWrapMode( mGradient->GetSpreadMethod() );
   Dali::WrapMode::Type wrap = GetWrapMode( mGradient->GetSpreadMethod() );
+  Sampler sampler = Sampler::New();
   sampler.SetWrapMode(  wrap, wrap  );
   sampler.SetWrapMode(  wrap, wrap  );
+  textureSet.SetSampler( 0u, sampler );
 
 
-  material.AddTexture( lookupTexture, UNIFORM_TEXTULRE_NAME, sampler );
+  mImpl->mRenderer = Renderer::New( geometry, shader );
+  mImpl->mRenderer.SetTextures( textureSet );
 
   mImpl->mRenderer.RegisterProperty( UNIFORM_ALIGNMENT_MATRIX_NAME, mGradientTransform );
 }
 
   mImpl->mRenderer.RegisterProperty( UNIFORM_ALIGNMENT_MATRIX_NAME, mGradientTransform );
 }
index 7f6f4f6..03eb4a7 100644 (file)
@@ -37,10 +37,8 @@ const uint32_t MAX_ITEM_SIZE( 512u  );
 const uint32_t MAX_ITEM_AREA( MAX_ITEM_SIZE*MAX_ITEM_SIZE  );
 }
 
 const uint32_t MAX_ITEM_AREA( MAX_ITEM_SIZE*MAX_ITEM_SIZE  );
 }
 
-ImageAtlasManager::ImageAtlasManager( Shader shader, const std::string& textureUniformName )
-: mShader( shader ),
-  mTextureUniformName( textureUniformName ),
-  mBrokenImageUrl( "" )
+ImageAtlasManager::ImageAtlasManager()
+: mBrokenImageUrl( "" )
 {
 }
 
 {
 }
 
@@ -48,7 +46,7 @@ ImageAtlasManager::~ImageAtlasManager()
 {
 }
 
 {
 }
 
-Material ImageAtlasManager::Add( Vector4& textureRect,
+TextureSet ImageAtlasManager::Add( Vector4& textureRect,
                                  const std::string& url,
                                  ImageDimensions size,
                                  FittingMode::Type fittingMode,
                                  const std::string& url,
                                  ImageDimensions size,
                                  FittingMode::Type fittingMode,
@@ -66,7 +64,7 @@ Material ImageAtlasManager::Add( Vector4& textureRect,
       || dimensions.GetWidth()>DEFAULT_ATLAS_SIZE
       || dimensions.GetHeight()>DEFAULT_ATLAS_SIZE)
   {
       || dimensions.GetWidth()>DEFAULT_ATLAS_SIZE
       || dimensions.GetHeight()>DEFAULT_ATLAS_SIZE)
   {
-    return Material();
+    return TextureSet();
   }
 
   unsigned int i = 0;
   }
 
   unsigned int i = 0;
@@ -74,17 +72,17 @@ Material ImageAtlasManager::Add( Vector4& textureRect,
   {
     if( (*iter).Upload( textureRect, url, size, fittingMode, orientationCorrection ) )
     {
   {
     if( (*iter).Upload( textureRect, url, size, fittingMode, orientationCorrection ) )
     {
-      return mMaterialList[i];
+      return mTextureSetList[i];
     }
     i++;
   }
 
   CreateNewAtlas();
   mAtlasList.back().Upload( textureRect, url, size, fittingMode, orientationCorrection );
     }
     i++;
   }
 
   CreateNewAtlas();
   mAtlasList.back().Upload( textureRect, url, size, fittingMode, orientationCorrection );
-  return mMaterialList.back();
+  return mTextureSetList.back();
 }
 
 }
 
-Material ImageAtlasManager::Add( Vector4& textureRect,
+TextureSet ImageAtlasManager::Add( Vector4& textureRect,
                                  PixelDataPtr pixelData )
 {
 
                                  PixelDataPtr pixelData )
 {
 
@@ -93,7 +91,7 @@ Material ImageAtlasManager::Add( Vector4& textureRect,
       || pixelData->GetWidth()>DEFAULT_ATLAS_SIZE
       || pixelData->GetHeight()>DEFAULT_ATLAS_SIZE )
   {
       || pixelData->GetWidth()>DEFAULT_ATLAS_SIZE
       || pixelData->GetHeight()>DEFAULT_ATLAS_SIZE )
   {
-    return Material();
+    return TextureSet();
   }
 
   unsigned int i = 0;
   }
 
   unsigned int i = 0;
@@ -101,23 +99,23 @@ Material ImageAtlasManager::Add( Vector4& textureRect,
   {
     if( (*iter).Upload( textureRect, pixelData ) )
     {
   {
     if( (*iter).Upload( textureRect, pixelData ) )
     {
-      return mMaterialList[i];
+      return mTextureSetList[i];
     }
     i++;
   }
 
   CreateNewAtlas();
   mAtlasList.back().Upload( textureRect, pixelData );
     }
     i++;
   }
 
   CreateNewAtlas();
   mAtlasList.back().Upload( textureRect, pixelData );
-  return mMaterialList.back();
+  return mTextureSetList.back();
 
 }
 
 
 }
 
-void ImageAtlasManager::Remove( Material material, const Vector4& textureRect )
+void ImageAtlasManager::Remove( TextureSet textureSet, const Vector4& textureRect )
 {
   unsigned int i = 0;
 {
   unsigned int i = 0;
-  for( MaterialContainer::iterator iter = mMaterialList.begin(); iter != mMaterialList.end(); ++iter)
+  for( TextureSetContainer::iterator iter = mTextureSetList.begin(); iter != mTextureSetList.end(); ++iter)
   {
   {
-    if( (*iter) == material )
+    if( (*iter) == textureSet )
     {
       mAtlasList[i].Remove(textureRect);
       return;
     {
       mAtlasList[i].Remove(textureRect);
       return;
@@ -142,9 +140,9 @@ void ImageAtlasManager::CreateNewAtlas()
     newAtlas.SetBrokenImage( mBrokenImageUrl );
   }
   mAtlasList.push_back( newAtlas );
     newAtlas.SetBrokenImage( mBrokenImageUrl );
   }
   mAtlasList.push_back( newAtlas );
-  Material newMaterial = Material::New( mShader );
-  newMaterial.AddTexture( newAtlas.GetAtlas(), mTextureUniformName );
-  mMaterialList.push_back( newMaterial );
+  TextureSet textureSet = TextureSet::New();
+  textureSet.SetImage( 0u, newAtlas.GetAtlas() );
+  mTextureSetList.push_back( textureSet );
 }
 
 } // namespace Internal
 }
 
 } // namespace Internal
index 8b562a9..e191351 100644 (file)
@@ -21,7 +21,7 @@
 #include <string>
 #include <dali/public-api/common/vector-wrapper.h>
 #include <dali/public-api/object/ref-object.h>
 #include <string>
 #include <dali/public-api/common/vector-wrapper.h>
 #include <dali/public-api/object/ref-object.h>
-#include <dali/devel-api/rendering/material.h>
+#include <dali/devel-api/rendering/texture-set.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/image-atlas/image-atlas.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/image-atlas/image-atlas.h>
@@ -42,17 +42,15 @@ class ImageAtlasManager : public RefObject
 {
 public:
   typedef std::vector< Toolkit::ImageAtlas > AtlasContainer;
 {
 public:
   typedef std::vector< Toolkit::ImageAtlas > AtlasContainer;
-  typedef std::vector< Material > MaterialContainer;
+  typedef std::vector< TextureSet > TextureSetContainer;
 
 public:
 
   /**
    * Construtor
    *
 
 public:
 
   /**
    * Construtor
    *
-   * @param[in] shader The shader for material.
-   * @param[in] textureUniformName The texture uniform name for the atlas image.
    */
    */
-  ImageAtlasManager( Shader shader, const std::string& textureUniformName );
+  ImageAtlasManager();
 
   /**
    * @brief Add an image to the atlas.
 
   /**
    * @brief Add an image to the atlas.
@@ -67,9 +65,9 @@ public:
    * @param [in] size The width and height to fit the loaded image to.
    * @param [in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter.
    * @param [in] orientationCorrection Reorient the image to respect any orientation metadata in its header.
    * @param [in] size The width and height to fit the loaded image to.
    * @param [in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter.
    * @param [in] orientationCorrection Reorient the image to respect any orientation metadata in its header.
-   * @return The material containing the image.
+   * @return The texture set containing the image.
    */
    */
-  Material Add( Vector4& textureRect,
+  TextureSet Add( Vector4& textureRect,
                 const std::string& url,
                 ImageDimensions size = ImageDimensions(),
                 FittingMode::Type fittingMode = FittingMode::DEFAULT,
                 const std::string& url,
                 ImageDimensions size = ImageDimensions(),
                 FittingMode::Type fittingMode = FittingMode::DEFAULT,
@@ -80,18 +78,18 @@ public:
    *
    * @param [out] textureRect The texture area of the resource image in the atlas.
    * @param [in] pixelData The pixel data.
    *
    * @param [out] textureRect The texture area of the resource image in the atlas.
    * @param [in] pixelData The pixel data.
-   * @return The material containing the image.
+   * @return The texture set containing the image.
    */
    */
-  Material Add( Vector4& textureRect,
+  TextureSet Add( Vector4& textureRect,
                 PixelDataPtr pixelData );
 
   /**
                 PixelDataPtr pixelData );
 
   /**
-   * Remove the image at the given rectangle from the material.
+   * Remove the image at the given rectangle from the texture set.
    *
    *
-   * @param [in] material The material containing the atlas image.
+   * @param [in] textureSet The texture set containing the atlas image.
    * @param [in] textureRect The texture area to be removed.
    */
    * @param [in] textureRect The texture area to be removed.
    */
-  void Remove( Material material, const Vector4& textureRect );
+  void Remove( TextureSet textureSet, const Vector4& textureRect );
 
   /**
    * @brief Set the broken image which is used to replace the image if loading fails.
 
   /**
    * @brief Set the broken image which is used to replace the image if loading fails.
@@ -100,6 +98,11 @@ public:
    */
   void SetBrokenImage( const std::string& brokenImageUrl );
 
    */
   void SetBrokenImage( const std::string& brokenImageUrl );
 
+  /**
+   * @brief Get shader
+   */
+  Shader GetShader() const;
+
 private:
 
   /**
 private:
 
   /**
@@ -130,9 +133,7 @@ protected:
 private:
 
   AtlasContainer    mAtlasList;
 private:
 
   AtlasContainer    mAtlasList;
-  MaterialContainer mMaterialList;
-  Shader            mShader;
-  std::string       mTextureUniformName;
+  TextureSetContainer mTextureSetList;
   std::string       mBrokenImageUrl;
 
 };
   std::string       mBrokenImageUrl;
 
 };
index 17eae58..c2bec85 100644 (file)
@@ -71,7 +71,6 @@ const char * const BOX_THEN_LINEAR("boxThenLinear");
 const char * const NO_FILTER("noFilter");
 const char * const DONT_CARE("dontCare");
 
 const char * const NO_FILTER("noFilter");
 const char * const DONT_CARE("dontCare");
 
-const std::string TEXTURE_UNIFORM_NAME = "sTexture";
 const std::string ATLAS_RECT_UNIFORM_NAME = "uAtlasRect";
 const std::string PIXEL_AREA_UNIFORM_NAME = "pixelArea";
 
 const std::string ATLAS_RECT_UNIFORM_NAME = "uAtlasRect";
 const std::string PIXEL_AREA_UNIFORM_NAME = "pixelArea";
 
@@ -359,8 +358,12 @@ Renderer ImageRenderer::CreateRenderer() const
     }
   }
 
     }
   }
 
-  Material material = Material::New( shader );
-  return Renderer::New( geometry, material );
+  TextureSet textureSet = TextureSet::New();
+
+  Renderer renderer = Renderer::New( geometry, shader );
+  renderer.SetTextures( textureSet );
+
+  return renderer;
 }
 
 Renderer ImageRenderer::CreateNativeImageRenderer() const
 }
 
 Renderer ImageRenderer::CreateNativeImageRenderer() const
@@ -396,8 +399,11 @@ Renderer ImageRenderer::CreateNativeImageRenderer() const
     }
   }
 
     }
   }
 
-  Material material = Material::New( shader );
-  return Renderer::New( geometry, material );
+  TextureSet textureSet = TextureSet::New();
+  Renderer renderer = Renderer::New( geometry, shader );
+  renderer.SetTextures( textureSet );
+
+  return renderer;
 }
 
 void ImageRenderer::InitializeRenderer( const std::string& imageUrl )
 }
 
 void ImageRenderer::InitializeRenderer( const std::string& imageUrl )
@@ -418,11 +424,13 @@ void ImageRenderer::InitializeRenderer( const std::string& imageUrl )
     if( !mImpl->mRenderer )
     {
       Vector4 atlasRect;
     if( !mImpl->mRenderer )
     {
       Vector4 atlasRect;
-      Material material = mAtlasManager.Add(atlasRect, imageUrl, mDesiredSize, mFittingMode, mSamplingMode );
-      if( material )
+      TextureSet textureSet = mAtlasManager.Add(atlasRect, imageUrl, mDesiredSize, mFittingMode, mSamplingMode );
+      if( textureSet )
       {
         Geometry geometry = CreateGeometry( mFactoryCache, ImageDimensions( 1, 1 ) );
       {
         Geometry geometry = CreateGeometry( mFactoryCache, ImageDimensions( 1, 1 ) );
-        mImpl->mRenderer = Renderer::New( geometry, material );
+        Shader shader( GetImageShader(mFactoryCache) );
+        mImpl->mRenderer = Renderer::New( geometry, shader );
+        mImpl->mRenderer.SetTextures( textureSet );
         mImpl->mRenderer.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, atlasRect );
       }
       else // big image, atlasing is not applied
         mImpl->mRenderer.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, atlasRect );
       }
       else // big image, atlasing is not applied
@@ -431,8 +439,8 @@ void ImageRenderer::InitializeRenderer( const std::string& imageUrl )
 
         ResourceImage image = Dali::ResourceImage::New( imageUrl, mDesiredSize, mFittingMode, mSamplingMode );
         image.LoadingFinishedSignal().Connect( this, &ImageRenderer::OnImageLoaded );
 
         ResourceImage image = Dali::ResourceImage::New( imageUrl, mDesiredSize, mFittingMode, mSamplingMode );
         image.LoadingFinishedSignal().Connect( this, &ImageRenderer::OnImageLoaded );
-        Material material = mImpl->mRenderer.GetMaterial();
-        material.AddTexture( image, TEXTURE_UNIFORM_NAME );
+        TextureSet textureSet = mImpl->mRenderer.GetTextures();
+        textureSet.SetImage( 0u, image );
       }
 
       mFactoryCache.SaveRenderer( imageUrl, mImpl->mRenderer );
       }
 
       mFactoryCache.SaveRenderer( imageUrl, mImpl->mRenderer );
@@ -728,17 +736,10 @@ void ImageRenderer::ApplyImageToSampler( const Image& image )
 {
   if( image )
   {
 {
   if( image )
   {
-    Material material = mImpl->mRenderer.GetMaterial();
-    if( material )
+    TextureSet textureSet = mImpl->mRenderer.GetTextures();
+    if( textureSet )
     {
     {
-      int index = material.GetTextureIndex( TEXTURE_UNIFORM_NAME );
-      if( index != -1 )
-      {
-        material.SetTextureImage( index, image );
-        return;
-      }
-
-      material.AddTexture( image, TEXTURE_UNIFORM_NAME );
+      textureSet.SetImage( 0u, image );
     }
   }
 }
     }
   }
 }
@@ -757,7 +758,7 @@ void ImageRenderer::OnImageLoaded( ResourceImage image )
 
 void ImageRenderer::CleanCache(const std::string& url)
 {
 
 void ImageRenderer::CleanCache(const std::string& url)
 {
-  Material material = mImpl->mRenderer.GetMaterial();
+  TextureSet textureSet = mImpl->mRenderer.GetTextures();
 
   Vector4 atlasRect( 0.f, 0.f, 1.f, 1.f );
   Property::Index index = mImpl->mRenderer.GetPropertyIndex( ATLAS_RECT_UNIFORM_NAME );
 
   Vector4 atlasRect( 0.f, 0.f, 1.f, 1.f );
   Property::Index index = mImpl->mRenderer.GetPropertyIndex( ATLAS_RECT_UNIFORM_NAME );
@@ -770,7 +771,7 @@ void ImageRenderer::CleanCache(const std::string& url)
   mImpl->mRenderer.Reset();
   if( mFactoryCache.CleanRendererCache( url ) && index != Property::INVALID_INDEX )
   {
   mImpl->mRenderer.Reset();
   if( mFactoryCache.CleanRendererCache( url ) && index != Property::INVALID_INDEX )
   {
-    mAtlasManager.Remove( material, atlasRect );
+    mAtlasManager.Remove( textureSet, atlasRect );
   }
 }
 
   }
 }
 
index a942f9a..1ae3e50 100644 (file)
@@ -167,9 +167,9 @@ public:
 private:
 
   /**
 private:
 
   /**
-   * @brief Applies the image to the material used for this renderer
+   * @brief Applies the image to the texture set used for this renderer
    *
    *
-   * @param[in] image The Image to apply to the material used for this renderer
+   * @param[in] image The Image to apply to the texture set used for this renderer
    */
   void ApplyImageToSampler( const Image& image );
 
    */
   void ApplyImageToSampler( const Image& image );
 
index 4f7fe40..df0e8f5 100644 (file)
@@ -47,8 +47,6 @@ const char * const RENDERER_TYPE_VALUE("nPatch");
 const char * const IMAGE_URL_NAME("imageUrl");
 const char * const BORDER_ONLY("borderOnly");
 
 const char * const IMAGE_URL_NAME("imageUrl");
 const char * const BORDER_ONLY("borderOnly");
 
-std::string TEXTURE_UNIFORM_NAME = "sTexture";
-
 const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
   attribute mediump vec2 aPosition;\n
   varying mediump vec2 vTexCoord;\n
 const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
   attribute mediump vec2 aPosition;\n
   varying mediump vec2 vTexCoord;\n
@@ -172,7 +170,7 @@ void AddVertex( Vector< Vector2 >& vertices, unsigned int x, unsigned int y )
   vertices.PushBack( Vector2( x, y ) );
 }
 
   vertices.PushBack( Vector2( x, y ) );
 }
 
-void RegisterStretchProperties( Material& material, const char * uniformName, const NinePatchImage::StretchRanges& stretchPixels, uint16_t imageExtent)
+void RegisterStretchProperties( TextureSet& textureSet, const char * uniformName, const NinePatchImage::StretchRanges& stretchPixels, uint16_t imageExtent)
 {
   uint16_t prevEnd = 0;
   uint16_t prevFix = 0;
 {
   uint16_t prevEnd = 0;
   uint16_t prevFix = 0;
@@ -188,7 +186,7 @@ void RegisterStretchProperties( Material& material, const char * uniformName, co
 
     std::stringstream uniform;
     uniform << uniformName << "[" << i << "]";
 
     std::stringstream uniform;
     uniform << uniformName << "[" << i << "]";
-    material.RegisterProperty( uniform.str(), Vector2( fix, stretch ) );
+    textureSet.RegisterProperty( uniform.str(), Vector2( fix, stretch ) );
 
     prevEnd = end;
     prevFix = fix;
 
     prevEnd = end;
     prevFix = fix;
@@ -199,7 +197,7 @@ void RegisterStretchProperties( Material& material, const char * uniformName, co
     prevFix += imageExtent - prevEnd;
     std::stringstream uniform;
     uniform << uniformName << "[" << i << "]";
     prevFix += imageExtent - prevEnd;
     std::stringstream uniform;
     uniform << uniformName << "[" << i << "]";
-    material.RegisterProperty( uniform.str(), Vector2( prevFix, prevStretch ) );
+    textureSet.RegisterProperty( uniform.str(), Vector2( prevFix, prevStretch ) );
   }
 }
 
   }
 }
 
@@ -369,8 +367,9 @@ void NPatchRenderer::InitializeRenderer()
     InitializeFromBrokenImage();
   }
 
     InitializeFromBrokenImage();
   }
 
-  Material material = Material::New( shader );
-  mImpl->mRenderer = Renderer::New( geometry, material );
+  TextureSet textureSet = TextureSet::New();
+  mImpl->mRenderer = Renderer::New( geometry, shader );
+  mImpl->mRenderer.SetTextures( textureSet );
 }
 
 
 }
 
 
@@ -443,19 +442,15 @@ void NPatchRenderer::ChangeRenderer( bool oldBorderOnly, size_t oldGridX, size_t
   if( gridChanged )
   {
     Shader shader = CreateShader();
   if( gridChanged )
   {
     Shader shader = CreateShader();
-    Material material;
+    TextureSet textureSet;
     if( shader )
     {
     if( shader )
     {
-      material = mImpl->mRenderer.GetMaterial();
-      if( material )
+      textureSet = mImpl->mRenderer.GetTextures();
+      if( !textureSet )
       {
       {
-        material.SetShader( shader );
+        InitializeFromBrokenImage();
       }
       }
-    }
-
-    if( !material )
-    {
-      InitializeFromBrokenImage();
+      mImpl->mRenderer.SetShader( shader );
     }
   }
 }
     }
   }
 }
@@ -543,18 +538,10 @@ void NPatchRenderer::InitializeFromBrokenImage()
 
 void NPatchRenderer::ApplyImageToSampler()
 {
 
 void NPatchRenderer::ApplyImageToSampler()
 {
-  Material material = mImpl->mRenderer.GetMaterial();
-  if( material )
+  TextureSet textureSet = mImpl->mRenderer.GetTextures();
+  if( textureSet )
   {
   {
-    int index = material.GetTextureIndex( TEXTURE_UNIFORM_NAME );
-    if( index > -1 )
-    {
-      material.SetTextureImage( index, mCroppedImage );
-    }
-    else
-    {
-      material.AddTexture(  mCroppedImage, TEXTURE_UNIFORM_NAME );
-    }
+    textureSet.SetImage( 0u, mCroppedImage );
 
     if( mStretchPixelsX.Size() == 1 && mStretchPixelsY.Size() == 1 )
     {
 
     if( mStretchPixelsX.Size() == 1 && mStretchPixelsY.Size() == 1 )
     {
@@ -565,18 +552,18 @@ void NPatchRenderer::ApplyImageToSampler()
       uint16_t stretchWidth = stretchX.GetY() - stretchX.GetX();
       uint16_t stretchHeight = stretchY.GetY() - stretchY.GetX();
 
       uint16_t stretchWidth = stretchX.GetY() - stretchX.GetX();
       uint16_t stretchHeight = stretchY.GetY() - stretchY.GetX();
 
-      material.RegisterProperty( "uFixed[0]", Vector2::ZERO );
-      material.RegisterProperty( "uFixed[1]", Vector2( stretchX.GetX(), stretchY.GetX()) );
-      material.RegisterProperty( "uFixed[2]", Vector2( mImageSize.GetWidth() - stretchWidth, mImageSize.GetHeight() - stretchHeight ) );
-      material.RegisterProperty( "uStretchTotal", Vector2( stretchWidth, stretchHeight ) );
+      textureSet.RegisterProperty( "uFixed[0]", Vector2::ZERO );
+      textureSet.RegisterProperty( "uFixed[1]", Vector2( stretchX.GetX(), stretchY.GetX()) );
+      textureSet.RegisterProperty( "uFixed[2]", Vector2( mImageSize.GetWidth() - stretchWidth, mImageSize.GetHeight() - stretchHeight ) );
+      textureSet.RegisterProperty( "uStretchTotal", Vector2( stretchWidth, stretchHeight ) );
     }
     else
     {
     }
     else
     {
-      material.RegisterProperty( "uNinePatchFactorsX[0]", Vector2::ZERO );
-      material.RegisterProperty( "uNinePatchFactorsY[0]", Vector2::ZERO );
+      textureSet.RegisterProperty( "uNinePatchFactorsX[0]", Vector2::ZERO );
+      textureSet.RegisterProperty( "uNinePatchFactorsY[0]", Vector2::ZERO );
 
 
-      RegisterStretchProperties( material, "uNinePatchFactorsX", mStretchPixelsX, mImageSize.GetWidth() );
-      RegisterStretchProperties( material, "uNinePatchFactorsY", mStretchPixelsY, mImageSize.GetHeight() );
+      RegisterStretchProperties( textureSet, "uNinePatchFactorsX", mStretchPixelsX, mImageSize.GetWidth() );
+      RegisterStretchProperties( textureSet, "uNinePatchFactorsY", mStretchPixelsY, mImageSize.GetHeight() );
     }
   }
 }
     }
   }
 }
index b6c22e8..44754d7 100644 (file)
@@ -189,7 +189,7 @@ private:
   void InitializeFromBrokenImage();
 
   /**
   void InitializeFromBrokenImage();
 
   /**
-   * @brief Applies this renderer's image to the sampler to the material used for this renderer
+   * @brief Applies this renderer's image to the sampler to the texture set used for this renderer
    */
   void ApplyImageToSampler();
 
    */
   void ApplyImageToSampler();
 
index acb09bf..2c88562 100644 (file)
@@ -46,8 +46,6 @@ const char * const IMAGE_RENDERER("image");
 const char * const N_PATCH_RENDERER("nPatch");
 const char * const SVG_RENDERER("svg");
 
 const char * const N_PATCH_RENDERER("nPatch");
 const char * const SVG_RENDERER("svg");
 
-const std::string TEXTURE_UNIFORM_NAME = "sTexture";
-
 const char * const BROKEN_RENDERER_IMAGE_URL( DALI_IMAGE_DIR "broken.png");
 
 }
 const char * const BROKEN_RENDERER_IMAGE_URL( DALI_IMAGE_DIR "broken.png");
 
 }
@@ -423,7 +421,7 @@ void RendererFactory::CreateAtlasManager()
   if( !mAtlasManager )
   {
     Shader shader = ImageRenderer::GetImageShader( *( mFactoryCache.Get() ) );
   if( !mAtlasManager )
   {
     Shader shader = ImageRenderer::GetImageShader( *( mFactoryCache.Get() ) );
-    mAtlasManager = new ImageAtlasManager(shader, TEXTURE_UNIFORM_NAME);
+    mAtlasManager = new ImageAtlasManager();
     mAtlasManager->SetBrokenImage( BROKEN_RENDERER_IMAGE_URL );
   }
 }
     mAtlasManager->SetBrokenImage( BROKEN_RENDERER_IMAGE_URL );
   }
 }
index 9e01462..5202d42 100644 (file)
 #include "nanosvg/nanosvgrast.h"
 #include "svg-renderer.h"
 
 #include "nanosvg/nanosvgrast.h"
 #include "svg-renderer.h"
 
-namespace
-{
-const std::string TEXTURE_UNIFORM_NAME = "sTexture";
-}
-
 namespace Dali
 {
 
 namespace Dali
 {
 
@@ -110,8 +105,8 @@ void SvgRasterizeThread::AddTask( RasterizingTaskPtr task )
     wasEmpty = mRasterizeTasks.empty();
     if( !wasEmpty && task != NULL)
     {
     wasEmpty = mRasterizeTasks.empty();
     if( !wasEmpty && task != NULL)
     {
-      // Remove the tasks with the same material.
-      // Older task which waiting to rasterize and apply the svg to the same material is expired.
+      // Remove the tasks with the same renderer.
+      // Older task which waiting to rasterize and apply the svg to the same renderer is expired.
       for( std::vector< RasterizingTaskPtr >::iterator it = mRasterizeTasks.begin(), endIt = mRasterizeTasks.end(); it != endIt; ++it )
       {
         if( (*it) && (*it)->GetSvgRenderer() == task->GetSvgRenderer() )
       for( std::vector< RasterizingTaskPtr >::iterator it = mRasterizeTasks.begin(), endIt = mRasterizeTasks.end(); it != endIt; ++it )
       {
         if( (*it) && (*it)->GetSvgRenderer() == task->GetSvgRenderer() )
index 8309674..e3b1ce2 100644 (file)
@@ -21,7 +21,7 @@
 #include <dali/devel-api/threading/conditional-wait.h>
 #include <dali/devel-api/threading/mutex.h>
 #include <dali/devel-api/threading/thread.h>
 #include <dali/devel-api/threading/conditional-wait.h>
 #include <dali/devel-api/threading/mutex.h>
 #include <dali/devel-api/threading/thread.h>
-#include <dali/devel-api/rendering/material.h>
+#include <dali/devel-api/rendering/texture-set.h>
 #include <dali/devel-api/images/pixel-data.h>
 #include <dali/public-api/images/buffer-image.h>
 #include <dali/public-api/common/intrusive-ptr.h>
 #include <dali/devel-api/images/pixel-data.h>
 #include <dali/public-api/images/buffer-image.h>
 #include <dali/public-api/common/intrusive-ptr.h>
@@ -138,9 +138,9 @@ public:
   RasterizingTaskPtr NextCompletedTask();
 
   /**
   RasterizingTaskPtr NextCompletedTask();
 
   /**
-   * Remove the task with the given material from the waiting queue, called by main thread.
+   * Remove the task with the given renderer from the waiting queue, called by main thread.
    *
    *
-   * Typically called when the actor is put off stage, so the material is not needed anymore.
+   * Typically called when the actor is put off stage, so the renderer is not needed anymore.
    *
    * @param[in] renderer The renderer pointer.
    */
    *
    * @param[in] renderer The renderer pointer.
    */
@@ -181,7 +181,7 @@ protected:
 
   /**
    * The entry function of the worker thread.
 
   /**
    * The entry function of the worker thread.
-   * It fetches task from the Queue, rasterizes the image and apply to the material.
+   * It fetches task from the Queue, rasterizes the image and apply to the renderer.
    */
   virtual void Run();
 
    */
   virtual void Run();
 
index d3c128d..2642c74 100644 (file)
@@ -104,8 +104,9 @@ void SvgRenderer::DoSetOnStage( Actor& actor )
     geometry =  mFactoryCache.CreateQuadGeometry();
     mFactoryCache.SaveGeometry( RendererFactoryCache::QUAD_GEOMETRY, geometry );
   }
     geometry =  mFactoryCache.CreateQuadGeometry();
     mFactoryCache.SaveGeometry( RendererFactoryCache::QUAD_GEOMETRY, geometry );
   }
-  Material material = Material::New( shader );
-  mImpl->mRenderer = Renderer::New( geometry, material );
+  TextureSet textureSet = TextureSet::New();
+  mImpl->mRenderer = Renderer::New( geometry, shader );
+  mImpl->mRenderer.SetTextures( textureSet );
 
   if( mImpl->mSize != Vector2::ZERO && mParsedImage )
   {
 
   if( mImpl->mSize != Vector2::ZERO && mParsedImage )
   {
@@ -197,19 +198,19 @@ void SvgRenderer::ApplyRasterizedImage( PixelDataPtr rasterizedPixelData )
 {
   if( GetIsOnStage()  )
   {
 {
   if( GetIsOnStage()  )
   {
-    Material currentMaterial = mImpl->mRenderer.GetMaterial();
+    TextureSet currentTextureSet = mImpl->mRenderer.GetTextures();
     if( mAtlasRect != FULL_TEXTURE_RECT )
     {
     if( mAtlasRect != FULL_TEXTURE_RECT )
     {
-      mAtlasManager.Remove( currentMaterial, mAtlasRect );
+      mAtlasManager.Remove( currentTextureSet, mAtlasRect );
     }
 
     Vector4 atlasRect;
     }
 
     Vector4 atlasRect;
-    Material material = mAtlasManager.Add(atlasRect, rasterizedPixelData );
-    if( material ) // atlasing
+    TextureSet textureSet = mAtlasManager.Add(atlasRect, rasterizedPixelData );
+    if( textureSet ) // atlasing
     {
     {
-      if( material != currentMaterial )
+      if( textureSet != currentTextureSet )
       {
       {
-        mImpl->mRenderer.SetMaterial( material );
+        mImpl->mRenderer.SetTextures( textureSet );
       }
       mImpl->mRenderer.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, atlasRect );
       mAtlasRect = atlasRect;
       }
       mImpl->mRenderer.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, atlasRect );
       mAtlasRect = atlasRect;
@@ -221,27 +222,20 @@ void SvgRenderer::ApplyRasterizedImage( PixelDataPtr rasterizedPixelData )
 
       if( mAtlasRect == FULL_TEXTURE_RECT )
       {
 
       if( mAtlasRect == FULL_TEXTURE_RECT )
       {
-        material = currentMaterial;
+        textureSet = currentTextureSet;
       }
       else
       {
       }
       else
       {
-        material = Material::New( ImageRenderer::GetImageShader( mFactoryCache ) );
-        mImpl->mRenderer.SetMaterial( material );
+        textureSet = TextureSet::New();
+        mImpl->mRenderer.SetTextures( textureSet );
 
         mImpl->mRenderer.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, FULL_TEXTURE_RECT );
         mAtlasRect = FULL_TEXTURE_RECT;
       }
 
 
         mImpl->mRenderer.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, FULL_TEXTURE_RECT );
         mAtlasRect = FULL_TEXTURE_RECT;
       }
 
-      if( material )
+      if( textureSet )
       {
       {
-        int index = material.GetTextureIndex( TEXTURE_UNIFORM_NAME );
-        if( index != -1 )
-        {
-          material.SetTextureImage( index, texture );
-          return;
-        }
-
-        material.AddTexture( texture, TEXTURE_UNIFORM_NAME );
+        textureSet.SetImage( 0u, texture );
       }
     }
   }
       }
     }
   }
index 2c20ba1..d1437ff 100644 (file)
@@ -121,7 +121,7 @@ public:
 
 private:
   /**
 
 private:
   /**
-   * @bried Rasterize the svg with the given size, and add it to the material.
+   * @bried Rasterize the svg with the given size, and add it to the renderer.
    *
    * @param[in] size The target size of the SVG rasterization.
    */
    *
    * @param[in] size The target size of the SVG rasterization.
    */
index 2218ddc..91e556f 100644 (file)
@@ -23,7 +23,7 @@
 #include <dali/public-api/object/property-map.h>
 #include <dali/devel-api/object/property-buffer.h>
 #include <dali/devel-api/rendering/geometry.h>
 #include <dali/public-api/object/property-map.h>
 #include <dali/devel-api/object/property-buffer.h>
 #include <dali/devel-api/rendering/geometry.h>
-#include <dali/devel-api/rendering/material.h>
+#include <dali/devel-api/rendering/texture-set.h>
 #include <dali/devel-api/rendering/renderer.h>
 #include <dali/devel-api/rendering/shader.h>
 
 #include <dali/devel-api/rendering/renderer.h>
 #include <dali/devel-api/rendering/shader.h>
 
@@ -127,12 +127,11 @@ Actor CreateBouncingEffectActor( Property::Index& bouncePropertyIndex )
   meshGeometry.AddVertexBuffer( vertices );
   meshGeometry.SetIndexBuffer( indices );
 
   meshGeometry.AddVertexBuffer( vertices );
   meshGeometry.SetIndexBuffer( indices );
 
-  // Create material
+  // Create the shader
   Shader shader = Shader::New( MESH_VERTEX_SHADER, MESH_FRAGMENT_SHADER );
   Shader shader = Shader::New( MESH_VERTEX_SHADER, MESH_FRAGMENT_SHADER );
-  Material material = Material::New( shader );
 
   // Create renderer
 
   // Create renderer
-  Renderer renderer = Renderer::New( meshGeometry, material );
+  Renderer renderer = Renderer::New( meshGeometry, shader );
 
   // Create actor
   Actor meshActor= Actor::New();
 
   // Create actor
   Actor meshActor= Actor::New();
index 1b3a5f1..ed8dada 100644 (file)
@@ -184,16 +184,8 @@ void BlurTwoPassFilter::Enable()
   mRootActor.Add( mActorForBlending );
 
   // Add effect texture to blend-two-image custom shader
   mRootActor.Add( mActorForBlending );
 
   // Add effect texture to blend-two-image custom shader
-  Material material = mActorForBlending.GetRendererAt(0).GetMaterial();
-  int textureIndex = material.GetTextureIndex( EFFECT_IMAGE_NAME );
-  if( textureIndex == -1 )
-  {
-    material.AddTexture( mInputImage, EFFECT_IMAGE_NAME );
-  }
-  else
-  {
-    material.SetTextureImage( textureIndex, mInputImage );
-  }
+  TextureSet textureSet = mActorForBlending.GetRendererAt(0).GetTextures();
+  textureSet.SetImage( 1u, mInputImage );
 
   SetupCamera();
   CreateRenderTasks();
 
   SetupCamera();
   CreateRenderTasks();
index 43ccb78..bb393ff 100644 (file)
@@ -284,8 +284,7 @@ struct Decorator::Impl : public ConnectionTracker
   {
     mQuadVertexFormat[ "aPosition" ] = Property::VECTOR2;
     mQuadIndexFormat[ "indices" ] = Property::INTEGER;
   {
     mQuadVertexFormat[ "aPosition" ] = Property::VECTOR2;
     mQuadIndexFormat[ "indices" ] = Property::INTEGER;
-    mHighlightMaterial = Material::New( Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ) );
-
+    mHighlightShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
     SetupTouchEvents();
   }
 
     SetupTouchEvents();
   }
 
@@ -1069,7 +1068,7 @@ struct Decorator::Impl : public ConnectionTracker
 
         if( !mHighlightRenderer )
         {
 
         if( !mHighlightRenderer )
         {
-          mHighlightRenderer = Dali::Renderer::New( mQuadGeometry, mHighlightMaterial );
+          mHighlightRenderer = Dali::Renderer::New( mQuadGeometry, mHighlightShader );
           mHighlightActor.AddRenderer( mHighlightRenderer );
         }
       }
           mHighlightActor.AddRenderer( mHighlightRenderer );
         }
       }
@@ -1653,7 +1652,7 @@ struct Decorator::Impl : public ConnectionTracker
 
   Actor               mHighlightActor;            ///< Actor to display highlight
   Renderer            mHighlightRenderer;
 
   Actor               mHighlightActor;            ///< Actor to display highlight
   Renderer            mHighlightRenderer;
-  Material            mHighlightMaterial;         ///< Material used for highlight
+  Shader              mHighlightShader;           ///< Shader used for highlight
   Property::Map       mQuadVertexFormat;
   Property::Map       mQuadIndexFormat;
   PopupImpl           mCopyPastePopup;
   Property::Map       mQuadVertexFormat;
   Property::Map       mQuadIndexFormat;
   PopupImpl           mCopyPastePopup;
index 49dd310..f40b3a4 100644 (file)
@@ -96,12 +96,11 @@ void AtlasGlyphManager::Add( const Text::GlyphInfo& glyph,
 
   if ( mAtlasManager.Add( bitmap, slot ) )
   {
 
   if ( mAtlasManager.Add( bitmap, slot ) )
   {
-    // A new atlas was created so set the material details for the atlas
+    // A new atlas was created so set the texture set details for the atlas
     Dali::Atlas atlas = mAtlasManager.GetAtlasContainer( slot.mAtlasId );
     Dali::Atlas atlas = mAtlasManager.GetAtlasContainer( slot.mAtlasId );
-    Pixel::Format pixelFormat = mAtlasManager.GetPixelFormat( slot.mAtlasId );
-    Material material = Material::New( pixelFormat == Pixel::L8 ? mShaderL8 : mShaderRgba );
-    material.AddTexture( atlas, "sTexture" );
-    mAtlasManager.SetMaterial( slot.mAtlasId, material );
+    TextureSet textureSet = TextureSet::New();
+    textureSet.SetImage( 0u, atlas );
+    mAtlasManager.SetTextures( slot.mAtlasId, textureSet );
   }
 
   GlyphRecordEntry record;
   }
 
   GlyphRecordEntry record;
@@ -252,9 +251,15 @@ void AtlasGlyphManager::AdjustReferenceCount( Text::FontId fontId, Text::GlyphIn
   }
 }
 
   }
 }
 
-Material AtlasGlyphManager::GetMaterial( uint32_t atlasId ) const
+TextureSet AtlasGlyphManager::GetTextures( uint32_t atlasId ) const
 {
 {
-  return mAtlasManager.GetMaterial( atlasId );
+  return mAtlasManager.GetTextures( atlasId );
+}
+
+Shader AtlasGlyphManager::GetShader( uint32_t atlasId ) const
+{
+  Pixel::Format pixelFormat = mAtlasManager.GetPixelFormat( atlasId );
+  return pixelFormat == Pixel::L8 ? mShaderL8 : mShaderRgba;
 }
 
 AtlasGlyphManager::~AtlasGlyphManager()
 }
 
 AtlasGlyphManager::~AtlasGlyphManager()
index 0c67501..90210f2 100644 (file)
@@ -108,9 +108,14 @@ public:
   void AdjustReferenceCount( Text::FontId fontId, Text::GlyphIndex index, int32_t delta );
 
   /**
   void AdjustReferenceCount( Text::FontId fontId, Text::GlyphIndex index, int32_t delta );
 
   /**
-   * @copydoc Toolkit::AtlasGlyphManager::GetMaterial
+   * @copydoc Toolkit::AtlasGlyphManager::GetTextures
    */
    */
-  Material GetMaterial( uint32_t atlasId ) const;
+  TextureSet GetTextures( uint32_t atlasId ) const;
+
+  /**
+   * @copydoc Toolkit::AtlasGlyphManager::GetShader
+   */
+  Shader GetShader( uint32_t atlasId ) const;
 
   /**
    * @copydoc Toolkit::AtlasGlyphManager::GetMetrics
 
   /**
    * @copydoc Toolkit::AtlasGlyphManager::GetMetrics
index 5a46ef5..abcd391 100644 (file)
@@ -106,9 +106,14 @@ Pixel::Format AtlasGlyphManager::GetPixelFormat( uint32_t atlasId )
   return GetImplementation(*this).GetPixelFormat( atlasId );
 }
 
   return GetImplementation(*this).GetPixelFormat( atlasId );
 }
 
-Material AtlasGlyphManager::GetMaterial( uint32_t atlasId ) const
+TextureSet AtlasGlyphManager::GetTextures( uint32_t atlasId ) const
 {
 {
-  return GetImplementation(*this).GetMaterial( atlasId );
+  return GetImplementation(*this).GetTextures( atlasId );
+}
+
+Shader AtlasGlyphManager::GetShader( uint32_t atlasId ) const
+{
+  return GetImplementation(*this).GetShader( atlasId );
 }
 
 const Toolkit::AtlasGlyphManager::Metrics& AtlasGlyphManager::GetMetrics()
 }
 
 const Toolkit::AtlasGlyphManager::Metrics& AtlasGlyphManager::GetMetrics()
index 1870bd5..3831589 100644 (file)
@@ -140,13 +140,22 @@ public:
   Pixel::Format GetPixelFormat( uint32_t atlasId );
 
   /**
   Pixel::Format GetPixelFormat( uint32_t atlasId );
 
   /**
-   * @brief Get the material used by an atlas
+   * @brief Get the texture set used by an atlas
    *
    * @param[in] atlasId Id of an atlas
    *
    *
    * @param[in] atlasId Id of an atlas
    *
-   * @return The material used by the atlas
+   * @return The texture set used by the atlas
    */
    */
-  Material GetMaterial( uint32_t atlasId ) const;
+  TextureSet GetTextures( uint32_t atlasId ) const;
+
+  /**
+   * @brief Get the shader used by an atlas
+   *
+   * @param[in] atlasId Id of an atlas
+   *
+   * @return The shader used by the atlas
+   */
+  Shader GetShader( uint32_t atlasId ) const;
 
   /**
    * @brief Get Glyph Manager metrics
 
   /**
    * @brief Get Glyph Manager metrics
index dacb141..8d3ae1b 100644 (file)
@@ -436,7 +436,7 @@ AtlasManager::SizeType AtlasManager::GetAtlasCount() const
   return mAtlasList.size();
 }
 
   return mAtlasList.size();
 }
 
-Pixel::Format AtlasManager::GetPixelFormat( AtlasId atlas )
+Pixel::Format AtlasManager::GetPixelFormat( AtlasId atlas ) const
 {
   DALI_ASSERT_DEBUG( atlas && atlas <= mAtlasList.size() );
   Pixel::Format pixelFormat = Pixel::RGBA8888;
 {
   DALI_ASSERT_DEBUG( atlas && atlas <= mAtlasList.size() );
   Pixel::Format pixelFormat = Pixel::RGBA8888;
@@ -476,23 +476,23 @@ void AtlasManager::GetMetrics( Toolkit::AtlasManager::Metrics& metrics )
   metrics.mTextureMemoryUsed = textureMemoryUsed;
 }
 
   metrics.mTextureMemoryUsed = textureMemoryUsed;
 }
 
-Material AtlasManager::GetMaterial( AtlasId atlas ) const
+TextureSet AtlasManager::GetTextures( AtlasId atlas ) const
 {
   DALI_ASSERT_DEBUG( atlas && atlas <= mAtlasList.size() );
 {
   DALI_ASSERT_DEBUG( atlas && atlas <= mAtlasList.size() );
-  Material material;
+  TextureSet textureSet;
   if ( atlas && atlas-- <= mAtlasList.size() )
   {
   if ( atlas && atlas-- <= mAtlasList.size() )
   {
-    material = mAtlasList[ atlas ].mMaterial;
+    textureSet = mAtlasList[ atlas ].mTextureSet;
   }
   }
-  return material;
+  return textureSet;
 }
 
 }
 
-void AtlasManager::SetMaterial( AtlasId atlas, Material& material )
+void AtlasManager::SetTextures( AtlasId atlas, TextureSet& textureSet )
 {
   DALI_ASSERT_DEBUG( atlas && atlas <= mAtlasList.size() );
   if ( atlas && atlas-- <= mAtlasList.size() )
   {
 {
   DALI_ASSERT_DEBUG( atlas && atlas <= mAtlasList.size() );
   if ( atlas && atlas-- <= mAtlasList.size() )
   {
-    mAtlasList[ atlas ].mMaterial = material;
+    mAtlasList[ atlas ].mTextureSet = textureSet;
   }
 }
 
   }
 }
 
index b4828a0..e86bda1 100644 (file)
@@ -64,7 +64,7 @@ public:
     Pixel::Format mPixelFormat;                                         // pixel format used by atlas
     BufferImage mHorizontalStrip;                                       // Image used to pad upload
     BufferImage mVerticalStrip;                                         // Image used to pad upload
     Pixel::Format mPixelFormat;                                         // pixel format used by atlas
     BufferImage mHorizontalStrip;                                       // Image used to pad upload
     BufferImage mVerticalStrip;                                         // Image used to pad upload
-    Material mMaterial;                                                 // material used for atlas texture
+    TextureSet mTextureSet;                                             // Texture set used for atlas texture
     SizeType mTotalBlocks;                                              // total number of blocks in atlas
     SizeType mAvailableBlocks;                                          // number of blocks available in atlas
     Dali::Vector< SizeType > mFreeBlocksList;                           // unless there are any previously freed blocks
     SizeType mTotalBlocks;                                              // total number of blocks in atlas
     SizeType mAvailableBlocks;                                          // number of blocks available in atlas
     Dali::Vector< SizeType > mFreeBlocksList;                           // unless there are any previously freed blocks
@@ -156,7 +156,7 @@ public:
   /**
    * @copydoc Toolkit::AtlasManager::GetPixelFormat
    */
   /**
    * @copydoc Toolkit::AtlasManager::GetPixelFormat
    */
-  Pixel::Format GetPixelFormat( AtlasId atlas );
+  Pixel::Format GetPixelFormat( AtlasId atlas ) const;
 
   /**
    * @copydoc Toolkit::AtlasManager::GetMetrics
 
   /**
    * @copydoc Toolkit::AtlasManager::GetMetrics
@@ -164,14 +164,14 @@ public:
   void GetMetrics( Toolkit::AtlasManager::Metrics& metrics );
 
   /**
   void GetMetrics( Toolkit::AtlasManager::Metrics& metrics );
 
   /**
-   * @copydoc Toolkit::AtlasManager::GetMaterial
+   * @copydoc Toolkit::AtlasManager::GetTextures
    */
    */
-  Material GetMaterial( AtlasId atlas ) const;
+  TextureSet GetTextures( AtlasId atlas ) const;
 
   /**
 
   /**
-   * @copydoc Toolkit::AtlasManager::SetMaterial
+   * @copydoc Toolkit::AtlasManager::SetTextures
    */
    */
-  void SetMaterial( AtlasId atlas, Material& material );
+  void SetTextures( AtlasId atlas, TextureSet& textureSet );
 
 private:
 
 
 private:
 
index 2aa1bce..d28b586 100644 (file)
@@ -108,7 +108,7 @@ AtlasManager::SizeType AtlasManager::GetAtlasCount() const
   return GetImplementation(*this).GetAtlasCount();
 }
 
   return GetImplementation(*this).GetAtlasCount();
 }
 
-Pixel::Format AtlasManager::GetPixelFormat( AtlasId atlas )
+Pixel::Format AtlasManager::GetPixelFormat( AtlasId atlas ) const
 {
   return GetImplementation(*this).GetPixelFormat( atlas );
 }
 {
   return GetImplementation(*this).GetPixelFormat( atlas );
 }
@@ -118,14 +118,14 @@ void AtlasManager::GetMetrics( Metrics& metrics )
   GetImplementation(*this).GetMetrics( metrics );
 }
 
   GetImplementation(*this).GetMetrics( metrics );
 }
 
-Material AtlasManager::GetMaterial( AtlasId atlas ) const
+TextureSet AtlasManager::GetTextures( AtlasId atlas ) const
 {
 {
-  return GetImplementation(*this).GetMaterial( atlas );
+  return GetImplementation(*this).GetTextures( atlas );
 }
 
 }
 
-void AtlasManager::SetMaterial( AtlasId atlas, Material& material )
+void AtlasManager::SetTextures( AtlasId atlas, TextureSet& textureSet )
 {
 {
-  GetImplementation(*this).SetMaterial( atlas, material );
+  GetImplementation(*this).SetTextures( atlas, textureSet );
 }
 
 } // namespace Toolkit
 }
 
 } // namespace Toolkit
index 3449362..75f117a 100644 (file)
@@ -22,7 +22,7 @@
 #include <dali/public-api/common/dali-vector.h>
 #include <dali/public-api/images/buffer-image.h>
 #include <dali/devel-api/images/atlas.h>
 #include <dali/public-api/common/dali-vector.h>
 #include <dali/public-api/images/buffer-image.h>
 #include <dali/devel-api/images/atlas.h>
-#include <dali/devel-api/rendering/material.h>
+#include <dali/devel-api/rendering/texture-set.h>
 
 namespace Dali
 {
 
 namespace Dali
 {
@@ -247,7 +247,7 @@ public:
    *
    * @return Pixel format used by this atlas
    */
    *
    * @return Pixel format used by this atlas
    */
-  Pixel::Format GetPixelFormat( AtlasId atlas );
+  Pixel::Format GetPixelFormat( AtlasId atlas ) const;
 
   /**
    * @brief Fill in a metrics structure showing current status of this Atlas Manager
 
   /**
    * @brief Fill in a metrics structure showing current status of this Atlas Manager
@@ -257,21 +257,21 @@ public:
   void GetMetrics( Metrics& metrics );
 
   /**
   void GetMetrics( Metrics& metrics );
 
   /**
-   * @brief Get Material used by atlas
+   * @brief Get TextureSet used by atlas
    *
    * @param[in] atlas AtlasId
    *
    *
    * @param[in] atlas AtlasId
    *
-   * @return Material used by atlas
+   * @return TextureSet used by atlas
    */
    */
-  Material GetMaterial( AtlasId atlas ) const;
+  TextureSet GetTextures( AtlasId atlas ) const;
 
   /**
 
   /**
-   * @brief Set the material used by an atlas
+   * @brief Set the texture set used by an atlas
    *
    * @param[in] atlas AtlasId
    *
    * @param[in] atlas AtlasId
-   * @param[in] material The Material to assign
+   * @param[in] textureSet The texture set to assign
    */
    */
-  void SetMaterial( AtlasId atlas, Material& material );
+  void SetTextures( AtlasId atlas, TextureSet& textureSet );
 
 private:
 
 
 private:
 
index 88b2857..7a76534 100644 (file)
@@ -488,8 +488,10 @@ struct AtlasRenderer::Impl
     quadGeometry.AddVertexBuffer( quadVertices );
     quadGeometry.SetIndexBuffer( quadIndices );
 
     quadGeometry.AddVertexBuffer( quadVertices );
     quadGeometry.SetIndexBuffer( quadIndices );
 
-    Material material = mGlyphManager.GetMaterial( meshRecord.mAtlasId );
-    Dali::Renderer renderer = Dali::Renderer::New( quadGeometry, material );
+    TextureSet textureSet( mGlyphManager.GetTextures( meshRecord.mAtlasId ) );
+    Shader shader( mGlyphManager.GetShader( meshRecord.mAtlasId ) );
+    Dali::Renderer renderer = Dali::Renderer::New( quadGeometry, shader );
+    renderer.SetTextures( textureSet );
     renderer.SetProperty( Dali::Renderer::Property::BLENDING_MODE, BlendingMode::ON );
     renderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, DepthIndex::CONTENT + mDepth );
     Actor actor = Actor::New();
     renderer.SetProperty( Dali::Renderer::Property::BLENDING_MODE, BlendingMode::ON );
     renderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, DepthIndex::CONTENT + mDepth );
     Actor actor = Actor::New();
index 5a76197..1cee6e1 100644 (file)
@@ -275,13 +275,14 @@ void CubeTransitionEffect::OnStageConnection( int depth )
   Geometry geometry = CreateQuadGeometry();
   Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
 
   Geometry geometry = CreateQuadGeometry();
   Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
 
-  Material material = Material::New( shader );
+  TextureSet textureSet = TextureSet::New();
 
   if( mCurrentImage )
   {
 
   if( mCurrentImage )
   {
-    material.AddTexture( mCurrentImage, "sTexture" );
+    textureSet.SetImage( 0u, mCurrentImage );
   }
   }
-  mCurrentRenderer = Renderer::New( geometry, material );
+  mCurrentRenderer = Renderer::New( geometry, shader );
+  mCurrentRenderer.SetTextures( textureSet );
 
   mCurrentRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, depth );
   Self().AddRenderer( mCurrentRenderer );
 
   mCurrentRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, depth );
   Self().AddRenderer( mCurrentRenderer );
@@ -340,20 +341,10 @@ bool CubeTransitionEffect::IsTransitioning()
 void CubeTransitionEffect::SetCurrentImage( Image image )
 {
   mCurrentImage = image;
 void CubeTransitionEffect::SetCurrentImage( Image image )
 {
   mCurrentImage = image;
-
   if( mCurrentRenderer )
   {
   if( mCurrentRenderer )
   {
-    Material material = mCurrentRenderer.GetMaterial();
-
-    int index = material.GetTextureIndex("sTexture" );
-    if( index != -1 )
-    {
-      material.SetTextureImage( index, mCurrentImage );
-    }
-    else
-    {
-      material.AddTexture( mCurrentImage, "sTexture" );
-    }
+    TextureSet textureSet = mCurrentRenderer.GetTextures();
+    textureSet.SetImage( 0u, mCurrentImage );
   }
 }
 
   }
 }
 
@@ -363,8 +354,8 @@ void CubeTransitionEffect::SetTargetImage( Image image )
 
   if( mTargetRenderer )
   {
 
   if( mTargetRenderer )
   {
-    Material material = mTargetRenderer.GetMaterial();
-    material.AddTexture( mTargetImage, "sTexture" );
+    TextureSet textureSet = mTargetRenderer.GetTextures();
+    textureSet.SetImage( 0u, mTargetImage );
   }
 }
 
   }
 }
 
@@ -390,13 +381,15 @@ void CubeTransitionEffect::StartTransition( Vector2 panPosition, Vector2 panDisp
   }
 
   //create the target renderer
   }
 
   //create the target renderer
-  Material material = Material::New( mCurrentRenderer.GetMaterial().GetShader() );
+  TextureSet textureSet = TextureSet::New();
   if( mTargetImage )
   {
   if( mTargetImage )
   {
-    material.AddTexture( mTargetImage, "sTexture" );
+    textureSet.SetImage( 0u, mTargetImage );
   }
   Geometry geometry = mCurrentRenderer.GetGeometry();
   }
   Geometry geometry = mCurrentRenderer.GetGeometry();
-  mTargetRenderer = Renderer::New( geometry, material );
+  Shader shader( mCurrentRenderer.GetShader() );
+  mTargetRenderer = Renderer::New( geometry, shader );
+  mTargetRenderer.SetTextures( textureSet );
 
   int depthIndex = mCurrentRenderer.GetProperty<int>(Renderer::Property::DEPTH_INDEX);
   mTargetRenderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, depthIndex );
 
   int depthIndex = mCurrentRenderer.GetProperty<int>(Renderer::Property::DEPTH_INDEX);
   mTargetRenderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, depthIndex );
index d29846d..a5925af 100644 (file)
@@ -89,8 +89,8 @@ add_library(dali_addon SHARED
   ${PLUGING_SRC_DIR}/render-tasks/render-task-wrapper.cpp
   ${PLUGING_SRC_DIR}/rendering/geometry-api.cpp
   ${PLUGING_SRC_DIR}/rendering/geometry-wrapper.cpp
   ${PLUGING_SRC_DIR}/render-tasks/render-task-wrapper.cpp
   ${PLUGING_SRC_DIR}/rendering/geometry-api.cpp
   ${PLUGING_SRC_DIR}/rendering/geometry-wrapper.cpp
-  ${PLUGING_SRC_DIR}/rendering/material-api.cpp
-  ${PLUGING_SRC_DIR}/rendering/material-wrapper.cpp
+  ${PLUGING_SRC_DIR}/rendering/texture-set-api.cpp
+  ${PLUGING_SRC_DIR}/rendering/texture-set-wrapper.cpp
   ${PLUGING_SRC_DIR}/rendering/renderer-api.cpp
   ${PLUGING_SRC_DIR}/rendering/renderer-wrapper.cpp
   ${PLUGING_SRC_DIR}/rendering/sampler-api.cpp
   ${PLUGING_SRC_DIR}/rendering/renderer-api.cpp
   ${PLUGING_SRC_DIR}/rendering/renderer-wrapper.cpp
   ${PLUGING_SRC_DIR}/rendering/sampler-api.cpp
index d648d9b..3c50077 100644 (file)
@@ -46,8 +46,8 @@ script_v8_plugin_src_files = \
    $(v8_plugin_dir)/render-tasks/render-task-wrapper.cpp \
    $(v8_plugin_dir)/rendering/geometry-api.cpp \
    $(v8_plugin_dir)/rendering/geometry-wrapper.cpp \
    $(v8_plugin_dir)/render-tasks/render-task-wrapper.cpp \
    $(v8_plugin_dir)/rendering/geometry-api.cpp \
    $(v8_plugin_dir)/rendering/geometry-wrapper.cpp \
-   $(v8_plugin_dir)/rendering/material-api.cpp \
-   $(v8_plugin_dir)/rendering/material-wrapper.cpp \
+   $(v8_plugin_dir)/rendering/texture-set-api.cpp \
+   $(v8_plugin_dir)/rendering/texture-set-wrapper.cpp \
    $(v8_plugin_dir)/rendering/renderer-api.cpp \
    $(v8_plugin_dir)/rendering/renderer-wrapper.cpp \
    $(v8_plugin_dir)/rendering/sampler-api.cpp \
    $(v8_plugin_dir)/rendering/renderer-api.cpp \
    $(v8_plugin_dir)/rendering/renderer-wrapper.cpp \
    $(v8_plugin_dir)/rendering/sampler-api.cpp \
index e47285b..9459a46 100644 (file)
@@ -721,7 +721,7 @@ void ActorApi::ScaleBy( const v8::FunctionCallbackInfo<v8::Value>& args )
  * Add a renderer to this actor.
  * @example
  *
  * Add a renderer to this actor.
  * @example
  *
- *     var renderer = new dali.Renderer( geometry, material );
+ *     var renderer = new dali.Renderer( geometry, shader );
  *     actor.addRenderer( renderer );
  *
  * @for Actor
  *     actor.addRenderer( renderer );
  *
  * @for Actor
index 92719c7..ef9d285 100644 (file)
@@ -34,7 +34,7 @@
 #include <events/pan-gesture-detector-wrapper.h>
 #include <object/property-buffer-wrapper.h>
 #include <rendering/geometry-wrapper.h>
 #include <events/pan-gesture-detector-wrapper.h>
 #include <object/property-buffer-wrapper.h>
 #include <rendering/geometry-wrapper.h>
-#include <rendering/material-wrapper.h>
+#include <rendering/texture-set-wrapper.h>
 #include <rendering/renderer-wrapper.h>
 #include <rendering/shader-wrapper.h>
 #include <rendering/sampler-wrapper.h>
 #include <rendering/renderer-wrapper.h>
 #include <rendering/shader-wrapper.h>
 #include <rendering/sampler-wrapper.h>
@@ -80,7 +80,7 @@ const ApiFunction ConstructorFunctionTable[]=
     { "ItemFactory",        ItemFactoryWrapper::NewItemFactory},
     { "Shader",             ShaderWrapper::NewShader},
     { "Sampler",            SamplerWrapper::NewSampler},
     { "ItemFactory",        ItemFactoryWrapper::NewItemFactory},
     { "Shader",             ShaderWrapper::NewShader},
     { "Sampler",            SamplerWrapper::NewSampler},
-    { "Material",           MaterialWrapper::NewMaterial},
+    { "TextureSet",         TextureSetWrapper::NewTextureSet},
     { "Geometry",           GeometryWrapper::NewGeometry},
     { "Renderer",           RendererWrapper::NewRenderer},
     { "PropertyBuffer",     PropertyBufferWrapper::NewPropertyBuffer},
     { "Geometry",           GeometryWrapper::NewGeometry},
     { "Renderer",           RendererWrapper::NewRenderer},
     { "PropertyBuffer",     PropertyBufferWrapper::NewPropertyBuffer},
diff --git a/plugins/dali-script-v8/src/rendering/material-api.cpp b/plugins/dali-script-v8/src/rendering/material-api.cpp
deleted file mode 100644 (file)
index b21c376..0000000
+++ /dev/null
@@ -1,373 +0,0 @@
-/*
- * 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.
- *
- */
-
-
-// CLASS HEADER
-#include "material-api.h"
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/object/type-registry.h>
-
-// INTERNAL INCLUDES
-#include <v8-utils.h>
-#include <rendering/material-wrapper.h>
-#include <rendering/shader-wrapper.h>
-#include <rendering/shader-api.h>
-#include <rendering/sampler-wrapper.h>
-#include <rendering/sampler-api.h>
-#include <image/image-wrapper.h>
-
-namespace Dali
-{
-
-namespace V8Plugin
-{
-
-/**
- * ## Material API
- *
- * Material is a handle to an object that specifies the visual properties of the renderer.
- *
- * @class Material
- * @extends Handle
- */
-
-Material MaterialApi::GetMaterial( v8::Isolate* isolate, const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  v8::HandleScope handleScope( isolate );
-
-  v8::Local<v8::Object> object = args.This();
-  v8::Local<v8::External> field = v8::Local<v8::External>::Cast( object->GetInternalField(0) );
-  void* ptr = field->Value();
-
-  MaterialWrapper* wrapper = static_cast< MaterialWrapper *>(ptr);
-  return wrapper->GetMaterial();
-}
-
-Material MaterialApi::GetMaterialFromParams( int paramIndex,
-                                               bool& found,
-                                               v8::Isolate* isolate,
-                                               const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  found = false;
-
-  v8::HandleScope handleScope( isolate );
-  BaseWrappedObject* wrappedObject = V8Utils::GetWrappedDaliObjectParameter( paramIndex, BaseWrappedObject::MATERIAL, isolate, args );
-  if( wrappedObject )
-  {
-    found = true;
-    MaterialWrapper* wrapper = static_cast< MaterialWrapper *>(wrappedObject);
-    return wrapper->GetMaterial();
-  }
-  else
-  {
-    return Material();
-  }
-}
-
-/**
- * Create a new material object.
- *
- * @constructor
- * @method Material
- * @for Material
- * @param {Object} shader The shader used by the material
- * @return {Object} Material
- */
-Material MaterialApi::New( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-
-  bool found( false );
-  Shader shader = ShaderApi::GetShaderFromParams( 0, found, isolate, args );
-  if( found )
-  {
-    return Material::New( shader );
-  }
-  else
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "missing shader from param 0" );
-    return Material();
-  }
-}
-
-/**
- * Set the Shader used by this material
- *
- * @method setShader
- * @for Material
- * @param {Object} shader Handle to the shader
- */
-void MaterialApi::SetShader( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-
-  Material material = GetMaterial( isolate, args );
-
-  bool found( false );
-  Shader shader = ShaderApi::GetShaderFromParams( 0, found, isolate, args );
-  if( !found )
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "invalid shader parameter" );
-  }
-  else
-  {
-    return material.SetShader( shader );
-  }
-}
-
-/**
- * Get the Shader used by this material
- *
- * @method getShader
- * @for Material
- * @return {Object} Shader
- */
-void MaterialApi::GetShader( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-
-  Material material = GetMaterial( isolate, args );
-  Shader shader = material.GetShader();
-
-  // Wrap the shader
-  v8::Local<v8::Object> localObject = ShaderWrapper::WrapShader( isolate, shader );
-  args.GetReturnValue().Set( localObject );
-}
-
-/**
- * Add a new texture to be used by the material
- *
- * @method addTexture
- * @for Material
- * @param {Object} image The image used by this sampler
- * @param {String} uniformName The string with the name of the uniform
- * @param {Object} sampler The sampler to add to this material
- * @return {integer} The index of the texture in the array of textures or -1 if texture can not be added
- */
-void MaterialApi::AddTexture( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-
-  Material material = GetMaterial( isolate, args );
-
-  bool found( false );
-  Image image = V8Utils::GetImageParameter( PARAMETER_0, found, isolate, args );
-  if( !found )
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "missing image from param 0" );
-    return;
-  }
-
-  found = false;
-  std::string uniformName = V8Utils::GetStringParameter( PARAMETER_1, found, isolate, args );
-  if( !found )
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "missing uniform name from param 1" );
-    return;
-  }
-
-  found = false;
-  Sampler sampler = SamplerApi::GetSamplerFromParams( PARAMETER_2, found, isolate, args );
-  if( !found )
-  {
-    args.GetReturnValue().Set( v8::Integer::New( isolate, material.AddTexture( image, uniformName ) ) );
-  }
-  else
-  {
-    args.GetReturnValue().Set( v8::Integer::New( isolate, material.AddTexture( image, uniformName, sampler ) ) );
-  }
-}
-
-/**
- * Removes a texture from the material
- *
- * @method removeTexture
- * @for Material
- * @param {integer} index The index of the texture in the array of textures
- */
-void MaterialApi::RemoveTexture( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-
-  Material material = GetMaterial( isolate, args );
-
-  bool found( false );
-  int index = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 /* default */);
-  if( !found )
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "invalid index parameter" );
-  }
-  else
-  {
-    material.RemoveTexture( index );
-  }
-}
-
-/**
- * Sets the image to be used by a given texture
- * @method setTextureImage
- * @for Material
- * @param {integer} index The index of the texture in the array of textures
- * @param {Object} image The image used by this sampler
- */
-void MaterialApi::SetTextureImage( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-
-  Material material = GetMaterial( isolate, args );
-
-  bool found( false );
-  int index = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 /* default */);
-  if( !found )
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "invalid index parameter" );
-    return;
-  }
-
-  found = false;
-  Image image = V8Utils::GetImageParameter( PARAMETER_1, found, isolate, args );
-  if( !found )
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "missing image from param 1" );
-  }
-  else
-  {
-    material.SetTextureImage(index, image);
-  }
-}
-
-/**
- * Set the sampler used by a given texture
- * @method setTextureSampler
- * @for Material
- * @param {integer} index The index of the texture in the array of textures
- * @param {Object} sampler The new sampler
- */
-void MaterialApi::SetTextureSampler( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-
-  Material material = GetMaterial( isolate, args );
-
-  bool found( false );
-  int index = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 /* default */);
-  if( !found )
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "invalid index parameter" );
-    return;
-  }
-
-  found = false;
-  Sampler sampler = SamplerApi::GetSamplerFromParams( PARAMETER_1, found, isolate, args );
-  if( !found )
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "missing sampler from param 1" );
-  }
-  else
-  {
-    material.SetTextureSampler(index, sampler);
-  }
-}
-
-/**
- * Set the uniform name of a given texture
- * @method setTextureUniformName
- * @for Material
- * @param {integer} index The index of the texture in the array of textures
- * @param {string} uniformName The new uniform name
- */
-void MaterialApi::SetTextureUniformName( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-
-  Material material = GetMaterial( isolate, args );
-
-  bool found( false );
-  int index = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 /* default */);
-  if( !found )
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "invalid index parameter" );
-    return;
-  }
-
-  found = false;
-  std::string uniformName = V8Utils::GetStringParameter( PARAMETER_1, found, isolate, args );
-  if( !found )
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "invalid uniform name parameter" );
-  }
-  else
-  {
-    material.SetTextureUniformName(index, uniformName);
-  }
-}
-
-/**
- * Retrive the index of a texture given its uniform name
- * @method getTextureIndex
- * @for Material
- * @param {string} uniformName The uniform name
- * @return {integer} The index in the array of textures or -1 if the texture is not found
- */
-void MaterialApi::GetTextureIndex( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-
-  Material material = GetMaterial( isolate, args );
-
-  bool found( false );
-  std::string uniformName = V8Utils::GetStringParameter( PARAMETER_0, found, isolate, args );
-  if( !found )
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "invalid uniform name parameter" );
-  }
-  else
-  {
-    args.GetReturnValue().Set( v8::Integer::New( isolate, material.GetTextureIndex(uniformName) ) );
-  }
-}
-
-/**
- * Retrieve the number of textures used by the material
- *
- * @method getNumberOfTextures
- * @for Material
- * @return {integer} The number of textures
- */
-void MaterialApi::GetNumberOfTextures( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-
-  Material material = GetMaterial( isolate, args );
-
-  args.GetReturnValue().Set( v8::Integer::New( isolate, material.GetNumberOfTextures() ) );
-}
-
-} // namespace V8Plugin
-
-} // namespace Dali
diff --git a/plugins/dali-script-v8/src/rendering/material-api.h b/plugins/dali-script-v8/src/rendering/material-api.h
deleted file mode 100644 (file)
index 6cf64a0..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-#ifndef __DALI_V8PLUGIN_MATERIAL_API_H__
-#define __DALI_V8PLUGIN_MATERIAL_API_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.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <v8.h>
-#include <dali/devel-api/rendering/material.h>
-
-
-namespace Dali
-{
-
-namespace V8Plugin
-{
-
-namespace MaterialApi
-{
-
-  /**
-   * Helper to get material from args.This()
-   */
-  Material GetMaterial( v8::Isolate* isolate, const v8::FunctionCallbackInfo< v8::Value >& args );
-
-  /**
-   * @brief Helper to get material from the JavaScript object held in the given function argument
-   * @param[in] paramIndex Argument index the object is held in
-   * @param[in] found Whether material is found in the given function parameter
-   * @param[in] isolate v8 isolated instance
-   * @param[in] args v8 function call arguments interpreted
-   */
-  Material GetMaterialFromParams( int paramIndex,
-                                     bool& found,
-                                     v8::Isolate* isolate,
-                                     const v8::FunctionCallbackInfo< v8::Value >& args );
-
-  /**
-   * Constructor
-   */
-   Material New( const v8::FunctionCallbackInfo< v8::Value >& args );
-
-   /**
-    * Material API see material.h for a description
-    */
-   void SetShader( const v8::FunctionCallbackInfo< v8::Value >& args );
-   void GetShader( const v8::FunctionCallbackInfo< v8::Value >& args );
-   void AddTexture( const v8::FunctionCallbackInfo< v8::Value >& args );
-   void RemoveTexture( const v8::FunctionCallbackInfo< v8::Value >& args );
-   void SetTextureImage( const v8::FunctionCallbackInfo< v8::Value >& args );
-   void SetTextureSampler( const v8::FunctionCallbackInfo< v8::Value >& args );
-   void SetTextureUniformName( const v8::FunctionCallbackInfo< v8::Value >& args );
-   void GetTextureIndex( const v8::FunctionCallbackInfo< v8::Value >& args );
-   void GetNumberOfTextures( const v8::FunctionCallbackInfo< v8::Value >& args );
-
-}; // namespace MaterialApi
-
-} // namespace V8Plugin
-
-} // namespace Dali
-
-#endif // header __DALI_V8PLUGIN_MATERIAL_API_H__
diff --git a/plugins/dali-script-v8/src/rendering/material-wrapper.h b/plugins/dali-script-v8/src/rendering/material-wrapper.h
deleted file mode 100644 (file)
index 45e11ec..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-#ifndef __DALI_V8PLUGIN_MATERIAL_WRAPPER_H__
-#define __DALI_V8PLUGIN_MATERIAL_WRAPPER_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.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <v8.h>
-#include <dali/devel-api/rendering/material.h>
-
-// INTERNAL INCLUDES
-#include <object/handle-wrapper.h>
-
-namespace Dali
-{
-
-namespace V8Plugin
-{
-
-
-/**
- * A Material wrapper.
- * Provides access to Material specific functionality and V8 memory handling.
- */
-class MaterialWrapper : public HandleWrapper
-{
-
-public:
-
-  /**
-   * @brief Constructor
-   * @param[in] material DALi material
-   * @param[in] gc garbage collection interface
-   */
-  MaterialWrapper( const Material& material,
-                GarbageCollectorInterface& gc );
-
-  /**
-   * @brief Destructor
-   */
-  virtual ~MaterialWrapper()
-  {
-  };
-
-  /**
-   * @brief Creates a new Material wrapped inside a Javascript Object.
-   * @param[in] args v8 function call arguments interpreted
-   */
-  static void NewMaterial( const v8::FunctionCallbackInfo< v8::Value >& args);
-
-  /**
-   * Wraps a sampler
-   */
-  static v8::Handle<v8::Object> WrapMaterial(v8::Isolate* isolate, const Dali::Material& );
-
-
-  // The MaterialAttribute ObjectTemplate, we cache templates so we don't have
-  // keep generating them everytime we want to create a Material
-  static v8::Persistent<v8::ObjectTemplate> mMaterialTemplate;
-
-  /**
-   * @brief Gets the handle of material
-   * @return the handle of material
-   */
-  Material GetMaterial();
-
-
-private:
-
-  // Material
-  Material mMaterial;
-
-  /**
-   * @brief Creates the object template that used to create material at runtime
-   * @param[in] isolate v8 isolated instance
-   * @return the object template
-   */
-  static v8::Handle<v8::ObjectTemplate> MakeMaterialTemplate( v8::Isolate* isolate );
-
-  /**
-   * @brief Gets the object template that used to create material at runtime
-   * @param[in] isolate v8 isolated instance
-   * @return the object template
-   */
-  static v8::Local<v8::ObjectTemplate> GetMaterialTemplate( v8::Isolate* isolate );
-
-};
-
-} // namespace V8Plugin
-
-} // namespace Dali
-
-#endif // __DALI_V8PLUGIN_MATERIAL_WRAPPER_H__
index 2ec736d..5efcd94 100644 (file)
@@ -27,8 +27,9 @@
 #include <rendering/renderer-wrapper.h>
 #include <rendering/geometry-api.h>
 #include <rendering/geometry-wrapper.h>
 #include <rendering/renderer-wrapper.h>
 #include <rendering/geometry-api.h>
 #include <rendering/geometry-wrapper.h>
-#include <rendering/material-api.h>
-#include <rendering/material-wrapper.h>
+#include <rendering/texture-set-api.h>
+#include <rendering/texture-set-wrapper.h>
+#include <rendering/shader-api.h>
 
 namespace Dali
 {
 
 namespace Dali
 {
@@ -85,7 +86,7 @@ Renderer RendererApi::GetRendererFromParams( int paramIndex,
  * @method Renderer
  * @for Renderer
  * @param {Object} geometry The geometry to be used by this renderer
  * @method Renderer
  * @for Renderer
  * @param {Object} geometry The geometry to be used by this renderer
- * @param {Object} material The material to be used by this renderer
+ * @param {Object} shader The shader to be used by this renderer
  * @return {Object} Renderer
  */
 Renderer RendererApi::New( const v8::FunctionCallbackInfo< v8::Value >& args )
  * @return {Object} Renderer
  */
 Renderer RendererApi::New( const v8::FunctionCallbackInfo< v8::Value >& args )
@@ -102,14 +103,14 @@ Renderer RendererApi::New( const v8::FunctionCallbackInfo< v8::Value >& args )
   }
 
   found = false;
   }
 
   found = false;
-  Material material = MaterialApi::GetMaterialFromParams( 1, found, isolate, args );
+  Shader shader = ShaderApi::GetShaderFromParams( 1, found, isolate, args );
   if( !found )
   {
   if( !found )
   {
-    DALI_SCRIPT_EXCEPTION( isolate, "missing material from param 0" );
+    DALI_SCRIPT_EXCEPTION( isolate, "missing shader from param 0" );
     return Renderer();
   }
 
     return Renderer();
   }
 
-  return Renderer::New(geometry, material);
+  return Renderer::New(geometry, shader);
 }
 
 /**
 }
 
 /**
@@ -159,13 +160,13 @@ void RendererApi::GetGeometry( const v8::FunctionCallbackInfo<v8::Value>& args )
 }
 
 /**
 }
 
 /**
- * Sets the material to be used by this renderer
+ * Sets the texture set to be used by this renderer
  *
  *
- * @method setMaterial
+ * @method setTextures
  * @for Renderer
  * @for Renderer
- * @param {Object} material The material to be used by this renderer
+ * @param {Object} textureSet The TextureSet to be used by this renderer
  */
  */
-void RendererApi::SetMaterial( const v8::FunctionCallbackInfo< v8::Value >& args )
+void RendererApi::SetTextures( const v8::FunctionCallbackInfo< v8::Value >& args )
 {
   v8::Isolate* isolate = args.GetIsolate();
   v8::HandleScope handleScope( isolate );
 {
   v8::Isolate* isolate = args.GetIsolate();
   v8::HandleScope handleScope( isolate );
@@ -173,34 +174,34 @@ void RendererApi::SetMaterial( const v8::FunctionCallbackInfo< v8::Value >& args
   Renderer renderer = GetRenderer( isolate, args );
 
   bool found( false );
   Renderer renderer = GetRenderer( isolate, args );
 
   bool found( false );
-  Material material = MaterialApi::GetMaterialFromParams( 0, found, isolate, args );
+  TextureSet textureSet = TextureSetApi::GetTextureSetFromParams( 0, found, isolate, args );
   if( !found )
   {
   if( !found )
   {
-    DALI_SCRIPT_EXCEPTION( isolate, "missing material from param 0" );
+    DALI_SCRIPT_EXCEPTION( isolate, "missing texture set from param 0" );
   }
   else
   {
   }
   else
   {
-    renderer.SetMaterial(material);
+    renderer.SetTextures(textureSet);
   }
 }
 
 /**
   }
 }
 
 /**
- * Gets the material used by this renderer
+ * Gets the texture set used by this renderer
  *
  *
- * @method getMaterial
+ * @method getTextures
  * @for Renderer
  * @for Renderer
- * @return {Object} The material used by this renderer
+ * @return {Object} The texture set used by this renderer
  */
  */
-void RendererApi::GetMaterial( const v8::FunctionCallbackInfo<v8::Value>& args )
+void RendererApi::GetTextures( const v8::FunctionCallbackInfo<v8::Value>& args )
 {
   v8::Isolate* isolate = args.GetIsolate();
   v8::HandleScope handleScope( isolate );
 
   Renderer renderer = GetRenderer( isolate, args );
 {
   v8::Isolate* isolate = args.GetIsolate();
   v8::HandleScope handleScope( isolate );
 
   Renderer renderer = GetRenderer( isolate, args );
-  Material material = renderer.GetMaterial();
+  TextureSet textureSet = renderer.GetTextures();
 
 
-  // Wrap the material
-  v8::Local<v8::Object> localObject = MaterialWrapper::WrapMaterial( isolate, material );
+  // Wrap the textureset
+  v8::Local<v8::Object> localObject = TextureSetWrapper::WrapTextureSet( isolate, textureSet );
   args.GetReturnValue().Set( localObject );
 }
 
   args.GetReturnValue().Set( localObject );
 }
 
index 50e1874..f44eeb8 100644 (file)
@@ -59,8 +59,8 @@ namespace RendererApi
     */
    void SetGeometry( const v8::FunctionCallbackInfo< v8::Value >& args );
    void GetGeometry( const v8::FunctionCallbackInfo< v8::Value >& args );
     */
    void SetGeometry( const v8::FunctionCallbackInfo< v8::Value >& args );
    void GetGeometry( const v8::FunctionCallbackInfo< v8::Value >& args );
-   void SetMaterial( const v8::FunctionCallbackInfo< v8::Value >& args );
-   void GetMaterial( const v8::FunctionCallbackInfo< v8::Value >& args );
+   void SetTextures( const v8::FunctionCallbackInfo< v8::Value >& args );
+   void GetTextures( const v8::FunctionCallbackInfo< v8::Value >& args );
    void SetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args );
    void GetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args );
    void SetBlendEquation( const v8::FunctionCallbackInfo< v8::Value >& args );
    void SetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args );
    void GetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args );
    void SetBlendEquation( const v8::FunctionCallbackInfo< v8::Value >& args );
index 3286b10..75bc2d3 100644 (file)
@@ -47,8 +47,8 @@ const ApiFunction RendererFunctionTable[]=
 
    { "SetGeometry"             , RendererApi::SetGeometry },
    { "GetGeometry"             , RendererApi::GetGeometry },
 
    { "SetGeometry"             , RendererApi::SetGeometry },
    { "GetGeometry"             , RendererApi::GetGeometry },
-   { "SetMaterial"             , RendererApi::SetMaterial },
-   { "GetMaterial"             , RendererApi::GetMaterial },
+   { "SetTextures"             , RendererApi::SetTextures },
+   { "GetTextures"             , RendererApi::GetTextures },
    { "SetBlendFunc"            , RendererApi::SetBlendFunc },
    { "GetBlendFunc"            , RendererApi::GetBlendFunc },
    { "SetBlendEquation"        , RendererApi::SetBlendEquation },
    { "SetBlendFunc"            , RendererApi::SetBlendFunc },
    { "GetBlendFunc"            , RendererApi::GetBlendFunc },
    { "SetBlendEquation"        , RendererApi::SetBlendEquation },
diff --git a/plugins/dali-script-v8/src/rendering/texture-set-api.cpp b/plugins/dali-script-v8/src/rendering/texture-set-api.cpp
new file mode 100644 (file)
index 0000000..30d8d47
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+ * 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.
+ *
+ */
+
+
+// CLASS HEADER
+#include "texture-set-api.h"
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/type-registry.h>
+
+// INTERNAL INCLUDES
+#include <v8-utils.h>
+#include <rendering/texture-set-wrapper.h>
+#include <rendering/shader-wrapper.h>
+#include <rendering/shader-api.h>
+#include <rendering/sampler-wrapper.h>
+#include <rendering/sampler-api.h>
+#include <image/image-wrapper.h>
+
+namespace Dali
+{
+
+namespace V8Plugin
+{
+
+/**
+ * ## TextureSet API
+ *
+ * TextureSet is a handle to an object that contains the textures used by a renderer
+ *
+ * @class TextureSet
+ * @extends Handle
+ */
+
+TextureSet TextureSetApi::GetTextureSet( v8::Isolate* isolate, const v8::FunctionCallbackInfo< v8::Value >& args )
+{
+  v8::HandleScope handleScope( isolate );
+
+  v8::Local<v8::Object> object = args.This();
+  v8::Local<v8::External> field = v8::Local<v8::External>::Cast( object->GetInternalField(0) );
+  void* ptr = field->Value();
+
+  TextureSetWrapper* wrapper = static_cast< TextureSetWrapper *>(ptr);
+  return wrapper->GetTextureSet();
+}
+
+TextureSet TextureSetApi::GetTextureSetFromParams( int paramIndex,
+                                               bool& found,
+                                               v8::Isolate* isolate,
+                                               const v8::FunctionCallbackInfo< v8::Value >& args )
+{
+  found = false;
+
+  v8::HandleScope handleScope( isolate );
+  BaseWrappedObject* wrappedObject = V8Utils::GetWrappedDaliObjectParameter( paramIndex, BaseWrappedObject::TEXTURE_SET, isolate, args );
+  if( wrappedObject )
+  {
+    found = true;
+    TextureSetWrapper* wrapper = static_cast< TextureSetWrapper *>(wrappedObject);
+    return wrapper->GetTextureSet();
+  }
+  else
+  {
+    return TextureSet();
+  }
+}
+
+/**
+ * Create a new texture set object.
+ *
+ * @constructor
+ * @method TextureSet
+ * @for TextureSet
+ * @return {Object} TextureSet
+ */
+TextureSet TextureSetApi::New( const v8::FunctionCallbackInfo< v8::Value >& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  return TextureSet();
+}
+
+
+/**
+ * Sets the image to be used by a given texture
+ * @method setImage
+ * @for TextureSet
+ * @param {integer} index The index of the texture in the array of textures
+ * @param {Object} image The image used by this sampler
+ */
+void TextureSetApi::SetImage( const v8::FunctionCallbackInfo< v8::Value >& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+
+  TextureSet textureSet = GetTextureSet( isolate, args );
+
+  bool found( false );
+  int index = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 /* default */);
+  if( !found )
+  {
+    DALI_SCRIPT_EXCEPTION( isolate, "invalid index parameter" );
+    return;
+  }
+
+  found = false;
+  Image image = V8Utils::GetImageParameter( PARAMETER_1, found, isolate, args );
+  if( !found )
+  {
+    DALI_SCRIPT_EXCEPTION( isolate, "missing image from param 1" );
+  }
+  else
+  {
+    textureSet.SetImage(index, image);
+  }
+}
+
+/**
+ * Set the sampler used by a given texture
+ * @method setSampler
+ * @for TextureSet
+ * @param {integer} index The index of the texture in the array of textures
+ * @param {Object} sampler The new sampler
+ */
+void TextureSetApi::SetSampler( const v8::FunctionCallbackInfo< v8::Value >& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+
+  TextureSet textureSet = GetTextureSet( isolate, args );
+
+  bool found( false );
+  int index = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 /* default */);
+  if( !found )
+  {
+    DALI_SCRIPT_EXCEPTION( isolate, "invalid index parameter" );
+    return;
+  }
+
+  found = false;
+  Sampler sampler = SamplerApi::GetSamplerFromParams( PARAMETER_1, found, isolate, args );
+  if( !found )
+  {
+    DALI_SCRIPT_EXCEPTION( isolate, "missing sampler from param 1" );
+  }
+  else
+  {
+    textureSet.SetSampler(index, sampler);
+  }
+}
+
+} // namespace V8Plugin
+
+} // namespace Dali
diff --git a/plugins/dali-script-v8/src/rendering/texture-set-api.h b/plugins/dali-script-v8/src/rendering/texture-set-api.h
new file mode 100644 (file)
index 0000000..c5dc357
--- /dev/null
@@ -0,0 +1,69 @@
+#ifndef __DALI_V8PLUGIN_TEXURE_SET_API_H__
+#define __DALI_V8PLUGIN_TEXURE_SET_API_H__
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <v8.h>
+#include <dali/devel-api/rendering/texture-set.h>
+
+
+namespace Dali
+{
+
+namespace V8Plugin
+{
+
+namespace TextureSetApi
+{
+
+  /**
+   * Helper to get TextureSet from args.This()
+   */
+  TextureSet GetTextureSet( v8::Isolate* isolate, const v8::FunctionCallbackInfo< v8::Value >& args );
+
+  /**
+   * @brief Helper to get texture set from the JavaScript object held in the given function argument
+   * @param[in] paramIndex Argument index the object is held in
+   * @param[in] found Whether texture set is found in the given function parameter
+   * @param[in] isolate v8 isolated instance
+   * @param[in] args v8 function call arguments interpreted
+   */
+  TextureSet GetTextureSetFromParams( int paramIndex,
+                                     bool& found,
+                                     v8::Isolate* isolate,
+                                     const v8::FunctionCallbackInfo< v8::Value >& args );
+
+  /**
+   * Constructor
+   */
+  TextureSet New( const v8::FunctionCallbackInfo< v8::Value >& args );
+
+   /**
+    * TextureSet API see texture-set.h for a description
+    */
+   void SetImage( const v8::FunctionCallbackInfo< v8::Value >& args );
+   void SetSampler( const v8::FunctionCallbackInfo< v8::Value >& args );
+
+}; // namespace TextureSetApi
+
+} // namespace V8Plugin
+
+} // namespace Dali
+
+#endif // header __DALI_V8PLUGIN_TEXURE_SET_API_H__
  */
 
 // CLASS HEADER
  */
 
 // CLASS HEADER
-#include "material-wrapper.h"
+#include "texture-set-wrapper.h"
 
 // INTERNAL INCLUDES
 #include <v8-utils.h>
 
 // INTERNAL INCLUDES
 #include <v8-utils.h>
-#include <rendering/material-api.h>
+#include <rendering/texture-set-api.h>
 #include <shared/api-function.h>
 #include <shared/object-template-helper.h>
 #include <dali-wrapper.h>
 #include <shared/api-function.h>
 #include <shared/object-template-helper.h>
 #include <dali-wrapper.h>
@@ -31,7 +31,7 @@ namespace Dali
 namespace V8Plugin
 {
 
 namespace V8Plugin
 {
 
-v8::Persistent<v8::ObjectTemplate> MaterialWrapper::mMaterialTemplate;
+v8::Persistent<v8::ObjectTemplate> TextureSetWrapper::mTextureSetTemplate;
 
 namespace // un-named name space
 {
 
 namespace // un-named name space
 {
@@ -39,45 +39,38 @@ namespace // un-named name space
 /**
  * Contains a list of all functions that can be called
  */
 /**
  * Contains a list of all functions that can be called
  */
-const ApiFunction MaterialFunctionTable[]=
+const ApiFunction TextureSetFunctionTable[]=
 {
     /**************************************
 {
     /**************************************
-    * Material API (in order of Material.h)
+    * TextureSet API (in order of texture-set.h)
     **************************************/
 
     **************************************/
 
-   { "SetShader"                       , MaterialApi::SetShader },
-   { "GetShader"                       , MaterialApi::GetShader },
-   { "AddTexture"                      , MaterialApi::AddTexture },
-   { "RemoveTexture"                   , MaterialApi::RemoveTexture },
-   { "SetTextureImage"                 , MaterialApi::SetTextureImage },
-   { "SetTextureSampler"               , MaterialApi::SetTextureSampler },
-   { "SetTextureUniformName"           , MaterialApi::SetTextureUniformName },
-   { "GetTextureIndex"                 , MaterialApi::GetTextureIndex },
-   { "GetNumberOfTextures"             , MaterialApi::GetNumberOfTextures },
+   { "SetImage"                        , TextureSetApi::SetImage },
+   { "SetSampler"                      , TextureSetApi::SetSampler },
 };
 
 };
 
-const unsigned int MaterialFunctionTableCount = sizeof(MaterialFunctionTable)/sizeof(MaterialFunctionTable[0]);
+const unsigned int TextureSetFunctionTableCount = sizeof(TextureSetFunctionTable)/sizeof(TextureSetFunctionTable[0]);
 } //un-named space
 
 
 } //un-named space
 
 
-MaterialWrapper::MaterialWrapper( const Dali::Material& material, GarbageCollectorInterface& gc )
-:  HandleWrapper(  BaseWrappedObject::MATERIAL , material, gc )
+TextureSetWrapper::TextureSetWrapper( const Dali::TextureSet& textureSet, GarbageCollectorInterface& gc )
+:  HandleWrapper(  BaseWrappedObject::TEXTURE_SET , textureSet, gc )
 {
 {
-    mMaterial = material;
+    mTextureSet = textureSet;
 }
 
 }
 
-v8::Handle<v8::Object> MaterialWrapper::WrapMaterial(v8::Isolate* isolate, const Dali::Material& material )
+v8::Handle<v8::Object> TextureSetWrapper::WrapTextureSet(v8::Isolate* isolate, const Dali::TextureSet& textureSet )
 {
   v8::EscapableHandleScope handleScope( isolate );
   v8::Local<v8::ObjectTemplate> objectTemplate;
 
 {
   v8::EscapableHandleScope handleScope( isolate );
   v8::Local<v8::ObjectTemplate> objectTemplate;
 
-  objectTemplate = GetMaterialTemplate( isolate);
+  objectTemplate = GetTextureSetTemplate( isolate);
 
   // create an instance of the template
   v8::Local<v8::Object> localObject = objectTemplate->NewInstance();
 
 
   // create an instance of the template
   v8::Local<v8::Object> localObject = objectTemplate->NewInstance();
 
-  // create the Material wrapper
-  MaterialWrapper* pointer =  new MaterialWrapper( material, Dali::V8Plugin::DaliWrapper::Get().GetDaliGarbageCollector() );
+  // create the texture set wrapper
+  TextureSetWrapper* pointer =  new TextureSetWrapper( textureSet, Dali::V8Plugin::DaliWrapper::Get().GetDaliGarbageCollector() );
 
   // assign the JavaScript object to the wrapper.
   pointer->SetJavascriptObject( isolate, localObject );
 
   // assign the JavaScript object to the wrapper.
   pointer->SetJavascriptObject( isolate, localObject );
@@ -85,25 +78,25 @@ v8::Handle<v8::Object> MaterialWrapper::WrapMaterial(v8::Isolate* isolate, const
   return handleScope.Escape( localObject );
 }
 
   return handleScope.Escape( localObject );
 }
 
-v8::Local<v8::ObjectTemplate> MaterialWrapper::GetMaterialTemplate( v8::Isolate* isolate)
+v8::Local<v8::ObjectTemplate> TextureSetWrapper::GetTextureSetTemplate( v8::Isolate* isolate)
 {
   v8::EscapableHandleScope handleScope( isolate );
   v8::Local<v8::ObjectTemplate> objectTemplate;
 
 {
   v8::EscapableHandleScope handleScope( isolate );
   v8::Local<v8::ObjectTemplate> objectTemplate;
 
-  if( mMaterialTemplate.IsEmpty() )
+  if( mTextureSetTemplate.IsEmpty() )
   {
   {
-    objectTemplate = MakeMaterialTemplate( isolate );
-    mMaterialTemplate.Reset( isolate, objectTemplate );
+    objectTemplate = MakeTextureSetTemplate( isolate );
+    mTextureSetTemplate.Reset( isolate, objectTemplate );
   }
   else
   {
     // get the object template
   }
   else
   {
     // get the object template
-    objectTemplate = v8::Local<v8::ObjectTemplate>::New( isolate, mMaterialTemplate );
+    objectTemplate = v8::Local<v8::ObjectTemplate>::New( isolate, mTextureSetTemplate );
   }
   return handleScope.Escape( objectTemplate );
 }
 
   }
   return handleScope.Escape( objectTemplate );
 }
 
-v8::Handle<v8::ObjectTemplate> MaterialWrapper::MakeMaterialTemplate( v8::Isolate* isolate )
+v8::Handle<v8::ObjectTemplate> TextureSetWrapper::MakeTextureSetTemplate( v8::Isolate* isolate )
 {
   v8::EscapableHandleScope handleScope( isolate );
 
 {
   v8::EscapableHandleScope handleScope( isolate );
 
@@ -115,34 +108,34 @@ v8::Handle<v8::ObjectTemplate> MaterialWrapper::MakeMaterialTemplate( v8::Isolat
   objTemplate->SetInternalFieldCount( BaseWrappedObject::FIELD_COUNT );
 
   // add our function properties
   objTemplate->SetInternalFieldCount( BaseWrappedObject::FIELD_COUNT );
 
   // add our function properties
-  ObjectTemplateHelper::InstallFunctions( isolate, objTemplate, MaterialFunctionTable, MaterialFunctionTableCount );
+  ObjectTemplateHelper::InstallFunctions( isolate, objTemplate, TextureSetFunctionTable, TextureSetFunctionTableCount );
 
   return handleScope.Escape( objTemplate );
 }
 
 
   return handleScope.Escape( objTemplate );
 }
 
-void MaterialWrapper::NewMaterial( const v8::FunctionCallbackInfo< v8::Value >& args)
+void TextureSetWrapper::NewTextureSet( const v8::FunctionCallbackInfo< v8::Value >& args)
 {
   v8::Isolate* isolate = args.GetIsolate();
   v8::HandleScope handleScope( isolate);
 
   if(!args.IsConstructCall())
   {
 {
   v8::Isolate* isolate = args.GetIsolate();
   v8::HandleScope handleScope( isolate);
 
   if(!args.IsConstructCall())
   {
-      DALI_SCRIPT_EXCEPTION( isolate, "Material constructor called without 'new'");
+      DALI_SCRIPT_EXCEPTION( isolate, "TextureSet constructor called without 'new'");
       return;
   }
       return;
   }
-  Dali::Material material = MaterialApi::New( args );
+  Dali::TextureSet textureSet = TextureSetApi::New( args );
 
 
-  if(material)
+  if(textureSet)
   {
   {
-    v8::Local<v8::Object> localObject = WrapMaterial( isolate, material );
+    v8::Local<v8::Object> localObject = WrapTextureSet( isolate, textureSet );
     args.GetReturnValue().Set( localObject );
   }
 }
 
 
     args.GetReturnValue().Set( localObject );
   }
 }
 
 
-Material MaterialWrapper::GetMaterial()
+TextureSet TextureSetWrapper::GetTextureSet()
 {
 {
-  return mMaterial;
+  return mTextureSet;
 }
 
 
 }
 
 
diff --git a/plugins/dali-script-v8/src/rendering/texture-set-wrapper.h b/plugins/dali-script-v8/src/rendering/texture-set-wrapper.h
new file mode 100644 (file)
index 0000000..5826bbf
--- /dev/null
@@ -0,0 +1,107 @@
+#ifndef __DALI_V8PLUGIN_TEXTURE_SET_WRAPPER_H__
+#define __DALI_V8PLUGIN_TEXTURE_SET_WRAPPER_H__
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <v8.h>
+#include <dali/devel-api/rendering/texture-set.h>
+
+// INTERNAL INCLUDES
+#include <object/handle-wrapper.h>
+
+namespace Dali
+{
+
+namespace V8Plugin
+{
+
+
+/**
+ * A TextureSet wrapper.
+ * Provides access to TextureSet specific functionality and V8 memory handling.
+ */
+class TextureSetWrapper : public HandleWrapper
+{
+
+public:
+
+  /**
+   * @brief Constructor
+   * @param[in] textureSet DALi TextureSet
+   * @param[in] gc garbage collection interface
+   */
+  TextureSetWrapper( const TextureSet& textureSet,
+                GarbageCollectorInterface& gc );
+
+  /**
+   * @brief Destructor
+   */
+  virtual ~TextureSetWrapper()
+  {
+  };
+
+  /**
+   * @brief Creates a new TextureSet wrapped inside a Javascript Object.
+   * @param[in] args v8 function call arguments interpreted
+   */
+  static void NewTextureSet( const v8::FunctionCallbackInfo< v8::Value >& args);
+
+  /**
+   * Wraps a TextureSet
+   */
+  static v8::Handle<v8::Object> WrapTextureSet(v8::Isolate* isolate, const Dali::TextureSet& );
+
+
+  // The TextureSetAttribute ObjectTemplate, we cache templates so we don't have
+  // keep generating them everytime we want to create a TextureSet
+  static v8::Persistent<v8::ObjectTemplate> mTextureSetTemplate;
+
+  /**
+   * @brief Gets the handle of TextureSet
+   * @return the handle of the TextureSet
+   */
+  TextureSet GetTextureSet();
+
+
+private:
+
+  // TextureSet
+  TextureSet mTextureSet;
+
+  /**
+   * @brief Creates the object template that used to create TextureSets at runtime
+   * @param[in] isolate v8 isolated instance
+   * @return the object template
+   */
+  static v8::Handle<v8::ObjectTemplate> MakeTextureSetTemplate( v8::Isolate* isolate );
+
+  /**
+   * @brief Gets the object template that used to create TextureSets at runtime
+   * @param[in] isolate v8 isolated instance
+   * @return the object template
+   */
+  static v8::Local<v8::ObjectTemplate> GetTextureSetTemplate( v8::Isolate* isolate );
+
+};
+
+} // namespace V8Plugin
+
+} // namespace Dali
+
+#endif // __DALI_V8PLUGIN_TEXTURE_SET_WRAPPER_H__
index 0efc17e..4cdc867 100644 (file)
@@ -88,7 +88,7 @@ public:
       TIMER,
       SHADER,
       SAMPLER,
       TIMER,
       SHADER,
       SAMPLER,
-      MATERIAL,
+      TEXTURE_SET,
       GEOMETRY,
       RENDERER,
       PROPERTY_BUFFER,
       GEOMETRY,
       RENDERER,
       PROPERTY_BUFFER,