Commit 0d87f90af43262533fed3a39dfac5e197c634f00

Authored by Adeel Kazmi
2 parents 1a3e7b29 a3d5c29a

[dali_1.1.45] Merge branch 'devel/master'

Change-Id: Ie5ff6dbe0e8c581b17736a742d3eb13b99c6423d
com.samsung.dali-demo.xml
@@ -34,6 +34,9 @@ @@ -34,6 +34,9 @@
34 <ui-application appid="item-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/item-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> 34 <ui-application appid="item-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/item-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
35 <label>Item View</label> 35 <label>Item View</label>
36 </ui-application> 36 </ui-application>
  37 + <ui-application appid="renderer-stencil.example" exec="/usr/apps/com.samsung.dali-demo/bin/renderer-stencil.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
  38 + <label>Renderer Stencils</label>
  39 + </ui-application>
37 <ui-application appid="magnifier.example" exec="/usr/apps/com.samsung.dali-demo/bin/magnifier.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> 40 <ui-application appid="magnifier.example" exec="/usr/apps/com.samsung.dali-demo/bin/magnifier.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
38 <label>Magnifier</label> 41 <label>Magnifier</label>
39 </ui-application> 42 </ui-application>
@@ -160,8 +163,8 @@ @@ -160,8 +163,8 @@
160 <ui-application appid="video-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/video-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> 163 <ui-application appid="video-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/video-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
161 <label>Video View</label> 164 <label>Video View</label>
162 </ui-application> 165 </ui-application>
163 - <ui-application appid="mesh-renderer.example" exec="/usr/apps/com.samsung.dali-demo/bin/mesh-renderer.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">  
164 - <label>Mesh Renderer</label> 166 + <ui-application appid="mesh-visual.example" exec="/usr/apps/com.samsung.dali-demo/bin/mesh-visual.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
  167 + <label>Mesh Visual</label>
165 </ui-application> 168 </ui-application>
166 <ui-application appid="primitive-shapes.example" exec="/usr/apps/com.samsung.dali-demo/bin/primitive-shapes.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> 169 <ui-application appid="primitive-shapes.example" exec="/usr/apps/com.samsung.dali-demo/bin/primitive-shapes.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
167 <label>Primitive Shapes</label> 170 <label>Primitive Shapes</label>
demo/dali-demo.cpp
@@ -41,8 +41,8 @@ int DALI_EXPORT_API main(int argc, char **argv) @@ -41,8 +41,8 @@ int DALI_EXPORT_API main(int argc, char **argv)
41 demo.AddExample(Example("cube-transition-effect.example", DALI_DEMO_STR_TITLE_CUBE_TRANSITION)); 41 demo.AddExample(Example("cube-transition-effect.example", DALI_DEMO_STR_TITLE_CUBE_TRANSITION));
42 demo.AddExample(Example("dissolve-effect.example", DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION)); 42 demo.AddExample(Example("dissolve-effect.example", DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION));
43 demo.AddExample(Example("item-view.example", DALI_DEMO_STR_TITLE_ITEM_VIEW)); 43 demo.AddExample(Example("item-view.example", DALI_DEMO_STR_TITLE_ITEM_VIEW));
  44 + demo.AddExample(Example("renderer-stencil.example", DALI_DEMO_STR_TITLE_RENDERER_STENCIL));
44 demo.AddExample(Example("magnifier.example", DALI_DEMO_STR_TITLE_MAGNIFIER)); 45 demo.AddExample(Example("magnifier.example", DALI_DEMO_STR_TITLE_MAGNIFIER));
45 - demo.AddExample(Example("model3d-view.example", DALI_DEMO_STR_TITLE_MODEL_3D_VIEWER));  
46 demo.AddExample(Example("motion-blur.example", DALI_DEMO_STR_TITLE_MOTION_BLUR)); 46 demo.AddExample(Example("motion-blur.example", DALI_DEMO_STR_TITLE_MOTION_BLUR));
47 demo.AddExample(Example("motion-stretch.example", DALI_DEMO_STR_TITLE_MOTION_STRETCH)); 47 demo.AddExample(Example("motion-stretch.example", DALI_DEMO_STR_TITLE_MOTION_STRETCH));
48 demo.AddExample(Example("page-turn-view.example", DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW)); 48 demo.AddExample(Example("page-turn-view.example", DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW));
@@ -78,7 +78,7 @@ int DALI_EXPORT_API main(int argc, char **argv) @@ -78,7 +78,7 @@ int DALI_EXPORT_API main(int argc, char **argv)
78 demo.AddExample(Example("tilt.example", DALI_DEMO_STR_TITLE_TILT_SENSOR)); 78 demo.AddExample(Example("tilt.example", DALI_DEMO_STR_TITLE_TILT_SENSOR));
79 demo.AddExample(Example("effects-view.example", DALI_DEMO_STR_TITLE_EFFECTS_VIEW)); 79 demo.AddExample(Example("effects-view.example", DALI_DEMO_STR_TITLE_EFFECTS_VIEW));
80 demo.AddExample(Example("native-image-source.example", DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE)); 80 demo.AddExample(Example("native-image-source.example", DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE));
81 - demo.AddExample(Example("mesh-renderer.example", DALI_DEMO_STR_TITLE_MESH_RENDERER)); 81 + demo.AddExample(Example("mesh-visual.example", DALI_DEMO_STR_TITLE_MESH_VISUAL));
82 demo.AddExample(Example("primitive-shapes.example", DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES)); 82 demo.AddExample(Example("primitive-shapes.example", DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES));
83 83
84 demo.SortAlphabetically( true ); 84 demo.SortAlphabetically( true );
examples/dissolve-effect/dissolve-effect-example.cpp
@@ -91,13 +91,13 @@ Toolkit::ImageView CreateStageFillingImageView( const char * const imagePath ) @@ -91,13 +91,13 @@ Toolkit::ImageView CreateStageFillingImageView( const char * const imagePath )
91 Size stageSize = Stage::GetCurrent().GetSize(); 91 Size stageSize = Stage::GetCurrent().GetSize();
92 Toolkit::ImageView imageView = Toolkit::ImageView::New(); 92 Toolkit::ImageView imageView = Toolkit::ImageView::New();
93 Property::Map map; 93 Property::Map map;
94 - map["rendererType"] = "IMAGE";  
95 - map["url"] = imagePath;  
96 - map["desiredWidth"] = stageSize.x;  
97 - map["desiredHeight"] = stageSize.y;  
98 - map["fittingMode"] = "SCALE_TO_FILL";  
99 - map["samplingMode"] = "BOX_THEN_LINEAR";  
100 - map["synchronousLoading"] = true; 94 + map[Toolkit::Visual::Property::TYPE] = Toolkit::Visual::IMAGE;
  95 + map[Toolkit::ImageVisual::Property::URL] = imagePath;
  96 + map[Toolkit::ImageVisual::Property::DESIRED_WIDTH] = stageSize.x;
  97 + map[Toolkit::ImageVisual::Property::DESIRED_HEIGHT] = stageSize.y;
  98 + map[Toolkit::ImageVisual::Property::FITTING_MODE] = FittingMode::SCALE_TO_FILL;
  99 + map[Toolkit::ImageVisual::Property::SAMPLING_MODE] = SamplingMode::BOX_THEN_LINEAR;
  100 + map[Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING] = true;
101 imageView.SetProperty( Toolkit::ImageView::Property::IMAGE, map ); 101 imageView.SetProperty( Toolkit::ImageView::Property::IMAGE, map );
102 102
103 return imageView; 103 return imageView;
examples/gradients/gradients-example.cpp
@@ -77,7 +77,7 @@ public: @@ -77,7 +77,7 @@ public:
77 77
78 // ---- Gradient for background 78 // ---- Gradient for background
79 79
80 - mGradientMap.Insert("rendererType", "GRADIENT"); 80 + mGradientMap.Insert( Visual::Property::TYPE, Visual::GRADIENT );
81 81
82 Property::Array stopOffsets; 82 Property::Array stopOffsets;
83 stopOffsets.PushBack( 0.0f ); 83 stopOffsets.PushBack( 0.0f );
@@ -85,7 +85,7 @@ public: @@ -85,7 +85,7 @@ public:
85 stopOffsets.PushBack( 0.6f ); 85 stopOffsets.PushBack( 0.6f );
86 stopOffsets.PushBack( 0.8f ); 86 stopOffsets.PushBack( 0.8f );
87 stopOffsets.PushBack( 1.0f ); 87 stopOffsets.PushBack( 1.0f );
88 - mGradientMap.Insert("stopOffset", stopOffsets ); 88 + mGradientMap.Insert( GradientVisual::Property::STOP_OFFSET, stopOffsets );
89 89
90 Property::Array stopColors; 90 Property::Array stopColors;
91 stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 255.f )/255.f ); 91 stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 255.f )/255.f );
@@ -93,7 +93,7 @@ public: @@ -93,7 +93,7 @@ public:
93 stopColors.PushBack( Vector4( 214.f, 37.f, 139.f, 191.f )/255.f ); 93 stopColors.PushBack( Vector4( 214.f, 37.f, 139.f, 191.f )/255.f );
94 stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 150.f )/255.f ); 94 stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 150.f )/255.f );
95 stopColors.PushBack( Color::YELLOW ); 95 stopColors.PushBack( Color::YELLOW );
96 - mGradientMap.Insert("stopColor", stopColors); 96 + mGradientMap.Insert( GradientVisual::Property::STOP_COLOR, stopColors );
97 97
98 OnChangeIconClicked( changeButton ); 98 OnChangeIconClicked( changeButton );
99 } 99 }
@@ -106,30 +106,30 @@ public: @@ -106,30 +106,30 @@ public:
106 { 106 {
107 case 0: // linear gradient with units as objectBoundingBox 107 case 0: // linear gradient with units as objectBoundingBox
108 { 108 {
109 - gradientMap.Insert("startPosition", Vector2( 0.5f, 0.5f ));  
110 - gradientMap.Insert("endPosition", Vector2( -0.5f, -0.5f )); 109 + gradientMap.Insert( GradientVisual::Property::START_POSITION, Vector2( 0.5f, 0.5f ) );
  110 + gradientMap.Insert( GradientVisual::Property::END_POSITION, Vector2( -0.5f, -0.5f ) );
111 break; 111 break;
112 } 112 }
113 case 1: // linear gradient with units as userSpaceOnUse 113 case 1: // linear gradient with units as userSpaceOnUse
114 { 114 {
115 Vector2 halfStageSize = Stage::GetCurrent().GetSize()*0.5f; 115 Vector2 halfStageSize = Stage::GetCurrent().GetSize()*0.5f;
116 - gradientMap.Insert("startPosition", halfStageSize);  
117 - gradientMap.Insert("endPosition", -halfStageSize );  
118 - gradientMap.Insert("units", "USER_SPACE"); 116 + gradientMap.Insert( GradientVisual::Property::START_POSITION, halfStageSize );
  117 + gradientMap.Insert( GradientVisual::Property::END_POSITION, -halfStageSize );
  118 + gradientMap.Insert( GradientVisual::Property::UNITS, GradientVisual::Units::USER_SPACE );
119 break; 119 break;
120 } 120 }
121 case 2: // radial gradient with units as objectBoundingBox 121 case 2: // radial gradient with units as objectBoundingBox
122 { 122 {
123 - gradientMap.Insert("center", Vector2(0.5f, 0.5f));  
124 - gradientMap.Insert("radius", 1.414f); 123 + gradientMap.Insert( GradientVisual::Property::CENTER, Vector2( 0.5f, 0.5f ) );
  124 + gradientMap.Insert( GradientVisual::Property::RADIUS, 1.414f );
125 break; 125 break;
126 } 126 }
127 default: // radial gradient with units as userSpaceOnUse 127 default: // radial gradient with units as userSpaceOnUse
128 { 128 {
129 Vector2 stageSize = Stage::GetCurrent().GetSize(); 129 Vector2 stageSize = Stage::GetCurrent().GetSize();
130 - gradientMap.Insert("center", stageSize*0.5f);  
131 - gradientMap.Insert("radius", stageSize.Length());  
132 - gradientMap.Insert("units", "USER_SPACE"); 130 + gradientMap.Insert( GradientVisual::Property::CENTER, stageSize * 0.5f );
  131 + gradientMap.Insert( GradientVisual::Property::RADIUS, stageSize.Length());
  132 + gradientMap.Insert( GradientVisual::Property::UNITS, GradientVisual::Units::USER_SPACE );
133 break; 133 break;
134 } 134 }
135 } 135 }
examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp
@@ -177,12 +177,12 @@ public: @@ -177,12 +177,12 @@ public:
177 177
178 // Background image: 178 // Background image:
179 Dali::Property::Map backgroundImage; 179 Dali::Property::Map backgroundImage;
180 - backgroundImage.Insert( "rendererType", "IMAGE" );  
181 - backgroundImage.Insert( "url", BACKGROUND_IMAGE );  
182 - backgroundImage.Insert( "desiredWidth", stage.GetSize().width );  
183 - backgroundImage.Insert( "desiredHeight", stage.GetSize().height );  
184 - backgroundImage.Insert( "fittingMode", "SCALE_TO_FILL" );  
185 - backgroundImage.Insert( "samplingMode", "BOX_THEN_NEAREST" ); 180 + backgroundImage.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE );
  181 + backgroundImage.Insert( Toolkit::ImageVisual::Property::URL, BACKGROUND_IMAGE );
  182 + backgroundImage.Insert( Toolkit::ImageVisual::Property::DESIRED_WIDTH, stage.GetSize().width );
  183 + backgroundImage.Insert( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, stage.GetSize().height );
  184 + backgroundImage.Insert( Toolkit::ImageVisual::Property::FITTING_MODE, FittingMode::SCALE_TO_FILL );
  185 + backgroundImage.Insert( Toolkit::ImageVisual::Property::SAMPLING_MODE, SamplingMode::BOX_THEN_NEAREST );
186 186
187 Toolkit::ImageView background = Toolkit::ImageView::New(); 187 Toolkit::ImageView background = Toolkit::ImageView::New();
188 background.SetProperty( Toolkit::ImageView::Property::IMAGE, backgroundImage ); 188 background.SetProperty( Toolkit::ImageView::Property::IMAGE, backgroundImage );
examples/item-view/item-view-example.cpp
@@ -878,10 +878,10 @@ public: // From ItemFactory @@ -878,10 +878,10 @@ public: // From ItemFactory
878 borderActor.SetColorMode( USE_PARENT_COLOR ); 878 borderActor.SetColorMode( USE_PARENT_COLOR );
879 879
880 Property::Map borderProperty; 880 Property::Map borderProperty;
881 - borderProperty.Insert( "rendererType", "BORDER" );  
882 - borderProperty.Insert( "borderColor", Color::WHITE );  
883 - borderProperty.Insert( "borderSize", ITEM_BORDER_SIZE );  
884 - borderProperty.Insert( "antiAliasing", true ); 881 + borderProperty.Insert( Visual::Property::TYPE, Visual::BORDER );
  882 + borderProperty.Insert( BorderVisual::Property::COLOR, Color::WHITE );
  883 + borderProperty.Insert( BorderVisual::Property::SIZE, ITEM_BORDER_SIZE );
  884 + borderProperty.Insert( BorderVisual::Property::ANTI_ALIASING, true );
885 borderActor.SetProperty( ImageView::Property::IMAGE, borderProperty ); 885 borderActor.SetProperty( ImageView::Property::IMAGE, borderProperty );
886 886
887 actor.Add(borderActor); 887 actor.Add(borderActor);
@@ -902,8 +902,8 @@ public: // From ItemFactory @@ -902,8 +902,8 @@ public: // From ItemFactory
902 checkbox.SetZ( 0.1f ); 902 checkbox.SetZ( 0.1f );
903 903
904 Property::Map solidColorProperty; 904 Property::Map solidColorProperty;
905 - solidColorProperty.Insert( "rendererType", "COLOR" );  
906 - solidColorProperty.Insert( "mixColor", Vector4(0.f, 0.f, 0.f, 0.6f) ); 905 + solidColorProperty.Insert( Visual::Property::TYPE, Visual::COLOR );
  906 + solidColorProperty.Insert( ColorVisual::Property::MIX_COLOR, Vector4(0.f, 0.f, 0.f, 0.6f) );
