-const char* VERTEX_SHADER_SCROLL = DALI_COMPOSE_SHADER(
- attribute mediump vec2 aPosition;\n
- varying highp vec2 vTexCoord;\n
- varying highp float vRatio;\n
- uniform mediump mat4 uModelMatrix;\n
- uniform mediump mat4 uViewMatrix;\n
- uniform mediump mat4 uProjection;\n
- uniform mediump vec3 uSize;\n
- uniform mediump float uDelta;\n
- uniform mediump vec2 uTextureSize;
- uniform mediump float uGap;\n
- uniform mediump float uRtl;\n
- \n
- void main()\n
- {\n
- {\n
- highp vec4 vertexPosition = vec4(aPosition*uSize.xy, 0.0, 1.0);\n
- vertexPosition = uViewMatrix * uModelMatrix * vertexPosition ;\n
- vertexPosition.x = floor( vertexPosition.x ) + 0.5;
- vertexPosition.y = floor( vertexPosition.y ) + 0.5;
- float smallTextPadding = max(uSize.x - uTextureSize.x, 0. );\n
- float gap = max( uGap, smallTextPadding );\n
- float delta = floor ( uDelta ) + 0.5;
- vTexCoord.x = ( delta + ( uRtl * ( uTextureSize.x - uSize.x ) ) + ( aPosition.x * uSize.x ) )/ ( uTextureSize.x + gap );\n
- vTexCoord.y = ( 0.5 + floor( aPosition.y * uSize.y ) )/ ( uTextureSize.y ) ;\n
- vRatio = uTextureSize.x / ( uTextureSize.x + gap );\n
- gl_Position = uProjection * vertexPosition;
- }\n
- }\n
-);
-
-const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
- varying highp vec2 vTexCoord;\n
- varying highp float vRatio;\n
- uniform sampler2D sTexture;\n
- \n
- void main()\n
- {\n
- highp vec2 texCoord;\n
- texCoord.y = vTexCoord.y;\n
- texCoord.x = fract( vTexCoord.x ) / vRatio;\n
- if ( texCoord.x > 1.0 )\n
- discard;\n
- \n
- gl_FragColor = texture2D( sTexture, texCoord );\n
- }\n
-);
-
-/**
- * @brief Create and set up a camera for the render task to use
- *
- * @param[in] sizeOfTarget size of the source camera to look at
- * @param[out] offscreenCamera custom camera
- */
-void CreateCameraActor( const Size& sizeOfTarget, CameraActor& offscreenCamera )
-{
- offscreenCamera = CameraActor::New();
- offscreenCamera.SetOrthographicProjection( sizeOfTarget );
- offscreenCamera.SetInvertYAxis( true );
-}
-
-/**
- * @brief Create a render task
- *
- * @param[in] sourceActor actor to be used as source
- * @param[in] cameraActor camera looking at source
- * @param[in] offscreenTarget resulting image from render task
- * @param[out] renderTask render task that has been setup
- */
-void CreateRenderTask( Actor sourceActor, CameraActor cameraActor , FrameBufferImage offscreenTarget, RenderTask& renderTask )
-{
- Stage stage = Stage::GetCurrent();
- RenderTaskList taskList = stage.GetRenderTaskList();
- renderTask = taskList.CreateTask();
- renderTask.SetSourceActor( sourceActor );
- renderTask.SetExclusive( true );
- renderTask.SetInputEnabled( false );
- renderTask.SetClearEnabled( true );
- renderTask.SetCameraActor( cameraActor );
- renderTask.SetTargetFrameBuffer( offscreenTarget );
- renderTask.SetClearColor( Color::TRANSPARENT );
- renderTask.SetCullMode( false );
-}
-