Rename of Control Renderers to Visuals
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / renderers / primitive / primitive-visual.cpp
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include "primitive-renderer.h"
+#include "primitive-visual.h"
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
@@ -24,8 +24,8 @@
 #include <dali/public-api/common/constants.h>
 
 //INTERNAL INCLUDES
-#include <dali-toolkit/internal/controls/renderers/renderer-string-constants.h>
-#include <dali-toolkit/internal/controls/renderers/control-renderer-data-impl.h>
+#include <dali-toolkit/internal/controls/renderers/visual-string-constants.h>
+#include <dali-toolkit/internal/controls/renderers/visual-data-impl.h>
 
 namespace Dali
 {
@@ -136,8 +136,8 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
 
 } // namespace
 
-PrimitiveRenderer::PrimitiveRenderer( RendererFactoryCache& factoryCache )
-: ControlRenderer( factoryCache ),
+PrimitiveVisual::PrimitiveVisual( VisualFactoryCache& factoryCache )
+: Visual( factoryCache ),
   mColor( DEFAULT_COLOR ),
   mScaleDimensions( Vector3::ONE ),
   mScaleTopRadius( DEFAULT_SCALE_TOP_RADIUS ),
@@ -152,11 +152,11 @@ PrimitiveRenderer::PrimitiveRenderer( RendererFactoryCache& factoryCache )
 {
 }
 
-PrimitiveRenderer::~PrimitiveRenderer()
+PrimitiveVisual::~PrimitiveVisual()
 {
 }
 
-void PrimitiveRenderer::DoInitialize( Actor& actor, const Property::Map& propertyMap )
+void PrimitiveVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
 {
   //Find out which shape to renderer.
   Property::Value* primitiveType = propertyMap.Find( PRIMITIVE_SHAPE );
@@ -195,17 +195,17 @@ void PrimitiveRenderer::DoInitialize( Actor& actor, const Property::Map& propert
       }
       else
       {
-        DALI_LOG_ERROR( "No known shape in PrimitiveRenderer.\n" );
+        DALI_LOG_ERROR( "No known shape in PrimitiveVisual.\n" );
       }
     }
     else
     {
-      DALI_LOG_ERROR( "Invalid type for shape in PrimitiveRenderer.\n" );
+      DALI_LOG_ERROR( "Invalid type for shape in PrimitiveVisual.\n" );
     }
   }
   else
   {
-    DALI_LOG_ERROR( "Fail to provide shape to the PrimitiveRenderer object.\n" );
+    DALI_LOG_ERROR( "Fail to provide shape to the PrimitiveVisual object.\n" );
   }
 
   //Read in other potential properties.
@@ -213,7 +213,7 @@ void PrimitiveRenderer::DoInitialize( Actor& actor, const Property::Map& propert
   Property::Value* color = propertyMap.Find( SHAPE_COLOR );
   if( color && !color->Get( mColor ) )
   {
-    DALI_LOG_ERROR( "Invalid type for color in PrimitiveRenderer.\n" );
+    DALI_LOG_ERROR( "Invalid type for color in PrimitiveVisual.\n" );
   }
 
   Property::Value* slices = propertyMap.Find( SLICES );
@@ -233,7 +233,7 @@ void PrimitiveRenderer::DoInitialize( Actor& actor, const Property::Map& propert
     }
     else
     {
-      DALI_LOG_ERROR( "Invalid type for slices in PrimitiveRenderer.\n" );
+      DALI_LOG_ERROR( "Invalid type for slices in PrimitiveVisual.\n" );
     }
   }
 