907 checkbox.SetProperty( ImageView::Property::IMAGE, solidColorProperty ); 907 checkbox.SetProperty( ImageView::Property::IMAGE, solidColorProperty );
908 908
909 if( MODE_REMOVE_MANY != mMode && 909 if( MODE_REMOVE_MANY != mMode &&
examples/line-mesh/line-mesh-example.cpp
@@ -102,7 +102,7 @@ Geometry CreateGeometry() @@ -102,7 +102,7 @@ Geometry CreateGeometry()
102 Geometry pentagonGeometry = Geometry::New(); 102 Geometry pentagonGeometry = Geometry::New();
103 pentagonGeometry.AddVertexBuffer( pentagonVertices ); 103 pentagonGeometry.AddVertexBuffer( pentagonVertices );
104 pentagonGeometry.SetIndexBuffer( INDICES[0], INDICES_SIZE[0] ); 104 pentagonGeometry.SetIndexBuffer( INDICES[0], INDICES_SIZE[0] );
105 - pentagonGeometry.SetGeometryType( Geometry::LINES ); 105 + pentagonGeometry.SetType( Geometry::LINES );
106 return pentagonGeometry; 106 return pentagonGeometry;
107 } 107 }
108 108
@@ -334,7 +334,7 @@ public: @@ -334,7 +334,7 @@ public:
334 std::stringstream str; 334 std::stringstream str;
335 str << mCurrentIndexCount; 335 str << mCurrentIndexCount;
336 mIndicesCountLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, str.str() ); 336 mIndicesCountLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, str.str() );
337 - mGeometry.SetGeometryType( mPrimitiveType ); 337 + mGeometry.SetType( mPrimitiveType );
338 mGeometry.SetIndexBuffer( INDICES[ indicesArray ], INDICES_SIZE[ indicesArray ] ); 338 mGeometry.SetIndexBuffer( INDICES[ indicesArray ], INDICES_SIZE[ indicesArray ] );
339 mRenderer.SetIndexRange( 0, mCurrentIndexCount ); 339 mRenderer.SetIndexRange( 0, mCurrentIndexCount );
340 return true; 340 return true;
@@ -373,7 +373,7 @@ private: @@ -373,7 +373,7 @@ private:
373 Toolkit::PushButton mMinusButton; 373 Toolkit::PushButton mMinusButton;
374 Toolkit::PushButton mPlusButton; 374 Toolkit::PushButton mPlusButton;
375 Toolkit::TextLabel mIndicesCountLabel; 375 Toolkit::TextLabel mIndicesCountLabel;
376 - Geometry::GeometryType mPrimitiveType; 376 + Geometry::Type mPrimitiveType;
377 int mCurrentIndexCount; 377 int mCurrentIndexCount;
378 int mMaxIndexCount; 378 int mMaxIndexCount;
379 }; 379 };
examples/mesh-renderer/mesh-renderer-example.cpp renamed to examples/mesh-visual/mesh-visual-example.cpp
@@ -9,7 +9,7 @@ namespace @@ -9,7 +9,7 @@ namespace
9 //Keeps information about each model for access. 9 //Keeps information about each model for access.
10 struct Model 10 struct Model
11 { 11 {
12 - Control control; // Control housing the mesh renderer of the model. 12 + Control control; // Control housing the mesh visual of the model.
13 Vector2 rotation; // Keeps track of rotation about x and y axis for manual rotation. 13 Vector2 rotation; // Keeps track of rotation about x and y axis for manual rotation.
14 Animation rotationAnimation; // Automatically rotates when left alone. 14 Animation rotationAnimation; // Automatically rotates when left alone.
15 }; 15 };
@@ -31,12 +31,12 @@ namespace @@ -31,12 +31,12 @@ namespace
31 31
32 const char * const TEXTURES_PATH( DEMO_IMAGE_DIR "" ); 32 const char * const TEXTURES_PATH( DEMO_IMAGE_DIR "" );
33 33
34 - //Possible shader options.  
35 - const char * const SHADER_TYPE[] = 34 + //Possible shading modes.
  35 + MeshVisual::ShadingMode::Value SHADING_MODE_TABLE[] =
36 { 36 {
37 - "ALL_TEXTURES",  
38 - "DIFFUSE_TEXTURE",  
39 - "TEXTURELESS" 37 + MeshVisual::ShadingMode::TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING,
  38 + MeshVisual::ShadingMode::TEXTURED_WITH_SPECULAR_LIGHTING,
  39 + MeshVisual::ShadingMode::TEXTURELESS_WITH_DIFFUSE_LIGHTING
40 }; 40 };
41 41
42 //Files for background and toolbar 42 //Files for background and toolbar
@@ -47,23 +47,30 @@ namespace @@ -47,23 +47,30 @@ namespace
47 const float MODEL_SCALE = 0.75f; 47 const float MODEL_SCALE = 0.75f;
48 const int NUM_MESHES = 3; 48 const int NUM_MESHES = 3;
49 49
  50 + //Used to identify actors.
  51 + const int MODEL_TAG = 0;
  52 + const int LIGHT_TAG = 1;
  53 + const int LAYER_TAG = 2;
  54 +
50 } //End namespace 55 } //End namespace
51 56
52 -class MeshRendererController : public ConnectionTracker 57 +class MeshVisualController : public ConnectionTracker
53 { 58 {
54 public: 59 public:
55 60
56 - MeshRendererController( Application& application ) 61 + MeshVisualController( Application& application )
57 : mApplication( application ), //Store handle to the application. 62 : mApplication( application ), //Store handle to the application.
58 mModelIndex( 1 ), //Start with metal robot. 63 mModelIndex( 1 ), //Start with metal robot.
59 - mShaderIndex( 0 ), //Start with all textures.  
60 - mSelectedModelIndex( 0 ) //Non-valid default, which will get set to a correct value when used. 64 + mShadingModeIndex( 0 ), //Start with textured with detailed specular lighting.
  65 + mTag( -1 ), //Non-valid default, which will get set to a correct value when used.
  66 + mSelectedModelIndex( -1 ), //Non-valid default, which will get set to a correct value when used.
  67 + mPaused( false ) //Animations play by default.
61 { 68 {
62 // Connect to the Application's Init signal 69 // Connect to the Application's Init signal
63 - mApplication.InitSignal().Connect( this, &MeshRendererController::Create ); 70 + mApplication.InitSignal().Connect( this, &MeshVisualController::Create );
64 } 71 }
65 72
66 - ~MeshRendererController() 73 + ~MeshVisualController()
67 { 74 {
68 } 75 }
69 76
@@ -82,7 +89,7 @@ public: @@ -82,7 +89,7 @@ public:
82 LoadScene(); 89 LoadScene();
83 90
84 //Allow for exiting of the application via key presses. 91 //Allow for exiting of the application via key presses.
85 - stage.KeyEventSignal().Connect( this, &MeshRendererController::OnKeyEvent ); 92 + stage.KeyEventSignal().Connect( this, &MeshVisualController::OnKeyEvent );
86 } 93 }
87 94
88 //Sets up the on-screen elements. 95 //Sets up the on-screen elements.
@@ -90,25 +97,24 @@ public: @@ -90,25 +97,24 @@ public:
90 { 97 {
91 Stage stage = Stage::GetCurrent(); 98 Stage stage = Stage::GetCurrent();
92 99
93 - //Set up 3D layer to place objects on.  
94 - Layer layer = Layer::New();  
95 - layer.SetParentOrigin( ParentOrigin::CENTER );  
96 - layer.SetAnchorPoint( AnchorPoint::CENTER );  
97 - layer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );  
98 - layer.SetBehavior( Layer::LAYER_2D ); //We use a 2D layer as this is closer to UI work than full 3D scene creation.  
99 - layer.SetDepthTestDisabled( false ); //Enable depth testing, as otherwise the 2D layer would not do so.  
100 - stage.Add( layer );  
101 -  
102 - //Create gesture detector for panning of models.  
103 - mPanGestureDetector = PanGestureDetector::New();  
104 - mPanGestureDetector.DetectedSignal().Connect( this, &MeshRendererController::OnPan );  
105 -  
106 - //Add containers to house each renderer-holding-actor. 100 + //Set up layer to place objects on.
  101 + Layer baseLayer = Layer::New();
  102 + baseLayer.SetParentOrigin( ParentOrigin::CENTER );
  103 + baseLayer.SetAnchorPoint( AnchorPoint::CENTER );
  104 + baseLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
  105 + baseLayer.SetBehavior( Layer::LAYER_2D ); //We use a 2D layer as this is closer to UI work than full 3D scene creation.
  106 + baseLayer.SetDepthTestDisabled( false ); //Enable depth testing, as otherwise the 2D layer would not do so.
  107 + baseLayer.RegisterProperty( "Tag", LAYER_TAG ); //Used to differentiate between different kinds of actor.
  108 + baseLayer.TouchedSignal().Connect( this, &MeshVisualController::OnTouch );
  109 + stage.Add( baseLayer );
  110 +
  111 + //Add containers to house each visual-holding-actor.
107 for( int i = 0; i < NUM_MESHES; i++ ) 112 for( int i = 0; i < NUM_MESHES; i++ )
108 { 113 {
109 mContainers[i] = Actor::New(); 114 mContainers[i] = Actor::New();
110 mContainers[i].SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); 115 mContainers[i].SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
111 - mContainers[i].RegisterProperty( "Tag", Property::Value( i ) ); //Used to identify the actor and index into the model. 116 + mContainers[i].RegisterProperty( "Tag", MODEL_TAG ); //Used to differentiate between different kinds of actor.
  117 + mContainers[i].RegisterProperty( "Model", Property::Value( i ) ); //Used to index into the model.
112 118
113 //Position each container on screen 119 //Position each container on screen
114 if( i == 0 ) 120 if( i == 0 )
@@ -133,8 +139,8 @@ public: @@ -133,8 +139,8 @@ public:
133 mContainers[i].SetAnchorPoint( AnchorPoint::TOP_RIGHT ); 139 mContainers[i].SetAnchorPoint( AnchorPoint::TOP_RIGHT );
134 } 140 }
135 141
136 - mPanGestureDetector.Attach( mContainers[i] );  
137 - layer.Add( mContainers[i] ); 142 + mContainers[i].TouchedSignal().Connect( this, &MeshVisualController::OnTouch );
  143 + baseLayer.Add( mContainers[i] );
138 } 144 }
139 145
140 //Set up models 146 //Set up models
@@ -168,20 +174,66 @@ public: @@ -168,20 +174,66 @@ public:
168 //Create button for model changing 174 //Create button for model changing
169 Toolkit::PushButton modelButton = Toolkit::PushButton::New(); 175 Toolkit::PushButton modelButton = Toolkit::PushButton::New();
170 modelButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); 176 modelButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
171 - modelButton.ClickedSignal().Connect( this, &MeshRendererController::OnChangeModelClicked );  
172 - modelButton.SetParentOrigin( Vector3( 0.1, 0.95, 0.5 ) ); //Offset from bottom left 177 + modelButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeModelClicked );
  178 + modelButton.SetParentOrigin( Vector3( 0.05, 0.95, 0.5 ) ); //Offset from bottom left
173 modelButton.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT ); 179 modelButton.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT );
174 modelButton.SetLabelText( "Change Model" ); 180 modelButton.SetLabelText( "Change Model" );
175 - layer.Add( modelButton ); 181 + baseLayer.Add( modelButton );
176 182
177 //Create button for shader changing 183 //Create button for shader changing
178 Toolkit::PushButton shaderButton = Toolkit::PushButton::New(); 184 Toolkit::PushButton shaderButton = Toolkit::PushButton::New();
179 shaderButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); 185 shaderButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
180 - shaderButton.ClickedSignal().Connect( this, &MeshRendererController::OnChangeShaderClicked );  
181 - shaderButton.SetParentOrigin( Vector3( 0.9, 0.95, 0.5 ) ); //Offset from bottom right 186 + shaderButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeShaderClicked );
  187 + shaderButton.SetParentOrigin( Vector3( 0.95, 0.95, 0.5 ) ); //Offset from bottom right
182 shaderButton.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT ); 188 shaderButton.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT );
183 shaderButton.SetLabelText( "Change Shader" ); 189 shaderButton.SetLabelText( "Change Shader" );
184 - layer.Add( shaderButton ); 190 + baseLayer.Add( shaderButton );
  191 +
  192 + //Create button for pausing animations
  193 + Toolkit::PushButton pauseButton = Toolkit::PushButton::New();
  194 + pauseButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
  195 + pauseButton.ClickedSignal().Connect( this, &MeshVisualController::OnPauseClicked );
  196 + pauseButton.SetParentOrigin( Vector3( 0.5, 0.95, 0.5 ) ); //Offset from bottom center
  197 + pauseButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
  198 + pauseButton.SetLabelText( " || " );
  199 + baseLayer.Add( pauseButton );
  200 +
  201 + //Create control to act as light source of scene.
  202 + mLightSource = Control::New();
  203 + mLightSource.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::WIDTH );
  204 + mLightSource.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
  205 + mLightSource.RegisterProperty( "Tag", LIGHT_TAG );
  206 +
  207 + //Set position relative to top left, as the light source property is also relative to the top left.
  208 + mLightSource.SetParentOrigin( ParentOrigin::TOP_LEFT );
  209 + mLightSource.SetAnchorPoint( AnchorPoint::CENTER );
  210 + mLightSource.SetPosition( Stage::GetCurrent().GetSize().x * 0.5f, Stage::GetCurrent().GetSize().y * 0.1f );
  211 +
  212 + //Make white background.
  213 + Property::Map lightMap;
  214 + lightMap.Insert( Visual::Property::TYPE, Visual::COLOR );
  215 + lightMap.Insert( ColorVisual::Property::MIX_COLOR, Color::WHITE );
  216 + mLightSource.SetProperty( Control::Property::BACKGROUND, Property::Value( lightMap ) );
  217 +
  218 + //Label to show what this actor is for the user.
  219 + TextLabel lightLabel = TextLabel::New( "Light" );
  220 + lightLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
  221 + lightLabel.SetParentOrigin( ParentOrigin::CENTER );
  222 + lightLabel.SetAnchorPoint( AnchorPoint::CENTER );
  223 + float padding = 5.0f;
  224 + lightLabel.SetPadding( Padding( padding, padding, padding, padding ) );
  225 + mLightSource.Add( lightLabel );
  226 +
  227 + //Connect to touch signal for dragging.
  228 + mLightSource.TouchedSignal().Connect( this, &MeshVisualController::OnTouch );
  229 +
  230 + //Place the light source on a layer above the base, so that it is rendered above everything else.
  231 + Layer upperLayer = Layer::New();
  232 + baseLayer.Add( upperLayer );
  233 + upperLayer.Add( mLightSource );
  234 +
  235 + //Calling this sets the light position of each model to that of the light source control.
  236 + UpdateLight();
185 } 237 }
186 238
187 //Updates the displayed models to account for parameter changes. 239 //Updates the displayed models to account for parameter changes.
@@ -189,11 +241,12 @@ public: @@ -189,11 +241,12 @@ public:
189 { 241 {
190 //Create mesh property map 242 //Create mesh property map
191 Property::Map map; 243 Property::Map map;
192 - map.Insert( "rendererType", "MESH" );  
193 - map.Insert( "objectUrl", MODEL_FILE[mModelIndex] );  
194 - map.Insert( "materialUrl", MATERIAL_FILE[mModelIndex] );  
195 - map.Insert( "texturesPath", TEXTURES_PATH );  
196 - map.Insert( "shaderType", SHADER_TYPE[mShaderIndex] ); 244 + map.Insert( Visual::Property::TYPE, Visual::MESH );
  245 + map.Insert( MeshVisual::Property::OBJECT_URL, MODEL_FILE[mModelIndex] );
  246 + map.Insert( MeshVisual::Property::MATERIAL_URL, MATERIAL_FILE[mModelIndex] );
  247 + map.Insert( MeshVisual::Property::TEXTURES_PATH, TEXTURES_PATH );
  248 + map.Insert( MeshVisual::Property::SHADING_MODE, SHADING_MODE_TABLE[mShadingModeIndex] );
  249 + map.Insert( MeshVisual::Property::USE_SOFT_NORMALS, false );
197 250
198 //Set the two controls to use the mesh 251 //Set the two controls to use the mesh
199 for( int i = 0; i < NUM_MESHES; i++ ) 252 for( int i = 0; i < NUM_MESHES; i++ )
@@ -202,53 +255,101 @@ public: @@ -202,53 +255,101 @@ public:
202 } 255 }
203 } 256 }
204 257
205 - //Rotates the panned model based on the gesture.  
206 - void OnPan( Actor actor, const PanGesture& gesture ) 258 + //Updates the light position for each model to account for changes in the source on screen.
  259 + void UpdateLight()
