<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">
<label>Video View</label>
</ui-application>
- <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">
- <label>Mesh Renderer</label>
+ <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">
+ <label>Mesh Visual</label>
</ui-application>
<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">
<label>Primitive Shapes</label>
demo.AddExample(Example("tilt.example", DALI_DEMO_STR_TITLE_TILT_SENSOR));
demo.AddExample(Example("effects-view.example", DALI_DEMO_STR_TITLE_EFFECTS_VIEW));
demo.AddExample(Example("native-image-source.example", DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE));
- demo.AddExample(Example("mesh-renderer.example", DALI_DEMO_STR_TITLE_MESH_RENDERER));
+ demo.AddExample(Example("mesh-visual.example", DALI_DEMO_STR_TITLE_MESH_VISUAL));
demo.AddExample(Example("primitive-shapes.example", DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES));
demo.SortAlphabetically( true );
Size stageSize = Stage::GetCurrent().GetSize();
Toolkit::ImageView imageView = Toolkit::ImageView::New();
Property::Map map;
- map["rendererType"] = "IMAGE";
- map["url"] = imagePath;
- map["desiredWidth"] = stageSize.x;
- map["desiredHeight"] = stageSize.y;
- map["fittingMode"] = "SCALE_TO_FILL";
- map["samplingMode"] = "BOX_THEN_LINEAR";
- map["synchronousLoading"] = true;
+ map[Toolkit::Visual::Property::TYPE] = Toolkit::Visual::IMAGE;
+ map[Toolkit::ImageVisual::Property::URL] = imagePath;
+ map[Toolkit::ImageVisual::Property::DESIRED_WIDTH] = stageSize.x;
+ map[Toolkit::ImageVisual::Property::DESIRED_HEIGHT] = stageSize.y;
+ map[Toolkit::ImageVisual::Property::FITTING_MODE] = FittingMode::SCALE_TO_FILL;
+ map[Toolkit::ImageVisual::Property::SAMPLING_MODE] = SamplingMode::BOX_THEN_LINEAR;
+ map[Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING] = true;
imageView.SetProperty( Toolkit::ImageView::Property::IMAGE, map );
return imageView;
// ---- Gradient for background
- mGradientMap.Insert("rendererType", "GRADIENT");
+ mGradientMap.Insert( Visual::Property::TYPE, Visual::GRADIENT );
Property::Array stopOffsets;
stopOffsets.PushBack( 0.0f );
stopOffsets.PushBack( 0.6f );
stopOffsets.PushBack( 0.8f );
stopOffsets.PushBack( 1.0f );
- mGradientMap.Insert("stopOffset", stopOffsets );
+ mGradientMap.Insert( GradientVisual::Property::STOP_OFFSET, stopOffsets );
Property::Array stopColors;
stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 255.f )/255.f );
stopColors.PushBack( Vector4( 214.f, 37.f, 139.f, 191.f )/255.f );
stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 150.f )/255.f );
stopColors.PushBack( Color::YELLOW );
- mGradientMap.Insert("stopColor", stopColors);
+ mGradientMap.Insert( GradientVisual::Property::STOP_COLOR, stopColors );
OnChangeIconClicked( changeButton );
}
{
case 0: // linear gradient with units as objectBoundingBox
{
- gradientMap.Insert("startPosition", Vector2( 0.5f, 0.5f ));
- gradientMap.Insert("endPosition", Vector2( -0.5f, -0.5f ));
+ gradientMap.Insert( GradientVisual::Property::START_POSITION, Vector2( 0.5f, 0.5f ) );
+ gradientMap.Insert( GradientVisual::Property::END_POSITION, Vector2( -0.5f, -0.5f ) );
break;
}
case 1: // linear gradient with units as userSpaceOnUse
{
Vector2 halfStageSize = Stage::GetCurrent().GetSize()*0.5f;
- gradientMap.Insert("startPosition", halfStageSize);
- gradientMap.Insert("endPosition", -halfStageSize );
- gradientMap.Insert("units", "USER_SPACE");
+ gradientMap.Insert( GradientVisual::Property::START_POSITION, halfStageSize );
+ gradientMap.Insert( GradientVisual::Property::END_POSITION, -halfStageSize );
+ gradientMap.Insert( GradientVisual::Property::UNITS, GradientVisual::Units::USER_SPACE );
break;
}
case 2: // radial gradient with units as objectBoundingBox
{
- gradientMap.Insert("center", Vector2(0.5f, 0.5f));
- gradientMap.Insert("radius", 1.414f);
+ gradientMap.Insert( GradientVisual::Property::CENTER, Vector2( 0.5f, 0.5f ) );
+ gradientMap.Insert( GradientVisual::Property::RADIUS, 1.414f );
break;
}
default: // radial gradient with units as userSpaceOnUse
{
Vector2 stageSize = Stage::GetCurrent().GetSize();
- gradientMap.Insert("center", stageSize*0.5f);
- gradientMap.Insert("radius", stageSize.Length());
- gradientMap.Insert("units", "USER_SPACE");
+ gradientMap.Insert( GradientVisual::Property::CENTER, stageSize * 0.5f );
+ gradientMap.Insert( GradientVisual::Property::RADIUS, stageSize.Length());
+ gradientMap.Insert( GradientVisual::Property::UNITS, GradientVisual::Units::USER_SPACE );
break;
}
}
// Background image:
Dali::Property::Map backgroundImage;
- backgroundImage.Insert( "rendererType", "IMAGE" );
- backgroundImage.Insert( "url", BACKGROUND_IMAGE );
- backgroundImage.Insert( "desiredWidth", stage.GetSize().width );
- backgroundImage.Insert( "desiredHeight", stage.GetSize().height );
- backgroundImage.Insert( "fittingMode", "SCALE_TO_FILL" );
- backgroundImage.Insert( "samplingMode", "BOX_THEN_NEAREST" );
+ backgroundImage.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE );
+ backgroundImage.Insert( Toolkit::ImageVisual::Property::URL, BACKGROUND_IMAGE );
+ backgroundImage.Insert( Toolkit::ImageVisual::Property::DESIRED_WIDTH, stage.GetSize().width );
+ backgroundImage.Insert( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, stage.GetSize().height );
+ backgroundImage.Insert( Toolkit::ImageVisual::Property::FITTING_MODE, FittingMode::SCALE_TO_FILL );
+ backgroundImage.Insert( Toolkit::ImageVisual::Property::SAMPLING_MODE, SamplingMode::BOX_THEN_NEAREST );
Toolkit::ImageView background = Toolkit::ImageView::New();
background.SetProperty( Toolkit::ImageView::Property::IMAGE, backgroundImage );
borderActor.SetColorMode( USE_PARENT_COLOR );
Property::Map borderProperty;
- borderProperty.Insert( "rendererType", "BORDER" );
- borderProperty.Insert( "borderColor", Color::WHITE );
- borderProperty.Insert( "borderSize", ITEM_BORDER_SIZE );
- borderProperty.Insert( "antiAliasing", true );
+ borderProperty.Insert( Visual::Property::TYPE, Visual::BORDER );
+ borderProperty.Insert( BorderVisual::Property::COLOR, Color::WHITE );
+ borderProperty.Insert( BorderVisual::Property::SIZE, ITEM_BORDER_SIZE );
+ borderProperty.Insert( BorderVisual::Property::ANTI_ALIASING, true );
borderActor.SetProperty( ImageView::Property::IMAGE, borderProperty );
actor.Add(borderActor);
checkbox.SetZ( 0.1f );
Property::Map solidColorProperty;
- solidColorProperty.Insert( "rendererType", "COLOR" );
- solidColorProperty.Insert( "mixColor", Vector4(0.f, 0.f, 0.f, 0.6f) );
+ solidColorProperty.Insert( Visual::Property::TYPE, Visual::COLOR );
+ solidColorProperty.Insert( ColorVisual::Property::MIX_COLOR, Vector4(0.f, 0.f, 0.f, 0.6f) );
checkbox.SetProperty( ImageView::Property::IMAGE, solidColorProperty );
if( MODE_REMOVE_MANY != mMode &&
+++ /dev/null
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali/public-api/object/property-map.h>
-
-using namespace Dali;
-using namespace Dali::Toolkit;
-
-namespace
-{
- //Keeps information about each model for access.
- struct Model
- {
- Control control; // Control housing the mesh renderer of the model.
- Vector2 rotation; // Keeps track of rotation about x and y axis for manual rotation.
- Animation rotationAnimation; // Automatically rotates when left alone.
- };
-
- //Files for meshes
- const char * const MODEL_FILE[] =
- {
- DEMO_MODEL_DIR "Dino.obj",
- DEMO_MODEL_DIR "ToyRobot-Metal.obj",
- DEMO_MODEL_DIR "Toyrobot-Plastic.obj"
- };
-
- const char * const MATERIAL_FILE[] =
- {
- DEMO_MODEL_DIR "Dino.mtl",
- DEMO_MODEL_DIR "ToyRobot-Metal.mtl",
- DEMO_MODEL_DIR "Toyrobot-Plastic.mtl"
- };
-
- const char * const TEXTURES_PATH( DEMO_IMAGE_DIR "" );
-
- //Possible shader options.
- const char * const SHADER_TYPE[] =
- {
- "ALL_TEXTURES",
- "DIFFUSE_TEXTURE",
- "TEXTURELESS"
- };
-
- //Files for background and toolbar
- const char * const BACKGROUND_IMAGE( DEMO_IMAGE_DIR "background-1.jpg");
-
- const float X_ROTATION_DISPLACEMENT_FACTOR = 60.0f;
- const float Y_ROTATION_DISPLACEMENT_FACTOR = 60.0f;
- const float MODEL_SCALE = 0.75f;
- const int NUM_MESHES = 3;
-
- //Used to identify actors.
- const int MODEL_TAG = 0;
- const int LIGHT_TAG = 1;
- const int LAYER_TAG = 2;
-
-} //End namespace
-
-class MeshRendererController : public ConnectionTracker
-{
-public:
-
- MeshRendererController( Application& application )
- : mApplication( application ), //Store handle to the application.
- mModelIndex( 1 ), //Start with metal robot.
- mShaderIndex( 0 ), //Start with all textures.
- mTag( -1 ), //Non-valid default, which will get set to a correct value when used.
- mSelectedModelIndex( -1 ), //Non-valid default, which will get set to a correct value when used.
- mPaused( false ) //Animations play by default.
- {
- // Connect to the Application's Init signal
- mApplication.InitSignal().Connect( this, &MeshRendererController::Create );
- }
-
- ~MeshRendererController()
- {
- }
-
- // The Init signal is received once (only) during the Application lifetime
- void Create( Application& application )
- {
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
-
- //Add background
- ImageView backView = ImageView::New( BACKGROUND_IMAGE );
- backView.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- stage.Add( backView );
-
- //Setup and load the 3D models and buttons
- LoadScene();
-
- //Allow for exiting of the application via key presses.
- stage.KeyEventSignal().Connect( this, &MeshRendererController::OnKeyEvent );
- }
-
- //Sets up the on-screen elements.
- void LoadScene()
- {
- Stage stage = Stage::GetCurrent();
-
- //Set up layer to place objects on.
- Layer baseLayer = Layer::New();
- baseLayer.SetParentOrigin( ParentOrigin::CENTER );
- baseLayer.SetAnchorPoint( AnchorPoint::CENTER );
- baseLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
- baseLayer.SetBehavior( Layer::LAYER_2D ); //We use a 2D layer as this is closer to UI work than full 3D scene creation.
- baseLayer.SetDepthTestDisabled( false ); //Enable depth testing, as otherwise the 2D layer would not do so.
- baseLayer.RegisterProperty( "Tag", LAYER_TAG ); //Used to differentiate between different kinds of actor.
- baseLayer.TouchedSignal().Connect( this, &MeshRendererController::OnTouch );
- stage.Add( baseLayer );
-
- //Add containers to house each renderer-holding-actor.
- for( int i = 0; i < NUM_MESHES; i++ )
- {
- mContainers[i] = Actor::New();
- mContainers[i].SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
- mContainers[i].RegisterProperty( "Tag", MODEL_TAG ); //Used to differentiate between different kinds of actor.
- mContainers[i].RegisterProperty( "Model", Property::Value( i ) ); //Used to index into the model.
-
- //Position each container on screen
- if( i == 0 )
- {
- //Main, central model
- mContainers[i].SetSizeModeFactor( Vector3( MODEL_SCALE, MODEL_SCALE, 0.0f ) );
- mContainers[i].SetParentOrigin( ParentOrigin::CENTER );
- mContainers[i].SetAnchorPoint( AnchorPoint::CENTER );
- }
- else if( i == 1 )
- {
- //Top left model
- mContainers[i].SetSizeModeFactor( Vector3( MODEL_SCALE / 3.0f, MODEL_SCALE / 3.0f, 0.0f ) );
- mContainers[i].SetParentOrigin( Vector3( 0.05, 0.03, 0.5 ) ); //Offset from top left
- mContainers[i].SetAnchorPoint( AnchorPoint::TOP_LEFT );
- }
- else if( i == 2 )
- {
- //Top right model
- mContainers[i].SetSizeModeFactor( Vector3( MODEL_SCALE / 3.0f, MODEL_SCALE / 3.0f, 0.0f ) );
- mContainers[i].SetParentOrigin( Vector3( 0.95, 0.03, 0.5 ) ); //Offset from top right
- mContainers[i].SetAnchorPoint( AnchorPoint::TOP_RIGHT );
- }
-
- mContainers[i].TouchedSignal().Connect( this, &MeshRendererController::OnTouch );
- baseLayer.Add( mContainers[i] );
- }
-
- //Set up models
- for( int i = 0; i < NUM_MESHES; i++ )
- {
- //Create control to display model
- Control control = Control::New();
- control.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
- control.SetParentOrigin( ParentOrigin::CENTER );
- control.SetAnchorPoint( AnchorPoint::CENTER );
- mContainers[i].Add( control );
-
- //Make model spin to demonstrate 3D
- Animation rotationAnimation = Animation::New( 15.0f );
- float spin = i % 2 == 0 ? 1.0f : -1.0f; //Make actors spin in different directions to better show independence.
- rotationAnimation.AnimateBy( Property( control, Actor::Property::ORIENTATION ),
- Quaternion( Degree( 0.0f ), Degree( spin * 360.0f ), Degree( 0.0f ) ) );
- rotationAnimation.SetLooping( true );
- rotationAnimation.Play();
-
- //Store model information in corresponding structs.
- mModels[i].control = control;
- mModels[i].rotation.x = 0.0f;
- mModels[i].rotation.y = 0.0f;
- mModels[i].rotationAnimation = rotationAnimation;
- }
-
- //Calling this sets the model in the controls.
- ReloadModel();
-
- //Create button for model changing
- Toolkit::PushButton modelButton = Toolkit::PushButton::New();
- modelButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
- modelButton.ClickedSignal().Connect( this, &MeshRendererController::OnChangeModelClicked );
- modelButton.SetParentOrigin( Vector3( 0.05, 0.95, 0.5 ) ); //Offset from bottom left
- modelButton.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT );
- modelButton.SetLabelText( "Change Model" );
- baseLayer.Add( modelButton );
-
- //Create button for shader changing
- Toolkit::PushButton shaderButton = Toolkit::PushButton::New();
- shaderButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
- shaderButton.ClickedSignal().Connect( this, &MeshRendererController::OnChangeShaderClicked );
- shaderButton.SetParentOrigin( Vector3( 0.95, 0.95, 0.5 ) ); //Offset from bottom right
- shaderButton.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT );
- shaderButton.SetLabelText( "Change Shader" );
- baseLayer.Add( shaderButton );
-
- //Create button for pausing animations
- Toolkit::PushButton pauseButton = Toolkit::PushButton::New();
- pauseButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
- pauseButton.ClickedSignal().Connect( this, &MeshRendererController::OnPauseClicked );
- pauseButton.SetParentOrigin( Vector3( 0.5, 0.95, 0.5 ) ); //Offset from bottom center
- pauseButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
- pauseButton.SetLabelText( " || " );
- baseLayer.Add( pauseButton );
-
- //Create control to act as light source of scene.
- mLightSource = Control::New();
- mLightSource.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::WIDTH );
- mLightSource.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
- mLightSource.RegisterProperty( "Tag", LIGHT_TAG );
-
- //Set position relative to top left, as the light source property is also relative to the top left.
- mLightSource.SetParentOrigin( ParentOrigin::TOP_LEFT );
- mLightSource.SetAnchorPoint( AnchorPoint::CENTER );
- mLightSource.SetPosition( Stage::GetCurrent().GetSize().x * 0.5f, Stage::GetCurrent().GetSize().y * 0.1f );
-
- //Make white background.
- Property::Map lightMap;
- lightMap.Insert( "rendererType", "COLOR" );
- lightMap.Insert( "mixColor", Color::WHITE );
- mLightSource.SetProperty( Control::Property::BACKGROUND, Property::Value( lightMap ) );
-
- //Label to show what this actor is for the user.
- TextLabel lightLabel = TextLabel::New( "Light" );
- lightLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
- lightLabel.SetParentOrigin( ParentOrigin::CENTER );
- lightLabel.SetAnchorPoint( AnchorPoint::CENTER );
- float padding = 5.0f;
- lightLabel.SetPadding( Padding( padding, padding, padding, padding ) );
- mLightSource.Add( lightLabel );
-
- //Connect to touch signal for dragging.
- mLightSource.TouchedSignal().Connect( this, &MeshRendererController::OnTouch );
-
- //Place the light source on a layer above the base, so that it is rendered above everything else.
- Layer upperLayer = Layer::New();
- baseLayer.Add( upperLayer );
- upperLayer.Add( mLightSource );
-
- //Calling this sets the light position of each model to that of the light source control.
- UpdateLight();
- }
-
- //Updates the displayed models to account for parameter changes.
- void ReloadModel()
- {
- //Create mesh property map
- Property::Map map;
- map.Insert( "rendererType", "MESH" );
- map.Insert( "objectUrl", MODEL_FILE[mModelIndex] );
- map.Insert( "materialUrl", MATERIAL_FILE[mModelIndex] );
- map.Insert( "texturesPath", TEXTURES_PATH );
- map.Insert( "shaderType", SHADER_TYPE[mShaderIndex] );
- map.Insert( "useSoftNormals", false );
-
- //Set the two controls to use the mesh
- for( int i = 0; i < NUM_MESHES; i++ )
- {
- mModels[i].control.SetProperty( Control::Property::BACKGROUND, Property::Value( map ) );
- }
- }
-
- //Updates the light position for each model to account for changes in the source on screen.
- void UpdateLight()
- {
- //Set light position to the x and y of the light control, offset out of the screen.
- Vector3 controlPosition = mLightSource.GetCurrentPosition();
- Vector3 lightPosition = Vector3( controlPosition.x, controlPosition.y, Stage::GetCurrent().GetSize().x * 2.0f );
-
- for( int i = 0; i < NUM_MESHES; ++i )
- {
- mModels[i].control.RegisterProperty( "lightPosition", lightPosition, Property::ANIMATABLE );
- }
- }
-
- //If the light source is touched, move it by dragging it.
- //If a model is touched, rotate it by panning around.
- bool OnTouch( Actor actor, const TouchEvent& event )
- {
- //Get primary touch point.
- const Dali::TouchPoint& point = event.GetPoint( 0 );
-
- switch( point.state )
- {
- case TouchPoint::Down:
- {
- //Determine what was touched.
- actor.GetProperty( actor.GetPropertyIndex( "Tag" ) ).Get( mTag );
-
- if( mTag == MODEL_TAG )
- {
- //Find out which model has been selected
- actor.GetProperty( actor.GetPropertyIndex( "Model" ) ).Get( mSelectedModelIndex );
-
- //Pause current animation, as the touch gesture will be used to manually rotate the model
- mModels[mSelectedModelIndex].rotationAnimation.Pause();
-
- //Store start points.
- mPanStart = point.screen;
- mRotationStart = mModels[mSelectedModelIndex].rotation;
- }
-
- break;
- }
- case TouchPoint::Motion:
- {
- //Switch on the kind of actor we're interacting with.
- switch( mTag )
- {
- case MODEL_TAG: //Rotate model
- {
- //Calculate displacement and corresponding rotation.
- Vector2 displacement = point.screen - mPanStart;
- mModels[mSelectedModelIndex].rotation = Vector2( mRotationStart.x - displacement.y / Y_ROTATION_DISPLACEMENT_FACTOR, // Y displacement rotates around X axis
- mRotationStart.y + displacement.x / X_ROTATION_DISPLACEMENT_FACTOR ); // X displacement rotates around Y axis
- Quaternion rotation = Quaternion( Radian( mModels[mSelectedModelIndex].rotation.x ), Vector3::XAXIS) *
- Quaternion( Radian( mModels[mSelectedModelIndex].rotation.y ), Vector3::YAXIS);
-
- //Apply rotation.
- mModels[mSelectedModelIndex].control.SetOrientation( rotation );
-
- break;
- }
- case LIGHT_TAG: //Drag light
- {
- //Set light source to new position and update the models accordingly.
- mLightSource.SetPosition( Vector3( point.screen ) );
- UpdateLight();
-
- break;
- }
- }
-
- break;
- }
- case TouchPoint::Interrupted: //Same as finished.
- case TouchPoint::Finished:
- {
- if( mTag == MODEL_TAG )
- {
- //Return to automatic animation
- if( !mPaused )
- {
- mModels[mSelectedModelIndex].rotationAnimation.Play();
- }
- }
-
- break;
- }
- default:
- {
- //Other touch states do nothing.
- break;
- }
- }
-
- return true;
- }
-
- //Cycle through the list of models.
- bool OnChangeModelClicked( Toolkit::Button button )
- {
- ++mModelIndex %= 3;
-
- ReloadModel();
-
- return true;
- }
-
- //Cycle through the list of shaders.
- bool OnChangeShaderClicked( Toolkit::Button button )
- {
- ++mShaderIndex %= 3;
-
- ReloadModel();
-
- return true;
- }
-
- //Pause all animations, and keep them paused even after user panning.
- //This button is a toggle, so pressing again will start the animations again.
- bool OnPauseClicked( Toolkit::Button button )
- {
- //Toggle pause state.
- mPaused = !mPaused;
-
- //If we wish to pause animations, do so and keep them paused.
- if( mPaused )
- {
- for( int i = 0; i < NUM_MESHES ; ++i )
- {
- mModels[i].rotationAnimation.Pause();
- }
-
- button.SetLabelText( " > " );
- }
- else //Unpause all animations again.
- {
- for( int i = 0; i < NUM_MESHES ; ++i )
- {
- mModels[i].rotationAnimation.Play();
- }
-
- button.SetLabelText( " || " );
- }
-
- return true;
- }
-
- //If escape or the back button is pressed, quit the application (and return to the launcher)
- void OnKeyEvent( const KeyEvent& event )
- {
- if( event.state == KeyEvent::Down )
- {
- if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) )
- {
- mApplication.Quit();
- }
- }
- }
-
-private:
- Application& mApplication;
-
- //The models displayed on screen, including information about rotation.
- Model mModels[NUM_MESHES];
- Actor mContainers[NUM_MESHES];
-
- //Acts as a global light source, which can be dragged around.
- Control mLightSource;
-
- //Used to detect panning to rotate the selected model.
- Vector2 mPanStart;
- Vector2 mRotationStart;
-
- int mModelIndex; //Index of model to load.
- int mShaderIndex; //Index of shader type to use.
- int mTag; //Identifies what kind of actor has been selected in OnTouch.
- int mSelectedModelIndex; //Index of model selected on screen.
- bool mPaused; //If true, all animations are paused and should stay so.
-};
-
-void RunTest( Application& application )
-{
- MeshRendererController test( application );
-
- application.MainLoop();
-}
-
-// Entry point for Linux & Tizen applications
-//
-int main( int argc, char **argv )
-{
- Application application = Application::New( &argc, &argv );
-
- RunTest( application );
-
- return 0;
-}
--- /dev/null
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/public-api/object/property-map.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+namespace
+{
+ //Keeps information about each model for access.
+ struct Model
+ {
+ Control control; // Control housing the mesh visual of the model.
+ Vector2 rotation; // Keeps track of rotation about x and y axis for manual rotation.
+ Animation rotationAnimation; // Automatically rotates when left alone.
+ };
+
+ //Files for meshes
+ const char * const MODEL_FILE[] =
+ {
+ DEMO_MODEL_DIR "Dino.obj",
+ DEMO_MODEL_DIR "ToyRobot-Metal.obj",
+ DEMO_MODEL_DIR "Toyrobot-Plastic.obj"
+ };
+
+ const char * const MATERIAL_FILE[] =
+ {
+ DEMO_MODEL_DIR "Dino.mtl",
+ DEMO_MODEL_DIR "ToyRobot-Metal.mtl",
+ DEMO_MODEL_DIR "Toyrobot-Plastic.mtl"
+ };
+
+ const char * const TEXTURES_PATH( DEMO_IMAGE_DIR "" );
+
+ //Possible shading modes.
+ MeshVisual::ShadingMode::Value SHADING_MODE_TABLE[] =
+ {
+ MeshVisual::ShadingMode::TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING,
+ MeshVisual::ShadingMode::TEXTURED_WITH_SPECULAR_LIGHTING,
+ MeshVisual::ShadingMode::TEXTURELESS_WITH_DIFFUSE_LIGHTING
+ };
+
+ //Files for background and toolbar
+ const char * const BACKGROUND_IMAGE( DEMO_IMAGE_DIR "background-1.jpg");
+
+ const float X_ROTATION_DISPLACEMENT_FACTOR = 60.0f;
+ const float Y_ROTATION_DISPLACEMENT_FACTOR = 60.0f;
+ const float MODEL_SCALE = 0.75f;
+ const int NUM_MESHES = 3;
+
+ //Used to identify actors.
+ const int MODEL_TAG = 0;
+ const int LIGHT_TAG = 1;
+ const int LAYER_TAG = 2;
+
+} //End namespace
+
+class MeshVisualController : public ConnectionTracker
+{
+public:
+
+ MeshVisualController( Application& application )
+ : mApplication( application ), //Store handle to the application.
+ mModelIndex( 1 ), //Start with metal robot.
+ mShadingModeIndex( 0 ), //Start with textured with detailed specular lighting.
+ mTag( -1 ), //Non-valid default, which will get set to a correct value when used.
+ mSelectedModelIndex( -1 ), //Non-valid default, which will get set to a correct value when used.
+ mPaused( false ) //Animations play by default.
+ {
+ // Connect to the Application's Init signal
+ mApplication.InitSignal().Connect( this, &MeshVisualController::Create );
+ }
+
+ ~MeshVisualController()
+ {
+ }
+
+ // The Init signal is received once (only) during the Application lifetime
+ void Create( Application& application )
+ {
+ // Get a handle to the stage
+ Stage stage = Stage::GetCurrent();
+
+ //Add background
+ ImageView backView = ImageView::New( BACKGROUND_IMAGE );
+ backView.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ stage.Add( backView );
+
+ //Setup and load the 3D models and buttons
+ LoadScene();
+
+ //Allow for exiting of the application via key presses.
+ stage.KeyEventSignal().Connect( this, &MeshVisualController::OnKeyEvent );
+ }
+
+ //Sets up the on-screen elements.
+ void LoadScene()
+ {
+ Stage stage = Stage::GetCurrent();
+
+ //Set up layer to place objects on.
+ Layer baseLayer = Layer::New();
+ baseLayer.SetParentOrigin( ParentOrigin::CENTER );
+ baseLayer.SetAnchorPoint( AnchorPoint::CENTER );
+ baseLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+ baseLayer.SetBehavior( Layer::LAYER_2D ); //We use a 2D layer as this is closer to UI work than full 3D scene creation.
+ baseLayer.SetDepthTestDisabled( false ); //Enable depth testing, as otherwise the 2D layer would not do so.
+ baseLayer.RegisterProperty( "Tag", LAYER_TAG ); //Used to differentiate between different kinds of actor.
+ baseLayer.TouchedSignal().Connect( this, &MeshVisualController::OnTouch );
+ stage.Add( baseLayer );
+
+ //Add containers to house each visual-holding-actor.
+ for( int i = 0; i < NUM_MESHES; i++ )
+ {
+ mContainers[i] = Actor::New();
+ mContainers[i].SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
+ mContainers[i].RegisterProperty( "Tag", MODEL_TAG ); //Used to differentiate between different kinds of actor.
+ mContainers[i].RegisterProperty( "Model", Property::Value( i ) ); //Used to index into the model.
+
+ //Position each container on screen
+ if( i == 0 )
+ {
+ //Main, central model
+ mContainers[i].SetSizeModeFactor( Vector3( MODEL_SCALE, MODEL_SCALE, 0.0f ) );
+ mContainers[i].SetParentOrigin( ParentOrigin::CENTER );
+ mContainers[i].SetAnchorPoint( AnchorPoint::CENTER );
+ }
+ else if( i == 1 )
+ {
+ //Top left model
+ mContainers[i].SetSizeModeFactor( Vector3( MODEL_SCALE / 3.0f, MODEL_SCALE / 3.0f, 0.0f ) );
+ mContainers[i].SetParentOrigin( Vector3( 0.05, 0.03, 0.5 ) ); //Offset from top left
+ mContainers[i].SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ }
+ else if( i == 2 )
+ {
+ //Top right model
+ mContainers[i].SetSizeModeFactor( Vector3( MODEL_SCALE / 3.0f, MODEL_SCALE / 3.0f, 0.0f ) );
+ mContainers[i].SetParentOrigin( Vector3( 0.95, 0.03, 0.5 ) ); //Offset from top right
+ mContainers[i].SetAnchorPoint( AnchorPoint::TOP_RIGHT );
+ }
+
+ mContainers[i].TouchedSignal().Connect( this, &MeshVisualController::OnTouch );
+ baseLayer.Add( mContainers[i] );
+ }
+
+ //Set up models
+ for( int i = 0; i < NUM_MESHES; i++ )
+ {
+ //Create control to display model
+ Control control = Control::New();
+ control.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+ control.SetParentOrigin( ParentOrigin::CENTER );
+ control.SetAnchorPoint( AnchorPoint::CENTER );
+ mContainers[i].Add( control );
+
+ //Make model spin to demonstrate 3D
+ Animation rotationAnimation = Animation::New( 15.0f );
+ float spin = i % 2 == 0 ? 1.0f : -1.0f; //Make actors spin in different directions to better show independence.
+ rotationAnimation.AnimateBy( Property( control, Actor::Property::ORIENTATION ),
+ Quaternion( Degree( 0.0f ), Degree( spin * 360.0f ), Degree( 0.0f ) ) );
+ rotationAnimation.SetLooping( true );
+ rotationAnimation.Play();
+
+ //Store model information in corresponding structs.
+ mModels[i].control = control;
+ mModels[i].rotation.x = 0.0f;
+ mModels[i].rotation.y = 0.0f;
+ mModels[i].rotationAnimation = rotationAnimation;
+ }
+
+ //Calling this sets the model in the controls.
+ ReloadModel();
+
+ //Create button for model changing
+ Toolkit::PushButton modelButton = Toolkit::PushButton::New();
+ modelButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+ modelButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeModelClicked );
+ modelButton.SetParentOrigin( Vector3( 0.05, 0.95, 0.5 ) ); //Offset from bottom left
+ modelButton.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT );
+ modelButton.SetLabelText( "Change Model" );
+ baseLayer.Add( modelButton );
+
+ //Create button for shader changing
+ Toolkit::PushButton shaderButton = Toolkit::PushButton::New();
+ shaderButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+ shaderButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeShaderClicked );
+ shaderButton.SetParentOrigin( Vector3( 0.95, 0.95, 0.5 ) ); //Offset from bottom right
+ shaderButton.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT );
+ shaderButton.SetLabelText( "Change Shader" );
+ baseLayer.Add( shaderButton );
+
+ //Create button for pausing animations
+ Toolkit::PushButton pauseButton = Toolkit::PushButton::New();
+ pauseButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+ pauseButton.ClickedSignal().Connect( this, &MeshVisualController::OnPauseClicked );
+ pauseButton.SetParentOrigin( Vector3( 0.5, 0.95, 0.5 ) ); //Offset from bottom center
+ pauseButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
+ pauseButton.SetLabelText( " || " );
+ baseLayer.Add( pauseButton );
+
+ //Create control to act as light source of scene.
+ mLightSource = Control::New();
+ mLightSource.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::WIDTH );
+ mLightSource.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
+ mLightSource.RegisterProperty( "Tag", LIGHT_TAG );
+
+ //Set position relative to top left, as the light source property is also relative to the top left.
+ mLightSource.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ mLightSource.SetAnchorPoint( AnchorPoint::CENTER );
+ mLightSource.SetPosition( Stage::GetCurrent().GetSize().x * 0.5f, Stage::GetCurrent().GetSize().y * 0.1f );
+
+ //Make white background.
+ Property::Map lightMap;
+ lightMap.Insert( Visual::Property::TYPE, Visual::COLOR );
+ lightMap.Insert( ColorVisual::Property::MIX_COLOR, Color::WHITE );
+ mLightSource.SetProperty( Control::Property::BACKGROUND, Property::Value( lightMap ) );
+
+ //Label to show what this actor is for the user.
+ TextLabel lightLabel = TextLabel::New( "Light" );
+ lightLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+ lightLabel.SetParentOrigin( ParentOrigin::CENTER );
+ lightLabel.SetAnchorPoint( AnchorPoint::CENTER );
+ float padding = 5.0f;
+ lightLabel.SetPadding( Padding( padding, padding, padding, padding ) );
+ mLightSource.Add( lightLabel );
+
+ //Connect to touch signal for dragging.
+ mLightSource.TouchedSignal().Connect( this, &MeshVisualController::OnTouch );
+
+ //Place the light source on a layer above the base, so that it is rendered above everything else.
+ Layer upperLayer = Layer::New();
+ baseLayer.Add( upperLayer );
+ upperLayer.Add( mLightSource );
+
+ //Calling this sets the light position of each model to that of the light source control.
+ UpdateLight();
+ }
+
+ //Updates the displayed models to account for parameter changes.
+ void ReloadModel()
+ {
+ //Create mesh property map
+ Property::Map map;
+ map.Insert( Visual::Property::TYPE, Visual::MESH );
+ map.Insert( MeshVisual::Property::OBJECT_URL, MODEL_FILE[mModelIndex] );
+ map.Insert( MeshVisual::Property::MATERIAL_URL, MATERIAL_FILE[mModelIndex] );
+ map.Insert( MeshVisual::Property::TEXTURES_PATH, TEXTURES_PATH );
+ map.Insert( MeshVisual::Property::SHADING_MODE, SHADING_MODE_TABLE[mShadingModeIndex] );
+ map.Insert( MeshVisual::Property::USE_SOFT_NORMALS, false );
+
+ //Set the two controls to use the mesh
+ for( int i = 0; i < NUM_MESHES; i++ )
+ {
+ mModels[i].control.SetProperty( Control::Property::BACKGROUND, Property::Value( map ) );
+ }
+ }
+
+ //Updates the light position for each model to account for changes in the source on screen.
+ void UpdateLight()
+ {
+ //Set light position to the x and y of the light control, offset out of the screen.
+ Vector3 controlPosition = mLightSource.GetCurrentPosition();
+ Vector3 lightPosition = Vector3( controlPosition.x, controlPosition.y, Stage::GetCurrent().GetSize().x * 2.0f );
+
+ for( int i = 0; i < NUM_MESHES; ++i )
+ {
+ mModels[i].control.RegisterProperty( "lightPosition", lightPosition, Property::ANIMATABLE );
+ }
+ }
+
+ //If the light source is touched, move it by dragging it.
+ //If a model is touched, rotate it by panning around.
+ bool OnTouch( Actor actor, const TouchEvent& event )
+ {
+ //Get primary touch point.
+ const Dali::TouchPoint& point = event.GetPoint( 0 );
+
+ switch( point.state )
+ {
+ case TouchPoint::Down:
+ {
+ //Determine what was touched.
+ actor.GetProperty( actor.GetPropertyIndex( "Tag" ) ).Get( mTag );
+
+ if( mTag == MODEL_TAG )
+ {
+ //Find out which model has been selected
+ actor.GetProperty( actor.GetPropertyIndex( "Model" ) ).Get( mSelectedModelIndex );
+
+ //Pause current animation, as the touch gesture will be used to manually rotate the model
+ mModels[mSelectedModelIndex].rotationAnimation.Pause();
+
+ //Store start points.
+ mPanStart = point.screen;
+ mRotationStart = mModels[mSelectedModelIndex].rotation;
+ }
+
+ break;
+ }
+ case TouchPoint::Motion:
+ {
+ //Switch on the kind of actor we're interacting with.
+ switch( mTag )
+ {
+ case MODEL_TAG: //Rotate model
+ {
+ //Calculate displacement and corresponding rotation.
+ Vector2 displacement = point.screen - mPanStart;
+ mModels[mSelectedModelIndex].rotation = Vector2( mRotationStart.x - displacement.y / Y_ROTATION_DISPLACEMENT_FACTOR, // Y displacement rotates around X axis
+ mRotationStart.y + displacement.x / X_ROTATION_DISPLACEMENT_FACTOR ); // X displacement rotates around Y axis
+ Quaternion rotation = Quaternion( Radian( mModels[mSelectedModelIndex].rotation.x ), Vector3::XAXIS) *
+ Quaternion( Radian( mModels[mSelectedModelIndex].rotation.y ), Vector3::YAXIS);
+
+ //Apply rotation.
+ mModels[mSelectedModelIndex].control.SetOrientation( rotation );
+
+ break;
+ }
+ case LIGHT_TAG: //Drag light
+ {
+ //Set light source to new position and update the models accordingly.
+ mLightSource.SetPosition( Vector3( point.screen ) );
+ UpdateLight();
+
+ break;
+ }
+ }
+
+ break;
+ }
+ case TouchPoint::Interrupted: //Same as finished.
+ case TouchPoint::Finished:
+ {
+ if( mTag == MODEL_TAG )
+ {
+ //Return to automatic animation
+ if( !mPaused )
+ {
+ mModels[mSelectedModelIndex].rotationAnimation.Play();
+ }
+ }
+
+ break;
+ }
+ default:
+ {
+ //Other touch states do nothing.
+ break;
+ }
+ }
+
+ return true;
+ }
+
+ //Cycle through the list of models.
+ bool OnChangeModelClicked( Toolkit::Button button )
+ {
+ ++mModelIndex %= 3;
+
+ ReloadModel();
+
+ return true;
+ }
+
+ //Cycle through the list of shaders.
+ bool OnChangeShaderClicked( Toolkit::Button button )
+ {
+ ++mShadingModeIndex %= 3;
+
+ ReloadModel();
+
+ return true;
+ }
+
+ //Pause all animations, and keep them paused even after user panning.
+ //This button is a toggle, so pressing again will start the animations again.
+ bool OnPauseClicked( Toolkit::Button button )
+ {
+ //Toggle pause state.
+ mPaused = !mPaused;
+
+ //If we wish to pause animations, do so and keep them paused.
+ if( mPaused )
+ {
+ for( int i = 0; i < NUM_MESHES ; ++i )
+ {
+ mModels[i].rotationAnimation.Pause();
+ }
+
+ button.SetLabelText( " > " );
+ }
+ else //Unpause all animations again.
+ {
+ for( int i = 0; i < NUM_MESHES ; ++i )
+ {
+ mModels[i].rotationAnimation.Play();
+ }
+
+ button.SetLabelText( " || " );
+ }
+
+ return true;
+ }
+
+ //If escape or the back button is pressed, quit the application (and return to the launcher)
+ void OnKeyEvent( const KeyEvent& event )
+ {
+ if( event.state == KeyEvent::Down )
+ {
+ if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) )
+ {
+ mApplication.Quit();
+ }
+ }
+ }
+
+private:
+ Application& mApplication;
+
+ //The models displayed on screen, including information about rotation.
+ Model mModels[NUM_MESHES];
+ Actor mContainers[NUM_MESHES];
+
+ //Acts as a global light source, which can be dragged around.
+ Control mLightSource;
+
+ //Used to detect panning to rotate the selected model.
+ Vector2 mPanStart;
+ Vector2 mRotationStart;
+
+ int mModelIndex; //Index of model to load.
+ int mShadingModeIndex; //Index of shader type to use.
+ int mTag; //Identifies what kind of actor has been selected in OnTouch.
+ int mSelectedModelIndex; //Index of model selected on screen.
+ bool mPaused; //If true, all animations are paused and should stay so.
+};
+
+// Entry point for Linux & Tizen applications
+//
+int main( int argc, char **argv )
+{
+ Application application = Application::New( &argc, &argv );
+ MeshVisualController test( application );
+ application.MainLoop();
+ return 0;
+}
void SetImageFittedInBox( ImageView& imageView, Property::Map& shaderEffect, const char * const imagePath, int maxWidth, int maxHeight )
{
Property::Map map;
- map["rendererType"] = "IMAGE";
- map["url"] = imagePath;
+ map[Visual::Property::TYPE] = Visual::IMAGE;
+ map[ImageVisual::Property::URL] = imagePath;
// Load the image nicely scaled-down to fit within the specified max width and height:
- map["desiredWidth"] = maxWidth;
- map["desiredHeight"] = maxHeight;
- map["fittingMode"] = "SHRINK_TO_FIT";
- map["samplingMode"] = "BOX_THEN_LINEAR";
+ map[ImageVisual::Property::DESIRED_WIDTH] = maxWidth;
+ map[ImageVisual::Property::DESIRED_HEIGHT] = maxHeight;
+ map[ImageVisual::Property::FITTING_MODE] = FittingMode::SHRINK_TO_FIT;
+ map[ImageVisual::Property::SAMPLING_MODE] = SamplingMode::BOX_THEN_LINEAR;
map.Merge( shaderEffect );
imageView.SetProperty( ImageView::Property::IMAGE, map );
DEMO_IMAGE_DIR "octahedron-button.png"
};
- //Shape names
- const char * const SHAPE_SPHERE = "SPHERE";
- const char * const SHAPE_CONE = "CONE";
- const char * const SHAPE_CONICAL_FRUSTRUM = "CONICAL_FRUSTRUM";
- const char * const SHAPE_CYLINDER = "CYLINDER";
- const char * const SHAPE_CUBE = "CUBE";
- const char * const SHAPE_BEVELLED_CUBE = "BEVELLED_CUBE";
- const char * const SHAPE_OCTAHEDRON = "OCTAHEDRON";
-
//Shape property defaults
const int DEFAULT_SLICES = 32;
const int DEFAULT_STACKS = 32;
//
void SetupModel( Layer layer )
{
- //Create a container to house the renderer-holding actor, to provide a constant hitbox.
+ //Create a container to house the visual-holding actor, to provide a constant hitbox.
Actor container = Actor::New();
container.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
container.SetSizeModeFactor( Vector3( 0.9, 0.3, 0.0 ) ); //90% of width, 30% of height.
mPanGestureDetector.DetectedSignal().Connect( this, &PrimitiveShapesController::OnPan );
}
- //Clears all sliders and resets the primitive renderer property map.
+ //Clears all sliders and resets the primitive visual property map.
void InitialiseSlidersAndModel()
{
//Sliders
mSliderLabels.at( i ).SetVisible( false );
}
- //Renderer map for model
- mRendererMap.Clear();
- mRendererMap[ "rendererType" ] = "PRIMITIVE";
- mRendererMap[ "shapeColor" ] = mColor;
+ //Visual map for model
+ mVisualMap.Clear();
+ mVisualMap[ Visual::Property::TYPE ] = Visual::PRIMITIVE;
+ mVisualMap[ PrimitiveVisual::Property::COLOR ] = mColor;
}
//Sets the 3D model to a sphere and modifies the sliders appropriately.
{
InitialiseSlidersAndModel();
- //Set up specific renderer properties.
- mRendererMap[ "shape" ] = SHAPE_SPHERE;
- mRendererMap[ "slices" ] = DEFAULT_SLICES;
- mRendererMap[ "stacks" ] = DEFAULT_STACKS;
+ //Set up specific visual properties.
+ mVisualMap[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::SPHERE;
+ mVisualMap[ PrimitiveVisual::Property::SLICES ] = DEFAULT_SLICES;
+ mVisualMap[ PrimitiveVisual::Property::STACKS ] = DEFAULT_STACKS;
//Set up sliders.
- SetupSlider( 0, SLICES_LOWER_BOUND, SLICES_UPPER_BOUND, DEFAULT_STACKS, "slices" );
+ SetupSlider( 0, SLICES_LOWER_BOUND, SLICES_UPPER_BOUND, DEFAULT_STACKS, PrimitiveVisual::Property::SLICES, "slices" );
SetupMarks( mSliders.at( 0 ), SLICES_LOWER_BOUND, SLICES_UPPER_BOUND );
- SetupSlider( 1, STACKS_LOWER_BOUND, STACKS_UPPER_BOUND, DEFAULT_STACKS, "stacks" );
+ SetupSlider( 1, STACKS_LOWER_BOUND, STACKS_UPPER_BOUND, DEFAULT_STACKS, PrimitiveVisual::Property::STACKS, "stacks" );
SetupMarks( mSliders.at( 1 ), STACKS_LOWER_BOUND, STACKS_UPPER_BOUND );
//Set model in control.
- mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) );
+ mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mVisualMap ) );
}
//Sets the 3D model to a cone and modifies the sliders appropriately.
{
InitialiseSlidersAndModel();
- //Set up specific renderer properties.
- mRendererMap[ "shape" ] = SHAPE_CONE;
- mRendererMap[ "scaleHeight" ] = DEFAULT_SCALE_HEIGHT;
- mRendererMap[ "scaleBottomRadius" ] = DEFAULT_SCALE_BOTTOM_RADIUS;
- mRendererMap[ "slices" ] = DEFAULT_SLICES;
+ //Set up specific visual properties.
+ mVisualMap[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::CONE;
+ mVisualMap[ PrimitiveVisual::Property::SCALE_HEIGHT ] = DEFAULT_SCALE_HEIGHT;
+ mVisualMap[ PrimitiveVisual::Property::SCALE_BOTTOM_RADIUS ] = DEFAULT_SCALE_BOTTOM_RADIUS;
+ mVisualMap[ PrimitiveVisual::Property::SLICES ] = DEFAULT_SLICES;
//Set up sliders.
- SetupSlider( 0, 1.0f, 32.0f, DEFAULT_SCALE_HEIGHT, "scaleHeight" );
- SetupSlider( 1, 1.0f, 32.0f, DEFAULT_SCALE_BOTTOM_RADIUS, "scaleBottomRadius" );
- SetupSlider( 2, SLICES_LOWER_BOUND, SLICES_UPPER_BOUND, DEFAULT_STACKS, "slices" );
+ SetupSlider( 0, 1.0f, 32.0f, DEFAULT_SCALE_HEIGHT, PrimitiveVisual::Property::SCALE_HEIGHT, "scaleHeight" );
+ SetupSlider( 1, 1.0f, 32.0f, DEFAULT_SCALE_BOTTOM_RADIUS, PrimitiveVisual::Property::SCALE_BOTTOM_RADIUS, "scaleBottomRadius" );
+ SetupSlider( 2, SLICES_LOWER_BOUND, SLICES_UPPER_BOUND, DEFAULT_STACKS, PrimitiveVisual::Property::SLICES, "slices" );
SetupMarks( mSliders.at( 2 ), SLICES_LOWER_BOUND, SLICES_UPPER_BOUND );
//Set model in control.
- mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) );
+ mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mVisualMap ) );
}
//Sets the 3D model to a conical frustrum and modifies the sliders appropriately.
{
InitialiseSlidersAndModel();
- //Set up specific renderer properties.
- mRendererMap[ "shape" ] = SHAPE_CONICAL_FRUSTRUM;
- mRendererMap[ "scaleTopRadius" ] = DEFAULT_SCALE_TOP_RADIUS;
- mRendererMap[ "scaleBottomRadius" ] = DEFAULT_SCALE_BOTTOM_RADIUS;
- mRendererMap[ "scaleHeight" ] = DEFAULT_SCALE_HEIGHT;
- mRendererMap[ "slices" ] = DEFAULT_SLICES;
+ //Set up specific visual properties.
+ mVisualMap[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::CONICAL_FRUSTRUM;
+ mVisualMap[ PrimitiveVisual::Property::SCALE_TOP_RADIUS ] = DEFAULT_SCALE_TOP_RADIUS;
+ mVisualMap[ PrimitiveVisual::Property::SCALE_BOTTOM_RADIUS ] = DEFAULT_SCALE_BOTTOM_RADIUS;
+ mVisualMap[ PrimitiveVisual::Property::SCALE_HEIGHT ] = DEFAULT_SCALE_HEIGHT;
+ mVisualMap[ PrimitiveVisual::Property::SLICES ] = DEFAULT_SLICES;
//Set up used sliders.
- SetupSlider( 0, 1.0f, 32.0f, DEFAULT_SCALE_HEIGHT, "scaleHeight" );
- SetupSlider( 1, 0.0f, 32.0f, DEFAULT_SCALE_BOTTOM_RADIUS, "scaleBottomRadius" );
- SetupSlider( 2, 0.0f, 32.0f, DEFAULT_SCALE_TOP_RADIUS, "scaleTopRadius" );
+ SetupSlider( 0, 1.0f, 32.0f, DEFAULT_SCALE_HEIGHT, PrimitiveVisual::Property::SCALE_HEIGHT, "scaleHeight" );
+ SetupSlider( 1, 0.0f, 32.0f, DEFAULT_SCALE_BOTTOM_RADIUS, PrimitiveVisual::Property::SCALE_BOTTOM_RADIUS, "scaleBottomRadius" );
+ SetupSlider( 2, 0.0f, 32.0f, DEFAULT_SCALE_TOP_RADIUS, PrimitiveVisual::Property::SCALE_TOP_RADIUS, "scaleTopRadius" );
//Set model in control.
- mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) );
+ mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mVisualMap ) );
}
//Sets the 3D model to a cylinder and modifies the sliders appropriately.
{
InitialiseSlidersAndModel();
- //Set up specific renderer properties.
- mRendererMap[ "shape" ] = SHAPE_CYLINDER;
- mRendererMap[ "scaleHeight" ] = DEFAULT_SCALE_HEIGHT;
- mRendererMap[ "scaleRadius" ] = DEFAULT_SCALE_RADIUS;
- mRendererMap[ "slices" ] = DEFAULT_SLICES;
+ //Set up specific visual properties.
+ mVisualMap[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::CYLINDER;
+ mVisualMap[ PrimitiveVisual::Property::SCALE_HEIGHT ] = DEFAULT_SCALE_HEIGHT;
+ mVisualMap[ PrimitiveVisual::Property::SCALE_RADIUS ] = DEFAULT_SCALE_RADIUS;
+ mVisualMap[ PrimitiveVisual::Property::SLICES ] = DEFAULT_SLICES;
//Set up used sliders.
- SetupSlider( 0, 1.0f, 32.0f, DEFAULT_SCALE_HEIGHT, "scaleHeight" );
- SetupSlider( 1, 1.0f, 32.0f, DEFAULT_SCALE_RADIUS, "scaleRadius" );
- SetupSlider( 2, SLICES_LOWER_BOUND, SLICES_UPPER_BOUND, DEFAULT_STACKS, "slices" );
+ SetupSlider( 0, 1.0f, 32.0f, DEFAULT_SCALE_HEIGHT, PrimitiveVisual::Property::SCALE_HEIGHT, "scaleHeight" );
+ SetupSlider( 1, 1.0f, 32.0f, DEFAULT_SCALE_RADIUS, PrimitiveVisual::Property::SCALE_RADIUS, "scaleRadius" );
+ SetupSlider( 2, SLICES_LOWER_BOUND, SLICES_UPPER_BOUND, DEFAULT_STACKS, PrimitiveVisual::Property::SLICES, "slices" );
SetupMarks( mSliders.at( 2 ), SLICES_LOWER_BOUND, SLICES_UPPER_BOUND );
//Set model in control.
- mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) );
+ mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mVisualMap ) );
}
//Sets the 3D model to a cube and modifies the sliders appropriately.
{
InitialiseSlidersAndModel();
- //Set up specific renderer properties.
- mRendererMap[ "shape" ] = SHAPE_CUBE;
+ //Set up specific visual properties.
+ mVisualMap[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::CUBE;
//Set model in control.
- mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) );
+ mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mVisualMap ) );
}
//Sets the 3D model to a bevelled cube and modifies the sliders appropriately.
{
InitialiseSlidersAndModel();
- //Set up specific renderer properties.
- mRendererMap[ "shape" ] = SHAPE_BEVELLED_CUBE;
- mRendererMap[ "bevelPercentage" ] = DEFAULT_BEVEL_PERCENTAGE;
- mRendererMap[ "bevelSmoothness" ] = DEFAULT_BEVEL_SMOOTHNESS;
+ //Set up specific visual properties.
+ mVisualMap[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::BEVELLED_CUBE;
+ mVisualMap[ PrimitiveVisual::Property::BEVEL_PERCENTAGE ] = DEFAULT_BEVEL_PERCENTAGE;
+ mVisualMap[ PrimitiveVisual::Property::BEVEL_SMOOTHNESS ] = DEFAULT_BEVEL_SMOOTHNESS;
//Set up used sliders.
- SetupSlider( 0, 0.0f, 1.0f, DEFAULT_BEVEL_PERCENTAGE, "bevelPercentage" );
- SetupSlider( 1, 0.0f, 1.0f, DEFAULT_BEVEL_SMOOTHNESS, "bevelSmoothness" );
+ SetupSlider( 0, 0.0f, 1.0f, DEFAULT_BEVEL_PERCENTAGE, PrimitiveVisual::Property::BEVEL_PERCENTAGE, "bevelPercentage" );
+ SetupSlider( 1, 0.0f, 1.0f, DEFAULT_BEVEL_SMOOTHNESS, PrimitiveVisual::Property::BEVEL_SMOOTHNESS, "bevelSmoothness" );
//Set model in control.
- mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) );
+ mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mVisualMap ) );
}
//Sets the 3D model to an octahedron and modifies the sliders appropriately.
{
InitialiseSlidersAndModel();
- //Set up specific renderer properties.
- mRendererMap[ "shape" ] = SHAPE_OCTAHEDRON;
+ //Set up specific visual properties.
+ mVisualMap[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::OCTAHEDRON;
//Set model in control.
- mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) );
+ mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mVisualMap ) );
}
//Sets up the slider at the given index for the supplied property, and labels it appropriately.
- // rendererPropertyLabel is the property that will be set by this slider.
+ // visualProperty is the property that will be set by this slider.
void SetupSlider( int sliderIndex, float lowerBound, float upperBound, float startPoint,
- std::string rendererPropertyLabel )
+ Property::Index visualProperty, std::string visualPropertyLabel )
{
//Set up the slider itself.
- mSliders.at( sliderIndex ).RegisterProperty( "rendererProperty", Property::Value( rendererPropertyLabel ), Property::READ_WRITE );
+ mSliders.at( sliderIndex ).RegisterProperty( "visualProperty", Property::Value( visualProperty ), Property::READ_WRITE );
mSliders.at( sliderIndex ).SetProperty( Slider::Property::LOWER_BOUND, Property::Value( lowerBound ) );
mSliders.at( sliderIndex ).SetProperty( Slider::Property::UPPER_BOUND, Property::Value( upperBound ) );
mSliders.at( sliderIndex ).SetProperty( Slider::Property::VALUE, Property::Value( startPoint ) );
//We reset the TextLabel to force a relayout of the table.
mSliderTable.RemoveChildAt( TableView::CellPosition(sliderIndex, 0) );
- TextLabel sliderLabel = TextLabel::New( rendererPropertyLabel );
+ TextLabel sliderLabel = TextLabel::New( visualPropertyLabel );
sliderLabel.SetParentOrigin( ParentOrigin::CENTER );
sliderLabel.SetAnchorPoint( AnchorPoint::CENTER );
sliderLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
//When the slider is adjusted, change the corresponding shape property accordingly.
bool OnSliderValueChanged( Slider slider, float value )
{
- //Update property map to reflect the change to the specific renderer property.
- std::string rendererPropertyLabel;
- slider.GetProperty( slider.GetPropertyIndex( "rendererProperty" ) ).Get( rendererPropertyLabel );
- mRendererMap[ rendererPropertyLabel ] = value;
+ //Update property map to reflect the change to the specific visual property.
+ int visualProperty;
+ slider.GetProperty( slider.GetPropertyIndex( "visualProperty" ) ).Get( visualProperty );
+ mVisualMap[ visualProperty ] = value;
//Reload the model to display the change.
- mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) );
+ mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mVisualMap ) );
return true;
}
std::vector<TextLabel> mSliderLabels; ///< Holds the labels to each slider.
TableView mSliderTable; ///< A table to layout the sliders next to their labels.
- Property::Map mRendererMap; ///< Property map to create a primitive renderer.
- Control mModel; ///< Control to house the primitive renderer.
+ Property::Map mVisualMap; ///< Property map to create a primitive visual.
+ Control mModel; ///< Control to house the primitive visual.
PanGestureDetector mPanGestureDetector; ///< Detects pan gestures for rotation of the model.
Animation mRotationAnimation; ///< Automatically rotates the model, unless it is being panned.
{
ImageView actor = ImageView::New();
Property::Map map;
- map["rendererType"] = "IMAGE";
- map["url"] = filename;
- map["desiredWidth"] = width;
- map["desiredHeight"] = height;
- map["fittingMode"] = "SCALE_TO_FILL";
- map["samplingMode"] = "BOX_THEN_LINEAR";
+ map[Visual::Property::TYPE] = Visual::IMAGE;
+ map[ImageVisual::Property::URL] = filename;
+ map[ImageVisual::Property::DESIRED_WIDTH] = width;
+ map[ImageVisual::Property::DESIRED_HEIGHT] = height;
+ map[ImageVisual::Property::FITTING_MODE] = FittingMode::SCALE_TO_FILL;
+ map[ImageVisual::Property::SAMPLING_MODE] = SamplingMode::BOX_THEN_LINEAR;
actor.SetProperty( ImageView::Property::IMAGE, map );
actor.SetName( filename );
parent.Add( box );
Dali::Property::Map border;
- border.Insert( "rendererType", "BORDER" );
- border.Insert( "borderColor", Color::WHITE );
- border.Insert( "borderSize", 1.f );
+ border.Insert( Visual::Property::TYPE, Visual::BORDER );
+ border.Insert( BorderVisual::Property::COLOR, Color::WHITE );
+ border.Insert( BorderVisual::Property::SIZE, 1.f );
box.SetProperty( Control::Property::BACKGROUND, border );
}
Stage::GetCurrent().KeyEventSignal().Connect( this, &VideoViewController::OnKeyEvent );
Property::Map customShader;
- customShader.Insert( "fragmentShader", FRAGMENT_SHADER );
- mCustomShader.Insert( "rendererType", "IMAGE" );
- mCustomShader.Insert( "shader", customShader );
+ customShader.Insert( Visual::Shader::Property::FRAGMENT_SHADER, FRAGMENT_SHADER );
+ mCustomShader.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ mCustomShader.Insert( Visual::Property::SHADER, customShader );
Property::Map defaultShader;
- customShader.Insert( "fragmentShader", DEFAULT_FRAGMENT_SHADER );
- mDefaultShader.Insert( "rendererType", "IMAGE" );
- mDefaultShader.Insert( "shader", defaultShader );
+ customShader.Insert( Visual::Shader::Property::FRAGMENT_SHADER, DEFAULT_FRAGMENT_SHADER );
+ mDefaultShader.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ mDefaultShader.Insert( Visual::Property::SHADER, customShader );
mWindowSurfaceTarget.Insert( "RENDERING_TARGET", "windowSurfaceTarget" );
mNativeImageTarget.Insert( "RENDERING_TARGET", "nativeImageTarget" );
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"FILL_TO_PARENT",
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"sizeModeFactor": [0.25,0.166667,1],
"sizeAspectRatio": false,
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [1,1,1,1]
},
"color": [
"heightResizePolicy":"SIZE_RELATIVE_TO_PARENT",
"sizeModeFactor": [ 0.5, 0.333333333333, 1 ],
"background":{
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [ 0.8, 0, 0.2, 1 ]
}
},
"heightResizePolicy":"SIZE_RELATIVE_TO_PARENT",
"sizeModeFactor": [ 0.5, 0.333333333333, 1 ],
"background": {
- "rendererType": "IMAGE",
+ "visualType": "IMAGE",
"url": "{DEMO_IMAGE_DIR}Kid1.svg"
}
},
"heightResizePolicy":"SIZE_RELATIVE_TO_PARENT",
"sizeModeFactor": [ 0.5, 0.333333333333, 1 ],
"background": {
- "rendererType" : "BORDER",
+ "visualType" : "BORDER",
"borderColor" : [ 0.5, 0.5, 0.5, 1 ],
"borderSize" : 15.0
}
"heightResizePolicy":"SIZE_RELATIVE_TO_PARENT",
"sizeModeFactor": [ 0.5, 0.333333333333, 1 ],
"background": {
- "rendererType": "IMAGE",
+ "visualType": "IMAGE",
"url": "{DEMO_IMAGE_DIR}gallery-large-9.jpg"
}
},
"heightResizePolicy":"SIZE_RELATIVE_TO_PARENT",
"sizeModeFactor": [ 0.5, 0.333333333333, 1 ],
"background":{
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [ 1, 1, 0, 1 ]
}
},
"heightResizePolicy":"SIZE_RELATIVE_TO_PARENT",
"sizeModeFactor": [ 0.5, 0.333333333333, 1 ],
"background": {
- "rendererType" : "GRADIENT",
+ "visualType" : "GRADIENT",
"startPosition" : [ -0.5, -0.5 ],
"endPosition": [ 0.5, 0.5 ],
"stopColor" : [
"parentOrigin": [0.5, 0.5, 0.5],
"anchorPoint": [0.5, 1, 0.5],
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [0.71, 0, 0, 1]
},
"selected": false,
"parentOrigin": [0.5, 0.5, 0.5],
"anchorPoint": [0.5, 1, 0.5],
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [0, 0.14200000000000013, 0.71, 0.7]
},
"signals": [
"parentOrigin": [0.5, 0.5, 0.5],
"anchorPoint": [0.5, 1, 0.5],
"background": {
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [0.057450000000000064, 0.3, 0.0030000000000000027, 0.7]
},
"signals": [
"name":"simpleTable",
"type":"TableView",
"background":{
- "rendererType": "COLOR",
+ "visualType": "COLOR",
"mixColor": [0.5,0.5,0,1]
},
"parentOrigin": "CENTER",
{
"background":
{
- "rendererType": "GRADIENT",
+ "visualType": "GRADIENT",
"center": [240, 400],
"radius": 932,
"units": "USER_SPACE",
{
"background":
{
- "rendererType": "GRADIENT",
+ "visualType": "GRADIENT",
"center": [360, 640],
"radius": 1468,
"units": "USER_SPACE",
#define DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM "Super Blur and Bloom"
#define DALI_DEMO_STR_TITLE_EFFECTS_VIEW "Effects View"
#define DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE "Native Image Source"
-#define DALI_DEMO_STR_TITLE_MESH_RENDERER "Mesh Renderer"
+#define DALI_DEMO_STR_TITLE_MESH_VISUAL "Mesh Visual"
#define DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES "Primitive Shapes"
#endif
if ( !backgroundImagePath.empty() )
{
Dali::Property::Map map;
- map["rendererType"] = "IMAGE";
- map["url"] = backgroundImagePath;
- map["desiredWidth"] = stage.GetSize().x;
- map["desiredHeight"] = stage.GetSize().y;
- map["fittingMode"] = "SCALE_TO_FILL";
- map["samplingMode"] = "BOX_THEN_LINEAR";
- map["synchronousLoading"] = true;
+ map[Dali::Toolkit::Visual::Property::TYPE] = Dali::Toolkit::Visual::IMAGE;
+ map[Dali::Toolkit::ImageVisual::Property::URL] = backgroundImagePath;
+ map[Dali::Toolkit::ImageVisual::Property::DESIRED_WIDTH] = stage.GetSize().x;
+ map[Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT] = stage.GetSize().y;
+ map[Dali::Toolkit::ImageVisual::Property::FITTING_MODE] = Dali::FittingMode::SCALE_TO_FILL;
+ map[Dali::Toolkit::ImageVisual::Property::SAMPLING_MODE] = Dali::SamplingMode::BOX_THEN_LINEAR;
+ map[Dali::Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING] = true;
view.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
}