From: Nick Holland Date: Thu, 16 Feb 2017 15:15:05 +0000 (+0000) Subject: Remove examples using Deprecated SetImage( FrameBuffer ) API X-Git-Tag: dali_1.2.27~2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F28%2F115128%2F5;p=platform%2Fcore%2Fuifw%2Fdali-demo.git Remove examples using Deprecated SetImage( FrameBuffer ) API Examples removed dali-examples: super-blur-bloom-example new-window-example page-turn-view-example Example removed from dali-demo meta-ball-explosion & refrac The meta ball demos will be reimplemented with the new rendering API Change-Id: Ib3026a2dce5728c4adf28951fa8cd7b9139ec28b --- diff --git a/demo/dali-demo.cpp b/demo/dali-demo.cpp index b26291e..566c57e 100644 --- a/demo/dali-demo.cpp +++ b/demo/dali-demo.cpp @@ -43,8 +43,6 @@ int DALI_EXPORT_API main(int argc, char **argv) demo.AddExample(Example("fpp-game.example", DALI_DEMO_STR_TITLE_FPP_GAME)); demo.AddExample(Example("item-view.example", DALI_DEMO_STR_TITLE_ITEM_VIEW)); demo.AddExample(Example("mesh-visual.example", DALI_DEMO_STR_TITLE_MESH_VISUAL)); - demo.AddExample(Example("metaball-explosion.example", DALI_DEMO_STR_TITLE_METABALL_EXPLOSION)); - demo.AddExample(Example("metaball-refrac.example", DALI_DEMO_STR_TITLE_METABALL_REFRAC)); demo.AddExample(Example("motion-blur.example", DALI_DEMO_STR_TITLE_MOTION_BLUR)); demo.AddExample(Example("refraction-effect.example", DALI_DEMO_STR_TITLE_REFRACTION)); demo.AddExample(Example("renderer-stencil.example", DALI_DEMO_STR_TITLE_RENDERER_STENCIL)); diff --git a/examples-reel/dali-examples-reel.cpp b/examples-reel/dali-examples-reel.cpp index 3824596..9f29f97 100644 --- a/examples-reel/dali-examples-reel.cpp +++ b/examples-reel/dali-examples-reel.cpp @@ -58,14 +58,12 @@ int DALI_EXPORT_API main(int argc, char **argv) demo.AddExample(Example("mesh-sorting.example", DALI_DEMO_STR_TITLE_MESH_SORTING)); demo.AddExample(Example("motion-stretch.example", DALI_DEMO_STR_TITLE_MOTION_STRETCH)); demo.AddExample(Example("native-image-source.example", DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE)); - demo.AddExample(Example("page-turn-view.example", DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW)); demo.AddExample(Example("popup.example", DALI_DEMO_STR_TITLE_POPUP)); demo.AddExample(Example("primitive-shapes.example", DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES)); demo.AddExample(Example("progress-bar.example", DALI_DEMO_STR_TITLE_PROGRESS_BAR)); demo.AddExample(Example("scroll-view.example", DALI_DEMO_STR_TITLE_SCROLL_VIEW)); demo.AddExample(Example("size-negotiation.example", DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE)); demo.AddExample(Example("styling.example", DALI_DEMO_STR_TITLE_STYLING)); - demo.AddExample(Example("super-blur-bloom.example", DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM)); demo.AddExample(Example("text-editor.example", DALI_DEMO_STR_TITLE_TEXT_EDITOR)); demo.AddExample(Example("text-field.example", DALI_DEMO_STR_TITLE_TEXT_FIELD)); demo.AddExample(Example("text-label.example", DALI_DEMO_STR_TITLE_TEXT_LABEL)); diff --git a/examples/metaball-explosion/metaball-explosion-example.cpp b/examples/metaball-explosion/metaball-explosion-example.cpp deleted file mode 100644 index fa701cc..0000000 --- a/examples/metaball-explosion/metaball-explosion-example.cpp +++ /dev/null @@ -1,774 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include -#include -#include -#include -#include -#include -#include - -// INTERNAL INCLUDES -#include "shared/view.h" -#include "shared/utility.h" - -using namespace Dali; -using namespace Dali::Toolkit; - -namespace -{ -const char * const BACKGROUND_IMAGE( DEMO_IMAGE_DIR "background-2.jpg" ); -const char * const TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" ); - -const float GRAVITY_X(0); -const float GRAVITY_Y(-0.09); -} - -#define METABALL_NUMBER 6 - - -const char*const METABALL_VERTEX_SHADER = DALI_COMPOSE_SHADER ( - attribute mediump vec2 aPosition;\n - attribute mediump vec2 aTexture;\n - uniform mediump mat4 uMvpMatrix;\n - uniform mediump vec3 uSize;\n - uniform lowp vec4 uColor;\n - varying mediump vec2 vTexCoord;\n - - void main()\n - {\n - vTexCoord = aTexture;\n - mediump vec4 vertexPosition = vec4(aPosition.x, aPosition.y, 0.0, 1.0);\n - gl_Position = uMvpMatrix * vertexPosition;\n - }\n -); - - -const char*const METABALL_FRAG_SHADER = DALI_COMPOSE_SHADER ( - precision mediump float;\n - varying vec2 vTexCoord;\n - uniform vec2 uPositionMetaball;\n - uniform vec2 uPositionVar;\n - uniform vec2 uGravityVector;\n - uniform float uRadius;\n - uniform float uRadiusVar;\n - void main()\n - {\n - vec2 adjustedCoords = vTexCoord * 2.0 - 1.0;\n - vec2 finalMetaballPosition = uPositionMetaball + uGravityVector + uPositionVar;\n - \n - float finalRadius = uRadius + uRadiusVar;\n - vec2 distanceVec = adjustedCoords - finalMetaballPosition;\n - float result = dot(distanceVec, distanceVec);\n - float color = inversesqrt(result) * finalRadius;\n - \n - gl_FragColor = vec4(color,color,color,1.0);\n - }\n -); - -const char*const REFRACTION_FRAG_SHADER = DALI_COMPOSE_SHADER ( - precision highp float;\n - varying vec2 vTexCoord;\n - uniform sampler2D sTexture;\n - uniform sampler2D sEffect;\n - uniform vec2 uPositionMetaball;\n - void main()\n - {\n - vec2 zoomCoords;\n - vec3 normal = vec3(0.0,0.0,1.0);\n - vec2 fakePos = vec2(0.0,0.0);\n - vec3 color = vec3(1.0, 1.0, 1.0); - float ambient = 0.2; - \n - vec4 metaColor = texture2D(sEffect, vTexCoord);\n - \n - vec2 adjustedCoords = vTexCoord.xy * vec2(2.0) - vec2(1.0);\n - fakePos = adjustedCoords.xy - vec2(uPositionMetaball.x, -uPositionMetaball.y); - float len = length(fakePos) + 0.01;\n - vec3 colorPos = vec3(0,0,1); - \n - if (metaColor.r > 0.85)\n - {\n - zoomCoords = ((vTexCoord - 0.5) * 0.9);\n - zoomCoords = zoomCoords + 0.5;\n - \n - float interpNormal = mix(0.7, 1.0, (metaColor.r - 0.85) * 4.);\n - normal.xyz = vec3(fakePos.x * (1.0 - interpNormal) / len, fakePos.y * (1.0 - interpNormal) / len, interpNormal);\n - normal.xyz = normalize(normal.xyz);\n - color = vec3(0.65, 1.0, 0);\n - colorPos = vec3(fakePos.x,fakePos.y,0); - }\n - else if (metaColor.r > 0.75)\n - {\n - float interpolation = mix(0.9, 1.15, (0.85 - metaColor.r) * 10.0);\n - zoomCoords = ((vTexCoord - 0.5) * interpolation);\n - zoomCoords = zoomCoords + 0.5;\n - \n - float interpNormal = mix(0.7, 0.0, (0.85 - metaColor.r) * 10.0);\n - normal.xyz = vec3(fakePos.x * (1.0 - interpNormal) / len, fakePos.y * (1.0 - interpNormal) / len, interpNormal);\n - normal.xyz = normalize(normal.xyz);\n - color = vec3(0.65, 1.0, 0);\n - colorPos = vec3(fakePos.x,fakePos.y,0); - }\n - else\n - {\n - zoomCoords = vTexCoord;\n - normal = vec3(0,0,0);\n - ambient = 0.5;\n - }\n - \n - vec3 lightPosition = vec3(-750.0,-1000.0,2000.0);\n - vec3 vertex = vec3(adjustedCoords.x,adjustedCoords.y,0.0);\n - \n - vec3 vecToLight = normalize( lightPosition - vertex );\n - \n - float lightDiffuse = dot( vecToLight, normal );\n - lightDiffuse = max(0.0,lightDiffuse);\n - lightDiffuse = lightDiffuse * 0.5 + 0.5; - \n - vec3 vertexToEye = vec3(0,0,1) - vertex;\n - vertexToEye = normalize(vertexToEye); - vec3 lightReflect = normalize(reflect(-vecToLight, normal));\n - float specularFactor = max(0.0,dot(vertexToEye, lightReflect));\n - specularFactor = pow(specularFactor, 32.0) * 0.7; - \n - vec4 texColor = texture2D(sTexture, zoomCoords);\n - gl_FragColor.rgb = texColor.rgb * ambient + color.rgb * texColor.rgb * lightDiffuse + vec3(specularFactor);\n - gl_FragColor.a = 1.0; - }\n - ); - -const char*const FRAG_SHADER = DALI_COMPOSE_SHADER ( - precision mediump float;\n - void main()\n - {\n - gl_FragColor = texture2D(sTexture, vTexCoord);\n - }\n -); - - -struct MetaballInfo -{ - Actor actor; - Vector2 position; - float radius; - float initRadius; - - //new shader stuff - Property::Index positionIndex; - Property::Index positionVarIndex; -}; - - -/**************************************************************************/ -/* Demo using Metaballs ***********/ -/* When the metaball is clicked it explodes in different balls ***********/ -/**************************************************************************/ -class MetaballExplosionController : public ConnectionTracker -{ -public: - MetaballExplosionController( Application& application ); - ~MetaballExplosionController(); - - /** - * Main create function, it creates the metaballs and all the related data - */ - void Create( Application& app ); - - /** - * Touch event function - */ - bool OnTouch( Actor actor, const TouchData& touch ); - - /** - * Key event function - */ - void OnKeyEvent(const KeyEvent& event); - - -private: - Application& mApplication; - Vector2 mScreenSize; - - Layer mContentLayer; - - Image mBackImage; - FrameBufferImage mMetaballFBO; - - Actor mMetaballRoot; - MetaballInfo mMetaballs[METABALL_NUMBER]; - - Property::Index mPositionIndex; - Actor mCompositionActor; - - //Motion - Vector2 mCurrentTouchPosition; - Vector2 mMetaballPosVariation; - Vector2 mMetaballPosVariationFrom; - Vector2 mMetaballPosVariationTo; - Vector2 mMetaballCenter; - - //Animations - Animation mPositionVarAnimation[METABALL_NUMBER]; - - int mDispersion; - Animation mDispersionAnimation[METABALL_NUMBER]; - - Timer mTimerDispersion; - - float mTimeMult; - - //Private functions - - /** - * Create a mesh data with the geometry for the metaball rendering - */ - Geometry CreateGeometry(); - - /** - * Create a mesh data with the geometry for the final composition - */ - Geometry CreateGeometryComposition(); - - /** - * Create a mesh actor for the metaballs - */ - void CreateMetaballActors(); - - /** - * Create the render task and FBO to render the metaballs into a texture - */ - void CreateMetaballImage(); - - /** - * Create a mesh image to render the final composition - */ - void AddRefractionImage(); - - /** - * Function to create animations for the small variations of position inside the metaball - */ - void CreateAnimations(); - - /** - * Function to reset metaball state - */ - void ResetMetaballs(bool resetAnims); - - /** - * Function to create disperse each of the ball that compose the metaball when exploding - */ - void DisperseBallAnimation(int ball); - - /** - * Function to make metaballs come back to reset position - */ - void LaunchResetMetaballPosition(Animation &source); - - /** - * Function to set things at the end of the animation - */ - void EndDisperseAnimation(Animation &source); - - /** - * Function to init dispersion of the metaballs one by one using a timer - * (so not all the balls begin moving at the same time) - */ - bool OnTimerDispersionTick(); - - /** - * Function to set the actual position of the metaballs when the user clicks the screen - */ - void SetPositionToMetaballs(Vector2 & metaballCenter); -}; - - -//----------------------------------------------------------------------------------------------- -// -// IMPLEMENTATION -// -//---------------- - -MetaballExplosionController::MetaballExplosionController( Application& application ) -: mApplication( application ), - mScreenSize(), - mContentLayer(), - mBackImage(), - mMetaballFBO(), - mMetaballRoot(), - mMetaballs(), - mPositionIndex(), - mCompositionActor(), - mCurrentTouchPosition(), - mMetaballPosVariation(), - mMetaballPosVariationFrom(), - mMetaballPosVariationTo(), - mMetaballCenter(), - mPositionVarAnimation(), - mDispersion( 0 ), - mDispersionAnimation(), - mTimerDispersion(), - mTimeMult( 1.0f ) -{ - // Connect to the Application's Init signal - mApplication.InitSignal().Connect( this, &MetaballExplosionController::Create ); -} - -MetaballExplosionController::~MetaballExplosionController() -{ - // Nothing to do here; -} - -void MetaballExplosionController::Create( Application& app ) -{ - Stage stage = Stage::GetCurrent(); - - stage.KeyEventSignal().Connect(this, &MetaballExplosionController::OnKeyEvent); - - mScreenSize = stage.GetSize(); - - mTimeMult = 1.0f; - - stage.SetBackgroundColor(Color::BLACK); - - //Set background image for the view - mBackImage = DemoHelper::LoadImage( BACKGROUND_IMAGE ); - - srand((unsigned)time(0)); - - //Create internal data - CreateMetaballActors(); - CreateMetaballImage(); - AddRefractionImage(); - - CreateAnimations(); - - mDispersion = 0; - mTimerDispersion = Timer::New( 150 ); - mTimerDispersion.TickSignal().Connect(this, &MetaballExplosionController::OnTimerDispersionTick); - - // Connect the callback to the touch signal on the mesh actor - stage.GetRootLayer().TouchSignal().Connect( this, &MetaballExplosionController::OnTouch ); -} - -Geometry MetaballExplosionController::CreateGeometry() -{ - float aspect = (float)mScreenSize.y / (float)mScreenSize.x; - - // Create vertices and specify their color - float xsize = mScreenSize.x * 0.5; - - //We create the meshdata for the metaballs - struct VertexPosition { Vector2 position; }; - struct VertexTexture { Vector2 texture; }; - struct VertexNormal { Vector3 normal; }; - - VertexPosition vertices[] = { - { Vector2( -xsize, -xsize * aspect) }, - { Vector2( xsize, -xsize * aspect) }, - { Vector2( -xsize, xsize * aspect) }, - { Vector2( xsize, xsize * aspect) } - }; - - VertexTexture textures[] = { - { Vector2(0.0f, 0.0f) }, - { Vector2(1.0f, 0.0f) }, - { Vector2(0.0f, 1.0f * aspect) }, - { Vector2(1.0f, 1.0f * aspect) } - }; - - unsigned int numberOfVertices = sizeof(vertices)/sizeof(VertexPosition); - - //Vertices - Property::Map positionVertexFormat; - positionVertexFormat["aPosition"] = Property::VECTOR2; - PropertyBuffer positionVertices = PropertyBuffer::New( positionVertexFormat ); - positionVertices.SetData( vertices, numberOfVertices ); - - //Textures - Property::Map textureVertexFormat; - textureVertexFormat["aTexture"] = Property::VECTOR2; - PropertyBuffer textureVertices = PropertyBuffer::New( textureVertexFormat ); - textureVertices.SetData( textures, numberOfVertices ); - - //Indices - unsigned short indices[] = { 0, 3, 1, 0, 2, 3 }; - - // Create the geometry object - Geometry texturedQuadGeometry = Geometry::New(); - texturedQuadGeometry.AddVertexBuffer( positionVertices ); - texturedQuadGeometry.AddVertexBuffer( textureVertices ); - - texturedQuadGeometry.SetIndexBuffer ( &indices[0], sizeof( indices )/ sizeof( indices[0] ) ); - - return texturedQuadGeometry; -} - -Geometry MetaballExplosionController::CreateGeometryComposition() -{ - float aspect = (float)mScreenSize.y / (float)mScreenSize.x; - - // Create vertices and specify their color - float xsize = mScreenSize.x * 0.5; - - //We create the meshdata for the metaballs - struct VertexPosition { Vector2 position; }; - struct VertexTexture { Vector2 texture; }; - struct VertexNormal { Vector3 normal; }; - - VertexPosition vertices[] = { - { Vector2( -xsize, -xsize * aspect) }, - { Vector2( xsize, -xsize * aspect) }, - { Vector2( -xsize, xsize * aspect) }, - { Vector2( xsize, xsize * aspect) } - }; - - VertexTexture textures[] = { - { Vector2(0.0f, 0.0f) }, - { Vector2(1.0f, 0.0f) }, - { Vector2(0.0f, 1.0f) }, - { Vector2(1.0f, 1.0f) } - }; - - unsigned int numberOfVertices = sizeof(vertices)/sizeof(VertexPosition); - - //Vertices - Property::Map positionVertexFormat; - positionVertexFormat["aPosition"] = Property::VECTOR2; - PropertyBuffer positionVertices = PropertyBuffer::New( positionVertexFormat ); - positionVertices.SetData( vertices, numberOfVertices ); - - //Textures - Property::Map textureVertexFormat; - textureVertexFormat["aTexture"] = Property::VECTOR2; - PropertyBuffer textureVertices = PropertyBuffer::New( textureVertexFormat ); - textureVertices.SetData( textures, numberOfVertices ); - - //Indices - unsigned short indices[] = { 0, 3, 1, 0, 2, 3 }; - - // Create the geometry object - Geometry texturedQuadGeometry = Geometry::New(); - texturedQuadGeometry.AddVertexBuffer( positionVertices ); - texturedQuadGeometry.AddVertexBuffer( textureVertices ); - - texturedQuadGeometry.SetIndexBuffer ( &indices[0], sizeof( indices )/ sizeof( indices[0] ) ); - - return texturedQuadGeometry; -} - -float randomNumber(float lowest, float highest) -{ - float range=(highest-lowest); - return lowest+range*rand()/RAND_MAX; -} - -void MetaballExplosionController::CreateMetaballActors() -{ - //Create the shader for the metaballs - Shader shader = Shader::New( METABALL_VERTEX_SHADER, METABALL_FRAG_SHADER ); - - Geometry metaballGeom = CreateGeometry(); - Renderer renderer = Renderer::New( metaballGeom, shader ); - renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON ); - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::ONE ); - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::ONE ); - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::ONE ); - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::ONE ); - - //Initialization of each of the metaballs - for( int i = 0; i < METABALL_NUMBER; i++ ) - { - mMetaballs[i].position = Vector2(0.0f, 0.0f); - mMetaballs[i].radius = mMetaballs[i].initRadius = randomNumber(0.05f,0.07f); - - mMetaballs[i].actor = Actor::New( ); - mMetaballs[i].actor.SetName("Metaball"); - mMetaballs[i].actor.SetScale( 1.0f ); - mMetaballs[i].actor.SetParentOrigin( ParentOrigin::CENTER ); - mMetaballs[i].actor.AddRenderer( renderer ); - - mMetaballs[i].positionIndex = mMetaballs[i].actor.RegisterProperty( "uPositionMetaball", mMetaballs[i].position ); - - mMetaballs[i].positionVarIndex = mMetaballs[i].actor.RegisterProperty( "uPositionVar", Vector2(0.f,0.f) ); - - mMetaballs[i].actor.RegisterProperty( "uGravityVector", Vector2(randomNumber(-0.2,0.2),randomNumber(-0.2,0.2)) ); - - mMetaballs[i].actor.RegisterProperty( "uRadius", mMetaballs[i].radius ); - - mMetaballs[i].actor.RegisterProperty( "uRadiusVar", 0.f ); - - mMetaballs[i].actor.SetSize(400, 400); - } - - //Root creation - mMetaballRoot = Actor::New(); - mMetaballRoot.SetParentOrigin( ParentOrigin::CENTER ); - for( int i = 0; i < METABALL_NUMBER; i++ ) - { - mMetaballRoot.Add( mMetaballs[i].actor ); - } - - //Initialization of variables related to metaballs - mMetaballPosVariation = Vector2(0,0); - mMetaballPosVariationFrom = Vector2(0,0); - mMetaballPosVariationTo = Vector2(0,0); - mCurrentTouchPosition = Vector2(0,0); -} - -void MetaballExplosionController::CreateMetaballImage() -{ - //We create an FBO and a render task to create to render the metaballs with a fragment shader - Stage stage = Stage::GetCurrent(); - mMetaballFBO = FrameBufferImage::New(mScreenSize.x, mScreenSize.y, Pixel::RGBA8888, RenderBuffer::COLOR_DEPTH); - - - stage.Add(mMetaballRoot); - - //Creation of the render task used to render the metaballs - RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); - RenderTask task = taskList.CreateTask(); - task.SetRefreshRate( RenderTask::REFRESH_ALWAYS ); - task.SetSourceActor( mMetaballRoot ); - task.SetExclusive(true); - task.SetClearColor( Color::BLACK ); - task.SetClearEnabled( true ); - task.SetTargetFrameBuffer( mMetaballFBO ); -} - -void MetaballExplosionController::AddRefractionImage() -{ - //Create Gaussian blur for the rendered image - FrameBufferImage fbo; - fbo = FrameBufferImage::New( mScreenSize.x, mScreenSize.y, Pixel::RGBA8888, RenderBuffer::COLOR_DEPTH); - - GaussianBlurView gbv = GaussianBlurView::New(5, 2.0f, Pixel::RGBA8888, 0.5f, 0.5f, true); - gbv.SetBackgroundColor(Color::TRANSPARENT); - gbv.SetUserImageAndOutputRenderTarget( mMetaballFBO, fbo ); - gbv.SetSize(mScreenSize.x, mScreenSize.y); - Stage::GetCurrent().Add(gbv); - gbv.Activate(); - - //Create new shader - Shader shader = Shader::New( METABALL_VERTEX_SHADER, REFRACTION_FRAG_SHADER ); - - //Create new texture set - TextureSet textureSet = TextureSet::New(); - TextureSetImage( textureSet, 0u, mBackImage ); - TextureSetImage( textureSet, 1u, fbo ); - - //Create geometry - Geometry metaballGeom = CreateGeometryComposition(); - - Renderer mRenderer = Renderer::New( metaballGeom, shader ); - mRenderer.SetTextures( textureSet ); - - mCompositionActor = Actor::New( ); - mCompositionActor.SetParentOrigin(ParentOrigin::CENTER); - mCompositionActor.SetPosition(Vector3(0.0f, 0.0f, 0.0f)); - mCompositionActor.SetSize(mScreenSize.x, mScreenSize.y); - - mCompositionActor.AddRenderer( mRenderer ); - - Vector2 metaballCenter(0.0,0); - metaballCenter.x = metaballCenter.x * 0.5; - metaballCenter.y = metaballCenter.y * 0.5; - - mPositionIndex = mCompositionActor.RegisterProperty( "uPositionMetaball", metaballCenter ); - - SetPositionToMetaballs(metaballCenter); - - mCompositionActor.SetSize(mScreenSize.x, mScreenSize.y); - - Stage stage = Stage::GetCurrent(); - stage.Add( mCompositionActor ); -} - -void MetaballExplosionController::CreateAnimations() -{ - Vector2 direction; - - for( int i = 0; i < METABALL_NUMBER; i++ ) - { - float key; - KeyFrames keySinCosVariation = KeyFrames::New(); - Vector2 sinCosVariation(0,0); - - direction.x = randomNumber(-100.f,100.f); - direction.y = randomNumber(-100.f,100.f); - - direction.Normalize(); - direction *= 0.1f; - - for( int j = 0; j < 360; j++ ) - { - sinCosVariation.x = sin(j * Math::PI/180.f) * direction.x; - sinCosVariation.y = cos(j * Math::PI/180.f) * direction.y; - key = j/360.f; - keySinCosVariation.Add(key, sinCosVariation); - } - - mPositionVarAnimation[i] = Animation::New(3.f); - mPositionVarAnimation[i].AnimateBetween(Property( mMetaballs[i].actor, mMetaballs[i].positionVarIndex ), keySinCosVariation); - mPositionVarAnimation[i].SetLooping( true ); - mPositionVarAnimation[i].Play(); - } -} - -void MetaballExplosionController::ResetMetaballs(bool resetAnims) -{ - for( int i = 0; i < METABALL_NUMBER; i++ ) - { - if (mDispersionAnimation[i]) - mDispersionAnimation[i].Clear(); - - mMetaballs[i].position = Vector2(0.0f, 0.0f); - mMetaballs[i].actor.SetProperty(mMetaballs[i].positionIndex, mMetaballs[i].position); - } - mTimerDispersion.Stop(); - mDispersion = 0; - - mCompositionActor.SetProperty( mPositionIndex, Vector2(0,0) ); -} - -void MetaballExplosionController::DisperseBallAnimation(int ball) -{ - Vector2 position; - position.x = randomNumber(-1.5f,1.5f); - position.y = randomNumber(-1.5f,1.5f); - - mDispersionAnimation[ball] = Animation::New(2.0f * mTimeMult); - mDispersionAnimation[ball].AnimateTo( Property(mMetaballs[ball].actor, mMetaballs[ball].positionIndex), position); - mDispersionAnimation[ball].Play(); - - if( ball == METABALL_NUMBER - 1 ) - mDispersionAnimation[ball].FinishedSignal().Connect( this, &MetaballExplosionController::LaunchResetMetaballPosition ); -} - -void MetaballExplosionController::LaunchResetMetaballPosition(Animation &source) -{ - for( int i = 0; i < METABALL_NUMBER; i++ ) - { - mDispersionAnimation[i] = Animation::New(1.5f + i*0.25f*mTimeMult); - mDispersionAnimation[i].AnimateTo(Property(mMetaballs[i].actor, mMetaballs[i].positionIndex), Vector2(0,0)); - mDispersionAnimation[i].Play(); - - if( i == METABALL_NUMBER - 1 ) - mDispersionAnimation[i].FinishedSignal().Connect( this, &MetaballExplosionController::EndDisperseAnimation ); - } -} - -void MetaballExplosionController::EndDisperseAnimation(Animation &source) -{ - mCompositionActor.SetProperty( mPositionIndex, Vector2(0,0) ); -} - -bool MetaballExplosionController::OnTimerDispersionTick() -{ - if( mDispersion < METABALL_NUMBER ) - { - DisperseBallAnimation(mDispersion); - mDispersion++; - } - return true; -} - -void MetaballExplosionController::SetPositionToMetaballs(Vector2 & metaballCenter) -{ - //We set the position for the metaballs based on click position - for( int i = 0; i < METABALL_NUMBER; i++ ) - { - mMetaballs[i].position = metaballCenter; - mMetaballs[i].actor.SetProperty(mMetaballs[i].positionIndex, mMetaballs[i].position); - } - - mCompositionActor.SetProperty( mPositionIndex, metaballCenter ); -} - -bool MetaballExplosionController::OnTouch( Actor actor, const TouchData& touch ) -{ - float aspectR = mScreenSize.y / mScreenSize.x; - - switch( touch.GetState( 0 ) ) - { - case PointState::DOWN: - { - ResetMetaballs(true); - - const Vector2 screen = touch.GetScreenPosition( 0 ); - Vector2 metaballCenter = Vector2((screen.x / mScreenSize.x) - 0.5, (aspectR * (mScreenSize.y - screen.y) / mScreenSize.y) - 0.5) * 2.0; - SetPositionToMetaballs(metaballCenter); - - break; - } - case PointState::MOTION: - { - const Vector2 screen = touch.GetScreenPosition( 0 ); - Vector2 metaballCenter = Vector2((screen.x / mScreenSize.x) - 0.5, (aspectR * (mScreenSize.y - screen.y) / mScreenSize.y) - 0.5) * 2.0; - SetPositionToMetaballs(metaballCenter); - break; - } - case PointState::UP: - case PointState::LEAVE: - case PointState::INTERRUPTED: - { - mTimerDispersion.Start(); - break; - } - default: - break; - } - return true; -} - -void MetaballExplosionController::OnKeyEvent(const KeyEvent& event) -{ - if(event.state == KeyEvent::Down) - { - if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) ) - { - mApplication.Quit(); - } - } -} - - -//----------------------------------------------------------------------------------------------- -// -// Main functions -// -//----------------------------------------------------------------------------------------------- - -void RunTest( Application& application ) -{ - MetaballExplosionController test( application ); - - application.MainLoop(); -} - -// Entry point for Linux & Tizen applications -// -int DALI_EXPORT_API main( int argc, char **argv ) -{ - Application application = Application::New( &argc, &argv ); - - RunTest( application ); - - return 0; -} diff --git a/examples/metaball-refrac/metaball-refrac-example.cpp b/examples/metaball-refrac/metaball-refrac-example.cpp deleted file mode 100644 index 713032d..0000000 --- a/examples/metaball-refrac/metaball-refrac-example.cpp +++ /dev/null @@ -1,865 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include -#include -#include - -#include -#include -#include "shared/utility.h" - -using namespace Dali; -using namespace Dali::Toolkit; - -namespace -{ -const char * const BACKGROUND_IMAGE( DEMO_IMAGE_DIR "background-2.jpg" ); -const char * const TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" ); - -const float GRAVITY_X(0); -const float GRAVITY_Y(-0.09); -} - -#define METABALL_NUMBER 4 - -const char*const METABALL_VERTEX_SHADER = DALI_COMPOSE_SHADER ( - attribute mediump vec2 aPosition;\n - attribute mediump vec2 aTexture;\n - attribute mediump vec3 aNormal;\n - uniform mediump mat4 uMvpMatrix;\n - uniform mediump vec3 uSize;\n - uniform lowp vec4 uColor;\n - varying mediump vec2 vTexCoord;\n - - void main()\n - {\n - mediump vec4 vertexPosition = vec4(aPosition.x, aPosition.y, 0.0, 1.0);\n - vertexPosition = uMvpMatrix * vertexPosition;\n - gl_Position = vertexPosition;\n - vTexCoord = aTexture;\n - }\n -); - - -const char*const METABALL_FRAG_SHADER = DALI_COMPOSE_SHADER ( - precision mediump float;\n - varying vec2 vTexCoord;\n - uniform vec2 uPositionMetaball;\n - uniform vec2 uPositionVar;\n - uniform vec2 uGravityVector;\n - uniform float uRadius;\n - uniform float uRadiusVar;\n - uniform float uAspect;\n - void main()\n - {\n - vec2 adjustedCoords = vTexCoord * 2.0 - 1.0;\n - vec2 finalMetaballPosition = uPositionMetaball + uGravityVector + uPositionVar;\n - - float distance = (adjustedCoords.x - finalMetaballPosition.x) * (adjustedCoords.x - finalMetaballPosition.x) + - (adjustedCoords.y - finalMetaballPosition.y) * (adjustedCoords.y - finalMetaballPosition.y);\n - float finalRadius = uRadius + uRadiusVar;\n - float color = finalRadius / sqrt( distance );\n - vec2 bordercolor = vec2(0.0,0.0);\n - if (vTexCoord.x < 0.1)\n - {\n - bordercolor.x = (0.1 - vTexCoord.x) * 0.8;\n - }\n - if (vTexCoord.x > 0.9)\n - {\n - bordercolor.x = (vTexCoord.x - 0.9) * 0.8;\n - }\n - if (vTexCoord.y < 0.1)\n - {\n - bordercolor.y = (0.1 - vTexCoord.y) * 0.8;\n - }\n - if (vTexCoord.y > (0.9 * uAspect))\n - {\n - bordercolor.y = (vTexCoord.y - (0.9 * uAspect)) * 0.8;\n - }\n - float border = (bordercolor.x + bordercolor.y) * 0.5;\n - gl_FragColor = vec4(color + border,color + border,color + border,1.0);\n - }\n -); - -const char*const REFRACTION_FRAG_SHADER = DALI_COMPOSE_SHADER ( - precision mediump float;\n - varying vec2 vTexCoord;\n - uniform sampler2D sTexture;\n - uniform sampler2D sEffect;\n - void main()\n - {\n - vec4 metaColor = texture2D(sEffect, vTexCoord);\n - vec2 zoomCoords;\n - float bright = 1.0;\n - if (metaColor.r > 0.85)\n - {\n - zoomCoords = ((vTexCoord - 0.5) * 0.95) + 0.5;\n - }\n - else if (metaColor.r > 0.81)\n - {\n - float interpolation = mix(0.95, 1.05, (0.85 - metaColor.r) * 50.0);\n - zoomCoords = ((vTexCoord - 0.5) * interpolation) + 0.5;\n - bright = 1.2;\n - }\n - else\n - {\n - zoomCoords = vTexCoord;\n - }\n - - gl_FragColor = texture2D(sTexture, zoomCoords) * bright;\n - }\n - ); - -const char*const FRAG_SHADER = DALI_COMPOSE_SHADER ( - precision mediump float;\n - varying vec2 vTexCoord;\n - uniform sampler2D sTexture;\n - void main()\n - {\n - gl_FragColor = texture2D(sTexture, vTexCoord);\n - }\n -); - - -struct MetaballInfo -{ - Actor actor; - Vector2 position; - float radius; - float initRadius; - - //Properties needed for animations - Property::Index positionIndex; - Property::Index positionVarIndex; - Property::Index gravityIndex; - Property::Index radiusIndex; - Property::Index radiusVarIndex; - Property::Index aspectIndex; -}; - - -/***************************************************************************/ -/* Demo using Metaballs for Refraction when clicking the screen ************/ -/* The concept is similar to the Note 5 ScreenLock ************/ -/***************************************************************************/ -class MetaballRefracController : public ConnectionTracker -{ -public: - MetaballRefracController( Application& application ); - ~MetaballRefracController(); - - void Create( Application& app ); - bool OnTouch( Actor actor, const TouchData& touch ); - void OnKeyEvent(const KeyEvent& event); - - void SetGravity(const Vector2 & gravity); - - -private: - Application& mApplication; - Vector2 mScreenSize; - - Layer mContentLayer; - - Image mBackImage; - FrameBufferImage mMetaballFBO; - - Actor mMetaballRoot; - MetaballInfo mMetaballs[METABALL_NUMBER]; - - Actor mCompositionActor; - - //Motion - Vector2 mCurrentTouchPosition; - Vector2 mMetaballPosVariation; - Vector2 mMetaballPosVariationFrom; - Vector2 mMetaballPosVariationTo; - Vector2 mMetaballCenter; - - Vector2 mGravity; - Vector2 mGravityVar; - - Renderer mRendererRefraction; - TextureSet mTextureSetRefraction; - Shader mShaderRefraction; - TextureSet mTextureSetNormal; - Shader mShaderNormal; - - //Animations - Animation mGravityAnimation[METABALL_NUMBER]; - Animation mRadiusDecAnimation[METABALL_NUMBER]; - Animation mRadiusIncFastAnimation[METABALL_NUMBER]; - Animation mRadiusIncSlowAnimation[METABALL_NUMBER]; - Animation mRadiusVarAnimation[METABALL_NUMBER]; - Animation mPositionVarAnimation[METABALL_NUMBER]; - - //Private functions - Geometry CreateGeometry(); - Geometry CreateGeometryComposition(); - - void CreateMetaballActors(); - void CreateMetaballImage(); - void AddRefractionImage(); - void CreateAnimations(); - - void LaunchRadiusIncSlowAnimations(Animation &source); - void LaunchGetBackToPositionAnimation(Animation &source); - - void StopClickAnimations(); - void StopAfterClickAnimations(); - - void ResetMetaballsState(); - - void SetPositionToMetaballs(Vector2 & metaballCenter); -}; - - -//----------------------------------------------------------------------------------------------- -// -// IMPLEMENTATION -// -//---------------- - -MetaballRefracController::MetaballRefracController( Application& application ) - : mApplication( application ) -{ - // Connect to the Application's Init signal - mApplication.InitSignal().Connect( this, &MetaballRefracController::Create ); -} - -MetaballRefracController::~MetaballRefracController() -{ - // Nothing to do here; -} - -/* - * Setter function for gravity - */ -void MetaballRefracController::SetGravity(const Vector2 & gravity) -{ - mGravity = gravity; -} - -/** - * Main create function, it creates the metaballs and all the - */ -void MetaballRefracController::Create( Application& app ) -{ - Stage stage = Stage::GetCurrent(); - - stage.KeyEventSignal().Connect(this, &MetaballRefracController::OnKeyEvent); - - mScreenSize = stage.GetSize(); - - stage.SetBackgroundColor(Color::BLACK); - - //Set background image for the view - mBackImage = DemoHelper::LoadImage( BACKGROUND_IMAGE ); - - mGravity = Vector2(GRAVITY_X,GRAVITY_Y); - mGravityVar = Vector2(0,0); - - //Create internal data - CreateMetaballActors(); - CreateMetaballImage(); - AddRefractionImage(); - - CreateAnimations(); - - // Connect the callback to the touch signal on the mesh actor - stage.GetRootLayer().TouchSignal().Connect( this, &MetaballRefracController::OnTouch ); -} - -/** - * Create a mesh data with the geometry for the metaball rendering - */ -Geometry MetaballRefracController::CreateGeometry() -{ - float aspect = (float)mScreenSize.y / (float)mScreenSize.x; - - // Create vertices and specify their color - float xsize = mScreenSize.x * 0.5; - - //We create the meshdata for the metaballs - struct VertexPosition { Vector2 position; }; - struct VertexTexture { Vector2 texture; }; - struct VertexNormal { Vector3 normal; }; - - VertexPosition vertices[] = { - { Vector2( -xsize, -xsize * aspect) }, - { Vector2( xsize, -xsize * aspect) }, - { Vector2( -xsize, xsize * aspect) }, - { Vector2( xsize, xsize * aspect) } - }; - - VertexTexture textures[] = { - { Vector2(0.0f, 0.0f) }, - { Vector2(1.0f, 0.0f) }, - { Vector2(0.0f, 1.0f * aspect) }, - { Vector2(1.0f, 1.0f * aspect) } - }; - - VertexNormal normals [] = { - { Vector3(0.0f, 0.0f, 1.0f) }, - { Vector3(0.0f, 0.0f, 1.0f) }, - { Vector3(0.0f, 0.0f, 1.0f) }, - { Vector3(0.0f, 0.0f, 1.0f) } - }; - - unsigned int numberOfVertices = sizeof(vertices)/sizeof(VertexPosition); - - //Vertices - Property::Map positionVertexFormat; - positionVertexFormat["aPosition"] = Property::VECTOR2; - PropertyBuffer positionVertices = PropertyBuffer::New( positionVertexFormat ); - positionVertices.SetData( vertices, numberOfVertices ); - - //Textures - Property::Map textureVertexFormat; - textureVertexFormat["aTexture"] = Property::VECTOR2; - PropertyBuffer textureVertices = PropertyBuffer::New( textureVertexFormat ); - textureVertices.SetData( textures, numberOfVertices ); - - //Normals - Property::Map normalVertexFormat; - normalVertexFormat["aNormal"] = Property::VECTOR3; - PropertyBuffer normalVertices = PropertyBuffer::New( normalVertexFormat ); - normalVertices.SetData( normals, numberOfVertices ); - - //Indices - unsigned short indices[] = { 0, 3, 1, 0, 2, 3 }; - - // Create the geometry object - Geometry texturedQuadGeometry = Geometry::New(); - texturedQuadGeometry.AddVertexBuffer( positionVertices ); - texturedQuadGeometry.AddVertexBuffer( textureVertices ); - texturedQuadGeometry.AddVertexBuffer( normalVertices ); - - texturedQuadGeometry.SetIndexBuffer ( &indices[0], 6 ); - - return texturedQuadGeometry; -} - -/** - * Create a mesh data with the geometry for the metaball rendering - */ -Geometry MetaballRefracController::CreateGeometryComposition() -{ - float aspect = (float)mScreenSize.y / (float)mScreenSize.x; - - // Create vertices and specify their color - float xsize = mScreenSize.x * 0.5; - - //We create the meshdata for the metaballs - struct VertexPosition { Vector2 position; }; - struct VertexTexture { Vector2 texture; }; - struct VertexNormal { Vector3 normal; }; - - VertexPosition vertices[] = { - { Vector2( -xsize, -xsize * aspect) }, - { Vector2( xsize, -xsize * aspect) }, - { Vector2( -xsize, xsize * aspect) }, - { Vector2( xsize, xsize * aspect) } - }; - - VertexTexture textures[] = { - { Vector2(0.0f, 0.0f) }, - { Vector2(1.0f, 0.0f) }, - { Vector2(0.0f, 1.0f) }, - { Vector2(1.0f, 1.0f) } - }; - - VertexNormal normals [] = { - { Vector3(0.0f, 0.0f, 1.0f) }, - { Vector3(0.0f, 0.0f, 1.0f) }, - { Vector3(0.0f, 0.0f, 1.0f) }, - { Vector3(0.0f, 0.0f, 1.0f) } - }; - - unsigned int numberOfVertices = sizeof(vertices)/sizeof(VertexPosition); - - //Vertices - Property::Map positionVertexFormat; - positionVertexFormat["aPosition"] = Property::VECTOR2; - PropertyBuffer positionVertices = PropertyBuffer::New( positionVertexFormat ); - positionVertices.SetData( vertices, numberOfVertices ); - - //Textures - Property::Map textureVertexFormat; - textureVertexFormat["aTexture"] = Property::VECTOR2; - PropertyBuffer textureVertices = PropertyBuffer::New( textureVertexFormat ); - textureVertices.SetData( textures, numberOfVertices ); - - //Normals - Property::Map normalVertexFormat; - normalVertexFormat["aNormal"] = Property::VECTOR3; - PropertyBuffer normalVertices = PropertyBuffer::New( normalVertexFormat ); - normalVertices.SetData( normals, numberOfVertices ); - - //Indices - unsigned short indices[] = { 0, 3, 1, 0, 2, 3 }; - - // Create the geometry object - Geometry texturedQuadGeometry = Geometry::New(); - texturedQuadGeometry.AddVertexBuffer( positionVertices ); - texturedQuadGeometry.AddVertexBuffer( textureVertices ); - texturedQuadGeometry.AddVertexBuffer( normalVertices ); - - texturedQuadGeometry.SetIndexBuffer ( &indices[0], sizeof( indices )/ sizeof( indices[0] ) ); - - return texturedQuadGeometry; -} - -/** - * Create a mesh actor for the metaballs - */ -void MetaballRefracController::CreateMetaballActors() -{ - //We create metaball structures - //With MeshData Textured - float aspect = (float)mScreenSize.y / (float)mScreenSize.x; - - //Create the renderer for the metaballs - Shader shader = Shader::New( METABALL_VERTEX_SHADER, METABALL_FRAG_SHADER ); - Geometry metaballGeom = CreateGeometry(); - Renderer renderer = Renderer::New( metaballGeom, shader ); - renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON ); - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::ONE ); - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::ONE ); - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::ONE ); - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::ONE ); - - //Each metaball has a different radius - mMetaballs[0].radius = mMetaballs[0].initRadius = 0.0145f; - mMetaballs[1].radius = mMetaballs[1].initRadius = 0.012f; - mMetaballs[2].radius = mMetaballs[2].initRadius = 0.0135f; - mMetaballs[3].radius = mMetaballs[3].initRadius = 0.0135f; - - //Initialization of each of the metaballs - for (int i = 0 ; i < METABALL_NUMBER ; i++) - { - mMetaballs[i].position = Vector2(0.0f, 0.0f); - - mMetaballs[i].actor = Actor::New( ); - mMetaballs[i].actor.SetName("Metaball"); - mMetaballs[i].actor.SetScale( 1.0f ); - mMetaballs[i].actor.SetParentOrigin( ParentOrigin::CENTER ); - - - mMetaballs[i].actor.AddRenderer( renderer ); - - mMetaballs[i].positionIndex = mMetaballs[i].actor.RegisterProperty( "uPositionMetaball", mMetaballs[i].position ); - - mMetaballs[i].positionVarIndex = mMetaballs[i].actor.RegisterProperty( "uPositionVar", Vector2(0.f,0.f) ); - - mMetaballs[i].gravityIndex = mMetaballs[i].actor.RegisterProperty( "uGravityVector", Vector2(0.f,0.f) ); - - mMetaballs[i].radiusIndex = mMetaballs[i].actor.RegisterProperty( "uRadius", mMetaballs[i].radius ); - - mMetaballs[i].radiusVarIndex = mMetaballs[i].actor.RegisterProperty( "uRadiusVar", 0.f ); - - mMetaballs[i].aspectIndex = mMetaballs[i].actor.RegisterProperty( "uAspect", aspect ); - - mMetaballs[i].actor.SetSize(400, 400); - } - - //Root creation - mMetaballRoot = Actor::New(); - mMetaballRoot.SetParentOrigin( ParentOrigin::CENTER ); - for (int i = 0 ; i < METABALL_NUMBER ; i++) - { - mMetaballRoot.Add( mMetaballs[i].actor ); - } - - //Initialization of variables related to metaballs - mMetaballPosVariation = Vector2(0,0); - mMetaballPosVariationFrom = Vector2(0,0); - mMetaballPosVariationTo = Vector2(0,0); - mCurrentTouchPosition = Vector2(0,0); -} - -/** - * Create the render task and FBO to render the metaballs into a texture - */ -void MetaballRefracController::CreateMetaballImage() -{ - //We create an FBO and a render task to create to render the metaballs with a fragment shader - Stage stage = Stage::GetCurrent(); - mMetaballFBO = FrameBufferImage::New(mScreenSize.x, mScreenSize.y ); - - stage.Add(mMetaballRoot); - - //Creation of the render task used to render the metaballs - RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); - RenderTask task = taskList.CreateTask(); - task.SetRefreshRate( RenderTask::REFRESH_ALWAYS ); - task.SetSourceActor( mMetaballRoot ); - task.SetExclusive(true); - task.SetClearColor( Color::BLACK ); - task.SetClearEnabled( true ); - task.SetTargetFrameBuffer( mMetaballFBO ); -} - -/** - * Create a mesh image to render the final composition - */ -void MetaballRefracController::AddRefractionImage() -{ - //Creation of the composition image - - //Create geometry - Geometry metaballGeom = CreateGeometryComposition(); - - //Create Refraction shader and renderer - mShaderRefraction = Shader::New( METABALL_VERTEX_SHADER, REFRACTION_FRAG_SHADER ); - - //Create new texture set - mTextureSetRefraction = TextureSet::New(); - TextureSetImage( mTextureSetRefraction, 0u, mBackImage ); - TextureSetImage( mTextureSetRefraction, 1u, mMetaballFBO ); - - //Create normal shader - mShaderNormal = Shader::New( METABALL_VERTEX_SHADER, FRAG_SHADER ); - - //Create new texture set - mTextureSetNormal = TextureSet::New(); - TextureSetImage( mTextureSetNormal, 0u, mBackImage ); - - //Create actor - mCompositionActor = Actor::New( ); - mCompositionActor.SetParentOrigin(ParentOrigin::CENTER); - mCompositionActor.SetPosition(Vector3(0.0f, 0.0f, 0.0f)); - mCompositionActor.SetSize(mScreenSize.x, mScreenSize.y); - - mRendererRefraction = Renderer::New( metaballGeom, mShaderNormal ); - mRendererRefraction.SetTextures( mTextureSetNormal ); - mCompositionActor.AddRenderer( mRendererRefraction ); - - Stage stage = Stage::GetCurrent(); - stage.Add( mCompositionActor ); -} - -/** - * Creation of all the metaballs animations (gravity, movement, size, etc.) - */ -void MetaballRefracController::CreateAnimations() -{ - int i = 0; - float key; - - mPositionVarAnimation[1] = Animation::New(2.f); - mPositionVarAnimation[1].SetLooping( false ); - mPositionVarAnimation[1].Pause(); - mPositionVarAnimation[1].FinishedSignal().Connect( this, &MetaballRefracController::LaunchGetBackToPositionAnimation ); - - KeyFrames keySinCosVariation = KeyFrames::New(); - Vector2 sinCosVariation(0,0); - for ( i = 0 ; i < 360 ; i++) - { - sinCosVariation.x = 0.05f * (-sin(i * Math::PI/180.f) + cos(i * Math::PI/180.f)); - sinCosVariation.y = 0.05f * (sin(i * Math::PI/180.f) - cos(i * Math::PI/180.f)); - key = i/360.f; - keySinCosVariation.Add(key, sinCosVariation); - } - - mPositionVarAnimation[2] = Animation::New(6.f); - mPositionVarAnimation[2].AnimateBetween(Property( mMetaballs[2].actor, mMetaballs[2].positionVarIndex ), keySinCosVariation); - mPositionVarAnimation[2].SetLooping( true ); - mPositionVarAnimation[2].Pause(); - - KeyFrames keyCosSinVariation = KeyFrames::New(); - Vector2 cosSinVariation(0,0); - for ( i = 0 ; i < 360 ; i++) - { - cosSinVariation.x = 0.05f * (-sin(i * Math::PI/180.f) - cos(i * Math::PI/180.f)); - cosSinVariation.y = 0.05f * (sin(i * Math::PI/180.f) + cos(i * Math::PI/180.f)); - key = i/360.f; - keyCosSinVariation.Add(key, cosSinVariation); - } - - mPositionVarAnimation[3] = Animation::New(6.f); - mPositionVarAnimation[3].AnimateBetween(Property( mMetaballs[3].actor, mMetaballs[3].positionVarIndex ), keyCosSinVariation); - mPositionVarAnimation[3].SetLooping( true ); - mPositionVarAnimation[3].Pause(); - - //Animations for gravity - for ( i = 0 ; i < METABALL_NUMBER ; i++) - { - mGravityAnimation[i] = Animation::New(25.f); - mGravityAnimation[i].AnimateBy( Property( mMetaballs[i].actor, mMetaballs[i].gravityIndex ), mGravity * 25.f * 3.f); - mGravityAnimation[i].SetLooping( false ); - mGravityAnimation[i].Pause(); - } - - //Animation to decrease size of metaballs when there is no click - for ( i = 0 ; i < METABALL_NUMBER ; i++) - { - mRadiusDecAnimation[i] = Animation::New(25.f); - mRadiusDecAnimation[i].AnimateBy( Property( mMetaballs[i].actor, mMetaballs[i].radiusIndex ), -0.004f * 25.f * 3.f); - mRadiusDecAnimation[i].SetLooping( false ); - mRadiusDecAnimation[i].Pause(); - } - - //Animation to grow the size of the metaballs the first second of the click - for ( i = 0 ; i < METABALL_NUMBER ; i++) - { - mRadiusIncFastAnimation[i] = Animation::New(0.3f); - mRadiusIncFastAnimation[i].AnimateBy( Property( mMetaballs[i].actor, mMetaballs[i].radiusIndex ), 0.06f); - mRadiusIncFastAnimation[i].SetLooping( false ); - mRadiusIncFastAnimation[i].Pause(); - } - mRadiusIncFastAnimation[0].FinishedSignal().Connect( this, &MetaballRefracController::LaunchRadiusIncSlowAnimations ); - - //Animation to grow the size of the metaballs afterwards - for ( i = 0 ; i < METABALL_NUMBER ; i++) - { - mRadiusIncSlowAnimation[i] = Animation::New(20.f); - mRadiusIncSlowAnimation[i].AnimateBy( Property( mMetaballs[i].actor, mMetaballs[i].radiusIndex ), 0.04f); - mRadiusIncSlowAnimation[i].SetLooping( false ); - mRadiusIncSlowAnimation[i].Pause(); - } - - //keyframes of a sin function - KeyFrames keySin = KeyFrames::New(); - float val; - for ( i = 0 ; i < 360 ; i++) - { - val = 0.01f * sin(i * Math::PI/180.f); - key = i/360.f; - keySin.Add(key, val); - } - - //Animation to change the size of the metaball - mRadiusVarAnimation[2] = Animation::New(8.f); - mRadiusVarAnimation[2].AnimateBetween(Property( mMetaballs[2].actor, mMetaballs[2].radiusVarIndex ), keySin); - mRadiusVarAnimation[2].SetLooping( true ); - - //keyframes of a cos function - KeyFrames keyCos = KeyFrames::New(); - for ( i = 0 ; i < 360 ; i++) - { - val = 0.01f * cos(i * Math::PI/180.f); - key = i/360.f; - keyCos.Add(key, val); - } - - //Animation to change the size of the metaball - mRadiusVarAnimation[3] = Animation::New(8.f); - mRadiusVarAnimation[3].AnimateBetween(Property( mMetaballs[3].actor, mMetaballs[3].radiusVarIndex ), keyCos); - mRadiusVarAnimation[3].SetLooping( true ); -} - -/** - * Function to launch the animation to get the metaball[1] back to the center - */ -void MetaballRefracController::LaunchGetBackToPositionAnimation(Animation &source) -{ - mMetaballPosVariationTo = Vector2(0,0); - - mPositionVarAnimation[1] = Animation::New(1.f); - mPositionVarAnimation[1].SetLooping( false ); - mPositionVarAnimation[1].AnimateTo(Property( mMetaballs[1].actor, mMetaballs[1].positionVarIndex ), Vector2(0,0)); - mPositionVarAnimation[1].Play(); -} - -/** - * Function to launch the gro slow radius for the metaballs, and also the small variations for metaball[2] and [3] - */ -void MetaballRefracController::LaunchRadiusIncSlowAnimations(Animation &source) -{ - for (int i = 0 ; i < METABALL_NUMBER ; i++) - { - mRadiusIncSlowAnimation[i].Play(); - } - mPositionVarAnimation[2].Play(); - mPositionVarAnimation[3].Play(); -} - -/** - * Function to stop all animations related to the click of the user in the screen - */ -void MetaballRefracController::StopClickAnimations() -{ - for (int i = 0 ; i < METABALL_NUMBER ; i++) - { - mRadiusIncSlowAnimation[i].Stop(); - mRadiusIncFastAnimation[i].Stop(); - } - mPositionVarAnimation[1].Stop(); - mPositionVarAnimation[2].Stop(); - mPositionVarAnimation[3].Stop(); -} - -/** - * Function to stop all animations related to the after click of the user in the screen - */ -void MetaballRefracController::StopAfterClickAnimations() -{ - for (int i = 0 ; i < METABALL_NUMBER ; i++) - { - mGravityAnimation[i].Stop(); - mRadiusDecAnimation[i].Stop(); - - mMetaballs[i].radius = mMetaballs[i].initRadius; - - mMetaballs[i].actor.SetProperty(mMetaballs[i].gravityIndex, Vector2(0,0)); - mMetaballs[i].actor.SetProperty(mMetaballs[i].radiusIndex, mMetaballs[i].radius); - mMetaballs[i].actor.SetProperty(mMetaballs[i].radiusVarIndex, 0.f); - } - mRadiusVarAnimation[2].Stop(); - mRadiusVarAnimation[3].Stop(); -} - -/* - * Function that resets the sate of the different Metaballs - */ -void MetaballRefracController::ResetMetaballsState() -{ - mRendererRefraction.SetTextures(mTextureSetNormal); - mRendererRefraction.SetShader( mShaderNormal ); - - for (int i = 0 ; i < METABALL_NUMBER ; i++) - { - mMetaballs[i].radius = mMetaballs[i].initRadius; - } - - mMetaballPosVariationTo = Vector2(0,0); - mMetaballPosVariationFrom = Vector2(0,0); - mMetaballPosVariation = Vector2(0,0); - - mGravityVar = Vector2(0,0); -} - -/** - * Function to set the actual position of the metaballs when the user clicks the screen - */ -void MetaballRefracController::SetPositionToMetaballs(Vector2 & metaballCenter) -{ - //We set the position for the metaballs based on click position - for (int i = 0 ; i < METABALL_NUMBER ; i++) - { - mMetaballs[i].position = metaballCenter; - mMetaballs[i].actor.SetProperty(mMetaballs[i].positionIndex, mMetaballs[0].position); // 0 y no i ?!?!?! - } -} - -bool MetaballRefracController::OnTouch( Actor actor, const TouchData& touch ) -{ - float aspectR = mScreenSize.y / mScreenSize.x; - switch( touch.GetState( 0 ) ) - { - case PointState::DOWN: - { - StopAfterClickAnimations(); - for (int i = 0 ; i < METABALL_NUMBER ; i++) - mRadiusIncFastAnimation[i].Play(); - mRadiusVarAnimation[2].Play(); - mRadiusVarAnimation[3].Play(); - - //We draw with the refraction-composition shader - mRendererRefraction.SetTextures(mTextureSetRefraction); - mRendererRefraction.SetShader( mShaderRefraction ); - mCurrentTouchPosition = touch.GetScreenPosition( 0 ); - - //we use the click position for the metaballs - Vector2 metaballCenter = Vector2((mCurrentTouchPosition.x / mScreenSize.x) - 0.5, (aspectR * (mScreenSize.y - mCurrentTouchPosition.y) / mScreenSize.y) - 0.5) * 2.0; - SetPositionToMetaballs(metaballCenter); - break; - } - case PointState::MOTION: - { - Vector2 screen = touch.GetScreenPosition( 0 ); - Vector2 displacement = screen - mCurrentTouchPosition; - mCurrentTouchPosition = screen; - - mMetaballPosVariationTo.x += (displacement.x / mScreenSize.x) * 2.2; - mMetaballPosVariationTo.y += (- displacement.y / mScreenSize.y) * 2.2; - - if (mPositionVarAnimation[1]) - { - mPositionVarAnimation[1].FinishedSignal().Disconnect( this, &MetaballRefracController::LaunchGetBackToPositionAnimation ); - mPositionVarAnimation[1].Stop(); - } - mPositionVarAnimation[1] = Animation::New(1.f); - mPositionVarAnimation[1].SetLooping( false ); - mPositionVarAnimation[1].AnimateTo(Property( mMetaballs[1].actor, mMetaballs[1].positionVarIndex ), mMetaballPosVariationTo); - mPositionVarAnimation[1].FinishedSignal().Connect( this, &MetaballRefracController::LaunchGetBackToPositionAnimation ); - mPositionVarAnimation[1].Play(); - - //we use the click position for the metaballs - Vector2 metaballCenter = Vector2((screen.x / mScreenSize.x) - 0.5, (aspectR * (mScreenSize.y - screen.y) / mScreenSize.y) - 0.5) * 2.0; - SetPositionToMetaballs(metaballCenter); - break; - } - case PointState::UP: - case PointState::LEAVE: - case PointState::INTERRUPTED: - { - //Stop click animations - StopClickAnimations(); - - //Launch out of screen animations - for (int i = 0 ; i < METABALL_NUMBER ; i++) - mGravityAnimation[i].Play(); - - for (int i = 0 ; i < METABALL_NUMBER ; i++) - mRadiusDecAnimation[i].Play(); - - break; - } - default: - break; - } - return true; -} - - -void MetaballRefracController::OnKeyEvent(const KeyEvent& event) -{ - if(event.state == KeyEvent::Down) - { - if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) ) - { - mApplication.Quit(); - } - } -} - - -// -// -//----------------------------------------------------------------------------------------------- - -void RunTest( Application& application ) -{ - MetaballRefracController test( application ); - - application.MainLoop(); -} - -// Entry point for Linux & Tizen applications -// -int DALI_EXPORT_API main( int argc, char **argv ) -{ - Application application = Application::New( &argc, &argv ); - - RunTest( application ); - - return 0; -} diff --git a/examples/new-window/new-window-example.cpp b/examples/new-window/new-window-example.cpp deleted file mode 100644 index 545f8ad..0000000 --- a/examples/new-window/new-window-example.cpp +++ /dev/null @@ -1,568 +0,0 @@ -/* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// EXTERNAL INCLUDES -#include -#include -#include -#include -#include -#include - -#include -#include - -// INTERNAL INCLUDES -#include "shared/view.h" -#include "shared/utility.h" - -using namespace Dali; -using namespace Dali::Toolkit; - -class NewWindowController; - -namespace -{ -const char * const BACKGROUND_IMAGE( DEMO_IMAGE_DIR "background-2.jpg" ); -const char * const TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" ); -const char * const LOSE_CONTEXT_IMAGE( DEMO_IMAGE_DIR "icon-cluster-wobble.png" ); -const char * const LOSE_CONTEXT_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-cluster-wobble-selected.png" ); -const char * const BASE_IMAGE( DEMO_IMAGE_DIR "gallery-large-14.jpg" ); -const char * const EFFECT_IMAGE( DEMO_IMAGE_DIR "gallery-large-18.jpg" ); -const char * const LOGO_IMAGE(DEMO_IMAGE_DIR "dali-logo.png"); - -const float EXPLOSION_DURATION(1.2f); -const unsigned int EMIT_INTERVAL_IN_MS(40); -const float TRACK_DURATION_IN_MS(970); - -Application gApplication; -NewWindowController* gNewWindowController(NULL); - -#define MAKE_SHADER(A)#A - -const char* VERTEX_COLOR_MESH = MAKE_SHADER( -attribute mediump vec3 aPosition;\n -attribute lowp vec3 aColor;\n -uniform mediump mat4 uMvpMatrix;\n -uniform mediump vec3 uSize;\n -varying lowp vec3 vColor;\n -\n -void main()\n -{\n - gl_Position = uMvpMatrix * vec4( aPosition*uSize, 1.0 );\n - vColor = aColor;\n -}\n -); - -const char* FRAGMENT_COLOR_MESH = MAKE_SHADER( -uniform lowp vec4 uColor;\n -varying lowp vec3 vColor;\n -\n -void main()\n -{\n - gl_FragColor = vec4(vColor,1.0)*uColor; -}\n -); - -const char* VERTEX_TEXTURE_MESH = MAKE_SHADER( -attribute mediump vec3 aPosition;\n -attribute highp vec2 aTexCoord;\n -uniform mediump mat4 uMvpMatrix;\n -uniform mediump vec3 uSize;\n -varying mediump vec2 vTexCoord;\n -\n -void main()\n -{\n - gl_Position = uMvpMatrix * vec4( aPosition*uSize, 1.0 );\n - vTexCoord = aTexCoord;\n -}\n -); - -const char* FRAGMENT_TEXTURE_MESH = MAKE_SHADER( -varying mediump vec2 vTexCoord;\n -uniform lowp vec4 uColor;\n -uniform sampler2D sTexture;\n -\n -void main()\n -{\n - gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor; -}\n -); - -const char* FRAGMENT_BLEND_SHADER = MAKE_SHADER( -varying mediump vec2 vTexCoord;\n -uniform sampler2D sTexture;\n -uniform sampler2D sEffect;\n -uniform mediump float alpha;\n -\n -void main()\n -{\n - mediump vec4 fragColor = texture2D(sTexture, vTexCoord);\n - mediump vec4 fxColor = texture2D(sEffect, vTexCoord);\n - gl_FragColor = mix(fragColor,fxColor, alpha);\n -}\n -); - -}; // anonymous namespace - - -class NewWindowController : public ConnectionTracker -{ -public: - NewWindowController( Application& app ); - void Create( Application& app ); - void Destroy( Application& app ); - - void AddBubbles( Actor& parentActor, const Vector2& stageSize); - void AddMeshActor( Actor& parentActor ); - void AddBlendingImageActor( Actor& parentActor ); - void AddTextLabel( Actor& parentActor ); - - ImageView CreateBlurredMirrorImage(const char* imageName); - FrameBufferImage CreateFrameBufferForImage( const char* imageName, Property::Map& shaderEffect, const Vector3& rgbDelta ); - void SetUpBubbleEmission( const Vector2& emitPosition, const Vector2& direction ); - Geometry CreateMeshGeometry(); - Dali::Property::Map CreateColorModifierer(); - - static void NewWindow(void); - - bool OnTrackTimerTick(); - void OnKeyEvent(const KeyEvent& event); - bool OnLoseContextButtonClicked( Toolkit::Button button ); - void OnContextLost(); - void OnContextRegained(); - -private: - Application mApplication; - TextLabel mTextActor; - - Toolkit::Control mView; ///< The View instance. - Toolkit::ToolBar mToolBar; ///< The View's Toolbar. - TextLabel mTitleActor; ///< The Toolbar's Title. - Layer mContentLayer; ///< Content layer (scrolling cluster content) - Toolkit::PushButton mLoseContextButton; - - Toolkit::BubbleEmitter mEmitter; - Timer mEmitTrackTimer; - bool mNeedNewAnimation; - unsigned int mAnimateComponentCount; - Animation mEmitAnimation; -}; - - -NewWindowController::NewWindowController( Application& application ) -: mApplication(application), - mNeedNewAnimation(true), - mAnimateComponentCount( 0 ) -{ - mApplication.InitSignal().Connect(this, &NewWindowController::Create); - mApplication.TerminateSignal().Connect(this, &NewWindowController::Destroy); -} - -void NewWindowController::Create( Application& app ) -{ - Stage stage = Stage::GetCurrent(); - stage.SetBackgroundColor(Color::YELLOW); - - stage.KeyEventSignal().Connect(this, &NewWindowController::OnKeyEvent); - - // The Init signal is received once (only) during the Application lifetime - - // Hide the indicator bar - mApplication.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); - - mContentLayer = DemoHelper::CreateView( app, - mView, - mToolBar, - "", - TOOLBAR_IMAGE, - "Context recovery" ); - - Size stageSize = stage.GetSize(); - ImageView backgroundActor = ImageView::New( BACKGROUND_IMAGE, Dali::ImageDimensions( stageSize.x, stageSize.y ) ); - backgroundActor.SetParentOrigin( ParentOrigin::CENTER ); - mContentLayer.Add(backgroundActor); - - // Point the default render task at the view - RenderTaskList taskList = stage.GetRenderTaskList(); - RenderTask defaultTask = taskList.GetTask( 0u ); - if ( defaultTask ) - { - defaultTask.SetSourceActor( mView ); - } - - mLoseContextButton = Toolkit::PushButton::New(); - mLoseContextButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, LOSE_CONTEXT_IMAGE ); - mLoseContextButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, LOSE_CONTEXT_IMAGE_SELECTED ); - mLoseContextButton.ClickedSignal().Connect( this, &NewWindowController::OnLoseContextButtonClicked ); - mToolBar.AddControl( mLoseContextButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); - - Actor logoLayoutActor = Actor::New(); - logoLayoutActor.SetParentOrigin(ParentOrigin::CENTER); - logoLayoutActor.SetPosition(0.0f, -200.0f, 0.0f); - logoLayoutActor.SetScale(0.5f); - backgroundActor.Add(logoLayoutActor); - - ImageView imageView = ImageView::New( LOGO_IMAGE ); - imageView.SetName("daliLogo"); - imageView.SetParentOrigin(ParentOrigin::CENTER); - imageView.SetAnchorPoint(AnchorPoint::BOTTOM_CENTER); - logoLayoutActor.Add(imageView); - - ImageView mirrorImageView = CreateBlurredMirrorImage(LOGO_IMAGE); - mirrorImageView.SetParentOrigin(ParentOrigin::TOP_CENTER); - mirrorImageView.SetAnchorPoint(AnchorPoint::BOTTOM_CENTER); - logoLayoutActor.Add(mirrorImageView); - - AddBubbles( backgroundActor, stage.GetSize()); - AddMeshActor( backgroundActor ); - AddBlendingImageActor( backgroundActor ); - AddTextLabel( backgroundActor ); - - stage.ContextLostSignal().Connect(this, &NewWindowController::OnContextLost); - stage.ContextRegainedSignal().Connect(this, &NewWindowController::OnContextRegained); -} - -void NewWindowController::Destroy( Application& app ) -{ - UnparentAndReset(mTextActor); -} - -void NewWindowController::AddBubbles( Actor& parentActor, const Vector2& stageSize) -{ - mEmitter = Toolkit::BubbleEmitter::New( stageSize, - DemoHelper::LoadTexture( DEMO_IMAGE_DIR "bubble-ball.png" ), - 200, Vector2( 5.0f, 5.0f ) ); - - Texture background = DemoHelper::LoadTexture(BACKGROUND_IMAGE); - mEmitter.SetBackground( background, Vector3(0.5f, 0.f,0.5f) ); - mEmitter.SetBubbleDensity( 9.f ); - Actor bubbleRoot = mEmitter.GetRootActor(); - parentActor.Add( bubbleRoot ); - bubbleRoot.SetParentOrigin(ParentOrigin::CENTER); - bubbleRoot.SetZ(0.1f); - - mEmitTrackTimer = Timer::New( EMIT_INTERVAL_IN_MS ); - mEmitTrackTimer.TickSignal().Connect(this, &NewWindowController::OnTrackTimerTick); - mEmitTrackTimer.Start(); -} - -void NewWindowController::AddMeshActor( Actor& parentActor ) -{ - Geometry meshGeometry = CreateMeshGeometry(); - - // Create a coloured mesh - Shader shaderColorMesh = Shader::New( VERTEX_COLOR_MESH, FRAGMENT_COLOR_MESH ); - Renderer colorMeshRenderer = Renderer::New( meshGeometry, shaderColorMesh ); - - Actor colorMeshActor = Actor::New(); - colorMeshActor.AddRenderer( colorMeshRenderer ); - colorMeshActor.SetSize( 175.f,175.f, 175.f ); - colorMeshActor.SetParentOrigin( ParentOrigin::CENTER ); - colorMeshActor.SetAnchorPoint(AnchorPoint::TOP_CENTER); - colorMeshActor.SetPosition(Vector3(0.0f, 50.0f, 0.0f)); - colorMeshActor.SetOrientation( Degree(75.f), Vector3::XAXIS ); - colorMeshActor.SetName("ColorMeshActor"); - - // Create a textured mesh - Texture effectTexture = DemoHelper::LoadTexture(EFFECT_IMAGE); - Shader shaderTextureMesh = Shader::New( VERTEX_TEXTURE_MESH, FRAGMENT_TEXTURE_MESH ); - TextureSet textureSet = TextureSet::New(); - textureSet.SetTexture( 0u, effectTexture ); - Renderer textureMeshRenderer = Renderer::New( meshGeometry, shaderTextureMesh ); - textureMeshRenderer.SetTextures( textureSet ); - - Actor textureMeshActor = Actor::New(); - textureMeshActor.AddRenderer( textureMeshRenderer ); - textureMeshActor.SetSize( 175.f,175.f, 175.f ); - textureMeshActor.SetParentOrigin( ParentOrigin::CENTER ); - textureMeshActor.SetAnchorPoint(AnchorPoint::TOP_CENTER); - textureMeshActor.SetPosition(Vector3(0.0f, 200.0f, 0.0f)); - textureMeshActor.SetOrientation( Degree(75.f), Vector3::XAXIS ); - textureMeshActor.SetName("TextureMeshActor"); - - Layer layer3d = Layer::New(); - layer3d.SetParentOrigin( ParentOrigin::CENTER ); - layer3d.SetAnchorPoint( AnchorPoint::CENTER ); - layer3d.SetBehavior(Layer::LAYER_3D); - - layer3d.Add( colorMeshActor ); - layer3d.Add( textureMeshActor ); - parentActor.Add(layer3d); -} - -void NewWindowController::AddBlendingImageActor( Actor& parentActor ) -{ - Property::Map colorModifier = CreateColorModifierer(); - - FrameBufferImage fb2 = CreateFrameBufferForImage( EFFECT_IMAGE, colorModifier, Vector3( 0.5f, 0.5f, 0.5f ) ); - - ImageView tmpActor = ImageView::New(fb2); - parentActor.Add(tmpActor); - tmpActor.SetParentOrigin(ParentOrigin::CENTER_RIGHT); - tmpActor.SetAnchorPoint(AnchorPoint::TOP_RIGHT); - tmpActor.SetPosition(Vector3(0.0f, 150.0f, 0.0f)); - tmpActor.SetScale(0.25f); - - // create blending shader effect - Property::Map customShader; - customShader[ "fragmentShader" ] = FRAGMENT_BLEND_SHADER; - Property::Map map; - map[ "shader" ] = customShader; - - ImageView blendActor = ImageView::New( BASE_IMAGE ); - blendActor.SetProperty( ImageView::Property::IMAGE, map ); - blendActor.RegisterProperty( "alpha", 0.5f ); - - blendActor.SetParentOrigin(ParentOrigin::CENTER_RIGHT); - blendActor.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT); - blendActor.SetPosition(Vector3(0.0f, 100.0f, 0.0f)); - blendActor.SetSize(140, 140); - parentActor.Add(blendActor); - - TextureSet textureSet = blendActor.GetRendererAt(0u).GetTextures(); - TextureSetImage( textureSet, 1u, fb2 ); -} - -void NewWindowController::AddTextLabel( Actor& parentActor ) -{ - mTextActor = TextLabel::New("Some text"); - mTextActor.SetParentOrigin(ParentOrigin::CENTER); - mTextActor.SetColor(Color::RED); - mTextActor.SetName("PushMe text"); - parentActor.Add( mTextActor ); -} - -ImageView NewWindowController::CreateBlurredMirrorImage(const char* imageName) -{ - Image image = DemoHelper::LoadImage(imageName); - - Vector2 FBOSize = Vector2( image.GetWidth(), image.GetHeight() ); - FrameBufferImage fbo = FrameBufferImage::New( FBOSize.width, FBOSize.height, Pixel::RGBA8888); - - GaussianBlurView gbv = GaussianBlurView::New(5, 2.0f, Pixel::RGBA8888, 0.5f, 0.5f, true); - gbv.SetBackgroundColor(Color::TRANSPARENT); - gbv.SetUserImageAndOutputRenderTarget( image, fbo ); - gbv.SetSize(FBOSize); - Stage::GetCurrent().Add(gbv); - gbv.ActivateOnce(); - - ImageView blurredActor = ImageView::New(fbo); - blurredActor.SetSize(FBOSize); - blurredActor.SetScale(1.0f, -1.0f, 1.0f); - return blurredActor; -} - -FrameBufferImage NewWindowController::CreateFrameBufferForImage(const char* imageName, Property::Map& shaderEffect, const Vector3& rgbDelta ) -{ - Stage stage = Stage::GetCurrent(); - Uint16Pair intFboSize = ResourceImage::GetImageSize( imageName ); - Vector2 FBOSize = Vector2(intFboSize.GetWidth(), intFboSize.GetHeight()); - - FrameBufferImage framebuffer = FrameBufferImage::New(FBOSize.x, FBOSize.y ); - - RenderTask renderTask = stage.GetRenderTaskList().CreateTask(); - - ImageView imageView = ImageView::New( imageName ); - imageView.SetName("Source image actor"); - imageView.SetProperty( ImageView::Property::IMAGE, shaderEffect ); - imageView.RegisterProperty( "uRGBDelta", rgbDelta ); - - imageView.SetParentOrigin(ParentOrigin::CENTER); - imageView.SetAnchorPoint(AnchorPoint::CENTER); - imageView.SetScale(1.0f, -1.0f, 1.0f); - stage.Add(imageView); // Not in default image view - - CameraActor cameraActor = CameraActor::New(FBOSize); - cameraActor.SetParentOrigin(ParentOrigin::CENTER); - cameraActor.SetFieldOfView(Math::PI*0.25f); - cameraActor.SetNearClippingPlane(1.0f); - cameraActor.SetAspectRatio(FBOSize.width / FBOSize.height); - cameraActor.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor - cameraActor.SetPosition(0.0f, 0.0f, ((FBOSize.height * 0.5f) / tanf(Math::PI * 0.125f))); - stage.Add(cameraActor); - - renderTask.SetSourceActor(imageView); - renderTask.SetInputEnabled(false); - renderTask.SetTargetFrameBuffer(framebuffer); - renderTask.SetCameraActor( cameraActor ); - renderTask.SetClearColor( Color::TRANSPARENT ); - renderTask.SetClearEnabled( true ); - renderTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - - return framebuffer; -} - -void NewWindowController::SetUpBubbleEmission( const Vector2& emitPosition, const Vector2& direction) -{ - if( mNeedNewAnimation ) - { - float duration = Random::Range(1.f, 1.5f); - mEmitAnimation = Animation::New( duration ); - mNeedNewAnimation = false; - mAnimateComponentCount = 0; - } - - mEmitter.EmitBubble( mEmitAnimation, emitPosition, direction, Vector2(10,10) ); - - mAnimateComponentCount++; - - if( mAnimateComponentCount % 6 ==0 ) - { - mEmitAnimation.Play(); - mNeedNewAnimation = true; - } -} - -Geometry NewWindowController::CreateMeshGeometry() -{ - // Create vertices and specify their color - struct Vertex - { - Vector3 position; - Vector2 textureCoordinates; - Vector3 color; - }; - - Vertex vertexData[5] = { - { Vector3( 0.0f, 0.0f, 0.5f ), Vector2(0.5f, 0.5f), Vector3(1.0f, 1.0f, 1.0f) }, - { Vector3( -0.5f, -0.5f, 0.0f ), Vector2(0.0f, 0.0f), Vector3(1.0f, 0.0f, 0.0f) }, - { Vector3( 0.5f, -0.5f, 0.0f ), Vector2(1.0f, 0.0f), Vector3(1.0f, 1.0f, 0.0f) }, - { Vector3( -0.5f, 0.5f, 0.0f ), Vector2(0.0f, 1.0f), Vector3(0.0f, 1.0f, 0.0f) }, - { Vector3( 0.5f, 0.5f, 0.0f ), Vector2(1.0f, 1.0f), Vector3(0.0f, 0.0f, 1.0f) } }; - - Property::Map vertexFormat; - vertexFormat["aPosition"] = Property::VECTOR3; - vertexFormat["aTexCoord"] = Property::VECTOR2; - vertexFormat["aColor"] = Property::VECTOR3; - PropertyBuffer vertices = PropertyBuffer::New( vertexFormat ); - vertices.SetData( vertexData, 5 ); - - // Specify all the faces - unsigned short indexData[12] = { 0,1,3,0,2,4,0,3,4,0,2,1 }; - - // Create the geometry object - Geometry geometry = Geometry::New(); - geometry.AddVertexBuffer( vertices ); - geometry.SetIndexBuffer( &indexData[0], 12 ); - - return geometry; -} - -Dali::Property::Map NewWindowController::CreateColorModifierer() -{ - const char* fragmentShader ( DALI_COMPOSE_SHADER ( - precision highp float;\n - uniform vec3 uRGBDelta;\n - uniform float uIgnoreAlpha;\n - \n - varying mediump vec2 vTexCoord;\n - uniform sampler2D sTexture;\n - \n - float rand(vec2 co) \n - {\n - return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); \n} - \n - void main() {\n - vec4 color = texture2D(sTexture, vTexCoord); \n - // modify the hsv Value - color.rgb += uRGBDelta * rand(vTexCoord); \n - // if the new vale exceeds one, then decrease it - color.rgb -= max(color.rgb*2.0 - vec3(2.0), 0.0);\n - // if the new vale drops below zero, then increase it - color.rgb -= min(color.rgb*2.0, 0.0);\n - gl_FragColor = color; \n - }\n - ) ); - - Property::Map map; - Property::Map customShader; - customShader[ "fragmentShader" ] = fragmentShader; - map[ "shader" ] = customShader; - - return map; -} - -void NewWindowController::NewWindow(void) -{ - PositionSize posSize(0, 0, 720, 1280); - gApplication.ReplaceWindow(posSize, "NewWindow"); // Generates a new window -} - -bool NewWindowController::OnLoseContextButtonClicked( Toolkit::Button button ) -{ - // Add as an idle callback to avoid ProcessEvents being recursively called. - mApplication.AddIdle( MakeCallback( NewWindowController::NewWindow ) ); - return true; -} - -bool NewWindowController::OnTrackTimerTick() -{ - static int time=0; - const float radius(250.0f); - - time += EMIT_INTERVAL_IN_MS; - float modTime = time / TRACK_DURATION_IN_MS; - float angle = 2.0f*Math::PI*modTime; - - Vector2 position(radius*cosf(angle), radius*-sinf(angle)); - Vector2 aimPos(radius*2*sinf(angle), radius*2*-cosf(angle)); - Vector2 direction = aimPos-position; - Vector2 stageSize = Stage::GetCurrent().GetSize(); - - SetUpBubbleEmission( stageSize*0.5f+position, direction ); - SetUpBubbleEmission( stageSize*0.5f+position*0.75f, direction ); - SetUpBubbleEmission( stageSize*0.5f+position*0.7f, direction ); - - return true; -} - -void NewWindowController::OnKeyEvent(const KeyEvent& event) -{ - if(event.state == KeyEvent::Down) - { - if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) ) - { - mApplication.Quit(); - } - } -} - -void NewWindowController::OnContextLost() -{ - printf("Stage reporting context loss\n"); -} - -void NewWindowController::OnContextRegained() -{ - printf("Stage reporting context regain\n"); -} - -void RunTest(Application& app) -{ - gNewWindowController = new NewWindowController(app); - app.MainLoop(Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS); -} - -// Entry point for Linux & Tizen applications -// -int DALI_EXPORT_API main(int argc, char **argv) -{ - gApplication = Application::New(&argc, &argv, DEMO_THEME_PATH); - RunTest(gApplication); - - return 0; -} diff --git a/examples/page-turn-view/page-turn-view-example.cpp b/examples/page-turn-view/page-turn-view-example.cpp deleted file mode 100644 index 3eb9c32..0000000 --- a/examples/page-turn-view/page-turn-view-example.cpp +++ /dev/null @@ -1,377 +0,0 @@ -/* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "shared/view.h" -#include "shared/utility.h" - -using namespace Dali; -using namespace Dali::Toolkit; - -// LOCAL STUFF -namespace -{ -const char* const CHANGE_IMAGE_ICON(DEMO_IMAGE_DIR "icon-change.png"); -const char* const CHANGE_IMAGE_ICON_SELECTED( DEMO_IMAGE_DIR "icon-change-selected.png" ); - -// The content amount of one page between portrait and landscape view are different -// set a ratio to modify the current page number when the rotation is changed -const float PAGE_NUMBER_CORRESPONDING_RATIO(1.25f); - -const char* BOOK_COVER_PORTRAIT( DEMO_IMAGE_DIR "book-portrait-cover.jpg" ); -const char* BOOK_COVER_LANDSCAPE( DEMO_IMAGE_DIR "book-landscape-cover.jpg" ); -const char* BOOK_COVER_BACK_LANDSCAPE( DEMO_IMAGE_DIR "book-landscape-cover-back.jpg" ); - -const char* PAGE_IMAGES_PORTRAIT[] = -{ - DEMO_IMAGE_DIR "book-portrait-p1.jpg", - DEMO_IMAGE_DIR "book-portrait-p2.jpg", - DEMO_IMAGE_DIR "book-portrait-p3.jpg", - DEMO_IMAGE_DIR "book-portrait-p4.jpg", - DEMO_IMAGE_DIR "book-portrait-p5.jpg" -}; -const unsigned int NUMBER_OF_PORTRAIT_IMAGE( sizeof(PAGE_IMAGES_PORTRAIT) / sizeof(PAGE_IMAGES_PORTRAIT[0]) ); - -const char* PAGE_IMAGES_LANDSCAPE[] = -{ - DEMO_IMAGE_DIR "book-landscape-p1.jpg", - DEMO_IMAGE_DIR "book-landscape-p2.jpg", - DEMO_IMAGE_DIR "book-landscape-p3.jpg", - DEMO_IMAGE_DIR "book-landscape-p4.jpg", - DEMO_IMAGE_DIR "book-landscape-p5.jpg", - DEMO_IMAGE_DIR "book-landscape-p6.jpg", - DEMO_IMAGE_DIR "book-landscape-p7.jpg", - DEMO_IMAGE_DIR "book-landscape-p8.jpg" -}; -const unsigned int NUMBER_OF_LANDSCAPE_IMAGE( sizeof(PAGE_IMAGES_LANDSCAPE) / sizeof(PAGE_IMAGES_LANDSCAPE[0]) ); - -Texture LoadTextures( const char* imagePath1, const char* imagePath2 ) -{ - PixelData pixelData1 = DemoHelper::LoadPixelData( imagePath1, ImageDimensions(), FittingMode::DEFAULT, SamplingMode::DEFAULT ); - PixelData pixelData2 = DemoHelper::LoadPixelData( imagePath2, ImageDimensions(), FittingMode::DEFAULT, SamplingMode::DEFAULT ); - - unsigned int width = pixelData1.GetWidth() + pixelData2.GetWidth(); - unsigned int height = pixelData1.GetHeight() > pixelData2.GetHeight() ? pixelData1.GetHeight() : pixelData2.GetHeight(); - - Texture texture = Texture::New( Dali::TextureType::TEXTURE_2D, Pixel::RGB888, width, height ); - texture.Upload( pixelData1 ); - texture.Upload( pixelData2, 0u, 0u, pixelData1.GetWidth(), 0u, pixelData2.GetWidth(), pixelData2.GetHeight() ); - - return texture; -} - -}// end LOCAL STUFF - -class PortraitPageFactory : public PageFactory -{ - /** - * Query the number of pages available from the factory. - * The maximum available page has an ID of GetNumberOfPages()-1. - */ - virtual unsigned int GetNumberOfPages() - { - return 10*NUMBER_OF_PORTRAIT_IMAGE + 1; - } - /** - * Create an texture to represent a page. - * @param[in] pageId The ID of the page to create. - * @return A texture, or an uninitialized handle if the ID is out of range. - */ - virtual Texture NewPage( unsigned int pageId ) - { - Texture page; - - if( pageId == 0 ) - { - page = DemoHelper::LoadTexture( BOOK_COVER_PORTRAIT ); - } - else - { - page = DemoHelper::LoadTexture( PAGE_IMAGES_PORTRAIT[ (pageId-1) % NUMBER_OF_PORTRAIT_IMAGE ] ); - } - - return page; - } -}; - -class LandscapePageFactory : public PageFactory -{ - - /** - * Query the number of pages available from the factory. - * The maximum available page has an ID of GetNumberOfPages()-1. - */ - virtual unsigned int GetNumberOfPages() - { - return 10*NUMBER_OF_LANDSCAPE_IMAGE / 2 + 1; - } - /** - * Create an texture to represent a page. - * @param[in] pageId The ID of the page to create. - * @return A texture, or an uninitialized handle if the ID is out of range. - */ - virtual Texture NewPage( unsigned int pageId ) - { - Texture page; - if( pageId == 0 ) - { - page = LoadTextures( BOOK_COVER_LANDSCAPE, BOOK_COVER_BACK_LANDSCAPE ); - } - else - { - unsigned int imageId = (pageId-1)*2; - page = LoadTextures( PAGE_IMAGES_LANDSCAPE[ imageId % NUMBER_OF_LANDSCAPE_IMAGE ], PAGE_IMAGES_LANDSCAPE[ (imageId+1) % NUMBER_OF_LANDSCAPE_IMAGE ] ); - } - - return page; - } -}; - -/** - * This example shows how to use the page turn UI control to implement the page-turn demo - * The effect follows the pan gesture to animate the page - * Pan the page inwards, the page will bent, - * Depends on the distance of the panning, the page might turn over or slide back - * Also, in portrait view, the pan gesture outwards from position near the spine could turn the previous page back - * Allows to turn multiple pages one by one quickly towards the same direction, multiple animations are launched in this case -*/ -class PageTurnController : public ConnectionTracker -{ -public: - PageTurnController( Application &app ); - ~PageTurnController(); - - //This method gets called once the main loop of application is up and running - void OnInit( Application& app ); - -private: - - /** - * This method gets called when the button is clicked, switch between portrait and landscape views - */ - bool OnButtonClicked(Toolkit::Button button); - - /** - * Main key event handler - */ - void OnKeyEvent(const KeyEvent& event); - - /** - * Callback function of page turned signal - * @param[in] pageTurnView The handle of the PageTurnPortraitView or PageTurnLandscapeView - * @param[in] pageIndex The index of the page turned over - * @param[in] isTurningForward The turning direction, forwards or backwards - */ - void OnPageStartedTurn( PageTurnView pageTurnView, unsigned int pageIndex, bool isTurningForward ); - - /** - * Callback function of page turned signal - * @param[in] pageTurnView The handle of the PageTurnPortraitView or PageTurnLandscapeView - * @param[in] pageIndex The index of the page turned over - * @param[in] isTurningForward The turning direction, forwards or backwards - */ - void OnPageFinishedTurn( PageTurnView pageTurnView, unsigned int pageIndex, bool isTurningForward ); - - /** - * Callback function of page started pan signal - * - * @param[in] pageTurnView The calling page turn view - */ - void OnPageStartedPan( PageTurnView pageTurnView ); - - /** - * Callback function of page finished pan signal - * - * @param[in] pageTurnView The calling page turn view - */ - void OnPageFinishedPan( PageTurnView pageTurnView ); - -private: - - Application& mApplication; - Layer mButtonLayer; - - PageTurnView mPageTurnPortraitView; - PageTurnView mPageTurnLandscapeView; - PortraitPageFactory mPortraitPageFactory; - LandscapePageFactory mLandscapePageFactory; - - bool mIsPortrait; -}; - -PageTurnController::PageTurnController( Application &app ) -:mApplication( app ), - mIsPortrait( true ) -{ - // Connect to the Application's Init signal - app.InitSignal().Connect( this, &PageTurnController::OnInit ); -} - -PageTurnController::~PageTurnController() -{ -} - - -void PageTurnController::OnInit( Application& app ) -{ - // The Init signal is received once ( only ) during the Application lifetime - - Stage::GetCurrent().KeyEventSignal().Connect(this, &PageTurnController::OnKeyEvent); - - // Hide the indicator bar - app.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); - - Stage stage = Stage::GetCurrent(); - Vector2 stageSize = stage.GetSize(); - - mButtonLayer = Layer::New(); - mButtonLayer.SetAnchorPoint( Dali::AnchorPoint::CENTER ); - mButtonLayer.SetParentOrigin( Dali::ParentOrigin::CENTER ); - mButtonLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - Toolkit::PushButton button = Toolkit::PushButton::New(); - button.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); - button.SetParentOrigin( ParentOrigin::TOP_RIGHT ); - button.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_IMAGE_ICON ); - button.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_IMAGE_ICON_SELECTED ); - button.SetLeaveRequired( true ); - button.SetScale(1.5f); - button.PressedSignal().Connect( this, &PageTurnController::OnButtonClicked ); - stage.Add( mButtonLayer ); - mButtonLayer.Add(button); - - Vector2 bookSize( stageSize.x > stageSize.y ? stageSize.y : stageSize.x, - stageSize.x > stageSize.y ? stageSize.x : stageSize.y ); - - mPageTurnPortraitView = PageTurnPortraitView::New( mPortraitPageFactory, bookSize ); - mPageTurnPortraitView.SetParentOrigin( ParentOrigin::CENTER ); - mPageTurnPortraitView.SetAnchorPoint( AnchorPoint::CENTER ); - mPageTurnPortraitView.SetProperty( PageTurnView::Property::SPINE_SHADOW, Vector2(70.f, 30.f) ); - mPageTurnPortraitView.PageTurnStartedSignal().Connect( this, &PageTurnController::OnPageStartedTurn ); - mPageTurnPortraitView.PageTurnFinishedSignal().Connect( this, &PageTurnController::OnPageFinishedTurn ); - mPageTurnPortraitView.PagePanStartedSignal().Connect( this, &PageTurnController::OnPageStartedPan ); - mPageTurnPortraitView.PagePanFinishedSignal().Connect( this, &PageTurnController::OnPageFinishedPan ); - - mPageTurnLandscapeView = PageTurnLandscapeView::New( mLandscapePageFactory, Vector2(bookSize.y*0.5f, bookSize.x) ); - mPageTurnLandscapeView.SetParentOrigin( ParentOrigin::CENTER ); - mPageTurnLandscapeView.SetAnchorPoint( AnchorPoint::CENTER ); - mPageTurnLandscapeView.PageTurnStartedSignal().Connect( this, &PageTurnController::OnPageStartedTurn ); - mPageTurnLandscapeView.PageTurnFinishedSignal().Connect( this, &PageTurnController::OnPageFinishedTurn ); - mPageTurnLandscapeView.PagePanStartedSignal().Connect( this, &PageTurnController::OnPageStartedPan ); - mPageTurnLandscapeView.PagePanFinishedSignal().Connect( this, &PageTurnController::OnPageFinishedPan ); - - if( stageSize.x > stageSize.y ) - { - stage.Add(mPageTurnLandscapeView); - mPageTurnPortraitView.SetOrientation(Degree(90.f), Vector3::ZAXIS); - mIsPortrait = false; - } - else - { - stage.Add(mPageTurnPortraitView); - mPageTurnLandscapeView.SetOrientation(Degree(90.f), Vector3::ZAXIS); - mIsPortrait = true; - } - - mButtonLayer.RaiseToTop(); -} - -bool PageTurnController::OnButtonClicked(Toolkit::Button button) -{ - if( mIsPortrait ) - { - mPageTurnPortraitView.Unparent(); - Stage::GetCurrent().Add( mPageTurnLandscapeView ); - int pageId = mPageTurnPortraitView.GetProperty( PageTurnView::Property::CURRENT_PAGE_ID ).Get(); - int currentPage = ceil( static_cast(pageId) / PAGE_NUMBER_CORRESPONDING_RATIO ); - mPageTurnLandscapeView.SetProperty(PageTurnView::Property::CURRENT_PAGE_ID, currentPage ); - } - else - { - mPageTurnLandscapeView.Unparent(); - Stage::GetCurrent().Add( mPageTurnPortraitView ); - int pageId = mPageTurnLandscapeView.GetProperty( PageTurnView::Property::CURRENT_PAGE_ID ).Get(); - int currentPage = floor(pageId * PAGE_NUMBER_CORRESPONDING_RATIO ); - mPageTurnPortraitView.SetProperty(PageTurnView::Property::CURRENT_PAGE_ID, currentPage ); - } - - mIsPortrait = !mIsPortrait; - mButtonLayer.RaiseToTop(); - return true; -} - -/** - * Main key event handler - */ -void PageTurnController::OnKeyEvent(const KeyEvent& event) -{ - if(event.state == KeyEvent::Down) - { - if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) ) - { - mApplication.Quit(); - } - } -} - -void PageTurnController::OnPageStartedTurn( PageTurnView pageTurnView, unsigned int pageIndex, bool isTurningForward ) -{ - std::cout<< ( ( pageTurnView == mPageTurnPortraitView ) ? " portrait: " : " Landscape: " ) - << " page " << pageIndex - << ( isTurningForward ? " is starting to turn forward" : " is starting to turn backward" ) - << std::endl; -} - -void PageTurnController::OnPageFinishedTurn( PageTurnView pageTurnView, unsigned int pageIndex, bool isTurningForward ) -{ - std::cout<< ( ( pageTurnView == mPageTurnPortraitView ) ? " portrait: " : " Landscape: " ) - << " page " << pageIndex - << ( isTurningForward ? " has finished turning forward" : " has finished turning backward" ) - << std::endl; -} - -void PageTurnController::OnPageStartedPan( PageTurnView pageTurnView ) -{ - std::cout<< "Starting to pan" << std::endl; -} - -void PageTurnController::OnPageFinishedPan( PageTurnView pageTurnView ) -{ - std::cout<< "Finished panning" << std::endl; -} - -// Entry point for applications -int DALI_EXPORT_API main( int argc, char **argv ) -{ - Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); - PageTurnController test ( app ); - - app.MainLoop(); - - return 0; -} diff --git a/examples/super-blur-bloom/super-blur-bloom-example.cpp b/examples/super-blur-bloom/super-blur-bloom-example.cpp deleted file mode 100644 index d466e9f..0000000 --- a/examples/super-blur-bloom/super-blur-bloom-example.cpp +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#include -#include -#include -#include -#include -#include "shared/view.h" -#include "shared/utility.h" - -using namespace Dali; - -namespace -{ -const char * const TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" ); -const char * const TITLE_SUPER_BLUR( "Super Blur" ); -const char * const TITLE_BLOOM( "Bloom" ); -const char * const CHANGE_BACKGROUND_ICON( DEMO_IMAGE_DIR "icon-change.png" ); -const char * const CHANGE_BACKGROUND_ICON_SELECTED( DEMO_IMAGE_DIR "icon-change-selected.png" ); -const char * const CHANGE_BLUR_ICON( DEMO_IMAGE_DIR "icon-replace.png" ); -const char * const CHANGE_BLUR_ICON_SELECTED( DEMO_IMAGE_DIR "icon-replace-selected.png" ); - -const char* BACKGROUND_IMAGES[]= -{ - DEMO_IMAGE_DIR "background-1.jpg", - DEMO_IMAGE_DIR "background-2.jpg", - DEMO_IMAGE_DIR "background-3.jpg", - DEMO_IMAGE_DIR "background-4.jpg", - DEMO_IMAGE_DIR "background-5.jpg", - DEMO_IMAGE_DIR "background-magnifier.jpg", -}; -const unsigned int NUM_BACKGROUND_IMAGES( sizeof( BACKGROUND_IMAGES ) / sizeof( BACKGROUND_IMAGES[0] ) ); - -} - -class BlurExample : public ConnectionTracker -{ -public: - BlurExample(Application &app) - : mApp(app), - mImageIndex( 0 ), - mIsBlurring( false ) - { - // Connect to the Application's Init signal - app.InitSignal().Connect(this, &BlurExample::Create); - } - - ~BlurExample() - { - } -private: - // The Init signal is received once (only) during the Application lifetime - void Create(Application& app) - { - Stage stage = Stage::GetCurrent(); - Vector2 stageSize = stage.GetSize(); - - stage.KeyEventSignal().Connect(this, &BlurExample::OnKeyEvent); - - // Creates a default view with a default tool bar. - // The view is added to the stage. - Layer content = DemoHelper::CreateView( app, - mBackground, - mToolBar, - "", - TOOLBAR_IMAGE, - "" ); - - // Add a button to change background. (right of toolbar) - Toolkit::PushButton changeBackgroundButton = Toolkit::PushButton::New(); - changeBackgroundButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_BACKGROUND_ICON ); - changeBackgroundButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_BACKGROUND_ICON_SELECTED ); - - changeBackgroundButton.ClickedSignal().Connect( this, &BlurExample::OnChangeBackgroundIconClicked ); - mToolBar.AddControl( changeBackgroundButton, - DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, - Toolkit::Alignment::HorizontalRight, - DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); - - // Add a button to change the blur view. (left of toolbar) - Toolkit::PushButton changeBlurButton = Toolkit::PushButton::New(); - changeBlurButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_BLUR_ICON ); - changeBlurButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_BLUR_ICON_SELECTED ); - - changeBlurButton.ClickedSignal().Connect( this, &BlurExample::OnChangeBlurIconClicked ); - mToolBar.AddControl( changeBlurButton, - DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, - Toolkit::Alignment::HorizontalLeft, - DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); - - mSuperBlurView = Toolkit::SuperBlurView::New( 5 ); - mSuperBlurView.SetSize( stageSize ); - mSuperBlurView.SetParentOrigin( ParentOrigin::CENTER ); - mSuperBlurView.SetAnchorPoint( AnchorPoint::CENTER ); - mSuperBlurView.BlurFinishedSignal().Connect(this, &BlurExample::OnBlurFinished); - mCurrentImage = DemoHelper::LoadStageFillingImage( BACKGROUND_IMAGES[mImageIndex] ); - mSuperBlurView.SetImage( mCurrentImage ); - mBackground.Add( mSuperBlurView ); - mIsBlurring = true; - SetTitle( TITLE_SUPER_BLUR ); - - mBloomView = Toolkit::BloomView::New(); - mBloomView.SetParentOrigin(ParentOrigin::CENTER); - mBloomView.SetSize(stageSize); - mBloomActor = Toolkit::ImageView::New(mCurrentImage); - mBloomActor.SetParentOrigin( ParentOrigin::CENTER ); - mBloomView.Add( mBloomActor ); - - // Connect the callback to the touch signal on the background - mSuperBlurView.TouchSignal().Connect( this, &BlurExample::OnTouch ); - mBloomView.TouchSignal().Connect( this, &BlurExample::OnTouch ); - } - - // Callback function of the touch signal on the background - bool OnTouch(Dali::Actor actor, const Dali::TouchData& event) - { - switch( event.GetState( 0 ) ) - { - case PointState::DOWN: - { - if( mAnimation ) - { - mAnimation.Clear(); - } - - mAnimation = Animation::New( 2.f ); - if( mSuperBlurView.OnStage() ) - { - mAnimation.AnimateTo( Property( mSuperBlurView, mSuperBlurView.GetBlurStrengthPropertyIndex() ), 1.f ); - } - else - { - mAnimation.AnimateTo( Property( mBloomView, mBloomView.GetBloomIntensityPropertyIndex() ), 3.f ); - } - mAnimation.Play(); - break; - } - case PointState::UP: - case PointState::LEAVE: - case PointState::INTERRUPTED: - { - if( mAnimation ) - { - mAnimation.Clear(); - } - - mAnimation = Animation::New( 2.f ); - if( mSuperBlurView.OnStage() ) - { - mAnimation.AnimateTo( Property( mSuperBlurView, mSuperBlurView.GetBlurStrengthPropertyIndex() ), 0.f ); - } - else - { - mAnimation.AnimateTo( Property( mBloomView, mBloomView.GetBloomIntensityPropertyIndex() ), 0.f ); - } - mAnimation.Play(); - break; - } - case PointState::MOTION: - case PointState::STATIONARY: - { - break; - } - } - return true; - } - - /** - * Main key event handler - */ - void OnKeyEvent(const KeyEvent& event) - { - if(event.state == KeyEvent::Down) - { - if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) ) - { - mApp.Quit(); - } - } - } - - bool OnChangeBackgroundIconClicked( Toolkit::Button button ) - { - if( mIsBlurring ) - { - return true; - } - - if( mAnimation ) - { - mAnimation.Clear(); - } - - mImageIndex = (mImageIndex+1u)%NUM_BACKGROUND_IMAGES; - mCurrentImage = DemoHelper::LoadStageFillingImage( BACKGROUND_IMAGES[mImageIndex] ); - - if( mSuperBlurView.OnStage() ) - { - mIsBlurring = true; - - mSuperBlurView.SetBlurStrength( 0.f ); - mSuperBlurView.SetImage( mCurrentImage ); - } - else - { - mBloomView.SetProperty( mBloomView.GetBloomIntensityPropertyIndex(), 0.f ); - mBloomActor.SetImage( mCurrentImage ); - } - - return true; - } - - bool OnChangeBlurIconClicked( Toolkit::Button button ) - { - if( mSuperBlurView.OnStage() ) - { - SetTitle( TITLE_BLOOM ); - mBackground.Remove( mSuperBlurView ); - - mBloomActor.SetImage( mCurrentImage ); - mBloomView.SetProperty( mBloomView.GetBloomIntensityPropertyIndex(), 0.f ); - mBackground.Add( mBloomView ); - mBloomView.Activate(); - - } - else - { - SetTitle( TITLE_SUPER_BLUR ); - mBackground.Remove( mBloomView ); - mBloomView.Deactivate(); - - mBackground.Add( mSuperBlurView ); - mSuperBlurView.SetBlurStrength( 0.f ); - mSuperBlurView.SetImage( mCurrentImage ); - mIsBlurring = true; - } - - return true; - } - - void OnBlurFinished( Toolkit::SuperBlurView blurView ) - { - mIsBlurring = false; - } - - /** - * Sets/Updates the title of the View - * @param[in] title The new title for the view. - */ - void SetTitle(const std::string& title) - { - if(!mTitleActor) - { - mTitleActor = DemoHelper::CreateToolBarLabel( title ); - // Add title to the tool bar. - mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter ); - } - - mTitleActor.SetProperty( Toolkit::TextLabel::Property::TEXT, title ); - } - -private: - - Application& mApp; - Toolkit::ToolBar mToolBar; - Toolkit::TextLabel mTitleActor; ///< The Toolbar's Title. - Toolkit::Control mBackground; - Toolkit::SuperBlurView mSuperBlurView; - Toolkit::BloomView mBloomView; - Animation mAnimation; - Toolkit::ImageView mBloomActor; - Image mCurrentImage; - unsigned int mImageIndex; - bool mIsBlurring; -}; - -/*****************************************************************************/ - -static void -RunTest(Application& app) -{ - BlurExample theApp(app); - app.MainLoop(); -} - -/*****************************************************************************/ - -int DALI_EXPORT_API main(int argc, char **argv) -{ - Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); - - RunTest(app); - - return 0; -} diff --git a/resources/po/as.po b/resources/po/as.po index a384ac3..cc27807 100755 --- a/resources/po/as.po +++ b/resources/po/as.po @@ -79,12 +79,6 @@ msgstr "মেশ অসংযোগ" msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL" msgstr "3D অনুগামী" -msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION" -msgstr "মেটাবল মহা-বিস্ফোৰণবাদ" - -msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC" -msgstr "মেটাবল প্ৰতিসৰিত" - msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" msgstr "অস্পষ্ট" @@ -97,9 +91,6 @@ msgstr "অইন অনুবিম্ব" msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE" msgstr "অকণমান আপোচ কৰ্" -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" -msgstr "পৃষ্ঠা লেআউট" - msgid "DALI_DEMO_STR_TITLE_POPUP" msgstr "পোপা মেনু" @@ -130,9 +121,6 @@ msgstr "তাৰকা" msgid "DALI_DEMO_STR_TITLE_STYLING" msgstr "শৈলী" -msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" -msgstr "অস্পষ্টকৈ অপুষ্পক" - msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH" msgstr "টেক্সটারেদ মেশ" diff --git a/resources/po/de.po b/resources/po/de.po index ed6593d..ece6e56 100755 --- a/resources/po/de.po +++ b/resources/po/de.po @@ -79,12 +79,6 @@ msgstr "Mesh Sortierung" msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL" msgstr "3D-Modelle" -msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION" -msgstr "Metaball Explosion" - -msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC" -msgstr "Metaball Brechung" - msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" msgstr "Bewegungsunschärfe" @@ -97,9 +91,6 @@ msgstr "Nativen Bild" msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE" msgstr "Größe Verhandlung" -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" -msgstr "Seite wechseln" - msgid "DALI_DEMO_STR_TITLE_POPUP" msgstr "Popup-Menü" @@ -130,9 +121,6 @@ msgstr "Funkeln" msgid "DALI_DEMO_STR_TITLE_STYLING" msgstr "Styling" -msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" -msgstr "Unschärfe und blühen" - msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH" msgstr "Strukturiertem Mesh" diff --git a/resources/po/en_GB.po b/resources/po/en_GB.po index 933be8b..5054071 100755 --- a/resources/po/en_GB.po +++ b/resources/po/en_GB.po @@ -79,12 +79,6 @@ msgstr "Mesh Sorting" msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL" msgstr "Mesh Visual" -msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION" -msgstr "Metaball Explosion" - -msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC" -msgstr "Metaball Refraction" - msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" msgstr "Motion Blur" @@ -97,9 +91,6 @@ msgstr "Native Image Source" msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE" msgstr "Negotiate Size" -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" -msgstr "Page Turn View" - msgid "DALI_DEMO_STR_TITLE_POPUP" msgstr "Popup" @@ -130,9 +121,6 @@ msgstr "Sparkle" msgid "DALI_DEMO_STR_TITLE_STYLING" msgstr "Styling" -msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" -msgstr "Super Blur and Bloom" - msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH" msgstr "Mesh Texture" diff --git a/resources/po/en_US.po b/resources/po/en_US.po index c5a288d..28ed480 100755 --- a/resources/po/en_US.po +++ b/resources/po/en_US.po @@ -79,12 +79,6 @@ msgstr "Mesh Sorting" msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL" msgstr "Mesh Visual" -msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION" -msgstr "Metaball Explosion" - -msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC" -msgstr "Metaball Refraction" - msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" msgstr "Motion Blur" @@ -97,9 +91,6 @@ msgstr "Native Image Source" msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE" msgstr "Negotiate Size" -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" -msgstr "Page Turn View" - msgid "DALI_DEMO_STR_TITLE_POPUP" msgstr "Popup" @@ -130,9 +121,6 @@ msgstr "Sparkle" msgid "DALI_DEMO_STR_TITLE_STYLING" msgstr "Styling" -msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" -msgstr "Super Blur and Bloom" - msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH" msgstr "Mesh Texture" diff --git a/resources/po/es.po b/resources/po/es.po index 2ea1dee..6426481 100755 --- a/resources/po/es.po +++ b/resources/po/es.po @@ -79,12 +79,6 @@ msgstr "Ordenacion de geometrias" msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL" msgstr "Gemeotria 3D" -msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION" -msgstr "Explosion de metabolas" - -msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC" -msgstr "Refraccion de metabolas" - msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" msgstr "Desenfoque de movimiento" @@ -97,9 +91,6 @@ msgstr "Fuente de imagenes nativas" msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE" msgstr "Negociacion de tamaño" -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" -msgstr "Vista de páginas" - msgid "DALI_DEMO_STR_TITLE_POPUP" msgstr "Popup" @@ -130,9 +121,6 @@ msgstr "Brillar" msgid "DALI_DEMO_STR_TITLE_STYLING" msgstr "Estilo" -msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" -msgstr "Efecto blur y bloom" - msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH" msgstr "Geometria con texturas" diff --git a/resources/po/fi.po b/resources/po/fi.po index 476f975..57f5600 100755 --- a/resources/po/fi.po +++ b/resources/po/fi.po @@ -79,12 +79,6 @@ msgstr "Polygoniverkon Lajittelu" msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL" msgstr "Polygoniverkkovisuaali" -msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION" -msgstr "Metaball Räjähdys" - -msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC" -msgstr "Metaball Valon Taittumisella" - msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" msgstr "Liikesumennus" @@ -97,9 +91,6 @@ msgstr "Natiivi Kuvalähde" msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE" msgstr "Kokoneuvottelu" -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" -msgstr "Sivunkääntönäkymä" - msgid "DALI_DEMO_STR_TITLE_POPUP" msgstr "Ponnahdusikkuna" @@ -130,9 +121,6 @@ msgstr "Kimalteluefekti" msgid "DALI_DEMO_STR_TITLE_STYLING" msgstr "UI Tyyli" -msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" -msgstr "Erikoissumennus ja Hehku efekti" - msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH" msgstr "Teksturoitu Polygoniverkko" diff --git a/resources/po/ko.po b/resources/po/ko.po index 659b301..0b375c6 100755 --- a/resources/po/ko.po +++ b/resources/po/ko.po @@ -79,12 +79,6 @@ msgstr "메쉬 분류" msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL" msgstr "메쉬 비주얼" -msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION" -msgstr "메타볼 폭발" - -msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC" -msgstr "메타볼 굴절" - msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" msgstr "모션 블러" @@ -97,9 +91,6 @@ msgstr "네이티브 이미지 소스" msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE" msgstr "사이즈 조절" -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" -msgstr "책장 넘기기" - msgid "DALI_DEMO_STR_TITLE_POPUP" msgstr "팝업" @@ -130,9 +121,6 @@ msgstr "불꽃" msgid "DALI_DEMO_STR_TITLE_STYLING" msgstr "스타일링" -msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" -msgstr "블러링 이펙트" - msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH" msgstr "텍스쳐 메쉬" diff --git a/resources/po/ml.po b/resources/po/ml.po index 7d37255..414c7bd 100755 --- a/resources/po/ml.po +++ b/resources/po/ml.po @@ -79,12 +79,6 @@ msgstr "തരംതിരിക്കലിനായി mesh" msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL" msgstr "3D മോഡലിങ്" -msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION" -msgstr "മെറ്റാ പന്ത് സ്ഫോടനം" - -msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC" -msgstr "മെറ്റാ പന്ത് അപവർത്തനം" - msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" msgstr "അവ്യക്തമാക്കല്" @@ -97,9 +91,6 @@ msgstr "നേറ്റീവ് ചിത്രം" msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE" msgstr "വലുപ്പം കൂടിയാലോചന" -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" -msgstr "പേജ് ലേഔട്ട്" - msgid "DALI_DEMO_STR_TITLE_POPUP" msgstr "പോപപ്പ് മെനുവിൽ" @@ -130,9 +121,6 @@ msgstr "നക്ഷത്ര" msgid "DALI_DEMO_STR_TITLE_STYLING" msgstr "ശൈലി" -msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" -msgstr "മങ്ങൽ പൂക്കൽ" - msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH" msgstr "ടെക്സ്ചർ mesh" diff --git a/resources/po/ur.po b/resources/po/ur.po index cb07dd1..d7b6cc6 100755 --- a/resources/po/ur.po +++ b/resources/po/ur.po @@ -79,12 +79,6 @@ msgstr "میش کی چھنٹائی" msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL" msgstr "3D میش" -msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION" -msgstr "میٹابال دھماکہ" - -msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC" -msgstr "میٹابال اپورتن" - msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" msgstr "دھندلانے کی حرکت" @@ -97,9 +91,6 @@ msgstr "نیٹو تصویر" msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE" msgstr "سائز مذاکرات" -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" -msgstr "کتاب" - msgid "DALI_DEMO_STR_TITLE_POPUP" msgstr "پاپ اپ" @@ -130,9 +121,6 @@ msgstr "سٹار" msgid "DALI_DEMO_STR_TITLE_STYLING" msgstr "سٹائل" -msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" -msgstr "دھندلاپن اور بلوم" - msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH" msgstr "ٹیکسچرد میش" diff --git a/resources/po/zn_CH.po b/resources/po/zn_CH.po index 68087e2..55e7377 100755 --- a/resources/po/zn_CH.po +++ b/resources/po/zn_CH.po @@ -79,12 +79,6 @@ msgstr "网格排序" msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL" msgstr "3D模型" -msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION" -msgstr "元球爆炸" - -msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC" -msgstr "元球折射" - msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" msgstr "动作模糊" @@ -97,9 +91,6 @@ msgstr "本地图像" msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE" msgstr "尺寸协商" -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" -msgstr "翻页" - msgid "DALI_DEMO_STR_TITLE_POPUP" msgstr "弹窗" @@ -130,9 +121,6 @@ msgstr "火花" msgid "DALI_DEMO_STR_TITLE_STYLING" msgstr "样式" -msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" -msgstr "模糊及泛光" - msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH" msgstr "纹理网格" diff --git a/shared/dali-demo-strings.h b/shared/dali-demo-strings.h index 47f8f4f..6c6d171 100644 --- a/shared/dali-demo-strings.h +++ b/shared/dali-demo-strings.h @@ -60,13 +60,10 @@ extern "C" #define DALI_DEMO_STR_TITLE_MESH_MORPH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MESH_MORPH") #define DALI_DEMO_STR_TITLE_MESH_SORTING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MESH_SORTING") #define DALI_DEMO_STR_TITLE_MESH_VISUAL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MESH_VISUAL") -#define DALI_DEMO_STR_TITLE_METABALL_EXPLOSION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION") -#define DALI_DEMO_STR_TITLE_METABALL_REFRAC dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_METABALL_REFRAC") #define DALI_DEMO_STR_TITLE_MOTION_BLUR dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MOTION_BLUR") #define DALI_DEMO_STR_TITLE_MOTION_STRETCH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MOTION_STRETCH") #define DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE") #define DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE") -#define DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW") #define DALI_DEMO_STR_TITLE_POPUP dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_POPUP") #define DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES") #define DALI_DEMO_STR_TITLE_PROGRESS_BAR dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_PROGRESS_BAR") @@ -76,7 +73,6 @@ extern "C" #define DALI_DEMO_STR_TITLE_SCROLL_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SCROLL_VIEW") #define DALI_DEMO_STR_TITLE_SPARKLE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SPARKLE") #define DALI_DEMO_STR_TITLE_STYLING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_STYLING") -#define DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM") #define DALI_DEMO_STR_TITLE_TEXTURED_MESH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXTURED_MESH") #define DALI_DEMO_STR_TITLE_TEXT_EDITOR dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_EDITOR") #define DALI_DEMO_STR_TITLE_TEXT_FIELD dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_FIELD") @@ -117,13 +113,10 @@ extern "C" #define DALI_DEMO_STR_TITLE_MESH_MORPH "Mesh Morph" #define DALI_DEMO_STR_TITLE_MESH_SORTING "Mesh Sorting" #define DALI_DEMO_STR_TITLE_MESH_VISUAL "Mesh Visual" -#define DALI_DEMO_STR_TITLE_METABALL_EXPLOSION "Metaball Explosion" -#define DALI_DEMO_STR_TITLE_METABALL_REFRAC "Metaball Refractions" #define DALI_DEMO_STR_TITLE_MOTION_BLUR "Motion Blur" #define DALI_DEMO_STR_TITLE_MOTION_STRETCH "Motion Stretch" #define DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE "Native Image Source" #define DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE "Negotiate Size" -#define DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW "Page Turn View" #define DALI_DEMO_STR_TITLE_POPUP "Popup" #define DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES "Primitive Shapes" #define DALI_DEMO_STR_TITLE_PROGRESS_BAR "Progress Bar" @@ -133,7 +126,6 @@ extern "C" #define DALI_DEMO_STR_TITLE_SCROLL_VIEW "Scroll View" #define DALI_DEMO_STR_TITLE_SPARKLE "Sparkle" #define DALI_DEMO_STR_TITLE_STYLING "Styling" -#define DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM "Super Blur and Bloom" #define DALI_DEMO_STR_TITLE_TEXTURED_MESH "Mesh Texture" #define DALI_DEMO_STR_TITLE_TEXT_EDITOR "Text Editor" #define DALI_DEMO_STR_TITLE_TEXT_FIELD "Text Field"