207 { 260 {
208 - switch( gesture.state ) 261 + //Set light position to the x and y of the light control, offset out of the screen.
  262 + Vector3 controlPosition = mLightSource.GetCurrentPosition();
  263 + Vector3 lightPosition = Vector3( controlPosition.x, controlPosition.y, Stage::GetCurrent().GetSize().x * 2.0f );
  264 +
  265 + for( int i = 0; i < NUM_MESHES; ++i )
209 { 266 {
210 - case Gesture::Started:  
211 - {  
212 - //Find out which model has been selected  
213 - actor.GetProperty( actor.GetPropertyIndex( "Tag" ) ).Get( mSelectedModelIndex ); 267 + mModels[i].control.RegisterProperty( "lightPosition", lightPosition, Property::ANIMATABLE );
  268 + }
  269 + }
214 270
215 - //Pause current animation, as the gesture will be used to manually rotate the model  
216 - mModels[mSelectedModelIndex].rotationAnimation.Pause(); 271 + //If the light source is touched, move it by dragging it.
  272 + //If a model is touched, rotate it by panning around.
  273 + bool OnTouch( Actor actor, const TouchEvent& event )
  274 + {
  275 + //Get primary touch point.
  276 + const Dali::TouchPoint& point = event.GetPoint( 0 );
217 277
218 - break;  
219 - }  
220 - case Gesture::Continuing: 278 + switch( point.state )
  279 + {
  280 + case TouchPoint::Down:
221 { 281 {
222 - //Rotate based off the gesture.  
223 - mModels[mSelectedModelIndex].rotation.x -= gesture.displacement.y / X_ROTATION_DISPLACEMENT_FACTOR; // Y displacement rotates around X axis  
224 - mModels[mSelectedModelIndex].rotation.y += gesture.displacement.x / Y_ROTATION_DISPLACEMENT_FACTOR; // X displacement rotates around Y axis  
225 - Quaternion rotation = Quaternion( Radian( mModels[mSelectedModelIndex].rotation.x ), Vector3::XAXIS) *  
226 - Quaternion( Radian( mModels[mSelectedModelIndex].rotation.y ), Vector3::YAXIS); 282 + //Determine what was touched.
  283 + actor.GetProperty( actor.GetPropertyIndex( "Tag" ) ).Get( mTag );
  284 +
  285 + if( mTag == MODEL_TAG )
  286 + {
  287 + //Find out which model has been selected
  288 + actor.GetProperty( actor.GetPropertyIndex( "Model" ) ).Get( mSelectedModelIndex );
  289 +
  290 + //Pause current animation, as the touch gesture will be used to manually rotate the model
  291 + mModels[mSelectedModelIndex].rotationAnimation.Pause();
227 292
228 - mModels[mSelectedModelIndex].control.SetOrientation( rotation ); 293 + //Store start points.
  294 + mPanStart = point.screen;
  295 + mRotationStart = mModels[mSelectedModelIndex].rotation;
  296 + }
229 297
230 break; 298 break;
231 } 299 }
232 - case Gesture::Finished: 300 + case TouchPoint::Motion:
233 { 301 {
234 - //Return to automatic animation  
235 - mModels[mSelectedModelIndex].rotationAnimation.Play(); 302 + //Switch on the kind of actor we're interacting with.
  303 + switch( mTag )
  304 + {
  305 + case MODEL_TAG: //Rotate model
  306 + {
  307 + //Calculate displacement and corresponding rotation.
  308 + Vector2 displacement = point.screen - mPanStart;
  309 + mModels[mSelectedModelIndex].rotation = Vector2( mRotationStart.x - displacement.y / Y_ROTATION_DISPLACEMENT_FACTOR, // Y displacement rotates around X axis
  310 + mRotationStart.y + displacement.x / X_ROTATION_DISPLACEMENT_FACTOR ); // X displacement rotates around Y axis
  311 + Quaternion rotation = Quaternion( Radian( mModels[mSelectedModelIndex].rotation.x ), Vector3::XAXIS) *
  312 + Quaternion( Radian( mModels[mSelectedModelIndex].rotation.y ), Vector3::YAXIS);
  313 +
  314 + //Apply rotation.
  315 + mModels[mSelectedModelIndex].control.SetOrientation( rotation );
  316 +
  317 + break;
  318 + }
  319 + case LIGHT_TAG: //Drag light
  320 + {
  321 + //Set light source to new position and update the models accordingly.
  322 + mLightSource.SetPosition( Vector3( point.screen ) );
  323 + UpdateLight();
  324 +
  325 + break;
  326 + }
  327 + }
236 328
237 break; 329 break;
238 } 330 }
239 - case Gesture::Cancelled: 331 + case TouchPoint::Interrupted: //Same as finished.
  332 + case TouchPoint::Finished:
240 { 333 {
241 - //Return to automatic animation  
242 - mModels[mSelectedModelIndex].rotationAnimation.Play(); 334 + if( mTag == MODEL_TAG )
  335 + {
  336 + //Return to automatic animation
  337 + if( !mPaused )
  338 + {
  339 + mModels[mSelectedModelIndex].rotationAnimation.Play();
  340 + }
  341 + }
243 342
244 break; 343 break;
245 } 344 }
246 default: 345 default:
247 { 346 {
248 - //We can ignore other gestures and gesture states. 347 + //Other touch states do nothing.
249 break; 348 break;
250 } 349 }
251 } 350 }
  351 +
  352 + return true;
252 } 353 }
253 354
254 //Cycle through the list of models. 355 //Cycle through the list of models.
@@ -264,13 +365,43 @@ public: @@ -264,13 +365,43 @@ public:
264 //Cycle through the list of shaders. 365 //Cycle through the list of shaders.
265 bool OnChangeShaderClicked( Toolkit::Button button ) 366 bool OnChangeShaderClicked( Toolkit::Button button )
266 { 367 {
267 - ++mShaderIndex %= 3; 368 + ++mShadingModeIndex %= 3;
268 369
269 ReloadModel(); 370 ReloadModel();
270 371
271 return true; 372 return true;
272 } 373 }
273 374
  375 + //Pause all animations, and keep them paused even after user panning.
  376 + //This button is a toggle, so pressing again will start the animations again.
  377 + bool OnPauseClicked( Toolkit::Button button )
  378 + {
  379 + //Toggle pause state.
  380 + mPaused = !mPaused;
  381 +
  382 + //If we wish to pause animations, do so and keep them paused.
  383 + if( mPaused )
  384 + {
  385 + for( int i = 0; i < NUM_MESHES ; ++i )
  386 + {
  387 + mModels[i].rotationAnimation.Pause();
  388 + }
  389 +
  390 + button.SetLabelText( " > " );
  391 + }
  392 + else //Unpause all animations again.
  393 + {
  394 + for( int i = 0; i < NUM_MESHES ; ++i )
  395 + {
  396 + mModels[i].rotationAnimation.Play();
  397 + }
  398 +
  399 + button.SetLabelText( " || " );
  400 + }
  401 +
  402 + return true;
  403 + }
  404 +
274 //If escape or the back button is pressed, quit the application (and return to the launcher) 405 //If escape or the back button is pressed, quit the application (and return to the launcher)
275 void OnKeyEvent( const KeyEvent& event ) 406 void OnKeyEvent( const KeyEvent& event )
276 { 407 {
@@ -290,28 +421,26 @@ private: @@ -290,28 +421,26 @@ private:
290 Model mModels[NUM_MESHES]; 421 Model mModels[NUM_MESHES];
291 Actor mContainers[NUM_MESHES]; 422 Actor mContainers[NUM_MESHES];
292 423
  424 + //Acts as a global light source, which can be dragged around.
  425 + Control mLightSource;
  426 +
293 //Used to detect panning to rotate the selected model. 427 //Used to detect panning to rotate the selected model.
294 - PanGestureDetector mPanGestureDetector; 428 + Vector2 mPanStart;
  429 + Vector2 mRotationStart;
295 430
296 int mModelIndex; //Index of model to load. 431 int mModelIndex; //Index of model to load.
297 - int mShaderIndex; //Index of shader type to use. 432 + int mShadingModeIndex; //Index of shader type to use.
  433 + int mTag; //Identifies what kind of actor has been selected in OnTouch.
298 int mSelectedModelIndex; //Index of model selected on screen. 434 int mSelectedModelIndex; //Index of model selected on screen.
  435 + bool mPaused; //If true, all animations are paused and should stay so.
299 }; 436 };
300 437
301 -void RunTest( Application& application )  
302 -{  
303 - MeshRendererController test( application );  
304 -  
305 - application.MainLoop();  
306 -}  
307 -  
308 // Entry point for Linux & Tizen applications 438 // Entry point for Linux & Tizen applications
309 // 439 //
310 int main( int argc, char **argv ) 440 int main( int argc, char **argv )
311 { 441 {
312 Application application = Application::New( &argc, &argv ); 442 Application application = Application::New( &argc, &argv );
313 -  
314 - RunTest( application );  
315 - 443 + MeshVisualController test( application );
  444 + application.MainLoop();
316 return 0; 445 return 0;
317 } 446 }
examples/model3d-view/model3d-view-example.cpp
@@ -198,8 +198,6 @@ public: @@ -198,8 +198,6 @@ public:
198 mModelCounter = (mModelCounter + 1) % MODEL_NUMBER; 198 mModelCounter = (mModelCounter + 1) % MODEL_NUMBER;
199 mModel3dView.SetProperty(Model3dView::Property::GEOMETRY_URL, MODEL_FILE[mModelCounter]); 199 mModel3dView.SetProperty(Model3dView::Property::GEOMETRY_URL, MODEL_FILE[mModelCounter]);
200 mModel3dView.SetProperty(Model3dView::Property::MATERIAL_URL, MATERIAL_FILE[mModelCounter]); 200 mModel3dView.SetProperty(Model3dView::Property::MATERIAL_URL, MATERIAL_FILE[mModelCounter]);
201 - mModel3dView.SetProperty(Model3dView::Property::IMAGES_URL, IMAGE_PATH);  
202 -  
203 return true; 201 return true;
204 } 202 }
205 203
examples/motion-blur/motion-blur-example.cpp
@@ -103,13 +103,13 @@ const float ORIENTATION_DURATION = 0.5f; ///&lt; Time to rotate to @@ -103,13 +103,13 @@ const float ORIENTATION_DURATION = 0.5f; ///&lt; Time to rotate to
103 void SetImageFittedInBox( ImageView& imageView, Property::Map& shaderEffect, const char * const imagePath, int maxWidth, int maxHeight ) 103 void SetImageFittedInBox( ImageView& imageView, Property::Map& shaderEffect, const char * const imagePath, int maxWidth, int maxHeight )
104 { 104 {
105 Property::Map map; 105 Property::Map map;
106 - map["rendererType"] = "IMAGE";  
107 - map["url"] = imagePath; 106 + map[Visual::Property::TYPE] = Visual::IMAGE;
  107 + map[ImageVisual::Property::URL] = imagePath;
108 // Load the image nicely scaled-down to fit within the specified max width and height: 108 // Load the image nicely scaled-down to fit within the specified max width and height:
109 - map["desiredWidth"] = maxWidth;  
110 - map["desiredHeight"] = maxHeight;  
111 - map["fittingMode"] = "SHRINK_TO_FIT";  
112 - map["samplingMode"] = "BOX_THEN_LINEAR"; 109 + map[ImageVisual::Property::DESIRED_WIDTH] = maxWidth;
  110 + map[ImageVisual::Property::DESIRED_HEIGHT] = maxHeight;
  111 + map[ImageVisual::Property::FITTING_MODE] = FittingMode::SHRINK_TO_FIT;
  112 + map[ImageVisual::Property::SAMPLING_MODE] = SamplingMode::BOX_THEN_LINEAR;
113 map.Merge( shaderEffect ); 113 map.Merge( shaderEffect );
114 114
115 imageView.SetProperty( ImageView::Property::IMAGE, map ); 115 imageView.SetProperty( ImageView::Property::IMAGE, map );
examples/native-image-source/native-image-source-example.cpp
@@ -200,7 +200,9 @@ public: @@ -200,7 +200,9 @@ public:
200 200
201 // create a offscreen renderer task to render content into the native image source 201 // create a offscreen renderer task to render content into the native image source
202 Texture nativeTexture = Texture::New( *nativeImageSourcePtr ); 202 Texture nativeTexture = Texture::New( *nativeImageSourcePtr );
203 - FrameBuffer targetBuffer = FrameBuffer::New( nativeTexture.GetWidth(), nativeTexture.GetHeight(), FrameBuffer::COLOR ); 203 + // Create a FrameBuffer object with no default attachments.
  204 + FrameBuffer targetBuffer = FrameBuffer::New( nativeTexture.GetWidth(), nativeTexture.GetHeight(), FrameBuffer::Attachment::NONE );
  205 + // Add a color attachment to the FrameBuffer object.
204 targetBuffer.AttachColorTexture( nativeTexture ); 206 targetBuffer.AttachColorTexture( nativeTexture );
205 207
206 CameraActor cameraActor = CameraActor::New(imageSize); 208 CameraActor cameraActor = CameraActor::New(imageSize);
examples/point-mesh/point-mesh-example.cpp
@@ -105,7 +105,7 @@ Geometry CreateGeometry() @@ -105,7 +105,7 @@ Geometry CreateGeometry()
105 // Create the geometry object 105 // Create the geometry object
106 Geometry polyhedraGeometry = Geometry::New(); 106 Geometry polyhedraGeometry = Geometry::New();
107 polyhedraGeometry.AddVertexBuffer( polyhedraVertices ); 107 polyhedraGeometry.AddVertexBuffer( polyhedraVertices );
108 - polyhedraGeometry.SetGeometryType( Geometry::POINTS ); 108 + polyhedraGeometry.SetType( Geometry::POINTS );
109 109
110 return polyhedraGeometry; 110 return polyhedraGeometry;
111 } 111 }
examples/primitive-shapes/primitive-shapes-example.cpp
@@ -19,15 +19,6 @@ namespace @@ -19,15 +19,6 @@ namespace
19 DEMO_IMAGE_DIR "octahedron-button.png" 19 DEMO_IMAGE_DIR "octahedron-button.png"
20 }; 20 };
21 21
22 - //Shape names  
23 - const char * const SHAPE_SPHERE = "SPHERE";  
24 - const char * const SHAPE_CONE = "CONE";  
25 - const char * const SHAPE_CONICAL_FRUSTRUM = "CONICAL_FRUSTRUM";  
26 - const char * const SHAPE_CYLINDER = "CYLINDER";  
27 - const char * const SHAPE_CUBE = "CUBE";  
28 - const char * const SHAPE_BEVELLED_CUBE = "BEVELLED_CUBE";  
29 - const char * const SHAPE_OCTAHEDRON = "OCTAHEDRON";  
30 -  
31 //Shape property defaults 22 //Shape property defaults
32 const int DEFAULT_SLICES = 32; 23 const int DEFAULT_SLICES = 32;
33 const int DEFAULT_STACKS = 32; 24 const int DEFAULT_STACKS = 32;
@@ -278,7 +269,7 @@ public: @@ -278,7 +269,7 @@ public:
278 // 269 //
279 void SetupModel( Layer layer ) 270 void SetupModel( Layer layer )
280 { 271 {
281 - //Create a container to house the renderer-holding actor, to provide a constant hitbox. 272 + //Create a container to house the visual-holding actor, to provide a constant hitbox.
282 Actor container = Actor::New(); 273 Actor container = Actor::New();
283 container.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); 274 container.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
284 container.SetSizeModeFactor( Vector3( 0.9, 0.3, 0.0 ) ); //90% of width, 30% of height. 275 container.SetSizeModeFactor( Vector3( 0.9, 0.3, 0.0 ) ); //90% of width, 30% of height.
@@ -309,7 +300,7 @@ public: @@ -309,7 +300,7 @@ public:
309 mPanGestureDetector.DetectedSignal().Connect( this, &PrimitiveShapesController::OnPan ); 300 mPanGestureDetector.DetectedSignal().Connect( this, &PrimitiveShapesController::OnPan );
310 } 301 }
311 302
312 - //Clears all sliders and resets the primitive renderer property map. 303 + //Clears all sliders and resets the primitive visual property map.
313 void InitialiseSlidersAndModel() 304 void InitialiseSlidersAndModel()
314 { 305 {
315 //Sliders 306 //Sliders
@@ -321,10 +312,10 @@ public: @@ -321,10 +312,10 @@ public:
321 mSliderLabels.at( i ).SetVisible( false ); 312 mSliderLabels.at( i ).SetVisible( false );
322 } 313 }
323 314
324 - //Renderer map for model  
325 - mRendererMap.Clear();  
326 - mRendererMap[ "rendererType" ] = "PRIMITIVE";  
327 - mRendererMap[ "color" ] = mColor; 315 + //Visual map for model
  316 + mVisualMap.Clear();
  317 + mVisualMap[ Visual::Property::TYPE ] = Visual::PRIMITIVE;
  318 + mVisualMap[ PrimitiveVisual::Property::COLOR ] = mColor;
