예제 #1
0
void ShadowView::SetShaderConstants()
{
    CustomActor self = Self();

    mShadowRenderShader.SetUniform( SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME, Matrix::IDENTITY );
    mShadowRenderShader.SetUniform( SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME, Matrix::IDENTITY );
    mShadowRenderShader.SetUniform( SHADER_SHADOW_COLOR_PROPERTY_NAME, mCachedShadowColor );

    Property::Index lightCameraProjectionMatrixPropertyIndex = mShadowRenderShader.GetPropertyIndex(SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME);
    Property::Index lightCameraViewMatrixPropertyIndex = mShadowRenderShader.GetPropertyIndex(SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME);

    Constraint projectionMatrixConstraint = Constraint::New<Dali::Matrix>( lightCameraProjectionMatrixPropertyIndex, Source( mCameraActor, CameraActor::PROJECTION_MATRIX ), EqualToConstraintMatrix());
    Constraint viewMatrixConstraint = Constraint::New<Dali::Matrix>( lightCameraViewMatrixPropertyIndex, Source( mCameraActor, CameraActor::VIEW_MATRIX ), EqualToConstraintMatrix());

    mShadowRenderShader.ApplyConstraint(projectionMatrixConstraint);
    mShadowRenderShader.ApplyConstraint(viewMatrixConstraint);

    // Register a property that the user can use to control the blur in the internal object
    mBlurStrengthPropertyIndex = self.RegisterProperty(BLUR_STRENGTH_PROPERTY_NAME, BLUR_STRENGTH_DEFAULT);
    mBlurFilter.GetHandleForAnimateBlurStrength().ApplyConstraint( Constraint::New<float>( mBlurFilter.GetBlurStrengthPropertyIndex() ,
            Source( self, mBlurStrengthPropertyIndex),
            EqualToConstraint()) );

    //  Register a property that the user can use to control the color of the shadow.
    Property::Index index = mShadowRenderShader.GetPropertyIndex(SHADER_SHADOW_COLOR_PROPERTY_NAME);
    mShadowColorPropertyIndex = self.RegisterProperty(SHADOW_COLOR_PROPERTY_NAME, mCachedShadowColor);

    mShadowRenderShader.ApplyConstraint(Constraint::New<Dali::Vector4>( index, Source( self, mShadowColorPropertyIndex ), EqualToConstraint()) );
}
예제 #2
0
void Magnifier::SetFrameVisibility(bool visible)
{
  if(visible && !mFrameLayer)
  {
    Actor self(Self());

    Layer mFrameLayer = Layer::New();
    mFrameLayer.SetParentOrigin( ParentOrigin::CENTER );
    Stage::GetCurrent().Add(mFrameLayer);

    Image image = Image::New( DEFAULT_FRAME_IMAGE_PATH );
    ImageActor frame = ImageActor::New( image );
    frame.SetDrawMode(DrawMode::OVERLAY);
    frame.SetStyle( ImageActor::STYLE_NINE_PATCH );

    frame.SetNinePatchBorder( Vector4::ONE * IMAGE_BORDER_INDENT );
    mFrameLayer.Add(frame);

    // Apply position constraint to the frame
    Constraint constraint = Constraint::New<Vector3>( Actor::POSITION,
                                                      Source( self, Actor::WORLD_POSITION ),
                                                      EqualToConstraint() );
    frame.ApplyConstraint(constraint);

    // Apply scale constraint to the frame
    constraint = Constraint::New<Vector3>( Actor::SCALE,
                                           Source( self, Actor::SCALE ),
                                           EqualToConstraint() );
    frame.ApplyConstraint(constraint);

    Source(self, Actor::SCALE),

    // Apply size constraint to the the frame
    constraint = Constraint::New<Vector3>(Actor::SIZE,
                                          Source(self, Actor::SIZE),
                                          ImageBorderSizeConstraint());
    frame.ApplyConstraint(constraint);
  }
  else if(!visible && mFrameLayer)
  {
    Stage::GetCurrent().Remove(mFrameLayer);
    mFrameLayer.Reset();
  }
}
예제 #3
0
MotionStretchEffect MotionStretchEffect::Apply( Actor handle )
{
  MotionStretchEffect newEffect = New();
  handle.SetShaderEffect( newEffect );

  Property::Index uModelProperty = newEffect.GetPropertyIndex( MOTION_STRETCH_MODELVIEW_LASTFRAME );

  Constraint constraint = Constraint::New<Matrix>( uModelProperty,
                                                   Source( handle, Actor::WORLD_MATRIX ),
                                                   EqualToConstraint() );

  // and set up constraint.
  newEffect.ApplyConstraint(constraint);
  return newEffect;
}
예제 #4
0
void ImageView::Initialize()
{
  Actor self = Self();
  // Register property that represents the level of detail.
  mPropertyDetail = self.RegisterProperty(Toolkit::ImageView::DETAIL_PROPERTY_NAME, 0.0f);

  // Create an empty image actor, filling the entire size of this ImageView.
  Image emptyImage;
  mImageActor = ImageActor::New( emptyImage );
  self.Add( mImageActor );
  mImageActor.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
  mImageActor.SetParentOrigin( ParentOrigin::CENTER );
}
예제 #5
0
void SpreadFilter::Enable()
{
  mCameraActor = CameraActor::New();
  mCameraActor.SetParentOrigin(ParentOrigin::CENTER);

  // create actor to render input with applied emboss effect
  mActorForInput = ImageActor::New( mInputImage );
  mActorForInput.SetParentOrigin( ParentOrigin::CENTER );
  mActorForInput.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
  mActorForInput.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) );

  // create internal offscreen for result of horizontal pass
  mImageForHorz = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Image::Unused );

  // create an actor to render mImageForHorz for vertical blur pass
  mActorForHorz = ImageActor::New( mImageForHorz );
  mActorForHorz.SetParentOrigin( ParentOrigin::CENTER );
  mActorForHorz.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
  mActorForHorz.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) );

  mRootActor.Add( mActorForInput );
  mRootActor.Add( mActorForHorz );
  mRootActor.Add( mCameraActor );

  std::ostringstream fragmentSource;
  if( mDebugRender )
  {
    fragmentSource << "#define DEBUG_RENDER\n";
  }
  fragmentSource << SPREAD_FRAGMENT_SOURCE;

  mShaderForHorz = ShaderEffect::New( "", fragmentSource.str() );
  mActorForInput.SetShaderEffect( mShaderForHorz );
  mShaderForHorz.SetUniform( "uSpread", mSpread );
  mShaderForHorz.SetUniform( "uTexScale", Vector2( 1.0f / mTargetSize.width, 0.0f ) );

  mShaderForVert = ShaderEffect::New( "", fragmentSource.str() );
  mActorForHorz.SetShaderEffect( mShaderForVert );
  mShaderForVert.SetUniform( "uSpread", mSpread );
  mShaderForVert.SetUniform( "uTexScale", Vector2( 0.0f, 1.0f / mTargetSize.height ) );

  SetupCamera();
  CreateRenderTasks();
}
예제 #6
0
void View::SetBackground( ImageActor backgroundImage )
{
  // Create background layer if doesn't exist.

  if( !mBackgroundLayer )
  {
    mBackgroundLayer = Layer::New();

    mBackgroundLayer.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
    mBackgroundLayer.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );

    // Add background layer to custom actor.
    Self().Add( mBackgroundLayer );

    // Drop the background layer

    DALI_ASSERT_ALWAYS( mBackgroundLayer.OnStage() ); // We need to be on-stage to drop the layer
    mBackgroundLayer.LowerToBottom();
  }
  else
  {
    // It removes the old background
    if( 0 < mBackgroundLayer.GetChildCount() )
    {
      mBackgroundLayer.Remove( mBackgroundLayer.GetChildAt(0) );
    }
  }

  backgroundImage.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
  Constraint constraint = Constraint::New<Vector3>(
      Actor::SCALE,
      LocalSource( Actor::SIZE ),
      ParentSource( Actor::SIZE ),
      ScaleToFillXYKeepAspectRatioConstraint() );
  backgroundImage.ApplyConstraint( constraint );
  mBackgroundLayer.Add( backgroundImage );
}
예제 #7
0
void Magnifier::Initialize()
{
  Actor self = Self();
  mPropertySourcePosition = self.RegisterProperty( Toolkit::Magnifier::SOURCE_POSITION_PROPERTY_NAME, Vector3::ZERO );
  Vector2 stageSize(Stage::GetCurrent().GetSize());

  Layer dummyLayer = Layer::New();
  Stage().GetCurrent().Add(dummyLayer);
  dummyLayer.SetParentOrigin(ParentOrigin::CENTER);

  // NOTE:
  // sourceActor is a dummy delegate actor that takes the source property position,
  // and generates a WORLD_POSITION, which is 1 frame behind the source property.
  // This way the constraints for determining the camera position (source) and those
  // for determining viewport position use the same 1 frame old values.
  // A simple i) CameraPos = f(B), ii) B = f(A) set of constraints wont suffice as
  // although CameraPos will use B, which is A's previous value. The constraint will
  // not realise that B is still dirty as far as constraint (i) is concerned.
  // Perhaps this is a bug in the way the constraint system factors into what is dirty
  // and what is not.
  mSourceActor = Actor::New();
  dummyLayer.Add(mSourceActor);
  mSourceActor.SetParentOrigin(ParentOrigin::CENTER);
  Constraint constraint = Constraint::New<Vector3>( Actor::POSITION,
                                                    Source( self, mPropertySourcePosition ),
                                                    EqualToConstraint() );
  mSourceActor.ApplyConstraint(constraint);

  // create the render task this will render content on top of everything
  // based on camera source position.
  InitializeRenderTask();

  // set up some constraints to:
  // i) reposition (dest) frame actor based on magnifier actor's world position (this is 1 frame delayed)
  // ii) reposition and resize (dest) the render task's viewport based on magnifier actor's world position (1 frame delayed) & size.
  // iii) reposition (source) camera actor based on magnifier source actor's world position (this is 1 frame delayed)

  // Apply constraint to camera's position
  // Position our camera at the same distance from its target as the default camera is.
  // The camera position doesn't affect how we render, just what we render (due to near and far clip planes)
  // NOTE: We can't interrogate the default camera's position as it is not known initially (takes 1 frame
  // for value to update).
  // But we can determine the initial position using the same formula:
  // distance = stage.height * 0.5 / tan(FOV * 0.5)

  RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
  RenderTask renderTask = taskList.GetTask(0u);
  float fov = renderTask.GetCameraActor().GetFieldOfView();
  mDefaultCameraDistance = (stageSize.height * 0.5f) / tanf(fov * 0.5f);

  // Use a 1 frame delayed source position to determine the camera actor's position.
  // This is necessary as the viewport is determined by the Magnifier's Actor's World position (which is computed
  // at the end of the update cycle i.e. after constraints have been applied.)
  //Property::Index propertySourcePositionDelayed = mCameraActor.RegisterProperty("delayed-source-position", Vector3::ZERO);

  constraint = Constraint::New<Vector3>( Actor::POSITION,
                                                    Source( mSourceActor, Actor::WORLD_POSITION ),
                                                    CameraActorPositionConstraint(stageSize, mDefaultCameraDistance) );
  mCameraActor.ApplyConstraint(constraint);

  // Apply constraint to render-task viewport position
  constraint = Constraint::New<Vector2>( RenderTask::VIEWPORT_POSITION,
                                         Source( self, Actor::WORLD_POSITION ),//mPropertySourcePosition ),
                                         Source( self, Actor::SIZE ),
                                         Source( self, Actor::WORLD_SCALE),
                                         RenderTaskViewportPositionConstraint(stageSize) );
  mTask.ApplyConstraint(constraint);

  // Apply constraint to render-task viewport position
  constraint = Constraint::New<Vector2>( RenderTask::VIEWPORT_SIZE,
                                         Source( self, Actor::SIZE ),
                                         Source( self, Actor::WORLD_SCALE),
                                         RenderTaskViewportSizeConstraint() );
  mTask.ApplyConstraint(constraint);
}
예제 #8
0
void ShadowView::SetShaderConstants()
{
  Property::Index lightCameraProjectionMatrixPropertyIndex = mShadowPlane.RegisterProperty( SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME, Matrix::IDENTITY );
  Constraint projectionMatrixConstraint = Constraint::New<Dali::Matrix>( mShadowPlane, lightCameraProjectionMatrixPropertyIndex, EqualToConstraint() );
  projectionMatrixConstraint.AddSource( Source( mCameraActor, CameraActor::Property::PROJECTION_MATRIX ) );
  projectionMatrixConstraint.Apply();

  Property::Index lightCameraViewMatrixPropertyIndex = mShadowPlane.RegisterProperty( SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME, Matrix::IDENTITY );
  Constraint viewMatrixConstraint = Constraint::New<Dali::Matrix>( mShadowPlane, lightCameraViewMatrixPropertyIndex, EqualToConstraint() );
  viewMatrixConstraint.AddSource( Source( mCameraActor, CameraActor::Property::VIEW_MATRIX ) );
  viewMatrixConstraint.Apply();

  mShadowColorPropertyIndex = mShadowPlane.RegisterProperty( SHADER_SHADOW_COLOR_PROPERTY_NAME, mCachedShadowColor );
}
예제 #9
0
void ShadowView::ConstrainCamera()
{
  if( mPointLight && mShadowPlane )
  {
    // Constrain camera to look directly at center of shadow plane. (mPointLight position
    // is under control of application, can't use transform inheritance)

    Constraint cameraOrientationConstraint = Constraint::New<Quaternion> ( mCameraActor, Actor::Property::ORIENTATION, &LookAt );
    cameraOrientationConstraint.AddSource( Source( mShadowPlane, Actor::Property::WORLD_POSITION ) );
    cameraOrientationConstraint.AddSource( Source( mPointLight,  Actor::Property::WORLD_POSITION ) );
    cameraOrientationConstraint.AddSource( Source( mShadowPlane, Actor::Property::WORLD_ORIENTATION ) );
    cameraOrientationConstraint.Apply();

    Constraint pointLightPositionConstraint = Constraint::New<Vector3>( mCameraActor, Actor::Property::POSITION, EqualToConstraint() );
    pointLightPositionConstraint.AddSource( Source( mPointLight, Actor::Property::WORLD_POSITION ) );
    pointLightPositionConstraint.Apply();
  }
}
예제 #10
0
void ShadowView::OnInitialize()
{
  // root actor to parent all user added actors. Used as source actor for shadow render task.
  mChildrenRoot.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
  mChildrenRoot.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );

  Vector2 stageSize = Stage::GetCurrent().GetSize();
  mCameraActor = CameraActor::New(stageSize);

  mCameraActor.SetParentOrigin( ParentOrigin::CENTER );

  // Target is constrained to point at the shadow plane origin
  mCameraActor.SetNearClippingPlane( 1.0f );
  mCameraActor.SetType( Dali::Camera::FREE_LOOK ); // Camera orientation constrained to point at shadow plane world position
  mCameraActor.SetOrientation(Radian(Degree(180)), Vector3::YAXIS);
  mCameraActor.SetPosition(DEFAULT_LIGHT_POSITION);


  Property::Map customShader;
  customShader[ "vertex-shader" ] = RENDER_SHADOW_VERTEX_SOURCE;
  customShader[ "fragment-shader" ] = RENDER_SHADOW_FRAGMENT_SOURCE;

  customShader[ "subdivide-grid-x" ] = 20;
  customShader[ "subdivide-grid-y" ] = 20;

  customShader[ "hints" ] = "output-is-transparent";

  mShadowRenderShader[ "shader" ] = customShader;

  // Create render targets needed for rendering from light's point of view
  mSceneFromLightRenderTarget = FrameBufferImage::New( stageSize.width, stageSize.height, Pixel::RGBA8888 );

  mOutputImage = FrameBufferImage::New( stageSize.width * 0.5f, stageSize.height * 0.5f, Pixel::RGBA8888 );

  //////////////////////////////////////////////////////
  // Connect to actor tree

  Self().Add( mChildrenRoot );
  Stage::GetCurrent().Add( mCameraActor );

  mBlurFilter.SetRefreshOnDemand(false);
  mBlurFilter.SetInputImage(mSceneFromLightRenderTarget);
  mBlurFilter.SetOutputImage(mOutputImage);
  mBlurFilter.SetSize(stageSize * 0.5f);
  mBlurFilter.SetPixelFormat(Pixel::RGBA8888);

  mBlurRootActor = Actor::New();
  mBlurRootActor.SetName( "BLUR_ROOT_ACTOR" );

  // Turn off inheritance to ensure filter renders properly
  mBlurRootActor.SetPositionInheritanceMode(USE_PARENT_POSITION);
  mBlurRootActor.SetInheritOrientation(false);
  mBlurRootActor.SetInheritScale(false);
  mBlurRootActor.SetColorMode(USE_OWN_COLOR);

  Self().Add(mBlurRootActor);

  mBlurFilter.SetRootActor(mBlurRootActor);
  mBlurFilter.SetBackgroundColor(Vector4::ZERO);

  CustomActor self = Self();
  // Register a property that the user can use to control the blur in the internal object
  mBlurStrengthPropertyIndex = self.RegisterProperty(BLUR_STRENGTH_PROPERTY_NAME, BLUR_STRENGTH_DEFAULT);

  Constraint blurStrengthConstraint = Constraint::New<float>( mBlurFilter.GetHandleForAnimateBlurStrength(), mBlurFilter.GetBlurStrengthPropertyIndex(), EqualToConstraint() );
  blurStrengthConstraint.AddSource( Source( self, mBlurStrengthPropertyIndex) );
  blurStrengthConstraint.Apply();
}
예제 #11
0
void ShadowView::OnInitialize()
{
    // root actor to parent all user added actors. Used as source actor for shadow render task.
    mChildrenRoot.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
    mChildrenRoot.ApplyConstraint(Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ));

    Vector2 stageSize = Stage::GetCurrent().GetSize();
    mCameraActor = CameraActor::New(stageSize);

    mCameraActor.SetParentOrigin( ParentOrigin::CENTER );

    // Target is constrained to point at the shadow plane origin
    mCameraActor.SetNearClippingPlane( 1.0f );
    mCameraActor.SetType( Dali::Camera::FREE_LOOK ); // Camera orientation constrained to point at shadow plane world position
    mCameraActor.SetRotation(Radian(Degree(180)), Vector3::YAXIS);
    mCameraActor.SetPosition(DEFAULT_LIGHT_POSITION);

    mShadowRenderShader = ShaderEffect::New( RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE,
                          Dali::GeometryType( GEOMETRY_TYPE_IMAGE ),
                          ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_BLENDING ));

    // Create render targets needed for rendering from light's point of view
    mSceneFromLightRenderTarget = FrameBufferImage::New( stageSize.width, stageSize.height, Pixel::RGBA8888 );

    mOutputImage = FrameBufferImage::New( stageSize.width * 0.5f, stageSize.height * 0.5f, Pixel::RGBA8888 );

    //////////////////////////////////////////////////////
    // Connect to actor tree

    Self().Add( mChildrenRoot );
    Stage::GetCurrent().Add( mCameraActor );

    mBlurFilter.SetRefreshOnDemand(false);
    mBlurFilter.SetInputImage(mSceneFromLightRenderTarget);
    mBlurFilter.SetOutputImage(mOutputImage);
    mBlurFilter.SetSize(stageSize * 0.5f);
    mBlurFilter.SetPixelFormat(Pixel::RGBA8888);

    mBlurRootActor = Actor::New();

    // Turn off inheritance to ensure filter renders properly
    mBlurRootActor.SetPositionInheritanceMode(USE_PARENT_POSITION);
    mBlurRootActor.SetInheritRotation(false);
    mBlurRootActor.SetInheritScale(false);
    mBlurRootActor.SetColorMode(USE_OWN_COLOR);

    Self().Add(mBlurRootActor);

    mBlurFilter.SetRootActor(mBlurRootActor);
    mBlurFilter.SetBackgroundColor(Vector4::ZERO);

    SetShaderConstants();
}
예제 #12
0
void ShadowView::SetShadowPlane(Actor shadowPlane)
{
    mShadowPlaneBg = shadowPlane;

    mShadowPlane = ImageActor::New();
    mShadowPlane.SetParentOrigin(ParentOrigin::CENTER);
    mShadowPlane.SetAnchorPoint(AnchorPoint::CENTER);

    mShadowPlane.SetImage(mOutputImage);
    mShadowPlane.SetShaderEffect(mShadowRenderShader);

    // Rather than parent the shadow plane drawable and have constraints to move it to the same
    // position, instead parent the shadow plane drawable on the shadow plane passed in.
    mShadowPlaneBg.Add(mShadowPlane);
    mShadowPlane.SetParentOrigin(ParentOrigin::CENTER);
    mShadowPlane.SetZ(1.0f);

    ConstrainCamera();

    mShadowPlane.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, Source( mShadowPlaneBg, Actor::SIZE ), EqualToConstraint() ) );

    mBlurRootActor.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, Source( mShadowPlane, Actor::SIZE ), EqualToConstraint() ) );
}
예제 #13
0
void GaussianBlurView::OnInitialize()
{
    // root actor to parent all user added actors, needed to allow us to set that subtree as exclusive for our child render task
    mChildrenRoot.SetParentOrigin(ParentOrigin::CENTER);

    //////////////////////////////////////////////////////
    // Create shaders

    // horiz
    std::ostringstream horizFragmentShaderStringStream;
    horizFragmentShaderStringStream << "#define NUM_SAMPLES " << mNumSamples << "\n";
    horizFragmentShaderStringStream << GAUSSIAN_BLUR_FRAGMENT_SOURCE;
    mHorizBlurShader = ShaderEffect::New( "", horizFragmentShaderStringStream.str() );
    // vert
    std::ostringstream vertFragmentShaderStringStream;
    vertFragmentShaderStringStream << "#define NUM_SAMPLES " << mNumSamples << "\n";
    vertFragmentShaderStringStream << GAUSSIAN_BLUR_FRAGMENT_SOURCE;
    mVertBlurShader = ShaderEffect::New( "", vertFragmentShaderStringStream.str() );


    //////////////////////////////////////////////////////
    // Create actors

    // Create an ImageActor for performing a horizontal blur on the texture
    mImageActorHorizBlur = ImageActor::New();
    mImageActorHorizBlur.SetParentOrigin(ParentOrigin::CENTER);
    mImageActorHorizBlur.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
    mImageActorHorizBlur.SetShaderEffect( mHorizBlurShader );

    // Create an ImageActor for performing a vertical blur on the texture
    mImageActorVertBlur = ImageActor::New();
    mImageActorVertBlur.SetParentOrigin(ParentOrigin::CENTER);
    mImageActorVertBlur.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
    mImageActorVertBlur.SetShaderEffect( mVertBlurShader );

    // Register a property that the user can control to fade the blur in / out via the GaussianBlurView object
    mBlurStrengthPropertyIndex = Self().RegisterProperty(GAUSSIAN_BLUR_VIEW_STRENGTH_PROPERTY_NAME, GAUSSIAN_BLUR_VIEW_DEFAULT_BLUR_STRENGTH);

    // Create an ImageActor for compositing the blur and the original child actors render
    if(!mBlurUserImage)
    {
        mImageActorComposite = ImageActor::New();
        mImageActorComposite.SetParentOrigin(ParentOrigin::CENTER);
        mImageActorComposite.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
        mImageActorComposite.SetOpacity(GAUSSIAN_BLUR_VIEW_DEFAULT_BLUR_STRENGTH); // ensure alpha is enabled for this object and set default value

        Constraint blurStrengthConstraint = Constraint::New<float>( mImageActorComposite, Actor::Property::COLOR_ALPHA, EqualToConstraint());
        blurStrengthConstraint.AddSource( ParentSource(mBlurStrengthPropertyIndex) );
        blurStrengthConstraint.Apply();

        // Create an ImageActor for holding final result, i.e. the blurred image. This will get rendered to screen later, via default / user render task
        mTargetActor = ImageActor::New();
        mTargetActor.SetParentOrigin(ParentOrigin::CENTER);
        mTargetActor.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME


        //////////////////////////////////////////////////////
        // Create cameras for the renders corresponding to the view size
        mRenderFullSizeCamera = CameraActor::New();
        mRenderFullSizeCamera.SetParentOrigin(ParentOrigin::CENTER);


        //////////////////////////////////////////////////////
        // Connect to actor tree
        Self().Add( mImageActorComposite );
        Self().Add( mTargetActor );
        Self().Add( mRenderFullSizeCamera );
    }


    //////////////////////////////////////////////////////
    // Create camera for the renders corresponding to the (potentially downsampled) render targets' size
    mRenderDownsampledCamera = CameraActor::New();
    mRenderDownsampledCamera.SetParentOrigin(ParentOrigin::CENTER);


    //////////////////////////////////////////////////////
    // Connect to actor tree
    Self().Add( mChildrenRoot );
    Self().Add( mImageActorHorizBlur );
    Self().Add( mImageActorVertBlur );
    Self().Add( mRenderDownsampledCamera );
}