@@ -254,32 +254,32 @@ void PrimitiveRenderer::DoInitialize( Actor& actor, const Property::Map& propert
     }
     else
     {
-      DALI_LOG_ERROR( "Invalid type for stacks in PrimitiveRenderer.\n" );
+      DALI_LOG_ERROR( "Invalid type for stacks in PrimitiveVisual.\n" );
     }
   }
 
   Property::Value* scaleTop = propertyMap.Find( SCALE_TOP_RADIUS );
   if( scaleTop && !scaleTop->Get( mScaleTopRadius ) )
   {
-    DALI_LOG_ERROR( "Invalid type for scale top radius in PrimitiveRenderer.\n" );
+    DALI_LOG_ERROR( "Invalid type for scale top radius in PrimitiveVisual.\n" );
   }
 
   Property::Value* scaleBottom = propertyMap.Find( SCALE_BOTTOM_RADIUS );
   if( scaleBottom && !scaleBottom->Get( mScaleBottomRadius ) )
   {
-    DALI_LOG_ERROR( "Invalid type for scale bottom radius in PrimitiveRenderer.\n" );
+    DALI_LOG_ERROR( "Invalid type for scale bottom radius in PrimitiveVisual.\n" );
   }
 
   Property::Value* scaleHeight = propertyMap.Find( SCALE_HEIGHT );
   if( scaleHeight && !scaleHeight->Get( mScaleHeight ) )
   {
-    DALI_LOG_ERROR( "Invalid type for scale height in PrimitiveRenderer.\n" );
+    DALI_LOG_ERROR( "Invalid type for scale height in PrimitiveVisual.\n" );
   }
 
   Property::Value* scaleRadius = propertyMap.Find( SCALE_RADIUS );
   if( scaleRadius && !scaleRadius->Get( mScaleRadius ) )
   {
-    DALI_LOG_ERROR( "Invalid type for scale radius in PrimitiveRenderer.\n" );
+    DALI_LOG_ERROR( "Invalid type for scale radius in PrimitiveVisual.\n" );
   }
 
   Property::Value* dimensions = propertyMap.Find( SCALE_DIMENSIONS );
@@ -303,7 +303,7 @@ void PrimitiveRenderer::DoInitialize( Actor& actor, const Property::Map& propert
     }
     else
     {
-      DALI_LOG_ERROR( "Invalid type for scale dimensions in PrimitiveRenderer.\n" );
+      DALI_LOG_ERROR( "Invalid type for scale dimensions in PrimitiveVisual.\n" );
     }
   }
 
@@ -324,7 +324,7 @@ void PrimitiveRenderer::DoInitialize( Actor& actor, const Property::Map& propert
     }
     else
     {
-      DALI_LOG_ERROR( "Invalid type for bevel percentage in PrimitiveRenderer.\n" );
+      DALI_LOG_ERROR( "Invalid type for bevel percentage in PrimitiveVisual.\n" );
     }
   }
 
@@ -345,7 +345,7 @@ void PrimitiveRenderer::DoInitialize( Actor& actor, const Property::Map& propert
     }
     else
     {
-      DALI_LOG_ERROR( "Invalid type for bevel smoothness in PrimitiveRenderer.\n" );
+      DALI_LOG_ERROR( "Invalid type for bevel smoothness in PrimitiveVisual.\n" );
     }
   }
 
@@ -355,7 +355,7 @@ void PrimitiveRenderer::DoInitialize( Actor& actor, const Property::Map& propert
   {
     if( !lightPosition->Get( mLightPosition ) )
     {
-      DALI_LOG_ERROR( "Invalid value passed for light position in MeshRenderer object.\n" );
+      DALI_LOG_ERROR( "Invalid value passed for light position in MeshVisual object.\n" );
       mLightPosition = Vector3::ZERO;
     }
   }
@@ -369,31 +369,31 @@ void PrimitiveRenderer::DoInitialize( Actor& actor, const Property::Map& propert
   }
 }
 
-void PrimitiveRenderer::SetSize( const Vector2& size )
+void PrimitiveVisual::SetSize( const Vector2& size )
 {
-  ControlRenderer::SetSize( size );
+  Visual::SetSize( size );
 
   // ToDo: renderer responds to the size change
 }
 
-void PrimitiveRenderer::SetClipRect( const Rect<int>& clipRect )
+void PrimitiveVisual::SetClipRect( const Rect<int>& clipRect )
 {
-  ControlRenderer::SetClipRect( clipRect );
+  Visual::SetClipRect( clipRect );
 
   //ToDo: renderer responds to the clipRect change
 }
 
-void PrimitiveRenderer::SetOffset( const Vector2& offset )
+void PrimitiveVisual::SetOffset( const Vector2& offset )
 {
   //ToDo: renderer applies the offset
 }
 
-void PrimitiveRenderer::DoSetOnStage( Actor& actor )
+void PrimitiveVisual::DoSetOnStage( Actor& actor )
 {
   InitializeRenderer();
 }
 
-void PrimitiveRenderer::DoCreatePropertyMap( Property::Map& map ) const
+void PrimitiveVisual::DoCreatePropertyMap( Property::Map& map ) const
 {
   map.Clear();
   map.Insert( RENDERER_TYPE, RENDERER_TYPE_VALUE );
@@ -411,7 +411,7 @@ void PrimitiveRenderer::DoCreatePropertyMap( Property::Map& map ) const
   map.Insert( LIGHT_POSITION_UNIFORM_NAME, mLightPosition );
 }
 