328 } 319 }
329 320
330 //Sets the 3D model to a sphere and modifies the sliders appropriately. 321 //Sets the 3D model to a sphere and modifies the sliders appropriately.
@@ -332,19 +323,19 @@ public: @@ -332,19 +323,19 @@ public:
332 { 323 {
333 InitialiseSlidersAndModel(); 324 InitialiseSlidersAndModel();
334 325
335 - //Set up specific renderer properties.  
336 - mRendererMap[ "shape" ] = SHAPE_SPHERE;  
337 - mRendererMap[ "slices" ] = DEFAULT_SLICES;  
338 - mRendererMap[ "stacks" ] = DEFAULT_STACKS; 326 + //Set up specific visual properties.
  327 + mVisualMap[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::SPHERE;
  328 + mVisualMap[ PrimitiveVisual::Property::SLICES ] = DEFAULT_SLICES;
  329 + mVisualMap[ PrimitiveVisual::Property::STACKS ] = DEFAULT_STACKS;
339 330
340 //Set up sliders. 331 //Set up sliders.
341 - SetupSlider( 0, SLICES_LOWER_BOUND, SLICES_UPPER_BOUND, DEFAULT_STACKS, "slices" ); 332 + SetupSlider( 0, SLICES_LOWER_BOUND, SLICES_UPPER_BOUND, DEFAULT_STACKS, PrimitiveVisual::Property::SLICES, "slices" );
342 SetupMarks( mSliders.at( 0 ), SLICES_LOWER_BOUND, SLICES_UPPER_BOUND ); 333 SetupMarks( mSliders.at( 0 ), SLICES_LOWER_BOUND, SLICES_UPPER_BOUND );
343 - SetupSlider( 1, STACKS_LOWER_BOUND, STACKS_UPPER_BOUND, DEFAULT_STACKS, "stacks" ); 334 + SetupSlider( 1, STACKS_LOWER_BOUND, STACKS_UPPER_BOUND, DEFAULT_STACKS, PrimitiveVisual::Property::STACKS, "stacks" );
344 SetupMarks( mSliders.at( 1 ), STACKS_LOWER_BOUND, STACKS_UPPER_BOUND ); 335 SetupMarks( mSliders.at( 1 ), STACKS_LOWER_BOUND, STACKS_UPPER_BOUND );
345 336
346 //Set model in control. 337 //Set model in control.
347 - mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) ); 338 + mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mVisualMap ) );
348 } 339 }
349 340
350 //Sets the 3D model to a cone and modifies the sliders appropriately. 341 //Sets the 3D model to a cone and modifies the sliders appropriately.
@@ -352,20 +343,20 @@ public: @@ -352,20 +343,20 @@ public:
352 { 343 {
353 InitialiseSlidersAndModel(); 344 InitialiseSlidersAndModel();
354 345
355 - //Set up specific renderer properties.  
356 - mRendererMap[ "shape" ] = SHAPE_CONE;  
357 - mRendererMap[ "scaleHeight" ] = DEFAULT_SCALE_HEIGHT;  
358 - mRendererMap[ "scaleBottomRadius" ] = DEFAULT_SCALE_BOTTOM_RADIUS;  
359 - mRendererMap[ "slices" ] = DEFAULT_SLICES; 346 + //Set up specific visual properties.
  347 + mVisualMap[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::CONE;
  348 + mVisualMap[ PrimitiveVisual::Property::SCALE_HEIGHT ] = DEFAULT_SCALE_HEIGHT;
  349 + mVisualMap[ PrimitiveVisual::Property::SCALE_BOTTOM_RADIUS ] = DEFAULT_SCALE_BOTTOM_RADIUS;
  350 + mVisualMap[ PrimitiveVisual::Property::SLICES ] = DEFAULT_SLICES;
360 351
361 //Set up sliders. 352 //Set up sliders.
362 - SetupSlider( 0, 1.0f, 32.0f, DEFAULT_SCALE_HEIGHT, "scaleHeight" );  
363 - SetupSlider( 1, 1.0f, 32.0f, DEFAULT_SCALE_BOTTOM_RADIUS, "scaleBottomRadius" );  
364 - SetupSlider( 2, SLICES_LOWER_BOUND, SLICES_UPPER_BOUND, DEFAULT_STACKS, "slices" ); 353 + SetupSlider( 0, 1.0f, 32.0f, DEFAULT_SCALE_HEIGHT, PrimitiveVisual::Property::SCALE_HEIGHT, "scaleHeight" );
  354 + SetupSlider( 1, 1.0f, 32.0f, DEFAULT_SCALE_BOTTOM_RADIUS, PrimitiveVisual::Property::SCALE_BOTTOM_RADIUS, "scaleBottomRadius" );
  355 + SetupSlider( 2, SLICES_LOWER_BOUND, SLICES_UPPER_BOUND, DEFAULT_STACKS, PrimitiveVisual::Property::SLICES, "slices" );
365 SetupMarks( mSliders.at( 2 ), SLICES_LOWER_BOUND, SLICES_UPPER_BOUND ); 356 SetupMarks( mSliders.at( 2 ), SLICES_LOWER_BOUND, SLICES_UPPER_BOUND );
366 357
367 //Set model in control. 358 //Set model in control.
368 - mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) ); 359 + mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mVisualMap ) );
369 } 360 }
370 361
371 //Sets the 3D model to a conical frustrum and modifies the sliders appropriately. 362 //Sets the 3D model to a conical frustrum and modifies the sliders appropriately.
@@ -373,20 +364,20 @@ public: @@ -373,20 +364,20 @@ public:
373 { 364 {
374 InitialiseSlidersAndModel(); 365 InitialiseSlidersAndModel();
375 366
376 - //Set up specific renderer properties.  
377 - mRendererMap[ "shape" ] = SHAPE_CONICAL_FRUSTRUM;  
378 - mRendererMap[ "scaleTopRadius" ] = DEFAULT_SCALE_TOP_RADIUS;  
379 - mRendererMap[ "scaleBottomRadius" ] = DEFAULT_SCALE_BOTTOM_RADIUS;  
380 - mRendererMap[ "scaleHeight" ] = DEFAULT_SCALE_HEIGHT;  
381 - mRendererMap[ "slices" ] = DEFAULT_SLICES; 367 + //Set up specific visual properties.
  368 + mVisualMap[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::CONICAL_FRUSTRUM;
  369 + mVisualMap[ PrimitiveVisual::Property::SCALE_TOP_RADIUS ] = DEFAULT_SCALE_TOP_RADIUS;
  370 + mVisualMap[ PrimitiveVisual::Property::SCALE_BOTTOM_RADIUS ] = DEFAULT_SCALE_BOTTOM_RADIUS;
  371 + mVisualMap[ PrimitiveVisual::Property::SCALE_HEIGHT ] = DEFAULT_SCALE_HEIGHT;
  372 + mVisualMap[ PrimitiveVisual::Property::SLICES ] = DEFAULT_SLICES;
382 373
383 //Set up used sliders. 374 //Set up used sliders.
384 - SetupSlider( 0, 1.0f, 32.0f, DEFAULT_SCALE_HEIGHT, "scaleHeight" );  
385 - SetupSlider( 1, 0.0f, 32.0f, DEFAULT_SCALE_BOTTOM_RADIUS, "scaleBottomRadius" );  
386 - SetupSlider( 2, 0.0f, 32.0f, DEFAULT_SCALE_TOP_RADIUS, "scaleTopRadius" ); 375 + SetupSlider( 0, 1.0f, 32.0f, DEFAULT_SCALE_HEIGHT, PrimitiveVisual::Property::SCALE_HEIGHT, "scaleHeight" );
  376 + SetupSlider( 1, 0.0f, 32.0f, DEFAULT_SCALE_BOTTOM_RADIUS, PrimitiveVisual::Property::SCALE_BOTTOM_RADIUS, "scaleBottomRadius" );
  377 + SetupSlider( 2, 0.0f, 32.0f, DEFAULT_SCALE_TOP_RADIUS, PrimitiveVisual::Property::SCALE_TOP_RADIUS, "scaleTopRadius" );
387 378
388 //Set model in control. 379 //Set model in control.
389 - mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) ); 380 + mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mVisualMap ) );
390 } 381 }
391 382
392 //Sets the 3D model to a cylinder and modifies the sliders appropriately. 383 //Sets the 3D model to a cylinder and modifies the sliders appropriately.
@@ -394,20 +385,20 @@ public: @@ -394,20 +385,20 @@ public:
394 { 385 {
395 InitialiseSlidersAndModel(); 386 InitialiseSlidersAndModel();
396 387
397 - //Set up specific renderer properties.  
398 - mRendererMap[ "shape" ] = SHAPE_CYLINDER;  
399 - mRendererMap[ "scaleHeight" ] = DEFAULT_SCALE_HEIGHT;  
400 - mRendererMap[ "scaleRadius" ] = DEFAULT_SCALE_RADIUS;  
401 - mRendererMap[ "slices" ] = DEFAULT_SLICES; 388 + //Set up specific visual properties.
  389 + mVisualMap[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::CYLINDER;
  390 + mVisualMap[ PrimitiveVisual::Property::SCALE_HEIGHT ] = DEFAULT_SCALE_HEIGHT;
  391 + mVisualMap[ PrimitiveVisual::Property::SCALE_RADIUS ] = DEFAULT_SCALE_RADIUS;
  392 + mVisualMap[ PrimitiveVisual::Property::SLICES ] = DEFAULT_SLICES;
402 393
403 //Set up used sliders. 394 //Set up used sliders.
404 - SetupSlider( 0, 1.0f, 32.0f, DEFAULT_SCALE_HEIGHT, "scaleHeight" );  
405 - SetupSlider( 1, 1.0f, 32.0f, DEFAULT_SCALE_RADIUS, "scaleRadius" );  
406 - SetupSlider( 2, SLICES_LOWER_BOUND, SLICES_UPPER_BOUND, DEFAULT_STACKS, "slices" ); 395 + SetupSlider( 0, 1.0f, 32.0f, DEFAULT_SCALE_HEIGHT, PrimitiveVisual::Property::SCALE_HEIGHT, "scaleHeight" );
  396 + SetupSlider( 1, 1.0f, 32.0f, DEFAULT_SCALE_RADIUS, PrimitiveVisual::Property::SCALE_RADIUS, "scaleRadius" );
  397 + SetupSlider( 2, SLICES_LOWER_BOUND, SLICES_UPPER_BOUND, DEFAULT_STACKS, PrimitiveVisual::Property::SLICES, "slices" );
407 SetupMarks( mSliders.at( 2 ), SLICES_LOWER_BOUND, SLICES_UPPER_BOUND ); 398 SetupMarks( mSliders.at( 2 ), SLICES_LOWER_BOUND, SLICES_UPPER_BOUND );
408 399
409 //Set model in control. 400 //Set model in control.
410 - mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) ); 401 + mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mVisualMap ) );
411 } 402 }
412 403
413 //Sets the 3D model to a cube and modifies the sliders appropriately. 404 //Sets the 3D model to a cube and modifies the sliders appropriately.
@@ -415,11 +406,11 @@ public: @@ -415,11 +406,11 @@ public:
415 { 406 {
416 InitialiseSlidersAndModel(); 407 InitialiseSlidersAndModel();
417 408
418 - //Set up specific renderer properties.  
419 - mRendererMap[ "shape" ] = SHAPE_CUBE; 409 + //Set up specific visual properties.
  410 + mVisualMap[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::CUBE;
420 411
421 //Set model in control. 412 //Set model in control.
422 - mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) ); 413 + mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mVisualMap ) );
423 } 414 }
424 415
425 //Sets the 3D model to a bevelled cube and modifies the sliders appropriately. 416 //Sets the 3D model to a bevelled cube and modifies the sliders appropriately.
@@ -427,17 +418,17 @@ public: @@ -427,17 +418,17 @@ public:
427 { 418 {
428 InitialiseSlidersAndModel(); 419 InitialiseSlidersAndModel();
429 420
430 - //Set up specific renderer properties.  
431 - mRendererMap[ "shape" ] = SHAPE_BEVELLED_CUBE;  
432 - mRendererMap[ "bevelPercentage" ] = DEFAULT_BEVEL_PERCENTAGE;  
433 - mRendererMap[ "bevelSmoothness" ] = DEFAULT_BEVEL_SMOOTHNESS; 421 + //Set up specific visual properties.
  422 + mVisualMap[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::BEVELLED_CUBE;
  423 + mVisualMap[ PrimitiveVisual::Property::BEVEL_PERCENTAGE ] = DEFAULT_BEVEL_PERCENTAGE;
  424 + mVisualMap[ PrimitiveVisual::Property::BEVEL_SMOOTHNESS ] = DEFAULT_BEVEL_SMOOTHNESS;
434 425
435 //Set up used sliders. 426 //Set up used sliders.
436 - SetupSlider( 0, 0.0f, 1.0f, DEFAULT_BEVEL_PERCENTAGE, "bevelPercentage" );  
437 - SetupSlider( 1, 0.0f, 1.0f, DEFAULT_BEVEL_SMOOTHNESS, "bevelSmoothness" ); 427 + SetupSlider( 0, 0.0f, 1.0f, DEFAULT_BEVEL_PERCENTAGE, PrimitiveVisual::Property::BEVEL_PERCENTAGE, "bevelPercentage" );
  428 + SetupSlider( 1, 0.0f, 1.0f, DEFAULT_BEVEL_SMOOTHNESS, PrimitiveVisual::Property::BEVEL_SMOOTHNESS, "bevelSmoothness" );
438 429
439 //Set model in control. 430 //Set model in control.
440 - mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) ); 431 + mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mVisualMap ) );
441 } 432 }
442 433
443 //Sets the 3D model to an octahedron and modifies the sliders appropriately. 434 //Sets the 3D model to an octahedron and modifies the sliders appropriately.
@@ -445,20 +436,20 @@ public: @@ -445,20 +436,20 @@ public:
445 { 436 {
446 InitialiseSlidersAndModel(); 437 InitialiseSlidersAndModel();
447 438
448 - //Set up specific renderer properties.  
449 - mRendererMap[ "shape" ] = SHAPE_OCTAHEDRON; 439 + //Set up specific visual properties.
  440 + mVisualMap[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::OCTAHEDRON;
450 441
451 //Set model in control. 442 //Set model in control.
452 - mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) ); 443 + mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mVisualMap ) );
453 } 444 }
454 445
455 //Sets up the slider at the given index for the supplied property, and labels it appropriately. 446 //Sets up the slider at the given index for the supplied property, and labels it appropriately.
456 - // rendererPropertyLabel is the property that will be set by this slider. 447 + // visualProperty is the property that will be set by this slider.
457 void SetupSlider( int sliderIndex, float lowerBound, float upperBound, float startPoint, 448 void SetupSlider( int sliderIndex, float lowerBound, float upperBound, float startPoint,
458 - std::string rendererPropertyLabel ) 449 + Property::Index visualProperty, std::string visualPropertyLabel )
459 { 450 {
460 //Set up the slider itself. 451 //Set up the slider itself.
461 - mSliders.at( sliderIndex ).RegisterProperty( "rendererProperty", Property::Value( rendererPropertyLabel ), Property::READ_WRITE ); 452 + mSliders.at( sliderIndex ).RegisterProperty( "visualProperty", Property::Value( visualProperty ), Property::READ_WRITE );
462 mSliders.at( sliderIndex ).SetProperty( Slider::Property::LOWER_BOUND, Property::Value( lowerBound ) ); 453 mSliders.at( sliderIndex ).SetProperty( Slider::Property::LOWER_BOUND, Property::Value( lowerBound ) );
463 mSliders.at( sliderIndex ).SetProperty( Slider::Property::UPPER_BOUND, Property::Value( upperBound ) ); 454 mSliders.at( sliderIndex ).SetProperty( Slider::Property::UPPER_BOUND, Property::Value( upperBound ) );
464 mSliders.at( sliderIndex ).SetProperty( Slider::Property::VALUE, Property::Value( startPoint ) ); 455 mSliders.at( sliderIndex ).SetProperty( Slider::Property::VALUE, Property::Value( startPoint ) );
@@ -468,7 +459,7 @@ public: @@ -468,7 +459,7 @@ public:
468 //We reset the TextLabel to force a relayout of the table. 459 //We reset the TextLabel to force a relayout of the table.
469 mSliderTable.RemoveChildAt( TableView::CellPosition(sliderIndex, 0) ); 460 mSliderTable.RemoveChildAt( TableView::CellPosition(sliderIndex, 0) );
470 461
471 - TextLabel sliderLabel = TextLabel::New( rendererPropertyLabel ); 462 + TextLabel sliderLabel = TextLabel::New( visualPropertyLabel );
472 sliderLabel.SetParentOrigin( ParentOrigin::CENTER ); 463 sliderLabel.SetParentOrigin( ParentOrigin::CENTER );
473 sliderLabel.SetAnchorPoint( AnchorPoint::CENTER ); 464 sliderLabel.SetAnchorPoint( AnchorPoint::CENTER );
474 sliderLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); 465 sliderLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
@@ -547,13 +538,13 @@ public: @@ -547,13 +538,13 @@ public:
547 //When the slider is adjusted, change the corresponding shape property accordingly. 538 //When the slider is adjusted, change the corresponding shape property accordingly.
548 bool OnSliderValueChanged( Slider slider, float value ) 539 bool OnSliderValueChanged( Slider slider, float value )
549 { 540 {
550 - //Update property map to reflect the change to the specific renderer property.  
551 - std::string rendererPropertyLabel;  
552 - slider.GetProperty( slider.GetPropertyIndex( "rendererProperty" ) ).Get( rendererPropertyLabel );  
553 - mRendererMap[ rendererPropertyLabel ] = value; 541 + //Update property map to reflect the change to the specific visual property.
  542 + int visualProperty;
  543 + slider.GetProperty( slider.GetPropertyIndex( "visualProperty" ) ).Get( visualProperty );
  544 + mVisualMap[ visualProperty ] = value;
554 545
555 //Reload the model to display the change. 546 //Reload the model to display the change.
556 - mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) ); 547 + mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mVisualMap ) );
557 548
558 return true; 549 return true;
559 } 550 }
@@ -622,8 +613,8 @@ private: @@ -622,8 +613,8 @@ private:
622 std::vector<TextLabel> mSliderLabels; ///< Holds the labels to each slider. 613 std::vector<TextLabel> mSliderLabels; ///< Holds the labels to each slider.
623 TableView mSliderTable; ///< A table to layout the sliders next to their labels. 614 TableView mSliderTable; ///< A table to layout the sliders next to their labels.
624 615
625 - Property::Map mRendererMap; ///< Property map to create a primitive renderer.  
626 - Control mModel; ///< Control to house the primitive renderer. 616 + Property::Map mVisualMap; ///< Property map to create a primitive visual.
  617 + Control mModel; ///< Control to house the primitive visual.
