// EXTERNAL INCLUDES
#include <sstream>
#include <iomanip>
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/common/stage.h>
#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/integration-api/debug.h>
return Toolkit::ShadowView::New();
}
-TypeRegistration mType( typeid(Toolkit::ShadowView), typeid(Toolkit::Control), Create );
-
+DALI_TYPE_REGISTRATION_BEGIN( Toolkit::ShadowView, Toolkit::Control, Create )
+DALI_TYPE_REGISTRATION_END()
const float BLUR_STRENGTH_DEFAULT = 1.0f;
const Vector4 DEFAULT_SHADOW_COLOR = Vector4(0.2f, 0.2f, 0.2f, 0.8f);
-const std::string SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME( "uLightCameraProjectionMatrix" );
-const std::string SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME( "uLightCameraViewMatrix" );
-const std::string SHADER_SHADOW_COLOR_PROPERTY_NAME( "uShadowColor" );
-
-const std::string BLUR_STRENGTH_PROPERTY_NAME( "BlurStrengthProperty" );
-const std::string SHADOW_COLOR_PROPERTY_NAME( "ShadowColorProperty" );
+const char* const SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME = "uLightCameraProjectionMatrix";
+const char* const SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME = "uLightCameraViewMatrix";
+const char* const SHADER_SHADOW_COLOR_PROPERTY_NAME = "uShadowColor";
+const char* const BLUR_STRENGTH_PROPERTY_NAME = "BlurStrengthProperty";
+const char* const SHADOW_COLOR_PROPERTY_NAME = "ShadowColorProperty";
const char* const RENDER_SHADOW_VERTEX_SOURCE =
" uniform mediump mat4 uLightCameraProjectionMatrix;\n"
mShadowPlaneBg = shadowPlane;
mShadowPlane = ImageActor::New();
+ mShadowPlane.SetName( "SHADOW_PLANE" );
mShadowPlane.SetParentOrigin(ParentOrigin::CENTER);
mShadowPlane.SetAnchorPoint(AnchorPoint::CENTER);
ConstrainCamera();
- mShadowPlane.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, Source( mShadowPlaneBg, Actor::SIZE ), EqualToConstraint() ) );
+ mShadowPlane.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
- mBlurRootActor.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, Source( mShadowPlane, Actor::SIZE ), EqualToConstraint() ) );
+ mBlurRootActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
}
void ShadowView::SetPointLight(Actor pointLight)
{
// 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() ));
+ mChildrenRoot.SetRelayoutEnabled( true );
+ mChildrenRoot.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
Vector2 stageSize = Stage::GetCurrent().GetSize();
mCameraActor = CameraActor::New(stageSize);
// 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.SetOrientation(Radian(Degree(180)), Vector3::YAXIS);
mCameraActor.SetPosition(DEFAULT_LIGHT_POSITION);
mShadowRenderShader = ShaderEffect::New( RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE,
mBlurFilter.SetPixelFormat(Pixel::RGBA8888);
mBlurRootActor = Actor::New();
+ mBlurRootActor.SetName( "BLUR_ROOT_ACTOR" );
+ mBlurRootActor.SetRelayoutEnabled( true );
// Turn off inheritance to ensure filter renders properly
mBlurRootActor.SetPositionInheritanceMode(USE_PARENT_POSITION);
- mBlurRootActor.SetInheritRotation(false);
+ mBlurRootActor.SetInheritOrientation(false);
mBlurRootActor.SetInheritScale(false);
mBlurRootActor.SetColorMode(USE_OWN_COLOR);
// is under control of application, can't use transform inheritance)
Constraint cameraOrientationConstraint =
- Constraint::New<Quaternion> ( Actor::ROTATION,
- Source( mShadowPlane, Actor::WORLD_POSITION ),
- Source( mPointLight, Actor::WORLD_POSITION ),
- Source( mShadowPlane, Actor::WORLD_ROTATION ),
+ Constraint::New<Quaternion> ( Actor::Property::ORIENTATION,
+ Source( mShadowPlane, Actor::Property::WORLD_POSITION ),
+ Source( mPointLight, Actor::Property::WORLD_POSITION ),
+ Source( mShadowPlane, Actor::Property::WORLD_ORIENTATION ),
&LookAt );
mCameraActor.ApplyConstraint( cameraOrientationConstraint );
- Constraint pointLightPositionConstraint = Constraint::New<Vector3>( Actor::POSITION, Source( mPointLight, Actor::WORLD_POSITION ), EqualToConstraint() );
+ Constraint pointLightPositionConstraint = Constraint::New<Vector3>( Actor::Property::POSITION, Source( mPointLight, Actor::Property::WORLD_POSITION ), EqualToConstraint() );
mCameraActor.ApplyConstraint( pointLightPositionConstraint );
}
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());
+ Constraint projectionMatrixConstraint = Constraint::New<Dali::Matrix>( lightCameraProjectionMatrixPropertyIndex, Source( mCameraActor, CameraActor::Property::PROJECTION_MATRIX ), EqualToConstraintMatrix());
+ Constraint viewMatrixConstraint = Constraint::New<Dali::Matrix>( lightCameraViewMatrixPropertyIndex, Source( mCameraActor, CameraActor::Property::VIEW_MATRIX ), EqualToConstraintMatrix());
mShadowRenderShader.ApplyConstraint(projectionMatrixConstraint);
mShadowRenderShader.ApplyConstraint(viewMatrixConstraint);