-void PrimitiveRenderer::InitializeRenderer()
+void PrimitiveVisual::InitializeRenderer()
 {
   if( !mGeometry )
   {
@@ -426,7 +426,7 @@ void PrimitiveRenderer::InitializeRenderer()
   mImpl->mRenderer = Renderer::New( mGeometry, mShader );
 }
 
-void PrimitiveRenderer::UpdateShaderUniforms()
+void PrimitiveVisual::UpdateShaderUniforms()
 {
   Stage stage = Stage::GetCurrent();
   float width = stage.GetSize().width;
@@ -443,13 +443,13 @@ void PrimitiveRenderer::UpdateShaderUniforms()
   mShader.RegisterProperty( OBJECT_DIMENSIONS_UNIFORM_NAME, mObjectDimensions );
 }
 
-void PrimitiveRenderer::CreateShader()
+void PrimitiveVisual::CreateShader()
 {
   mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
   UpdateShaderUniforms();
 }
 
-void PrimitiveRenderer::CreateGeometry()
+void PrimitiveVisual::CreateGeometry()
 {
   Dali::Vector<Vertex> vertices;
   Dali::Vector<unsigned short> indices;
@@ -512,7 +512,7 @@ void PrimitiveRenderer::CreateGeometry()
   mGeometry.SetIndexBuffer( &indices[0], indices.Size() );
 }
 
-void PrimitiveRenderer::CreateSphere( Vector<Vertex>& vertices, Vector<unsigned short>& indices, int slices, int stacks )
+void PrimitiveVisual::CreateSphere( Vector<Vertex>& vertices, Vector<unsigned short>& indices, int slices, int stacks )
 {
   ComputeSphereVertices( vertices, slices, stacks );
   FormSphereTriangles( indices, slices, stacks );
@@ -520,7 +520,7 @@ void PrimitiveRenderer::CreateSphere( Vector<Vertex>& vertices, Vector<unsigned
   mObjectDimensions = Vector3::ONE;
 }
 
-void PrimitiveRenderer::CreateConic( Vector<Vertex>& vertices, Vector<unsigned short>& indices, float scaleTopRadius,
+void PrimitiveVisual::CreateConic( Vector<Vertex>& vertices, Vector<unsigned short>& indices, float scaleTopRadius,
                                      float scaleBottomRadius, float scaleHeight, int slices )
 {
   ComputeConicVertices( vertices, scaleTopRadius, scaleBottomRadius, scaleHeight, slices );
@@ -535,7 +535,7 @@ void PrimitiveRenderer::CreateConic( Vector<Vertex>& vertices, Vector<unsigned s
                                xDimension / largestDimension );
 }
 
-void PrimitiveRenderer::CreateBevelledCube( Vector<Vertex>& vertices, Vector<unsigned short>& indices,
+void PrimitiveVisual::CreateBevelledCube( Vector<Vertex>& vertices, Vector<unsigned short>& indices,
                                             Vector3 dimensions, float bevelPercentage, float bevelSmoothness )
 {
   dimensions.Normalize();
@@ -559,7 +559,7 @@ void PrimitiveRenderer::CreateBevelledCube( Vector<Vertex>& vertices, Vector<uns
   mObjectDimensions = dimensions;
 }
 
-void PrimitiveRenderer::ComputeCircleTables( Vector<float>& sinTable, Vector<float>& cosTable, int divisions,
+void PrimitiveVisual::ComputeCircleTables( Vector<float>& sinTable, Vector<float>& cosTable, int divisions,
                                              bool halfCircle )
 {
   if( divisions < 0 )
@@ -579,7 +579,7 @@ void PrimitiveRenderer::ComputeCircleTables( Vector<float>& sinTable, Vector<flo
   }
 }
 
-void PrimitiveRenderer::ComputeSphereVertices( Vector<Vertex>& vertices, int slices, int stacks )
+void PrimitiveVisual::ComputeSphereVertices( Vector<Vertex>& vertices, int slices, int stacks )
 {
   //Tables for calculating slices angles and stacks angles, respectively.
   Vector<float> sinTable1;
@@ -622,7 +622,7 @@ void PrimitiveRenderer::ComputeSphereVertices( Vector<Vertex>& vertices, int sli
   vertices[vertexIndex].normal =   Vector3( 0.0, -1.0, 0.0 );
 }
 
-void PrimitiveRenderer::FormSphereTriangles( Vector<unsigned short>& indices, int slices, int stacks )
+void PrimitiveVisual::FormSphereTriangles( Vector<unsigned short>& indices, int slices, int stacks )
 {
   if( stacks <= 1 )
   {
@@ -700,7 +700,7 @@ void PrimitiveRenderer::FormSphereTriangles( Vector<unsigned short>& indices, in
   }
 }
 
-void PrimitiveRenderer::ComputeConicVertices( Vector<Vertex>& vertices, float scaleTopRadius,
+void PrimitiveVisual::ComputeConicVertices( Vector<Vertex>& vertices, float scaleTopRadius,
                                                      float scaleBottomRadius, float scaleHeight, int slices )
 {
   int vertexIndex = 0;  //Track progress through vertices.
@@ -787,7 +787,7 @@ void PrimitiveRenderer::ComputeConicVertices( Vector<Vertex>& vertices, float sc
   vertexIndex++;
 }
 
-void PrimitiveRenderer::FormConicTriangles( Vector<unsigned short>& indices, float scaleTopRadius,
+void PrimitiveVisual::FormConicTriangles( Vector<unsigned short>& indices, float scaleTopRadius,
                                                    float scaleBottomRadius, int slices )
 {
   int  indiceIndex = 0;  //Track progress through indices.
@@ -914,7 +914,7 @@ void PrimitiveRenderer::FormConicTriangles( Vector<unsigned short>& indices, flo
   }
 }
 
-void PrimitiveRenderer::ComputeCubeVertices( Vector<Vertex>& vertices, Vector3 dimensions )
+void PrimitiveVisual::ComputeCubeVertices( Vector<Vertex>& vertices, Vector3 dimensions )
 {
   int numVertices = 4 * 6; //Four per face.
   int vertexIndex = 0; //Tracks progress through vertices.
@@ -997,7 +997,7 @@ void PrimitiveRenderer::ComputeCubeVertices( Vector<Vertex>& vertices, Vector3 d
 
 }
 
-void PrimitiveRenderer::FormCubeTriangles( Vector<unsigned short>& indices )
+void PrimitiveVisual::FormCubeTriangles( Vector<unsigned short>& indices )
 {
   int numTriangles = 12;
   int triangleIndex = 0;  //Track progress through indices.
@@ -1036,7 +1036,7 @@ void PrimitiveRenderer::FormCubeTriangles( Vector<unsigned short>& indices )
   indices[triangleIndex + 5] = 20;
 }
 
-void PrimitiveRenderer::ComputeOctahedronVertices( Vector<Vertex>& vertices, Vector3 dimensions, float smoothness )
+void PrimitiveVisual::ComputeOctahedronVertices( Vector<Vertex>& vertices, Vector3 dimensions, float smoothness )
 {
   int numVertices = 3 * 8; //Three per face
   int vertexIndex = 0; //Tracks progress through vertices.
@@ -1125,7 +1125,7 @@ void PrimitiveRenderer::ComputeOctahedronVertices( Vector<Vertex>& vertices, Vec
   }
 }
 
-void PrimitiveRenderer::FormOctahedronTriangles( Vector<unsigned short>& indices )
+void PrimitiveVisual::FormOctahedronTriangles( Vector<unsigned short>& indices )
 {
   int numTriangles = 8;
   int numIndices = numTriangles * 3;
@@ -1138,7 +1138,7 @@ void PrimitiveRenderer::FormOctahedronTriangles( Vector<unsigned short>& indices
   }
 }
 
-void PrimitiveRenderer::ComputeBevelledCubeVertices( Vector<Vertex>& vertices, Vector3 dimensions,
+void PrimitiveVisual::ComputeBevelledCubeVertices( Vector<Vertex>& vertices, Vector3 dimensions,
                                                      float bevelPercentage, float bevelSmoothness )
 {
   int numPositions = 24;
@@ -1382,7 +1382,7 @@ void PrimitiveRenderer::ComputeBevelledCubeVertices( Vector<Vertex>& vertices, V
   normalIndex++;
 }
 
-void PrimitiveRenderer::FormBevelledCubeTriangles( Vector<unsigned short>& indices )
+void PrimitiveVisual::FormBevelledCubeTriangles( Vector<unsigned short>& indices )
 {
   int numTriangles = 44; //(Going from top to bottom, that's 2 + 12 + 16 + 12 + 2)
   int indiceIndex = 0;  //Track progress through indices.