627 618
628 PanGestureDetector mPanGestureDetector; ///< Detects pan gestures for rotation of the model. 619 PanGestureDetector mPanGestureDetector; ///< Detects pan gestures for rotation of the model.
629 Animation mRotationAnimation; ///< Automatically rotates the model, unless it is being panned. 620 Animation mRotationAnimation; ///< Automatically rotates the model, unless it is being panned.
examples/renderer-stencil/renderer-stencil-example.cpp 0 โ†’ 100644
  1 +/*
  2 + * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + *
  16 + */
  17 +
  18 +// EXTERNAL INCLUDES
  19 +#include <dali-toolkit/dali-toolkit.h>
  20 +#include <dali/devel-api/adaptor-framework/bitmap-loader.h>
  21 +
  22 +// INTERNAL INCLUDES
  23 +#include "renderer-stencil-shaders.h"
  24 +#include "shared/view.h"
  25 +#include "shared/utility.h"
  26 +
  27 +using namespace Dali;
  28 +
  29 +namespace
  30 +{
  31 +
  32 +// Constants:
  33 +
  34 +// Application constants:
  35 +const char * const APPLICATION_TITLE( "Renderer Stencil API Demo" );
  36 +const char * const TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" );
  37 +const char * const BACKGROUND_IMAGE( DEMO_IMAGE_DIR "background-gradient.jpg" );
  38 +
  39 +// Texture filenames:
  40 +const char * const CUBE_TEXTURE( DEMO_IMAGE_DIR "people-medium-1.jpg" );
  41 +const char * const FLOOR_TEXTURE( DEMO_IMAGE_DIR "wood.png" );
  42 +
  43 +// Scale dimensions: These values are relative to the stage size. EG. width = 0.32f * stageSize.
  44 +const float CUBE_WIDTH_SCALE( 0.32f ); ///< The width (and height + depth) of the main and reflection cubes.
  45 +const Vector2 FLOOR_DIMENSION_SCALE( 0.67f, 0.017f ); ///< The width and height of the floor object.
  46 +
  47 +// Configurable animation characteristics:
  48 +const float ANIMATION_ROTATION_DURATION( 10.0f ); ///< Time in seconds to rotate the scene 360 degrees around Y.
  49 +const float ANIMATION_BOUNCE_TOTAL_TIME( 1.6f ); ///< Time in seconds to perform 1 full bounce animation cycle.
  50 +const float ANIMATION_BOUNCE_DEFORMATION_TIME( 0.4f ); ///< Time in seconds that the cube deformation animation will occur for (on contact with the floor).
  51 +const float ANIMATION_BOUNCE_DEFORMATION_PERCENT( 20.0f ); ///< Percentage (of the cube's size) to deform the cube by (on contact with floor).
  52 +const float ANIMATION_BOUNCE_HEIGHT_PERCENT( 40.0f ); ///< Percentage (of the cube's size) to bounce up in to the air by.
  53 +
  54 +// Base colors for the objects:
  55 +const Vector4 CUBE_COLOR( 1.0f, 1.0f, 1.0f, 1.0f ); ///< White.
  56 +const Vector4 FLOOR_COLOR( 1.0f, 1.0f, 1.0f, 1.0f ); ///< White.
  57 +const Vector4 REFLECTION_COLOR( 0.6f, 0.6f, 0.6f, 0.6f ); ///< Note that alpha is not 1.0f, to make the blend more photo-realistic.
  58 +
  59 +// We need to control the draw order as we are controlling both the stencil and depth buffer per renderer.
  60 +const int DEPTH_INDEX_GRANULARITY( 10000 ); ///< This value is the gap in depth-index in-between each renderer.
  61 +
  62 +} // Anonymous namespace
  63 +
  64 +/**
  65 + * @brief This example shows how to manipulate stencil and depth buffer properties within the Renderer API.
  66 + */
  67 +class RendererStencilExample : public ConnectionTracker
  68 +{
  69 +public:
  70 +
  71 + /**
  72 + * @brief Constructor.
  73 + * @param[in] application The DALi application object
  74 + */
  75 + RendererStencilExample( Application& application )
  76 + : mApplication( application )
  77 + {
  78 + // Connect to the Application's Init signal.
  79 + mApplication.InitSignal().Connect( this, &RendererStencilExample::Create );
  80 + }
  81 +
  82 + /**
  83 + * @brief Destructor (non-virtual).
  84 + */
  85 + ~RendererStencilExample()
  86 + {
  87 + }
  88 +
  89 +private:
  90 +
  91 + /**
  92 + * @brief Enum to facilitate more readable use of the cube array.
  93 + */
  94 + enum CubeType
  95 + {
  96 + MAIN_CUBE, ///< The main cube that bounces above the floor object.
  97 + REFLECTION_CUBE ///< The reflected cube object.
  98 + };
  99 +
  100 + /**
  101 + * @brief Struct to store the position, normal and texture coordinates of a single vertex.
  102 + */
  103 + struct TexturedVertex
  104 + {
  105 + Vector3 position;
  106 + Vector3 normal;
  107 + Vector2 textureCoord;
  108 + };
  109 +
  110 + /**
  111 + * @brief This is the main scene setup method for this demo.
  112 + * This is called via the Init signal which is received once (only) during the Application lifetime.
  113 + * @param[in] application The DALi application object
  114 + */
  115 + void Create( Application& application )
  116 + {
  117 + Stage stage = Stage::GetCurrent();
  118 +
  119 + // Creates a default view with a default tool-bar.
  120 + // The view is added to the stage.
  121 + Toolkit::ToolBar toolBar;
  122 + Layer toolBarLayer = DemoHelper::CreateView( application, mView, toolBar, BACKGROUND_IMAGE, TOOLBAR_IMAGE, APPLICATION_TITLE );
  123 + stage.Add( toolBarLayer );
  124 +
  125 + // Layer to hold the 3D scene.
  126 + Layer layer = Layer::New();
  127 + layer.SetAnchorPoint( AnchorPoint::CENTER );
  128 + // Set the parent origin to a small percentage below the center (so the demo will scale for different resolutions).
  129 + layer.SetParentOrigin( Vector3( 0.5f, 0.58f, 0.5f ) );
  130 + layer.SetBehavior( Layer::LAYER_2D );
  131 + layer.SetDepthTestDisabled( false );
  132 + stage.Add( layer );
  133 +
  134 + // Main cube:
  135 + // Make the demo scalable with different resolutions by basing
  136 + // the cube size on a percentage of the stage size.
  137 + float scaleSize( std::min( stage.GetSize().width, stage.GetSize().height ) );
  138 + float cubeWidth( scaleSize * CUBE_WIDTH_SCALE );
  139 + Vector3 cubeSize( cubeWidth, cubeWidth, cubeWidth );
  140 + // Create the geometry for the cube, and the texture.
  141 + Geometry cubeGeometry = CreateCubeVertices( Vector3::ONE, false );
  142 + TextureSet cubeTextureSet = CreateTextureSet( CUBE_TEXTURE );
  143 + // Create the cube object and add it.
  144 + // Note: The cube is anchored around its base for animation purposes, so the position can be zero.
  145 + mCubes[ MAIN_CUBE ] = CreateMainCubeObject( cubeGeometry, cubeSize, cubeTextureSet );
  146 + layer.Add( mCubes[ MAIN_CUBE ] );
  147 +
  148 + // Floor:
  149 + float floorWidth( scaleSize * FLOOR_DIMENSION_SCALE.x );
  150 + Vector3 floorSize( floorWidth, scaleSize * FLOOR_DIMENSION_SCALE.y, floorWidth );
  151 + // Create the floor object using the cube geometry with a new size, and add it.
  152 + Actor floorObject( CreateFloorObject( cubeGeometry, floorSize ) );
  153 + layer.Add( floorObject );
  154 +
  155 + // Stencil:
  156 + Vector3 planeSize( floorWidth, floorWidth, 0.0f );
  157 + // Create the stencil plane object, and add it.
  158 + Actor stencilPlaneObject( CreateStencilPlaneObject( planeSize ) );
  159 + layer.Add( stencilPlaneObject );
  160 +
  161 + // Reflection cube:
  162 + // Create the reflection cube object and add it.
  163 + // Note: The cube is anchored around its base for animation purposes, so the position can be zero.
  164 + mCubes[ REFLECTION_CUBE ] = CreateReflectionCubeObject( cubeSize, cubeTextureSet );
  165 + layer.Add( mCubes[ REFLECTION_CUBE ] );
  166 +
  167 + // Rotate the layer so we can see some of the top of the cube for a more 3D effect.
  168 + layer.SetProperty( Actor::Property::ORIENTATION, Quaternion( Degree( -24.0f ), Degree( 0.0f ), Degree( 0.0f ) ) );
  169 +
  170 + // Set up the rotation on the Y axis.
  171 + mRotationAnimation = Animation::New( ANIMATION_ROTATION_DURATION );
  172 + float fullRotation = 360.0f;
  173 + mRotationAnimation.AnimateBy( Property( mCubes[ MAIN_CUBE ], Actor::Property::ORIENTATION ),
  174 + Quaternion( Degree( 0.0f ), Degree( fullRotation ), Degree( 0.0f ) ) );
  175 + mRotationAnimation.AnimateBy( Property( floorObject, Actor::Property::ORIENTATION ),
  176 + Quaternion( Degree( 0.0f ), Degree( fullRotation ), Degree( 0.0f ) ) );
  177 + // Note the stencil is pre-rotated by 90 degrees on X, so we rotate relatively on its Z axis for an equivalent Y rotation.
  178 + mRotationAnimation.AnimateBy( Property( stencilPlaneObject, Actor::Property::ORIENTATION ),
  179 + Quaternion( Degree( 0.0f ), Degree( 0.0f ), Degree( fullRotation ) ) );
  180 + mRotationAnimation.AnimateBy( Property( mCubes[ REFLECTION_CUBE ], Actor::Property::ORIENTATION ),
  181 + Quaternion( Degree( 0.0f ), Degree( fullRotation ), Degree( 0.0f ) ) );
  182 + mRotationAnimation.SetLooping( true );
  183 +
  184 + // Set up the cube bouncing animation.
  185 + float totalTime = ANIMATION_BOUNCE_TOTAL_TIME;
  186 + float deformationTime = ANIMATION_BOUNCE_DEFORMATION_TIME;
  187 + // Percentage based amounts allows the bounce and deformation to scale for different resolution screens.
  188 + float deformationAmount = ANIMATION_BOUNCE_DEFORMATION_PERCENT / 100.0f;
  189 + float heightChange = ( cubeSize.y * ANIMATION_BOUNCE_HEIGHT_PERCENT ) / 100.0f;
  190 +
  191 + // Animation pre-calculations:
  192 + float halfTime = totalTime / 2.0f;
  193 + float halfDeformationTime = deformationTime / 2.0f;
  194 +
  195 + // First position the cubes at the top of the animation cycle.
  196 + mCubes[ MAIN_CUBE ].SetProperty( Actor::Property::POSITION_Y, -heightChange );
  197 + mCubes[ REFLECTION_CUBE ].SetProperty( Actor::Property::POSITION_Y, heightChange );
  198 +
  199 + mBounceAnimation = Animation::New( totalTime );
  200 +
  201 + // The animations for the main and reflected cubes are almost identical, so we combine the code to do both.
  202 + for( int cube = 0; cube < 2; ++cube )
  203 + {
  204 + // If iterating on the reflection cube, adjust the heightChange variable so the below code can be reused.
  205 + if( cube == 1 )
  206 + {
  207 + heightChange = -heightChange;
  208 + }
  209 +
  210 + // 1st TimePeriod: Start moving down with increasing speed, until it is time to distort the cube due to impact.
  211 + mBounceAnimation.AnimateBy( Property( mCubes[ cube ], Actor::Property::POSITION_Y ), heightChange, AlphaFunction::EASE_IN_SQUARE, TimePeriod( 0.0f, halfTime - halfDeformationTime ) );
  212 +
  213 + // 2nd TimePeriod: The cube is touching the floor, start deforming it - then un-deform it again.
  214 + mBounceAnimation.AnimateBy( Property( mCubes[ cube ], Actor::Property::SCALE_X ), deformationAmount, AlphaFunction::BOUNCE, TimePeriod( halfTime - halfDeformationTime, deformationTime ) );
  215 + mBounceAnimation.AnimateBy( Property( mCubes[ cube ], Actor::Property::SCALE_Z ), deformationAmount, AlphaFunction::BOUNCE, TimePeriod( halfTime - halfDeformationTime, deformationTime ) );
  216 + mBounceAnimation.AnimateBy( Property( mCubes[ cube ], Actor::Property::SCALE_Y ), -deformationAmount, AlphaFunction::BOUNCE, TimePeriod( halfTime - halfDeformationTime, deformationTime ) );
  217 +
  218 + // 3rd TimePeriod: Start moving up with decreasing speed, until at the apex of the animation.
  219 + mBounceAnimation.AnimateBy( Property( mCubes[ cube ], Actor::Property::POSITION_Y ), -heightChange, AlphaFunction::EASE_OUT_SQUARE, TimePeriod( halfTime + halfDeformationTime, halfTime - halfDeformationTime ) );
  220 + }
  221 +
  222 + mBounceAnimation.SetLooping( true );
  223 +
  224 + // Start the animations.
  225 + mRotationAnimation.Play();
  226 + mBounceAnimation.Play();
  227 +
  228 + // Respond to a click anywhere on the stage
  229 + stage.GetRootLayer().TouchSignal().Connect( this, &RendererStencilExample::OnTouch );
  230 + // Connect signals to allow Back and Escape to exit.
  231 + stage.KeyEventSignal().Connect( this, &RendererStencilExample::OnKeyEvent );
  232 + }
  233 +
  234 +private:
  235 +
  236 + // Methods to setup each component of the 3D scene:
  237 +
  238 + /**
  239 + * @brief Creates the Main cube object.
  240 + * This creates the renderer from existing geometry (as the cubes geometry is shared).
  241 + * The texture is set and all relevant renderer properties are set-up.
  242 + * @param[in] geometry Pre-calculated cube geometry
  243 + * @param[in] size The desired cube size
  244 + * @param[in] textureSet A pre-existing TextureSet with a texture set up, to be applied to the cube
  245 + * @return An actor set-up containing the main cube object
  246 + */
  247 + Actor CreateMainCubeObject( Geometry& geometry, Vector3 size, TextureSet& textureSet )
  248 + {
  249 + Toolkit::Control container = Toolkit::Control::New();
  250 + container.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
  251 + container.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
  252 + container.SetSize( size );
  253 + container.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
  254 +
  255 + // Create a renderer from the geometry and add the texture.
  256 + Renderer renderer = CreateRenderer( geometry, size, true, CUBE_COLOR );
  257 + renderer.SetTextures( textureSet );
  258 +
  259 + // Setup the renderer properties:
  260 + // We are writing to the color buffer & culling back faces.
  261 + renderer.SetProperty( Renderer::Property::WRITE_TO_COLOR_BUFFER, true );
  262 + renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK );
  263 +
  264 + // No stencil is used for the main cube.
  265 + renderer.SetProperty( Renderer::Property::STENCIL_MODE, StencilMode::OFF );
  266 +
  267 + // We do need to write to the depth buffer as other objects need to appear underneath this cube.
  268 + renderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::ON );
  269 + // We do not need to test the depth buffer as we are culling the back faces.
  270 + renderer.SetProperty( Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::OFF );
  271 +
  272 + // This object must be rendered 1st.
  273 + renderer.SetProperty( Renderer::Property::DEPTH_INDEX, 0 * DEPTH_INDEX_GRANULARITY );
  274 +
  275 + container.AddRenderer( renderer );
  276 + return container;
  277 + }
  278 +
  279 + /**
  280 + * @brief Creates the Floor object.
  281 + * This creates the renderer from existing geometry (as the cube geometry can be re-used).
  282 + * The texture is created and set and all relevant renderer properties are set-up.
  283 + * @param[in] geometry Pre-calculated cube geometry
  284 + * @param[in] size The desired floor size
  285 + * @return An actor set-up containing the floor object
  286 + */
  287 + Actor CreateFloorObject( Geometry& geometry, Vector3 size )
  288 + {
  289 + Toolkit::Control container = Toolkit::Control::New();
  290 + container.SetAnchorPoint( AnchorPoint::TOP_CENTER );
  291 + container.SetParentOrigin( ParentOrigin::TOP_CENTER );
  292 + container.SetSize( size );
  293 + container.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
  294 +
  295 + // Create a renderer from the geometry and add the texture.
  296 + TextureSet planeTextureSet = CreateTextureSet( FLOOR_TEXTURE );
  297 + Renderer renderer = CreateRenderer( geometry, size, true, FLOOR_COLOR );
  298 + renderer.SetTextures( planeTextureSet );
  299 +
  300 + // Setup the renderer properties:
  301 + // We are writing to the color buffer & culling back faces (as we are NOT doing depth write).
  302 + renderer.SetProperty( Renderer::Property::WRITE_TO_COLOR_BUFFER, true );
  303 + renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK );
  304 +
  305 + // No stencil is used for the floor.
  306 + renderer.SetProperty( Renderer::Property::STENCIL_MODE, StencilMode::OFF );
  307 +
  308 + // We do not write to the depth buffer as its not needed.
  309 + renderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::OFF );
  310 + // We do need to test the depth buffer as we need the floor to be underneath the cube.
  311 + renderer.SetProperty( Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::ON );
  312 +
  313 + // This object must be rendered 2nd.
  314 + renderer.SetProperty( Renderer::Property::DEPTH_INDEX, 1 * DEPTH_INDEX_GRANULARITY );
  315 +
  316 + container.AddRenderer( renderer );
  317 + return container;
  318 + }
  319 +
  320 + /**
  321 + * @brief Creates the Stencil-Plane object.
  322 + * This is places on the floor object to allow the reflection to be drawn on to the floor.
  323 + * This creates the geometry and renderer.
  324 + * All relevant renderer properties are set-up.
  325 + * @param[in] size The desired plane size
  326 + * @return An actor set-up containing the stencil-plane object
  327 + */
  328 + Actor CreateStencilPlaneObject( Vector3 size )
  329 + {
  330 + Toolkit::Control container = Toolkit::Control::New();
  331 + container.SetAnchorPoint( AnchorPoint::CENTER );
  332 + container.SetParentOrigin( ParentOrigin::CENTER );
  333 + container.SetSize( size );
  334 + container.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
  335 +
  336 + // We rotate the plane as the geometry is created flat in X & Y. We want it to span X & Z axis.
  337 + container.SetProperty( Actor::Property::ORIENTATION, Quaternion( Degree( -90.0f ), Degree( 0.0f ), Degree( 0.0f ) ) );
  338 +
  339 + // Create geometry for a flat plane.
  340 + Geometry planeGeometry = CreatePlaneVertices( Vector2::ONE );
  341 + // Create a renderer from the geometry.
  342 + Renderer renderer = CreateRenderer( planeGeometry, size, false, Vector4::ONE );
  343 +
  344 + // Setup the renderer properties:
  345 + // The stencil plane is only for stencilling, so disable writing to color buffer.
  346 + renderer.SetProperty( Renderer::Property::WRITE_TO_COLOR_BUFFER, false );
  347 +
  348 + // Enable stencil. Draw to the stencil buffer (only).
  349 + renderer.SetProperty( Renderer::Property::STENCIL_MODE, StencilMode::ON );
  350 + renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION, StencilFunction::ALWAYS );
  351 + renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION_REFERENCE, 1 );
  352 + renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION_MASK, 0xFF );
  353 + renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_FAIL, StencilOperation::KEEP );
  354 + renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, StencilOperation::KEEP );
  355 + renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, StencilOperation::REPLACE );
  356 + renderer.SetProperty( Renderer::Property::STENCIL_MASK, 0xFF );
  357 +
  358 + // We don't want to write to the depth buffer, as this would block the reflection being drawn.
  359 + renderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::OFF );
  360 + // We test the depth buffer as we want the stencil to only exist underneath the cube.
  361 + renderer.SetProperty( Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::ON );
  362 +
  363 + // This object must be rendered 3rd.
  364 + renderer.SetProperty( Renderer::Property::DEPTH_INDEX, 2 * DEPTH_INDEX_GRANULARITY );
  365 +
  366 + container.AddRenderer( renderer );
  367 + return container;
  368 + }
  369 +
  370 + /**
  371 + * @brief Creates the Reflection cube object.
  372 + * This creates new geometry (as the texture UVs are different to the main cube).
  373 + * The renderer is then created.
  374 + * The texture is set and all relevant renderer properties are set-up.
  375 + * @param[in] size The desired cube size
  376 + * @param[in] textureSet A pre-existing TextureSet with a texture set up, to be applied to the cube
  377 + * @return An actor set-up containing the reflection cube object
  378 + */
  379 + Actor CreateReflectionCubeObject( Vector3 size, TextureSet& textureSet )
  380 + {
  381 + Toolkit::Control container = Toolkit::Control::New();
  382 + container.SetAnchorPoint( AnchorPoint::TOP_CENTER );
  383 + container.SetParentOrigin( ParentOrigin::TOP_CENTER );
  384 + container.SetSize( size );
  385 + container.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
  386 +
  387 + // Create the cube geometry of unity size.
  388 + // The "true" specifies we want the texture UVs flipped vertically as this is the reflection cube.
  389 + Geometry reflectedCubeGeometry = CreateCubeVertices( Vector3::ONE, true );
  390 + // Create a renderer from the geometry and add the texture.
  391 + Renderer renderer = CreateRenderer( reflectedCubeGeometry, size, true, REFLECTION_COLOR );
  392 + renderer.SetTextures( textureSet );
  393 +
  394 + // Setup the renderer properties:
  395 + // Write to color buffer so reflection is visible
  396 + renderer.SetProperty( Renderer::Property::WRITE_TO_COLOR_BUFFER, true );
  397 + // We cull to skip drawing the back faces.
  398 + renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK );
  399 +
  400 + // We use blending to blend the reflection with the floor texture.
  401 + renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
  402 + renderer.SetProperty( Renderer::Property::BLEND_EQUATION_RGB, BlendEquation::ADD );
  403 + renderer.SetProperty( Renderer::Property::BLEND_EQUATION_ALPHA, BlendEquation::ADD );
  404 + renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::ONE );
  405 +
  406 + // Enable stencil. Here we only draw to areas within the stencil.
  407 + renderer.SetProperty( Renderer::Property::STENCIL_MODE, StencilMode::ON );
  408 + renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION, StencilFunction::EQUAL );
  409 + renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION_REFERENCE, 1 );
  410 + renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION_MASK, 0xff );
  411 + // Don't write to the stencil.
  412 + renderer.SetProperty( Renderer::Property::STENCIL_MASK, 0x00 );
  413 +
  414 + // We don't need to write to the depth buffer, as we are culling.
  415 + renderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::OFF );
  416 + // We need to test the depth buffer as we need the reflection to be underneath the cube.
  417 + renderer.SetProperty( Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::ON );
  418 +
  419 + // This object must be rendered last.
  420 + renderer.SetProperty( Renderer::Property::DEPTH_INDEX, 3 * DEPTH_INDEX_GRANULARITY );
  421 +
  422 + container.AddRenderer( renderer );
  423 + return container;
  424 + }
  425 +
  426 + // Methods:
  427 +
  428 + /**
  429 + * @brief Creates a geometry object from vertices and indices.
  430 + * @param[in] vertices The object vertices
  431 + * @param[in] indices The object indices
  432 + * @return A geometry object
  433 + */
  434 + Geometry CreateTexturedGeometry( Vector<TexturedVertex>& vertices, Vector<unsigned short>& indices )
  435 + {
  436 + // Vertices
  437 + Property::Map vertexFormat;
  438 + vertexFormat[POSITION] = Property::VECTOR3;
  439 + vertexFormat[NORMAL] = Property::VECTOR3;
  440 + vertexFormat[TEXTURE] = Property::VECTOR2;
  441 +
  442 + PropertyBuffer surfaceVertices = PropertyBuffer::New( vertexFormat );
  443 + surfaceVertices.SetData( &vertices[0u], vertices.Size() );
  444 +
  445 + Geometry geometry = Geometry::New();
  446 + geometry.AddVertexBuffer( surfaceVertices );
  447 +
  448 + // Indices for triangle formulation
  449 + geometry.SetIndexBuffer( &indices[0u], indices.Size() );
  450 + return geometry;
  451 + }
  452 +
  453 + /**
  454 + * @brief Creates a renderer from a geometry object.
  455 + * @param[in] geometry The geometry to use
  456 + * @param[in] dimensions The dimensions (will be passed in to the shader)
  457 + * @param[in] textured Set to true to use the texture versions of the shaders
  458 + * @param[in] color The base color for the renderer
  459 + * @return A renderer object
  460 + */
  461 + Renderer CreateRenderer( Geometry geometry, Vector3 dimensions, bool textured, Vector4 color )
  462 + {
  463 + Stage stage = Stage::GetCurrent();
  464 + Shader shader;
  465 +
  466 + if( textured )
  467 + {
  468 + shader = Shader::New( VERTEX_SHADER_TEXTURED, FRAGMENT_SHADER_TEXTURED );
  469 + }
  470 + else
  471 + {
  472 + shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
  473 + }
  474 +
  475 + // Here we modify the light position based on half the stage size as a pre-calculation step.
  476 + // This avoids the work having to be done in the shader.
  477 + shader.RegisterProperty( LIGHT_POSITION_UNIFORM_NAME, Vector3( -stage.GetSize().width / 2.0f, -stage.GetSize().width / 2.0f, 1000.0f ) );
  478 + shader.RegisterProperty( COLOR_UNIFORM_NAME, color );
  479 + shader.RegisterProperty( OBJECT_DIMENSIONS_UNIFORM_NAME, dimensions );
  480 +
  481 + return Renderer::New( geometry, shader );
  482 + }
  483 +
  484 + /**
  485 + * @brief Helper method to create a TextureSet from an image URL.
  486 + * @param[in] url An image URL
  487 + * @return A TextureSet object
  488 + */
  489 + TextureSet CreateTextureSet( const char* url )
  490 + {
  491 + TextureSet textureSet = TextureSet::New();
  492 +
  493 + if( textureSet )
  494 + {
  495 + Texture texture = DemoHelper::LoadTexture( url );
  496 + if( texture )
  497 + {
  498 + textureSet.SetTexture( 0u, texture );
  499 + }
  500 + }
  501 +
  502 + return textureSet;
  503 + }
  504 +
  505 + // Geometry Creation:
  506 +
  507 + /**
  508 + * @brief Creates a geometry object for a flat plane.
  509 + * The plane is oriented in X & Y axis (Z is 0).
  510 + * @param[in] dimensions The desired plane dimensions
  511 + * @return A Geometry object
  512 + */
  513 + Geometry CreatePlaneVertices( Vector2 dimensions )
  514 + {
  515 + Vector<TexturedVertex> vertices;
  516 + Vector<unsigned short> indices;
  517 + vertices.Resize( 4u );
  518 + indices.Resize( 6u );
  519 +
  520 + float scaledX = 0.5f * dimensions.x;
  521 + float scaledY = 0.5f * dimensions.y;
  522 +
  523 + vertices[0].position = Vector3( -scaledX, -scaledY, 0.0f );
  524 + vertices[0].textureCoord = Vector2( 0.0, 0.0f );
  525 + vertices[1].position = Vector3( scaledX, -scaledY, 0.0f );
  526 + vertices[1].textureCoord = Vector2( 1.0, 0.0f );
  527 + vertices[2].position = Vector3( scaledX, scaledY, 0.0f );
  528 + vertices[2].textureCoord = Vector2( 1.0, 1.0f );
  529 + vertices[3].position = Vector3( -scaledX, scaledY, 0.0f );
  530 + vertices[3].textureCoord = Vector2( 0.0, 1.0f );
  531 +
  532 + // All vertices have the same normal.
  533 + for( int i = 0; i < 4; ++i )
  534 + {
  535 + vertices[i].normal = Vector3( 0.0f, 0.0f, -1.0f );
  536 + }
  537 +
  538 + indices[0] = 0;
  539 + indices[1] = 1;
  540 + indices[2] = 2;
  541 + indices[3] = 2;
  542 + indices[4] = 3;
  543 + indices[5] = 0;
  544 +
  545 + // Use the helper method to create the geometry object.
  546 + return CreateTexturedGeometry( vertices, indices );
  547 + }
  548 +
  549 + /**
  550 + * @brief Creates a geometry object for a cube (or cuboid).
  551 + * @param[in] dimensions The desired cube dimensions
  552 + * @param[in] reflectVerticalUVs Set to True to force the UVs to be vertically flipped
  553 + * @return A Geometry object
  554 + */
  555 + Geometry CreateCubeVertices( Vector3 dimensions, bool reflectVerticalUVs )
  556 + {
  557 + Vector<TexturedVertex> vertices;
  558 + Vector<unsigned short> indices;
  559 + int vertexIndex = 0u; // Tracks progress through vertices.
  560 + float scaledX = 0.5f * dimensions.x;
  561 + float scaledY = 0.5f * dimensions.y;
  562 + float scaledZ = 0.5f * dimensions.z;
  563 + float verticalTextureCoord = reflectVerticalUVs ? 0.0f : 1.0f;
  564 +
  565 + vertices.Resize( 4u * 6u ); // 4 vertices x 6 faces
  566 +
  567 + Vector<Vector3> positions; // Stores vertex positions, which are shared between vertexes at the same position but with a different normal.
  568 + positions.Resize( 8u );
  569 + Vector<Vector3> normals; // Stores normals, which are shared between vertexes of the same face.
  570 + normals.Resize( 6u );
  571 +
  572 + positions[0] = Vector3( -scaledX, scaledY, -scaledZ );
  573 + positions[1] = Vector3( scaledX, scaledY, -scaledZ );
  574 + positions[2] = Vector3( scaledX, scaledY, scaledZ );
  575 + positions[3] = Vector3( -scaledX, scaledY, scaledZ );
  576 + positions[4] = Vector3( -scaledX, -scaledY, -scaledZ );
  577 + positions[5] = Vector3( scaledX, -scaledY, -scaledZ );
  578 + positions[6] = Vector3( scaledX, -scaledY, scaledZ );
  579 + positions[7] = Vector3( -scaledX, -scaledY, scaledZ );
  580 +
  581 + normals[0] = Vector3( 0, 1, 0 );
  582 + normals[1] = Vector3( 0, 0, -1 );
  583 + normals[2] = Vector3( 1, 0, 0 );
  584 + normals[3] = Vector3( 0, 0, 1 );
  585 + normals[4] = Vector3( -1, 0, 0 );
  586 + normals[5] = Vector3( 0, -1, 0 );
  587 +
  588 + // Top face, upward normals.
  589 + for( int i = 0; i < 4; ++i, ++vertexIndex )
  590 + {
  591 + vertices[vertexIndex].position = positions[i];
  592 + vertices[vertexIndex].normal = normals[0];
  593 + // The below logic forms the correct U/V pairs for a quad when "i" goes from 0 to 3.
  594 + vertices[vertexIndex].textureCoord = Vector2( ( i == 1 || i == 2 ) ? 1.0f : 0.0f, ( i == 2 || i == 3 ) ? 1.0f : 0.0f );
  595 + }
  596 +
  597 + // Top face, outward normals.
  598 + for( int i = 0; i < 4; ++i, vertexIndex += 2 )
  599 + {
  600 + vertices[vertexIndex].position = positions[i];
  601 + vertices[vertexIndex].normal = normals[i + 1];
  602 +
  603 + if( i == 3 )
  604 + {
  605 + // End, so loop around.
  606 + vertices[vertexIndex + 1].position = positions[0];
  607 + }
  608 + else
  609 + {
  610 + vertices[vertexIndex + 1].position = positions[i + 1];
  611 + }
  612 + vertices[vertexIndex + 1].normal = normals[i + 1];
  613 +
  614 + vertices[vertexIndex].textureCoord = Vector2( 0.0f, verticalTextureCoord );
  615 + vertices[vertexIndex+1].textureCoord = Vector2( 1.0f, verticalTextureCoord );
  616 + }
  617 +
  618 + // Flip the vertical texture coord for the UV values of the bottom points.
  619 + verticalTextureCoord = 1.0f - verticalTextureCoord;
  620 +
  621 + // Bottom face, outward normals.
  622 + for( int i = 0; i < 4; ++i, vertexIndex += 2 )
  623 + {
  624 + vertices[vertexIndex].position = positions[i + 4];
  625 + vertices[vertexIndex].normal = normals[i + 1];
  626 +
  627 + if( i == 3 )
  628 + {
  629 + // End, so loop around.
  630 + vertices[vertexIndex + 1].position = positions[4];
  631 + }
  632 + else
  633 + {
  634 + vertices[vertexIndex + 1].position = positions[i + 5];
  635 + }
  636 + vertices[vertexIndex + 1].normal = normals[i + 1];
  637 +
  638 + vertices[vertexIndex].textureCoord = Vector2( 0.0f, verticalTextureCoord );
  639 + vertices[vertexIndex+1].textureCoord = Vector2( 1.0f, verticalTextureCoord );
  640 + }
  641 +
  642 + // Bottom face, downward normals.
  643 + for( int i = 0; i < 4; ++i, ++vertexIndex )
  644 + {
  645 + // Reverse positions for bottom face to keep triangles clockwise (for culling).
  646 + vertices[vertexIndex].position = positions[ 7 - i ];
  647 + vertices[vertexIndex].normal = normals[5];
  648 + // The below logic forms the correct U/V pairs for a quad when "i" goes from 0 to 3.
  649 + vertices[vertexIndex].textureCoord = Vector2( ( i == 1 || i == 2 ) ? 1.0f : 0.0f, ( i == 2 || i == 3 ) ? 1.0f : 0.0f );
  650 + }
  651 +
  652 + // Create cube indices.
  653 + int triangleIndex = 0u; //Track progress through indices.
  654 + indices.Resize( 3u * 12u ); // 3 points x 12 triangles.
  655 +
  656 + // Top face.
  657 + indices[triangleIndex] = 0;
  658 + indices[triangleIndex + 1] = 1;
  659 + indices[triangleIndex + 2] = 2;
  660 + indices[triangleIndex + 3] = 2;
  661 + indices[triangleIndex + 4] = 3;
  662 + indices[triangleIndex + 5] = 0;
  663 + triangleIndex += 6;
  664 +
  665 + int topFaceStart = 4u;
  666 + int bottomFaceStart = topFaceStart + 8u;
  667 +
  668 + // Side faces.
  669 + for( int i = 0; i < 8; i += 2, triangleIndex += 6 )
  670 + {
  671 + indices[triangleIndex ] = i + topFaceStart;
  672 + indices[triangleIndex + 1] = i + bottomFaceStart + 1;
  673 + indices[triangleIndex + 2] = i + topFaceStart + 1;
  674 + indices[triangleIndex + 3] = i + topFaceStart;
  675 + indices[triangleIndex + 4] = i + bottomFaceStart;
  676 + indices[triangleIndex + 5] = i + bottomFaceStart + 1;
  677 + }
  678 +
  679 + // Bottom face.
  680 + indices[triangleIndex] = 20;
  681 + indices[triangleIndex + 1] = 21;
  682 + indices[triangleIndex + 2] = 22;
  683 + indices[triangleIndex + 3] = 22;
  684 + indices[triangleIndex + 4] = 23;
  685 + indices[triangleIndex + 5] = 20;
  686 +
  687 + // Use the helper method to create the geometry object.
  688 + return CreateTexturedGeometry( vertices, indices );
  689 + }
  690 +
  691 + // Signal handlers:
  692 +
  693 + /**
  694 + * @brief OnTouch signal handler.
  695 + * @param[in] actor The actor that has been touched
  696 + * @param[in] touch The touch information
  697 + * @return True if the event has been handled
  698 + */
  699 + bool OnTouch( Actor actor, const TouchData& touch )
  700 + {
  701 + // Quit the application.
  702 + mApplication.Quit();
  703 + return true;
  704 + }
  705 +
  706 + /**
  707 + * @brief OnKeyEvent signal handler.
  708 + * @param[in] event The key event information
  709 + */
  710 + void OnKeyEvent( const KeyEvent& event )
  711 + {
  712 + if( event.state == KeyEvent::Down )
  713 + {
  714 + if ( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) )
  715 + {
  716 + mApplication.Quit();
  717 + }
  718 + }
  719 + }
  720 +
  721 +private:
  722 +
  723 + // Member variables:
  724 +
  725 + Application& mApplication; ///< The DALi application object
  726 + Toolkit::Control mView; ///< The view used to show the background
  727 +
  728 + Animation mRotationAnimation; ///< The animation to spin the cube & floor
  729 + Animation mBounceAnimation; ///< The animation to bounce the cube
  730 + Actor mCubes[2]; ///< The cube object containers
  731 +};
  732 +
  733 +
  734 +/**
  735 + * @brief Creates an instance of the example object and runs it.
  736 + * @param[in] application The DALi application object
  737 + */
  738 +void RunExample( Application& application )
  739 +{
  740 + RendererStencilExample example( application );
  741 +
  742 + application.MainLoop();
  743 +}
  744 +
  745 +/**
  746 + * @brief Entry point for Linux & Tizen applications
  747 + * @param[in] argc The executables argument count
  748 + * @param[in] argv The executables argument vector
  749 + * @return The executables exit code (0)
  750 + */
  751 +int DALI_EXPORT_API main( int argc, char **argv )
  752 +{
  753 + Application application = Application::New( &argc, &argv );
  754 +
  755 + RunExample( application );
  756 +
  757 + return 0;
  758 +}
examples/renderer-stencil/renderer-stencil-shaders.h 0 โ†’ 100644
  1 +#ifndef DALI_DEMO_RENDERER_STENCIL_SHADERS_H
  2 +#define DALI_DEMO_RENDERER_STENCIL_SHADERS_H
  3 +
  4 +/*
  5 + * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  6 + *
  7 + * Licensed under the Apache License, Version 2.0 (the "License");
  8 + * you may not use this file except in compliance with the License.
  9 + * You may obtain a copy of the License at
  10 + *
  11 + * http://www.apache.org/licenses/LICENSE-2.0
  12 + *
  13 + * Unless required by applicable law or agreed to in writing, software
  14 + * distributed under the License is distributed on an "AS IS" BASIS,
  15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16 + * See the License for the specific language governing permissions and
  17 + * limitations under the License.
  18 + */
  19 +
  20 +// EXTERNAL INCLUDES
  21 +#include <dali/public-api/rendering/shader.h>
  22 +
  23 +// Shader uniforms:
  24 +const char * const COLOR_UNIFORM_NAME( "uColor" );
  25 +const char * const OBJECT_DIMENSIONS_UNIFORM_NAME( "uObjectDimensions" );
  26 +const char * const STAGE_SIZE_UNIFORM_NAME( "uStageSize" );
  27 +const char * const LIGHT_POSITION_UNIFORM_NAME = "uLightPosition";
  28 +const char * const POSITION( "aPosition");
  29 +const char * const NORMAL( "aNormal" );
  30 +const char * const TEXTURE( "aTexCoord" );
  31 +
  32 +// Shader for todor (vertex):
  33 +const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
  34 + attribute mediump vec3 aPosition;
  35 + attribute highp vec3 aNormal;
  36 + attribute highp vec2 aTexCoord;
  37 +
  38 + varying mediump vec2 vTexCoord;
  39 + uniform mediump mat4 uMvpMatrix;
  40 + uniform mediump vec3 uSize;
  41 + uniform mediump vec3 uObjectDimensions;
  42 + varying mediump vec3 vIllumination;
  43 + uniform mediump mat4 uModelView;
  44 + uniform mediump mat4 uViewMatrix;
  45 + uniform mediump mat3 uNormalMatrix;
  46 + uniform mediump vec3 uLightPosition;
  47 +
  48 + void main()
  49 + {
  50 + mediump vec4 vertexPosition = vec4( aPosition * uObjectDimensions, 1.0 );
  51 + vertexPosition = uMvpMatrix * vertexPosition;
  52 +
  53 + vec4 mvVertexPosition = uModelView * vertexPosition;
  54 +
  55 + vec3 vectorToLight = normalize( mat3( uViewMatrix ) * uLightPosition - mvVertexPosition.xyz );
  56 +
  57 + vec3 normal = uNormalMatrix * aNormal;
  58 + float lightDiffuse = max( dot( vectorToLight, normal ), 0.0 );
  59 + vIllumination = vec3( lightDiffuse * 0.5 + 0.5 );
  60 +
  61 + gl_Position = vertexPosition;
  62 + }
  63 +);
  64 +
  65 +const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
  66 + varying mediump vec2 vTexCoord;
  67 + varying mediump vec3 vIllumination;
  68 + uniform lowp vec4 uColor;
  69 + uniform sampler2D sTexture;
  70 +
  71 + void main()
  72 + {
  73 + gl_FragColor = vec4( vIllumination.rgb * uColor.rgb, uColor.a );
  74 + }
  75 +);
  76 +
  77 +const char* VERTEX_SHADER_TEXTURED = DALI_COMPOSE_SHADER(
  78 + attribute mediump vec3 aPosition;
  79 + attribute highp vec3 aNormal;
  80 + attribute highp vec2 aTexCoord;
  81 +
  82 + varying mediump vec2 vTexCoord;
  83 + uniform mediump mat4 uMvpMatrix;
  84 + uniform mediump vec3 uSize;
  85 + uniform mediump vec3 uObjectDimensions;
  86 + varying mediump vec3 vIllumination;
  87 + uniform mediump mat4 uModelView;
  88 + uniform mediump mat4 uViewMatrix;
  89 + uniform mediump mat3 uNormalMatrix;
  90 + uniform mediump vec3 uLightPosition;
  91 +
  92 + void main()
  93 + {
  94 + mediump vec4 vertexPosition = vec4( aPosition * uObjectDimensions, 1.0 );
  95 + vertexPosition = uMvpMatrix * vertexPosition;
  96 +
  97 + vec4 mvVertexPosition = uModelView * vertexPosition;
  98 +
  99 + vec3 vectorToLight = normalize( mat3( uViewMatrix ) * uLightPosition - mvVertexPosition.xyz );
  100 +
  101 + vec3 normal = uNormalMatrix * aNormal;
  102 + float lightDiffuse = max( dot( vectorToLight, normal ), 0.0 );
  103 + vIllumination = vec3( lightDiffuse * 0.5 + 0.5 );
  104 +
  105 + vTexCoord = aTexCoord;
  106 + gl_Position = vertexPosition;
  107 + }
  108 +);
  109 +
  110 +const char* FRAGMENT_SHADER_TEXTURED = DALI_COMPOSE_SHADER(
  111 + varying mediump vec2 vTexCoord;
  112 + varying mediump vec3 vIllumination;
  113 + uniform lowp vec4 uColor;
  114 + uniform sampler2D sTexture;
  115 +
  116 + void main()
  117 + {
  118 + gl_FragColor = vec4( texture2D( sTexture, vTexCoord ).rgb * vIllumination.rgb * uColor.rgb, uColor.a );
  119 + }
  120 +);
  121 +
  122 +#endif // DALI_DEMO_RENDERER_STENCIL_SHADERS_H
examples/scroll-view/scroll-view-example.cpp
@@ -454,12 +454,12 @@ private: @@ -454,12 +454,12 @@ private:
454 { 454 {
455 ImageView actor = ImageView::New(); 455 ImageView actor = ImageView::New();
456 Property::Map map; 456 Property::Map map;
457 - map["rendererType"] = "IMAGE";  
458 - map["url"] = filename;  
459 - map["desiredWidth"] = width;  
460 - map["desiredHeight"] = height;  
461 - map["fittingMode"] = "SCALE_TO_FILL";  
462 - map["samplingMode"] = "BOX_THEN_LINEAR"; 457 + map[Visual::Property::TYPE] = Visual::IMAGE;
  458 + map[ImageVisual::Property::URL] = filename;
  459 + map[ImageVisual::Property::DESIRED_WIDTH] = width;
  460 + map[ImageVisual::Property::DESIRED_HEIGHT] = height;
  461 + map[ImageVisual::Property::FITTING_MODE] = FittingMode::SCALE_TO_FILL;
  462 + map[ImageVisual::Property::SAMPLING_MODE] = SamplingMode::BOX_THEN_LINEAR;
463 actor.SetProperty( ImageView::Property::IMAGE, map ); 463 actor.SetProperty( ImageView::Property::IMAGE, map );
464 464
465 actor.SetName( filename ); 465 actor.SetName( filename );
examples/text-scrolling/text-scrolling-example.cpp
@@ -77,9 +77,9 @@ public: @@ -77,9 +77,9 @@ public:
77 parent.Add( box ); 77 parent.Add( box );
78 78
79 Dali::Property::Map border; 79 Dali::Property::Map border;
80 - border.Insert( "rendererType", "BORDER" );  
81 - border.Insert( "borderColor", Color::WHITE );  
82 - border.Insert( "borderSize", 1.f ); 80 + border.Insert( Visual::Property::TYPE, Visual::BORDER );
  81 + border.Insert( BorderVisual::Property::COLOR, Color::WHITE );
  82 + border.Insert( BorderVisual::Property::SIZE, 1.f );
83 box.SetProperty( Control::Property::BACKGROUND, border ); 83 box.SetProperty( Control::Property::BACKGROUND, border );
84 } 84 }
85 85
examples/video-view/video-view-example.cpp
@@ -210,14 +210,14 @@ class VideoViewController: public ConnectionTracker @@ -210,14 +210,14 @@ class VideoViewController: public ConnectionTracker
210 Stage::GetCurrent().KeyEventSignal().Connect( this, &VideoViewController::OnKeyEvent ); 210 Stage::GetCurrent().KeyEventSignal().Connect( this, &VideoViewController::OnKeyEvent );
211 211
212 Property::Map customShader; 212 Property::Map customShader;
213 - customShader.Insert( "fragmentShader", FRAGMENT_SHADER );  
214 - mCustomShader.Insert( "rendererType", "IMAGE" );  
215 - mCustomShader.Insert( "shader", customShader ); 213 + customShader.Insert( Visual::Shader::Property::FRAGMENT_SHADER, FRAGMENT_SHADER );
  214 + mCustomShader.Insert( Visual::Property::TYPE, Visual::IMAGE );
  215 + mCustomShader.Insert( Visual::Property::SHADER, customShader );
216 216
217 Property::Map defaultShader; 217 Property::Map defaultShader;
218 - customShader.Insert( "fragmentShader", DEFAULT_FRAGMENT_SHADER );  
219 - mDefaultShader.Insert( "rendererType", "IMAGE" );  
220 - mDefaultShader.Insert( "shader", defaultShader ); 218 + customShader.Insert( Visual::Shader::Property::FRAGMENT_SHADER, DEFAULT_FRAGMENT_SHADER );
  219 + mDefaultShader.Insert( Visual::Property::TYPE, Visual::IMAGE );
  220 + mDefaultShader.Insert( Visual::Property::SHADER, customShader );
221 221
222 mWindowSurfaceTarget.Insert( "RENDERING_TARGET", "windowSurfaceTarget" ); 222 mWindowSurfaceTarget.Insert( "RENDERING_TARGET", "windowSurfaceTarget" );
223 mNativeImageTarget.Insert( "RENDERING_TARGET", "nativeImageTarget" ); 223 mNativeImageTarget.Insert( "RENDERING_TARGET", "nativeImageTarget" );
packaging/com.samsung.dali-demo.spec
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 2
3 Name: com.samsung.dali-demo 3 Name: com.samsung.dali-demo
4 Summary: The OpenGLES Canvas Core Demo 4 Summary: The OpenGLES Canvas Core Demo
5 -Version: 1.1.44 5 +Version: 1.1.45
6 Release: 1 6 Release: 1
7 Group: System/Libraries 7 Group: System/Libraries
8 License: Apache-2.0 8 License: Apache-2.0
@@ -39,22 +39,21 @@ of the capability of the toolkit. @@ -39,22 +39,21 @@ of the capability of the toolkit.
39 %prep 39 %prep
40 %setup -q 40 %setup -q
41 41
42 -  
43 #Use TZ_PATH when tizen version is 3.x 42 #Use TZ_PATH when tizen version is 3.x
  43 +
44 %if "%{tizen_version_major}" == "2" 44 %if "%{tizen_version_major}" == "2"
45 %define dali_app_ro_dir /usr/apps/com.samsung.dali-demo/ 45 %define dali_app_ro_dir /usr/apps/com.samsung.dali-demo/
46 %define dali_xml_file_dir /usr/share/packages/ 46 %define dali_xml_file_dir /usr/share/packages/
47 %define dali_icon_dir /usr/share/icons/ 47 %define dali_icon_dir /usr/share/icons/
48 -%endif  
49 -  
50 -%if "%{tizen_version_major}" == "3" 48 +%define smack_rule_dir /etc/smack/accesses2.d/
  49 +%else
51 %define dali_app_ro_dir %TZ_SYS_RO_APP/com.samsung.dali-demo/ 50 %define dali_app_ro_dir %TZ_SYS_RO_APP/com.samsung.dali-demo/
52 %define dali_xml_file_dir %TZ_SYS_RO_PACKAGES 51 %define dali_xml_file_dir %TZ_SYS_RO_PACKAGES
53 %define dali_icon_dir %TZ_SYS_RO_ICONS 52 %define dali_icon_dir %TZ_SYS_RO_ICONS
  53 +%define smack_rule_dir %TZ_SYS_SMACK/accesses2.d/
54 %endif 54 %endif
55 55
56 %define dali_app_exe_dir %{dali_app_ro_dir}/bin/ 56 %define dali_app_exe_dir %{dali_app_ro_dir}/bin/
57 -%define smack_rule_dir /etc/smack/accesses2.d/  
58 %define locale_dir %{dali_app_ro_dir}/res/locale 57 %define locale_dir %{dali_app_ro_dir}/res/locale
59 %define local_style_dir ../../resources/style/mobile 58 %define local_style_dir ../../resources/style/mobile
60 59
resources/images/wood.png 0 โ†’ 100644

358 KB

resources/scripts/animated-colors.json
@@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
42 "heightResizePolicy":"FILL_TO_PARENT", 42 "heightResizePolicy":"FILL_TO_PARENT",
43 "sizeAspectRatio": false, 43 "sizeAspectRatio": false,
44 "background": { 44 "background": {
45 - "rendererType": "COLOR", 45 + "visualType": "COLOR",
46 "mixColor": [1,1,1,1] 46 "mixColor": [1,1,1,1]
47 }, 47 },
48 "color": [ 48 "color": [
@@ -78,7 +78,7 @@ @@ -78,7 +78,7 @@
78 "heightResizePolicy":"FILL_TO_PARENT", 78 "heightResizePolicy":"FILL_TO_PARENT",
79 "sizeAspectRatio": false, 79 "sizeAspectRatio": false,
80 "background": { 80 "background": {
81 - "rendererType": "COLOR", 81 + "visualType": "COLOR",
82 "mixColor": [1,1,1,1] 82 "mixColor": [1,1,1,1]
83 }, 83 },
84 "color": [ 84 "color": [
@@ -114,7 +114,7 @@ @@ -114,7 +114,7 @@
114 "heightResizePolicy":"FILL_TO_PARENT", 114 "heightResizePolicy":"FILL_TO_PARENT",
115 "sizeAspectRatio": false, 115 "sizeAspectRatio": false,
116 "background": { 116 "background": {
117 - "rendererType": "COLOR", 117 + "visualType": "COLOR",
118 "mixColor": [1,1,1,1] 118 "mixColor": [1,1,1,1]
119 }, 119 },
120 "color": [ 120 "color": [
@@ -146,7 +146,7 @@ @@ -146,7 +146,7 @@
146 "heightResizePolicy":"FILL_TO_PARENT", 146 "heightResizePolicy":"FILL_TO_PARENT",
147 "sizeAspectRatio": false, 147 "sizeAspectRatio": false,
148 "background": { 148 "background": {
149 - "rendererType": "COLOR", 149 + "visualType": "COLOR",
150 "mixColor": [1,1,1,1] 150 "mixColor": [1,1,1,1]
151 }, 151 },
152 "color": [ 152 "color": [
@@ -182,7 +182,7 @@ @@ -182,7 +182,7 @@
182 "heightResizePolicy":"FILL_TO_PARENT", 182 "heightResizePolicy":"FILL_TO_PARENT",
183 "sizeAspectRatio": false, 183 "sizeAspectRatio": false,
184 "background": { 184 "background": {
185 - "rendererType": "COLOR", 185 + "visualType": "COLOR",
186 "mixColor": [1,1,1,1] 186 "mixColor": [1,1,1,1]
187 }, 187 },
188 "color": [ 188 "color": [
@@ -218,7 +218,7 @@ @@ -218,7 +218,7 @@
218 "heightResizePolicy":"FILL_TO_PARENT", 218 "heightResizePolicy":"FILL_TO_PARENT",
219 "sizeAspectRatio": false, 219 "sizeAspectRatio": false,
220 "background": { 220 "background": {
221 - "rendererType": "COLOR", 221 + "visualType": "COLOR",
222 "mixColor": [1,1,1,1] 222 "mixColor": [1,1,1,1]
223 }, 223 },
224 "color": [ 224 "color": [
@@ -250,7 +250,7 @@ @@ -250,7 +250,7 @@
250 "heightResizePolicy":"FILL_TO_PARENT", 250 "heightResizePolicy":"FILL_TO_PARENT",
251 "sizeAspectRatio": false, 251 "sizeAspectRatio": false,
252 "background": { 252 "background": {
253 - "rendererType": "COLOR", 253 + "visualType": "COLOR",
254 "mixColor": [1,1,1,1] 254 "mixColor": [1,1,1,1]
255 }, 255 },
256 "color": [ 256 "color": [
@@ -286,7 +286,7 @@ @@ -286,7 +286,7 @@
286 "heightResizePolicy":"FILL_TO_PARENT", 286 "heightResizePolicy":"FILL_TO_PARENT",
287 "sizeAspectRatio": false, 287 "sizeAspectRatio": false,
288 "background": { 288 "background": {
289 - "rendererType": "COLOR", 289 + "visualType": "COLOR",
290 "mixColor": [1,1,1,1] 290 "mixColor": [1,1,1,1]
291 }, 291 },
292 "color": [ 292 "color": [
@@ -322,7 +322,7 @@ @@ -322,7 +322,7 @@
322 "heightResizePolicy":"FILL_TO_PARENT", 322 "heightResizePolicy":"FILL_TO_PARENT",
323 "sizeAspectRatio": false, 323 "sizeAspectRatio": false,
324 "background": { 324 "background": {
325 - "rendererType": "COLOR", 325 + "visualType": "COLOR",
326 "mixColor": [1,1,1,1] 326 "mixColor": [1,1,1,1]
327 }, 327 },
328 "color": [ 328 "color": [
@@ -354,7 +354,7 @@ @@ -354,7 +354,7 @@
354 "heightResizePolicy":"FILL_TO_PARENT", 354 "heightResizePolicy":"FILL_TO_PARENT",
355 "sizeAspectRatio": false, 355 "sizeAspectRatio": false,
356 "background": { 356 "background": {
357 - "rendererType": "COLOR", 357 + "visualType": "COLOR",
358 "mixColor": [1,1,1,1] 358 "mixColor": [1,1,1,1]
359 }, 359 },
360 "color": [ 360 "color": [
@@ -386,7 +386,7 @@ @@ -386,7 +386,7 @@
386 "heightResizePolicy":"FILL_TO_PARENT", 386 "heightResizePolicy":"FILL_TO_PARENT",
387 "sizeAspectRatio": false, 387 "sizeAspectRatio": false,
388 "background": { 388 "background": {
389 - "rendererType": "COLOR", 389 + "visualType": "COLOR",
390 "mixColor": [1,1,1,1] 390 "mixColor": [1,1,1,1]
391 }, 391 },
392 "color": [ 392 "color": [
@@ -418,7 +418,7 @@ @@ -418,7 +418,7 @@
418 "heightResizePolicy":"FILL_TO_PARENT", 418 "heightResizePolicy":"FILL_TO_PARENT",
419 "sizeAspectRatio": false, 419 "sizeAspectRatio": false,
420 "background": { 420 "background": {
421 - "rendererType": "COLOR", 421 + "visualType": "COLOR",
422 "mixColor": [1,1,1,1] 422 "mixColor": [1,1,1,1]
423 }, 423 },
424 "color": [ 424 "color": [
@@ -450,7 +450,7 @@ @@ -450,7 +450,7 @@
450 "heightResizePolicy":"FILL_TO_PARENT", 450 "heightResizePolicy":"FILL_TO_PARENT",
451 "sizeAspectRatio": false, 451 "sizeAspectRatio": false,
452 "background": { 452 "background": {
453 - "rendererType": "COLOR", 453 + "visualType": "COLOR",
454 "mixColor": [1,1,1,1] 454 "mixColor": [1,1,1,1]
455 }, 455 },
456 "color": [ 456 "color": [
@@ -486,7 +486,7 @@ @@ -486,7 +486,7 @@
486 "heightResizePolicy":"FILL_TO_PARENT", 486 "heightResizePolicy":"FILL_TO_PARENT",
487 "sizeAspectRatio": false, 487 "sizeAspectRatio": false,
488 "background": { 488 "background": {
489 - "rendererType": "COLOR", 489 + "visualType": "COLOR",
490 "mixColor": [1,1,1,1] 490 "mixColor": [1,1,1,1]
491 }, 491 },
492 "color": [ 492 "color": [
@@ -518,7 +518,7 @@ @@ -518,7 +518,7 @@
518 "heightResizePolicy":"FILL_TO_PARENT", 518 "heightResizePolicy":"FILL_TO_PARENT",
519 "sizeAspectRatio": false, 519 "sizeAspectRatio": false,
520 "background": { 520 "background": {
521 - "rendererType": "COLOR", 521 + "visualType": "COLOR",
522 "mixColor": [1,1,1,1] 522 "mixColor": [1,1,1,1]
523 }, 523 },
524 "color": [ 524 "color": [
@@ -557,7 +557,7 @@ @@ -557,7 +557,7 @@
557 "heightResizePolicy":"FILL_TO_PARENT", 557 "heightResizePolicy":"FILL_TO_PARENT",
558 "sizeAspectRatio": false, 558 "sizeAspectRatio": false,
559 "background": { 559 "background": {
560 - "rendererType": "COLOR", 560 + "visualType": "COLOR",
561 "mixColor": [1,1,1,1] 561 "mixColor": [1,1,1,1]
562 }, 562 },
563 "color": [ 563 "color": [
@@ -589,7 +589,7 @@ @@ -589,7 +589,7 @@
589 "heightResizePolicy":"FILL_TO_PARENT", 589 "heightResizePolicy":"FILL_TO_PARENT",
590 "sizeAspectRatio": false, 590 "sizeAspectRatio": false,
591 "background": { 591 "background": {
592 - "rendererType": "COLOR", 592 + "visualType": "COLOR",
593 "mixColor": [1,1,1,1] 593 "mixColor": [1,1,1,1]
594 }, 594 },
595 "color": [ 595 "color": [
@@ -622,7 +622,7 @@ @@ -622,7 +622,7 @@
622 "heightResizePolicy":"FILL_TO_PARENT", 622 "heightResizePolicy":"FILL_TO_PARENT",
623 "sizeAspectRatio": false, 623 "sizeAspectRatio": false,
624 "background": { 624 "background": {
625 - "rendererType": "COLOR", 625 + "visualType": "COLOR",
626 "mixColor": [1,1,1,1] 626 "mixColor": [1,1,1,1]
627 }, 627 },
628 "color": [ 628 "color": [
@@ -661,7 +661,7 @@ @@ -661,7 +661,7 @@
661 "heightResizePolicy":"FILL_TO_PARENT", 661 "heightResizePolicy":"FILL_TO_PARENT",
662 "sizeAspectRatio": false, 662 "sizeAspectRatio": false,
663 "background": { 663 "background": {
664 - "rendererType": "COLOR", 664 + "visualType": "COLOR",
665 "mixColor": [1,1,1,1] 665 "mixColor": [1,1,1,1]
666 }, 666 },
667 "color": [ 667 "color": [
@@ -693,7 +693,7 @@ @@ -693,7 +693,7 @@
693 "heightResizePolicy":"FILL_TO_PARENT", 693 "heightResizePolicy":"FILL_TO_PARENT",
694 "sizeAspectRatio": false, 694 "sizeAspectRatio": false,
695 "background": { 695 "background": {
696 - "rendererType": "COLOR", 696 + "visualType": "COLOR",
697 "mixColor": [1,1,1,1] 697 "mixColor": [1,1,1,1]
698 }, 698 },
699 "color": [ 699 "color": [
@@ -726,7 +726,7 @@ @@ -726,7 +726,7 @@
726 "heightResizePolicy":"FILL_TO_PARENT", 726 "heightResizePolicy":"FILL_TO_PARENT",
727 "sizeAspectRatio": false, 727 "sizeAspectRatio": false,
728 "background": { 728 "background": {
729 - "rendererType": "COLOR", 729 + "visualType": "COLOR",
730 "mixColor": [1,1,1,1] 730 "mixColor": [1,1,1,1]
731 }, 731 },
732 "color": [ 732 "color": [
@@ -758,7 +758,7 @@ @@ -758,7 +758,7 @@
758 "heightResizePolicy":"FILL_TO_PARENT", 758 "heightResizePolicy":"FILL_TO_PARENT",
759 "sizeAspectRatio": false, 759 "sizeAspectRatio": false,
760 "background": { 760 "background": {
761 - "rendererType": "COLOR", 761 + "visualType": "COLOR",
762 "mixColor": [1,1,1,1] 762 "mixColor": [1,1,1,1]
763 }, 763 },
764 "color": [ 764 "color": [
@@ -790,7 +790,7 @@ @@ -790,7 +790,7 @@
790 "heightResizePolicy":"FILL_TO_PARENT", 790 "heightResizePolicy":"FILL_TO_PARENT",
791 "sizeAspectRatio": false, 791 "sizeAspectRatio": false,
792 "background": { 792 "background": {
793 - "rendererType": "COLOR", 793 + "visualType": "COLOR",
794 "mixColor": [1,1,1,1] 794 "mixColor": [1,1,1,1]
795 }, 795 },
796 "color": [ 796 "color": [
@@ -823,7 +823,7 @@ @@ -823,7 +823,7 @@
823 "sizeModeFactor": [0.25,0.166667,1], 823 "sizeModeFactor": [0.25,0.166667,1],
824 "sizeAspectRatio": false, 824 "sizeAspectRatio": false,
825 "background": { 825 "background": {
826 - "rendererType": "COLOR", 826 + "visualType": "COLOR",
827 "mixColor": [1,1,1,1] 827 "mixColor": [1,1,1,1]
828 }, 828 },
829 "color": [ 829 "color": [
resources/scripts/background.json
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", 30 "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT",
31 "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], 31 "sizeModeFactor": [ 0.5, 0.333333333333, 1 ],
32 "background":{ 32 "background":{
33 - "rendererType": "COLOR", 33 + "visualType": "COLOR",
34 "mixColor": [ 0.8, 0, 0.2, 1 ] 34 "mixColor": [ 0.8, 0, 0.2, 1 ]
35 } 35 }
36 }, 36 },
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", 45 "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT",
46 "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], 46 "sizeModeFactor": [ 0.5, 0.333333333333, 1 ],
47 "background": { 47 "background": {
48 - "rendererType": "IMAGE", 48 + "visualType": "IMAGE",
49 "url": "{DEMO_IMAGE_DIR}Kid1.svg" 49 "url": "{DEMO_IMAGE_DIR}Kid1.svg"
50 } 50 }
51 }, 51 },
@@ -60,7 +60,7 @@ @@ -60,7 +60,7 @@
60 "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", 60 "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT",
61 "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], 61 "sizeModeFactor": [ 0.5, 0.333333333333, 1 ],
62 "background": { 62 "background": {
63 - "rendererType" : "BORDER", 63 + "visualType" : "BORDER",
64 "borderColor" : [ 0.5, 0.5, 0.5, 1 ], 64 "borderColor" : [ 0.5, 0.5, 0.5, 1 ],
65 "borderSize" : 15.0 65 "borderSize" : 15.0
66 } 66 }
@@ -76,7 +76,7 @@ @@ -76,7 +76,7 @@
76 "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", 76 "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT",
77 "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], 77 "sizeModeFactor": [ 0.5, 0.333333333333, 1 ],
78 "background": { 78 "background": {
79 - "rendererType": "IMAGE", 79 + "visualType": "IMAGE",
80 "url": "{DEMO_IMAGE_DIR}gallery-large-9.jpg" 80 "url": "{DEMO_IMAGE_DIR}gallery-large-9.jpg"
81 } 81 }
82 }, 82 },
@@ -91,7 +91,7 @@ @@ -91,7 +91,7 @@
91 "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", 91 "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT",
92 "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], 92 "sizeModeFactor": [ 0.5, 0.333333333333, 1 ],
93 "background":{ 93 "background":{
94 - "rendererType": "COLOR", 94 + "visualType": "COLOR",
95 "mixColor": [ 1, 1, 0, 1 ] 95 "mixColor": [ 1, 1, 0, 1 ]
96 } 96 }
97 }, 97 },
@@ -106,7 +106,7 @@ @@ -106,7 +106,7 @@
106 "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", 106 "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT",
107 "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], 107 "sizeModeFactor": [ 0.5, 0.333333333333, 1 ],
108 "background": { 108 "background": {
109 - "rendererType" : "GRADIENT", 109 + "visualType" : "GRADIENT",
110 "startPosition" : [ -0.5, -0.5 ], 110 "startPosition" : [ -0.5, -0.5 ],
111 "endPosition": [ 0.5, 0.5 ], 111 "endPosition": [ 0.5, 0.5 ],
112 "stopColor" : [ 112 "stopColor" : [
resources/scripts/clock.json
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 "parentOrigin": [0.5, 0.5, 0.5], 8 "parentOrigin": [0.5, 0.5, 0.5],
9 "anchorPoint": [0.5, 1, 0.5], 9 "anchorPoint": [0.5, 1, 0.5],
10 "background": { 10 "background": {
11 - "rendererType": "COLOR", 11 + "visualType": "COLOR",
12 "mixColor": [0.71, 0, 0, 1] 12 "mixColor": [0.71, 0, 0, 1]
13 }, 13 },
14 "selected": false, 14 "selected": false,
@@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
27 "parentOrigin": [0.5, 0.5, 0.5], 27 "parentOrigin": [0.5, 0.5, 0.5],
28 "anchorPoint": [0.5, 1, 0.5], 28 "anchorPoint": [0.5, 1, 0.5],
29 "background": { 29 "background": {
30 - "rendererType": "COLOR", 30 + "visualType": "COLOR",
31 "mixColor": [0, 0.14200000000000013, 0.71, 0.7] 31 "mixColor": [0, 0.14200000000000013, 0.71, 0.7]
32 }, 32 },
33 "signals": [ 33 "signals": [
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 "parentOrigin": [0.5, 0.5, 0.5], 45 "parentOrigin": [0.5, 0.5, 0.5],
46 "anchorPoint": [0.5, 1, 0.5], 46 "anchorPoint": [0.5, 1, 0.5],
47 "background": { 47 "background": {
48 - "rendererType": "COLOR", 48 + "visualType": "COLOR",
49 "mixColor": [0.057450000000000064, 0.3, 0.0030000000000000027, 0.7] 49 "mixColor": [0.057450000000000064, 0.3, 0.0030000000000000027, 0.7]
50 }, 50 },
51 "signals": [ 51 "signals": [
resources/scripts/table-view.json
@@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
43 "name":"simpleTable", 43 "name":"simpleTable",
44 "type":"TableView", 44 "type":"TableView",
45 "background":{ 45 "background":{
46 - "rendererType": "COLOR", 46 + "visualType": "COLOR",
47 "mixColor": [0.5,0.5,0,1] 47 "mixColor": [0.5,0.5,0,1]
48 }, 48 },
49 "parentOrigin": "CENTER", 49 "parentOrigin": "CENTER",
resources/style/demo-theme.json.in
@@ -69,7 +69,7 @@ @@ -69,7 +69,7 @@
69 { 69 {
70 "background": 70 "background":
71 { 71 {
72 - "rendererType": "GRADIENT", 72 + "visualType": "GRADIENT",
73 "center": [240, 400], 73 "center": [240, 400],
74 "radius": 932, 74 "radius": 932,
75 "units": "USER_SPACE", 75 "units": "USER_SPACE",
resources/style/mobile/demo-theme.json.in
@@ -82,7 +82,7 @@ @@ -82,7 +82,7 @@
82 { 82 {
83 "background": 83 "background":
84 { 84 {
85 - "rendererType": "GRADIENT", 85 + "visualType": "GRADIENT",
86 "center": [360, 640], 86 "center": [360, 640],
87 "radius": 1468, 87 "radius": 1468,
88 "units": "USER_SPACE", 88 "units": "USER_SPACE",
shared/dali-demo-strings.h
1 /* 1 /*
2 - * Copyright (c) 2015 Samsung Electronics Co., Ltd. 2 + * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
@@ -37,6 +37,7 @@ extern &quot;C&quot; @@ -37,6 +37,7 @@ extern &quot;C&quot;
37 #define DALI_DEMO_STR_TITLE_CUBE_TRANSITION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CUBE_TRANSITION") 37 #define DALI_DEMO_STR_TITLE_CUBE_TRANSITION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CUBE_TRANSITION")
38 #define DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION") 38 #define DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION")
39 #define DALI_DEMO_STR_TITLE_ITEM_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_ITEM_VIEW") 39 #define DALI_DEMO_STR_TITLE_ITEM_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_ITEM_VIEW")
  40 +#define DALI_DEMO_STR_TITLE_RENDERER_STENCIL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RENDERER_STENCIL")
40 #define DALI_DEMO_STR_TITLE_MAGNIFIER dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MAGNIFIER") 41 #define DALI_DEMO_STR_TITLE_MAGNIFIER dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MAGNIFIER")
41 #define DALI_DEMO_STR_TITLE_MOTION_BLUR dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MOTION_BLUR") 42 #define DALI_DEMO_STR_TITLE_MOTION_BLUR dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MOTION_BLUR")
42 #define DALI_DEMO_STR_TITLE_MOTION_STRETCH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MOTION_STRETCH") 43 #define DALI_DEMO_STR_TITLE_MOTION_STRETCH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MOTION_STRETCH")
@@ -71,6 +72,7 @@ extern &quot;C&quot; @@ -71,6 +72,7 @@ extern &quot;C&quot;
71 #define DALI_DEMO_STR_TITLE_CUBE_TRANSITION "Cube Effect" 72 #define DALI_DEMO_STR_TITLE_CUBE_TRANSITION "Cube Effect"
72 #define DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION "Dissolve Effect" 73 #define DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION "Dissolve Effect"
73 #define DALI_DEMO_STR_TITLE_ITEM_VIEW "Item View" 74 #define DALI_DEMO_STR_TITLE_ITEM_VIEW "Item View"
  75 +#define DALI_DEMO_STR_TITLE_RENDERER_STENCIL "Renderer Stencils"
74 #define DALI_DEMO_STR_TITLE_MAGNIFIER "Magnifier" 76 #define DALI_DEMO_STR_TITLE_MAGNIFIER "Magnifier"
75 #define DALI_DEMO_STR_TITLE_MODEL_3D_VIEWER "Model 3D Viewer" 77 #define DALI_DEMO_STR_TITLE_MODEL_3D_VIEWER "Model 3D Viewer"
76 #define DALI_DEMO_STR_TITLE_MOTION_BLUR "Motion Blur" 78 #define DALI_DEMO_STR_TITLE_MOTION_BLUR "Motion Blur"
@@ -107,7 +109,7 @@ extern &quot;C&quot; @@ -107,7 +109,7 @@ extern &quot;C&quot;
107 #define DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM "Super Blur and Bloom" 109 #define DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM "Super Blur and Bloom"
108 #define DALI_DEMO_STR_TITLE_EFFECTS_VIEW "Effects View" 110 #define DALI_DEMO_STR_TITLE_EFFECTS_VIEW "Effects View"
109 #define DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE "Native Image Source" 111 #define DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE "Native Image Source"
110 -#define DALI_DEMO_STR_TITLE_MESH_RENDERER "Mesh Renderer" 112 +#define DALI_DEMO_STR_TITLE_MESH_VISUAL "Mesh Visual"
111 #define DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES "Primitive Shapes" 113 #define DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES "Primitive Shapes"
112 114
113 #endif 115 #endif
shared/utility.h
@@ -112,7 +112,7 @@ Dali::Geometry CreateTexturedQuad() @@ -112,7 +112,7 @@ Dali::Geometry CreateTexturedQuad()
112 //Create the geometry 112 //Create the geometry
113 Dali::Geometry geometry = Dali::Geometry::New(); 113 Dali::Geometry geometry = Dali::Geometry::New();
114 geometry.AddVertexBuffer( vertexBuffer ); 114 geometry.AddVertexBuffer( vertexBuffer );
115 - geometry.SetGeometryType(Dali::Geometry::TRIANGLE_STRIP ); 115 + geometry.SetType(Dali::Geometry::TRIANGLE_STRIP );
116 116
117 return geometry; 117 return geometry;
118 } 118 }
shared/view.h
@@ -131,13 +131,13 @@ Dali::Layer CreateView( Dali::Application&amp; application, @@ -131,13 +131,13 @@ Dali::Layer CreateView( Dali::Application&amp; application,
131 if ( !backgroundImagePath.empty() ) 131 if ( !backgroundImagePath.empty() )
132 { 132 {
133 Dali::Property::Map map; 133 Dali::Property::Map map;
134 - map["rendererType"] = "IMAGE";  
135 - map["url"] = backgroundImagePath;  
136 - map["desiredWidth"] = stage.GetSize().x;  
137 - map["desiredHeight"] = stage.GetSize().y;  
138 - map["fittingMode"] = "SCALE_TO_FILL";  
139 - map["samplingMode"] = "BOX_THEN_LINEAR";  
140 - map["synchronousLoading"] = true; 134 + map[Dali::Toolkit::Visual::Property::TYPE] = Dali::Toolkit::Visual::IMAGE;
  135 + map[Dali::Toolkit::ImageVisual::Property::URL] = backgroundImagePath;
  136 + map[Dali::Toolkit::ImageVisual::Property::DESIRED_WIDTH] = stage.GetSize().x;
  137 + map[Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT] = stage.GetSize().y;
  138 + map[Dali::Toolkit::ImageVisual::Property::FITTING_MODE] = Dali::FittingMode::SCALE_TO_FILL;
  139 + map[Dali::Toolkit::ImageVisual::Property::SAMPLING_MODE] = Dali::SamplingMode::BOX_THEN_LINEAR;
  140 + map[Dali::Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING] = true;
141 view.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map ); 141 view.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
142 } 142 }
143 143