// All the properties should still be the default values
// Defaults taken from scene-graph-camera.cpp
- DALI_TEST_EQUALS(800.0f / 480.0f, actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(480.0f / 800.0f, actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
DALI_TEST_EQUALS(45.0f * (Math::PI / 180.0f), actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
DALI_TEST_EQUALS(800.0f, actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
DALI_TEST_EQUALS(3.0f * 800.0f, actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(400.0f, actor.GetProperty(DevelCameraActor::Property::ORTHOGRAPHIC_SIZE).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
DALI_TEST_EQUALS(0.0f, actor.GetProperty(Actor::Property::POSITION_Z).Get<float>(), TEST_LOCATION);
DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION);
DALI_TEST_EQUALS(0.489957f, actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
DALI_TEST_EQUALS(800.0f, actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
DALI_TEST_EQUALS(4895.0f, actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(400.0f, actor.GetProperty(DevelCameraActor::Property::ORTHOGRAPHIC_SIZE).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
DALI_TEST_EQUALS(1600.0f, actor.GetProperty(Actor::Property::POSITION_Z).Get<float>(), TEST_LOCATION);
DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION);
DALI_TEST_EQUALS(0.489957f, actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
DALI_TEST_EQUALS(800.0f, actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
DALI_TEST_EQUALS(4895.0f, actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(400.0f, actor.GetProperty(DevelCameraActor::Property::ORTHOGRAPHIC_SIZE).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
DALI_TEST_EQUALS(1600.0f, actor.GetProperty(Actor::Property::POSITION_Z).Get<float>(), TEST_LOCATION);
DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION);
END_TEST;
}
+int UtcDaliCameraActorSetGetOthographicSizeP(void)
+{
+ TestApplication application;
+ tet_infoline("Testing Dali::CameraActor Set Orthographic Size (P)");
+
+ CameraActor actor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ actor.SetProjectionMode(Dali::Camera::ORTHOGRAPHIC_PROJECTION);
+
+ // Get default orthographic size by inputed size
+ DALI_TEST_EQUALS(actor.GetProperty(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE).Get<float>(), static_cast<float>(TestApplication::DEFAULT_SURFACE_HEIGHT) * 0.5f, TEST_LOCATION);
+
+ float value = 0.0f;
+
+ // Set an initial value to confirm a further set changes it.
+ float size = 300.0f;
+ actor.SetProperty(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE, size);
+
+ value = 0.0f;
+ DALI_TEST_CHECK(actor.GetProperty(DevelCameraActor::Property::ORTHOGRAPHIC_SIZE).Get(value));
+ DALI_TEST_EQUALS(value, size, TEST_LOCATION);
+
+ size = 1600.0f;
+ actor.SetProperty(DevelCameraActor::Property::ORTHOGRAPHIC_SIZE, size);
+
+ value = 0.0f;
+ DALI_TEST_CHECK(actor.GetProperty(DevelCameraActor::Property::ORTHOGRAPHIC_SIZE).Get(value));
+ DALI_TEST_EQUALS(value, size, TEST_LOCATION);
+
+ actor.SetProperty(DevelCameraActor::Property::PROJECTION_DIRECTION, DevelCameraActor::ProjectionDirection::HORIZONTAL);
+
+ size = 600.0f;
+ actor.SetProperty(DevelCameraActor::Property::ORTHOGRAPHIC_SIZE, size);
+
+ value = 0.0f;
+ DALI_TEST_CHECK(actor.GetProperty(DevelCameraActor::Property::ORTHOGRAPHIC_SIZE).Get(value));
+ DALI_TEST_EQUALS(value, size, TEST_LOCATION);
+
+ END_TEST;
+}
+
int UtcDaliCameraActorSetPerspectiveProjectionP(void)
{
TestApplication application;
application.GetScene().Add(actor);
actor.SetOrthographicProjection(Size(1080.0f, 1920.0f));
+
application.SendNotification();
application.Render(0);
application.Render();
application.SendNotification();
float defaultAspectRatio;
- float defaultFieldOfView;
float defaultNearPlaneDistance;
float defaultFarPlaneDistance;
actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(defaultAspectRatio);
- actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(defaultFieldOfView);
actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(defaultNearPlaneDistance);
actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(defaultFarPlaneDistance);
Vector3 defaultPos = actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
- actor.SetOrthographicProjection(Size(1080.0f, 1920.0f));
-
- application.SendNotification();
- application.Render(0);
- application.Render();
- application.SendNotification();
+ auto TestOrthographicPlaneDistance = [&](float width, float height, float expectOrthographicSize) {
+ actor.SetOrthographicProjection(Size(width, height));
- float value;
- actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(value);
- DALI_TEST_EQUALS(defaultAspectRatio, value, FLOAT_EPSILON, TEST_LOCATION);
- actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value);
- DALI_TEST_EQUALS(defaultFieldOfView, value, FLOAT_EPSILON, TEST_LOCATION);
- actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(value);
- DALI_TEST_EQUALS(defaultNearPlaneDistance, value, FLOAT_EPSILON, TEST_LOCATION);
- actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(value);
- DALI_TEST_EQUALS(defaultFarPlaneDistance, value, FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(expectOrthographicSize, actor.GetProperty(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE).Get<float>(), TEST_LOCATION);
- actor.GetProperty(CameraActor::Property::LEFT_PLANE_DISTANCE).Get(value);
- DALI_TEST_EQUALS(-540.0f, value, FLOAT_EPSILON, TEST_LOCATION);
- actor.GetProperty(CameraActor::Property::RIGHT_PLANE_DISTANCE).Get(value);
- DALI_TEST_EQUALS(540.0f, value, FLOAT_EPSILON, TEST_LOCATION);
- actor.GetProperty(CameraActor::Property::TOP_PLANE_DISTANCE).Get(value);
- DALI_TEST_EQUALS(960.0f, value, FLOAT_EPSILON, TEST_LOCATION);
- actor.GetProperty(CameraActor::Property::BOTTOM_PLANE_DISTANCE).Get(value);
- DALI_TEST_EQUALS(-960.0f, value, FLOAT_EPSILON, TEST_LOCATION);
+ application.SendNotification();
+ application.Render(0);
+ application.Render();
+ application.SendNotification();
- Vector3 pos = actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
- DALI_TEST_EQUALS(defaultPos.z, pos.z, 0.001f, TEST_LOCATION);
+ float value;
+ actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(value);
+ DALI_TEST_EQUALS(defaultAspectRatio, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(defaultNearPlaneDistance, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(defaultFarPlaneDistance, value, FLOAT_EPSILON, TEST_LOCATION);
+
+ actor.GetProperty(CameraActor::Property::LEFT_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(-540.0f, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::RIGHT_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(540.0f, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::TOP_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(960.0f, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::BOTTOM_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(-960.0f, value, FLOAT_EPSILON, TEST_LOCATION);
+
+ Vector3 pos = actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
+ DALI_TEST_EQUALS(defaultPos.z, pos.z, 0.001f, TEST_LOCATION);
+
+ DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION);
+ };
- DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION);
+ TestOrthographicPlaneDistance(1080.0f, 1920.0f, 960.0f);
+ // Change projection direction
+ actor.SetProperty(DevelCameraActor::Property::PROJECTION_DIRECTION, DevelCameraActor::ProjectionDirection::HORIZONTAL);
+ TestOrthographicPlaneDistance(1080.0f, 1920.0f, 540.0f);
END_TEST;
}
END_TEST;
}
-int UtcDaliCameraActorSetOrthographicProjectionP2(void)
-{
- TestApplication application;
- tet_infoline("Testing Dali::CameraActor::SetOrthographicProjection (P,2)");
-
- CameraActor actor = CameraActor::New();
- DALI_TEST_CHECK(actor);
-
- float defaultAspectRatio;
- float defaultFieldOfView;
- float defaultNearPlaneDistance;
- float defaultFarPlaneDistance;
- actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(defaultAspectRatio);
- actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(defaultFieldOfView);
- actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(defaultNearPlaneDistance);
- actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(defaultFarPlaneDistance);
-
- // Check setting with specific near and far plane distances.
- actor.SetOrthographicProjection(-100.0f, 200.0f, -300.0f, 500.0f, 400.0f, 4000.0f);
-
- float value;
- actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(value);
- DALI_TEST_EQUALS(defaultAspectRatio, value, FLOAT_EPSILON, TEST_LOCATION);
- actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value);
- DALI_TEST_EQUALS(defaultFieldOfView, value, FLOAT_EPSILON, TEST_LOCATION);
- actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(value);
- DALI_TEST_EQUALS(400.0f, value, FLOAT_EPSILON, TEST_LOCATION);
- actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(value);
- DALI_TEST_EQUALS(4000.0f, value, FLOAT_EPSILON, TEST_LOCATION);
-
- actor.GetProperty(CameraActor::Property::LEFT_PLANE_DISTANCE).Get(value);
- DALI_TEST_EQUALS(-100.0f, value, FLOAT_EPSILON, TEST_LOCATION);
- actor.GetProperty(CameraActor::Property::RIGHT_PLANE_DISTANCE).Get(value);
- DALI_TEST_EQUALS(200.0f, value, FLOAT_EPSILON, TEST_LOCATION);
- actor.GetProperty(CameraActor::Property::TOP_PLANE_DISTANCE).Get(value);
- DALI_TEST_EQUALS(-300.0f, value, FLOAT_EPSILON, TEST_LOCATION);
- actor.GetProperty(CameraActor::Property::BOTTOM_PLANE_DISTANCE).Get(value);
- DALI_TEST_EQUALS(500.0f, value, FLOAT_EPSILON, TEST_LOCATION);
-
- DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION);
-
- END_TEST;
-}
-
-int UtcDaliCameraActorSetOrthographicProjectionP3(void)
-{
- TestApplication application;
- tet_infoline("Testing Dali::CameraActor::SetOrthographicProjection (P,3)");
-
- CameraActor actor = CameraActor::New();
- DALI_TEST_CHECK(actor);
-
- float defaultAspectRatio;
- float defaultFieldOfView;
- float defaultNearPlaneDistance;
- float defaultFarPlaneDistance;
- actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(defaultAspectRatio);
- actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(defaultFieldOfView);
- actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(defaultNearPlaneDistance);
- actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(defaultFarPlaneDistance);
-
- actor.SetProjectionMode(Dali::Camera::ORTHOGRAPHIC_PROJECTION);
-
- actor.SetProperty(CameraActor::Property::LEFT_PLANE_DISTANCE, -100.0f);
- actor.SetProperty(CameraActor::Property::RIGHT_PLANE_DISTANCE, 200.0f);
- actor.SetProperty(CameraActor::Property::TOP_PLANE_DISTANCE, -300.0f);
- actor.SetProperty(CameraActor::Property::BOTTOM_PLANE_DISTANCE, 500.0f);
- actor.SetNearClippingPlane(400.0f);
- actor.SetFarClippingPlane(4000.0f);
-
- float value;
- actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(value);
- DALI_TEST_EQUALS(defaultAspectRatio, value, FLOAT_EPSILON, TEST_LOCATION);
- actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value);
- DALI_TEST_EQUALS(defaultFieldOfView, value, FLOAT_EPSILON, TEST_LOCATION);
- actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(value);
- DALI_TEST_EQUALS(400.0f, value, FLOAT_EPSILON, TEST_LOCATION);
- actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(value);
- DALI_TEST_EQUALS(4000.0f, value, FLOAT_EPSILON, TEST_LOCATION);
-
- actor.GetProperty(CameraActor::Property::LEFT_PLANE_DISTANCE).Get(value);
- DALI_TEST_EQUALS(-100.0f, value, FLOAT_EPSILON, TEST_LOCATION);
- actor.GetProperty(CameraActor::Property::RIGHT_PLANE_DISTANCE).Get(value);
- DALI_TEST_EQUALS(200.0f, value, FLOAT_EPSILON, TEST_LOCATION);
- actor.GetProperty(CameraActor::Property::TOP_PLANE_DISTANCE).Get(value);
- DALI_TEST_EQUALS(-300.0f, value, FLOAT_EPSILON, TEST_LOCATION);
- actor.GetProperty(CameraActor::Property::BOTTOM_PLANE_DISTANCE).Get(value);
- DALI_TEST_EQUALS(500.0f, value, FLOAT_EPSILON, TEST_LOCATION);
-
- DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION);
-
- Dali::Camera::ProjectionMode projectionMode = actor.GetProperty<Dali::Camera::ProjectionMode>(CameraActor::Property::PROJECTION_MODE);
- DALI_TEST_EQUALS(projectionMode, Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION);
- END_TEST;
-}
-
int UtcDaliCameraActorSetProjectionModeP(void)
{
TestApplication application;
indices.push_back(CameraActor::Property::PROJECTION_MATRIX);
indices.push_back(CameraActor::Property::VIEW_MATRIX);
indices.push_back(CameraActor::Property::INVERT_Y_AXIS);
+ indices.push_back(DevelCameraActor::Property::ORTHOGRAPHIC_SIZE);
+ indices.push_back(DevelCameraActor::Property::PROJECTION_DIRECTION);
DALI_TEST_CHECK(actor.GetPropertyCount() == (Actor::New().GetPropertyCount() + indices.size()));
{
DALI_TEST_EQUALS(*iter, actor.GetPropertyIndex(actor.GetPropertyName(*iter)), TEST_LOCATION);
- if(*iter == CameraActor::Property::FIELD_OF_VIEW)
+ if(*iter == CameraActor::Property::FIELD_OF_VIEW || *iter == CameraActor::Property::ASPECT_RATIO || *iter == DevelCameraActor::Property::ORTHOGRAPHIC_SIZE)
{
DALI_TEST_CHECK(actor.IsPropertyAnimatable(*iter));
}
DALI_TEST_CHECK(!actor.IsPropertyAnimatable(*iter));
}
- if((*iter == CameraActor::Property::PROJECTION_MATRIX) ||
+ if((*iter == CameraActor::Property::LEFT_PLANE_DISTANCE) ||
+ (*iter == CameraActor::Property::RIGHT_PLANE_DISTANCE) ||
+ (*iter == CameraActor::Property::TOP_PLANE_DISTANCE) ||
+ (*iter == CameraActor::Property::BOTTOM_PLANE_DISTANCE) ||
+ (*iter == CameraActor::Property::PROJECTION_MATRIX) ||
(*iter == CameraActor::Property::VIEW_MATRIX))
{
DALI_TEST_CHECK(!actor.IsPropertyWritable(*iter));
{"type", Property::INTEGER, true, false, true, Dali::CameraActor::Property::TYPE},
{"projectionMode", Property::INTEGER, true, false, true, Dali::CameraActor::Property::PROJECTION_MODE},
{"fieldOfView", Property::FLOAT, true, true, true, Dali::CameraActor::Property::FIELD_OF_VIEW},
- {"aspectRatio", Property::FLOAT, true, false, true, Dali::CameraActor::Property::ASPECT_RATIO},
+ {"aspectRatio", Property::FLOAT, true, true, true, Dali::CameraActor::Property::ASPECT_RATIO},
{"nearPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::NEAR_PLANE_DISTANCE},
{"farPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::FAR_PLANE_DISTANCE},
- {"leftPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::LEFT_PLANE_DISTANCE},
- {"rightPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE},
- {"topPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::TOP_PLANE_DISTANCE},
- {"bottomPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE},
+ {"leftPlaneDistance", Property::FLOAT, false, false, true, Dali::CameraActor::Property::LEFT_PLANE_DISTANCE},
+ {"rightPlaneDistance", Property::FLOAT, false, false, true, Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE},
+ {"topPlaneDistance", Property::FLOAT, false, false, true, Dali::CameraActor::Property::TOP_PLANE_DISTANCE},
+ {"bottomPlaneDistance", Property::FLOAT, false, false, true, Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE},
{"targetPosition", Property::VECTOR3, true, false, true, Dali::CameraActor::Property::TARGET_POSITION},
{"projectionMatrix", Property::MATRIX, false, false, true, Dali::CameraActor::Property::PROJECTION_MATRIX},
{"viewMatrix", Property::MATRIX, false, false, true, Dali::CameraActor::Property::VIEW_MATRIX},
- {"invertYAxis", Property::BOOLEAN, true, false, true, Dali::CameraActor::Property::INVERT_Y_AXIS}};
+ {"invertYAxis", Property::BOOLEAN, true, false, true, Dali::CameraActor::Property::INVERT_Y_AXIS},
+ {"orthographicSize", Property::FLOAT, true, true, true, Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE},
+ {"projectionDirection", Property::INTEGER, true, false, true, Dali::DevelCameraActor::Property::PROJECTION_DIRECTION}};
for(uint32_t index = 0; index < (sizeof(CAMERA_DEFAULT_PROPERTY) / sizeof(PropertyDetails)); ++index)
{
application.GetScene().Add(actor);
camera.SetFieldOfView(0.1f);
+ camera.SetAspectRatio(0.5f);
+ camera.SetProperty(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE, 200.0f);
- Constraint constraint = Constraint::New<float>(actor, Actor::Property::POSITION_X, EqualToConstraint());
- constraint.AddSource(Source(camera, CameraActor::Property::FIELD_OF_VIEW));
- constraint.Apply();
+ Constraint constraintX = Constraint::New<float>(actor, Actor::Property::POSITION_X, EqualToConstraint());
+ constraintX.AddSource(Source(camera, CameraActor::Property::FIELD_OF_VIEW));
+ constraintX.Apply();
+
+ Constraint constraintY = Constraint::New<float>(actor, Actor::Property::POSITION_Y, EqualToConstraint());
+ constraintY.AddSource(Source(camera, CameraActor::Property::ASPECT_RATIO));
+ constraintY.Apply();
+
+ Constraint constraintZ = Constraint::New<float>(actor, Actor::Property::POSITION_Z, EqualToConstraint());
+ constraintZ.AddSource(Source(camera, DevelCameraActor::Property::ORTHOGRAPHIC_SIZE));
+ constraintZ.Apply();
application.SendNotification();
application.Render();
DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_Y), 0.5f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_Z), 200.0f, TEST_LOCATION);
camera.SetFieldOfView(0.5f);
+ camera.SetAspectRatio(0.2f);
+ camera.SetProperty(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE, 100.0f);
application.SendNotification();
application.Render();
DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.5f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_Y), 0.2f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_Z), 100.0f, TEST_LOCATION);
END_TEST;
}
actor.SetProperty(Actor::Property::POSITION, Vector2(0.1f, 0.0f));
application.GetScene().Add(actor);
- Radian sourceFoV = Radian(0.6f);
- Radian targetFoV = Radian(0.1f);
+ Radian sourceFoV = Radian(0.6f);
+ float sourceAspect = 0.7f;
+
+ Radian targetFoV = Radian(0.1f);
+ float targetAspect = 1.3f;
Matrix expectedProjectionMatrix1;
Matrix expectedProjectionMatrix2;
// Build expect projection matrix
camera.SetFieldOfView(sourceFoV.radian);
+ camera.SetAspectRatio(sourceAspect);
application.SendNotification();
application.Render();
camera.GetProperty(CameraActor::Property::PROJECTION_MATRIX).Get(expectedProjectionMatrix1);
camera.SetFieldOfView(sourceFoV.radian * 0.6f + targetFoV.radian * 0.4f);
+ camera.SetAspectRatio(sourceAspect * 0.6f + targetAspect * 0.4f);
application.SendNotification();
application.Render();
camera.GetProperty(CameraActor::Property::PROJECTION_MATRIX).Get(expectedProjectionMatrix2);
camera.SetFieldOfView(targetFoV.radian);
+ camera.SetAspectRatio(targetAspect);
application.SendNotification();
application.Render();
camera.GetProperty(CameraActor::Property::PROJECTION_MATRIX).Get(expectedProjectionMatrix3);
// progress 0.0
DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::FIELD_OF_VIEW), sourceFoV.radian, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::ASPECT_RATIO), sourceAspect, TEST_LOCATION);
camera.GetProperty(CameraActor::Property::PROJECTION_MATRIX).Get(projectionMatrix);
DALI_TEST_EQUALS(projectionMatrix, expectedProjectionMatrix1, Epsilon<100000>::value, TEST_LOCATION);
// progress 0.4
DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::FIELD_OF_VIEW), sourceFoV.radian * 0.6f + targetFoV.radian * 0.4f, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::ASPECT_RATIO), sourceAspect * 0.6f + targetAspect * 0.4f, TEST_LOCATION);
camera.GetProperty(CameraActor::Property::PROJECTION_MATRIX).Get(projectionMatrix);
DALI_TEST_EQUALS(projectionMatrix, expectedProjectionMatrix2, Epsilon<100000>::value, TEST_LOCATION);
// progress 1.0
DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::FIELD_OF_VIEW), targetFoV.radian, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::ASPECT_RATIO), targetAspect, TEST_LOCATION);
camera.GetProperty(CameraActor::Property::PROJECTION_MATRIX).Get(projectionMatrix);
DALI_TEST_EQUALS(projectionMatrix, expectedProjectionMatrix3, Epsilon<100000>::value, TEST_LOCATION);
{
tet_printf("AnimateTo\n");
camera.SetProperty(CameraActor::Property::FIELD_OF_VIEW, sourceFoV.radian);
+ camera.SetProperty(CameraActor::Property::ASPECT_RATIO, sourceAspect);
Animation animation = Animation::New(1.0f);
animation.AnimateTo(Property(camera, CameraActor::Property::FIELD_OF_VIEW), targetFoV.radian);
+ animation.AnimateTo(Property(camera, CameraActor::Property::ASPECT_RATIO), targetAspect);
animation.AnimateTo(Property(camera, Actor::Property::POSITION_X), 0.0f); ///< For line coverage.
animation.Play();
{
tet_printf("AnimateBetween\n");
Animation animation = Animation::New(1.0f);
- KeyFrames keyFrames = KeyFrames::New();
- keyFrames.Add(0.0f, sourceFoV.radian);
- keyFrames.Add(1.0f, targetFoV.radian);
- animation.AnimateBetween(Property(camera, CameraActor::Property::FIELD_OF_VIEW), keyFrames);
+
+ KeyFrames keyFrames1 = KeyFrames::New();
+ keyFrames1.Add(0.0f, sourceFoV.radian);
+ keyFrames1.Add(1.0f, targetFoV.radian);
+
+ KeyFrames keyFrames2 = KeyFrames::New();
+ keyFrames2.Add(0.0f, sourceAspect);
+ keyFrames2.Add(1.0f, targetAspect);
+
+ animation.AnimateBetween(Property(camera, CameraActor::Property::FIELD_OF_VIEW), keyFrames1);
+ animation.AnimateBetween(Property(camera, CameraActor::Property::ASPECT_RATIO), keyFrames2);
+
animation.Play();
TestAnimationProgress();
{
tet_printf("AnimateBy\n");
camera.SetProperty(CameraActor::Property::FIELD_OF_VIEW, sourceFoV.radian);
+ camera.SetProperty(CameraActor::Property::ASPECT_RATIO, sourceAspect);
Animation animation = Animation::New(1.0f);
animation.AnimateBy(Property(camera, CameraActor::Property::FIELD_OF_VIEW), targetFoV.radian - sourceFoV.radian);
+ animation.AnimateBy(Property(camera, CameraActor::Property::ASPECT_RATIO), targetAspect - sourceAspect);
+ animation.Play();
+
+ TestAnimationProgress();
+ }
+
+ END_TEST;
+}
+
+int UtcDaliCameraActorAnimatedProperties04(void)
+{
+ TestApplication application;
+ tet_infoline("Testing Dali::Internal::CameraActor::GetSceneObjectAnimatableProperty()");
+
+ CameraActor camera = application.GetScene().GetRenderTaskList().GetTask(0u).GetCameraActor();
+
+ // Make camera as orthographic mode
+ camera.SetProjectionMode(Dali::Camera::ORTHOGRAPHIC_PROJECTION);
+
+ // Add dummy actor
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector2(0.1f, 0.0f));
+ application.GetScene().Add(actor);
+
+ float sourceOrthographic = 2.0f;
+ float sourceAspect = 0.7f;
+
+ float targetOrthographic = 4.0f;
+ float targetAspect = 1.3f;
+
+ Matrix expectedProjectionMatrix1;
+ Matrix expectedProjectionMatrix2;
+ Matrix expectedProjectionMatrix3;
+
+ // Reduce near-far value for projection matrix epsilon
+ camera.SetNearClippingPlane(1.0f);
+ camera.SetFarClippingPlane(3.0f);
+
+ // Build expect projection matrix
+ camera.SetProperty(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE, sourceOrthographic);
+ camera.SetAspectRatio(sourceAspect);
+ application.SendNotification();
+ application.Render();
+ camera.GetProperty(CameraActor::Property::PROJECTION_MATRIX).Get(expectedProjectionMatrix1);
+
+ camera.SetProperty(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE, sourceOrthographic * 0.6f + targetOrthographic * 0.4f);
+ camera.SetAspectRatio(sourceAspect * 0.6f + targetAspect * 0.4f);
+ application.SendNotification();
+ application.Render();
+ camera.GetProperty(CameraActor::Property::PROJECTION_MATRIX).Get(expectedProjectionMatrix2);
+
+ camera.SetProperty(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE, targetOrthographic);
+ camera.SetAspectRatio(targetAspect);
+ application.SendNotification();
+ application.Render();
+ camera.GetProperty(CameraActor::Property::PROJECTION_MATRIX).Get(expectedProjectionMatrix3);
+
+ auto TestAnimationProgress = [&]() {
+ Matrix projectionMatrix;
+
+ application.SendNotification();
+ application.Render(0);
+
+ float expectOrthographic;
+ float expectAspect;
+ float expectLeft;
+ float expectRight;
+ float expectTop;
+ float expectBottom;
+
+ auto UpdateExpectPlaneDistance = [&]() {
+ bool isVertical = camera.GetProperty<int>(DevelCameraActor::Property::PROJECTION_DIRECTION) == static_cast<int>(DevelCameraActor::ProjectionDirection::VERTICAL);
+ expectLeft = -(isVertical ? expectOrthographic * expectAspect : expectOrthographic);
+ expectRight = (isVertical ? expectOrthographic * expectAspect : expectOrthographic);
+ expectTop = (isVertical ? expectOrthographic : expectOrthographic / expectAspect);
+ expectBottom = -(isVertical ? expectOrthographic : expectOrthographic / expectAspect);
+ };
+
+ // progress 0.0
+ expectOrthographic = sourceOrthographic;
+ expectAspect = sourceAspect;
+ UpdateExpectPlaneDistance();
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(DevelCameraActor::Property::ORTHOGRAPHIC_SIZE), expectOrthographic, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::ASPECT_RATIO), expectAspect, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::LEFT_PLANE_DISTANCE), expectLeft, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::RIGHT_PLANE_DISTANCE), expectRight, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::TOP_PLANE_DISTANCE), expectTop, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::BOTTOM_PLANE_DISTANCE), expectBottom, TEST_LOCATION);
+
+ camera.GetProperty(CameraActor::Property::PROJECTION_MATRIX).Get(projectionMatrix);
+ DALI_TEST_EQUALS(projectionMatrix, expectedProjectionMatrix1, Epsilon<100000>::value, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render(400);
+
+ // progress 0.4
+ expectOrthographic = sourceOrthographic * 0.6f + targetOrthographic * 0.4f;
+ expectAspect = sourceAspect * 0.6f + targetAspect * 0.4f;
+ UpdateExpectPlaneDistance();
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(DevelCameraActor::Property::ORTHOGRAPHIC_SIZE), expectOrthographic, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::ASPECT_RATIO), expectAspect, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::LEFT_PLANE_DISTANCE), expectLeft, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::RIGHT_PLANE_DISTANCE), expectRight, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::TOP_PLANE_DISTANCE), expectTop, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::BOTTOM_PLANE_DISTANCE), expectBottom, TEST_LOCATION);
+
+ camera.GetProperty(CameraActor::Property::PROJECTION_MATRIX).Get(projectionMatrix);
+ DALI_TEST_EQUALS(projectionMatrix, expectedProjectionMatrix2, Epsilon<100000>::value, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render(600);
+
+ // progress 1.0
+ expectOrthographic = targetOrthographic;
+ expectAspect = targetAspect;
+ UpdateExpectPlaneDistance();
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(DevelCameraActor::Property::ORTHOGRAPHIC_SIZE), expectOrthographic, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::ASPECT_RATIO), expectAspect, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::LEFT_PLANE_DISTANCE), expectLeft, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::RIGHT_PLANE_DISTANCE), expectRight, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::TOP_PLANE_DISTANCE), expectTop, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::BOTTOM_PLANE_DISTANCE), expectBottom, TEST_LOCATION);
+
+ camera.GetProperty(CameraActor::Property::PROJECTION_MATRIX).Get(projectionMatrix);
+ DALI_TEST_EQUALS(projectionMatrix, expectedProjectionMatrix3, Epsilon<100000>::value, TEST_LOCATION);
+
+ // Ensure Animate finished.
+ application.SendNotification();
+ application.Render(16);
+ };
+
+ // AnimateTo
+ {
+ tet_printf("AnimateTo - vertical\n");
+ camera.SetProperty(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE, sourceOrthographic);
+ camera.SetProperty(CameraActor::Property::ASPECT_RATIO, sourceAspect);
+ Animation animation = Animation::New(1.0f);
+ animation.AnimateTo(Property(camera, DevelCameraActor::Property::ORTHOGRAPHIC_SIZE), targetOrthographic);
+ animation.AnimateTo(Property(camera, CameraActor::Property::ASPECT_RATIO), targetAspect);
+ animation.Play();
+ TestAnimationProgress();
+ }
+
+ // AnimateBetween
+ {
+ tet_printf("AnimateBetween - vertical\n");
+ Animation animation = Animation::New(1.0f);
+
+ KeyFrames keyFrames1 = KeyFrames::New();
+ keyFrames1.Add(0.0f, sourceOrthographic);
+ keyFrames1.Add(1.0f, targetOrthographic);
+
+ KeyFrames keyFrames2 = KeyFrames::New();
+ keyFrames2.Add(0.0f, sourceAspect);
+ keyFrames2.Add(1.0f, targetAspect);
+
+ animation.AnimateBetween(Property(camera, DevelCameraActor::Property::ORTHOGRAPHIC_SIZE), keyFrames1);
+ animation.AnimateBetween(Property(camera, CameraActor::Property::ASPECT_RATIO), keyFrames2);
+
animation.Play();
+ TestAnimationProgress();
+ }
+ // AnimateBy
+ {
+ tet_printf("AnimateBy - vertical\n");
+ camera.SetProperty(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE, sourceOrthographic);
+ camera.SetProperty(CameraActor::Property::ASPECT_RATIO, sourceAspect);
+ Animation animation = Animation::New(1.0f);
+ animation.AnimateBy(Property(camera, DevelCameraActor::Property::ORTHOGRAPHIC_SIZE), targetOrthographic - sourceOrthographic);
+ animation.AnimateBy(Property(camera, CameraActor::Property::ASPECT_RATIO), targetAspect - sourceAspect);
+ animation.Play();
+ TestAnimationProgress();
+ }
+
+ END_TEST;
+}
+
+int UtcDaliCameraActorAnimatedProperties05(void)
+{
+ TestApplication application;
+ tet_infoline("Testing Dali::Internal::CameraActor::GetSceneObjectAnimatableProperty()");
+
+ CameraActor camera = application.GetScene().GetRenderTaskList().GetTask(0u).GetCameraActor();
+
+ // Make camera as orthographic mode and horizontal
+ camera.SetProjectionMode(Dali::Camera::ORTHOGRAPHIC_PROJECTION);
+ camera.SetProperty(DevelCameraActor::Property::PROJECTION_DIRECTION, DevelCameraActor::ProjectionDirection::HORIZONTAL);
+
+ // Add dummy actor
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector2(0.1f, 0.0f));
+ application.GetScene().Add(actor);
+
+ float sourceOrthographic = 2.0f;
+ float sourceAspect = 0.7f;
+
+ float targetOrthographic = 4.0f;
+ float targetAspect = 1.3f;
+
+ Matrix expectedProjectionMatrix1;
+ Matrix expectedProjectionMatrix2;
+ Matrix expectedProjectionMatrix3;
+
+ // Reduce near-far value for projection matrix epsilon
+ camera.SetNearClippingPlane(1.0f);
+ camera.SetFarClippingPlane(3.0f);
+
+ // Build expect projection matrix
+ camera.SetProperty(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE, sourceOrthographic);
+ camera.SetAspectRatio(sourceAspect);
+ application.SendNotification();
+ application.Render();
+ camera.GetProperty(CameraActor::Property::PROJECTION_MATRIX).Get(expectedProjectionMatrix1);
+
+ camera.SetProperty(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE, sourceOrthographic * 0.6f + targetOrthographic * 0.4f);
+ camera.SetAspectRatio(sourceAspect * 0.6f + targetAspect * 0.4f);
+ application.SendNotification();
+ application.Render();
+ camera.GetProperty(CameraActor::Property::PROJECTION_MATRIX).Get(expectedProjectionMatrix2);
+
+ camera.SetProperty(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE, targetOrthographic);
+ camera.SetAspectRatio(targetAspect);
+ application.SendNotification();
+ application.Render();
+ camera.GetProperty(CameraActor::Property::PROJECTION_MATRIX).Get(expectedProjectionMatrix3);
+
+ auto TestAnimationProgress = [&]() {
+ Matrix projectionMatrix;
+
+ application.SendNotification();
+ application.Render(0);
+
+ float expectOrthographic;
+ float expectAspect;
+ float expectLeft;
+ float expectRight;
+ float expectTop;
+ float expectBottom;
+
+ auto UpdateExpectPlaneDistance = [&]() {
+ bool isVertical = camera.GetProperty<int>(DevelCameraActor::Property::PROJECTION_DIRECTION) == static_cast<int>(DevelCameraActor::ProjectionDirection::VERTICAL);
+ expectLeft = -(isVertical ? expectOrthographic * expectAspect : expectOrthographic);
+ expectRight = (isVertical ? expectOrthographic * expectAspect : expectOrthographic);
+ expectTop = (isVertical ? expectOrthographic : expectOrthographic / expectAspect);
+ expectBottom = -(isVertical ? expectOrthographic : expectOrthographic / expectAspect);
+ };
+
+ // progress 0.0
+ expectOrthographic = sourceOrthographic;
+ expectAspect = sourceAspect;
+ UpdateExpectPlaneDistance();
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(DevelCameraActor::Property::ORTHOGRAPHIC_SIZE), expectOrthographic, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::ASPECT_RATIO), expectAspect, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::LEFT_PLANE_DISTANCE), expectLeft, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::RIGHT_PLANE_DISTANCE), expectRight, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::TOP_PLANE_DISTANCE), expectTop, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::BOTTOM_PLANE_DISTANCE), expectBottom, TEST_LOCATION);
+
+ camera.GetProperty(CameraActor::Property::PROJECTION_MATRIX).Get(projectionMatrix);
+ DALI_TEST_EQUALS(projectionMatrix, expectedProjectionMatrix1, Epsilon<100000>::value, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render(400);
+
+ // progress 0.4
+ expectOrthographic = sourceOrthographic * 0.6f + targetOrthographic * 0.4f;
+ expectAspect = sourceAspect * 0.6f + targetAspect * 0.4f;
+ UpdateExpectPlaneDistance();
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(DevelCameraActor::Property::ORTHOGRAPHIC_SIZE), expectOrthographic, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::ASPECT_RATIO), expectAspect, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::LEFT_PLANE_DISTANCE), expectLeft, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::RIGHT_PLANE_DISTANCE), expectRight, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::TOP_PLANE_DISTANCE), expectTop, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::BOTTOM_PLANE_DISTANCE), expectBottom, TEST_LOCATION);
+
+ camera.GetProperty(CameraActor::Property::PROJECTION_MATRIX).Get(projectionMatrix);
+ DALI_TEST_EQUALS(projectionMatrix, expectedProjectionMatrix2, Epsilon<100000>::value, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render(600);
+
+ // progress 1.0
+ expectOrthographic = targetOrthographic;
+ expectAspect = targetAspect;
+ UpdateExpectPlaneDistance();
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(DevelCameraActor::Property::ORTHOGRAPHIC_SIZE), expectOrthographic, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::ASPECT_RATIO), expectAspect, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::LEFT_PLANE_DISTANCE), expectLeft, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::RIGHT_PLANE_DISTANCE), expectRight, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::TOP_PLANE_DISTANCE), expectTop, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::BOTTOM_PLANE_DISTANCE), expectBottom, TEST_LOCATION);
+
+ camera.GetProperty(CameraActor::Property::PROJECTION_MATRIX).Get(projectionMatrix);
+ DALI_TEST_EQUALS(projectionMatrix, expectedProjectionMatrix3, Epsilon<100000>::value, TEST_LOCATION);
+
+ // Ensure Animate finished.
+ application.SendNotification();
+ application.Render(16);
+ };
+
+ // AnimateTo
+ {
+ tet_printf("AnimateTo - horizontal\n");
+ camera.SetProperty(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE, sourceOrthographic);
+ camera.SetProperty(CameraActor::Property::ASPECT_RATIO, sourceAspect);
+ Animation animation = Animation::New(1.0f);
+ animation.AnimateTo(Property(camera, DevelCameraActor::Property::ORTHOGRAPHIC_SIZE), targetOrthographic);
+ animation.AnimateTo(Property(camera, CameraActor::Property::ASPECT_RATIO), targetAspect);
+ animation.Play();
+ TestAnimationProgress();
+ }
+
+ // AnimateBetween
+ {
+ tet_printf("AnimateBetween - horizontal\n");
+ Animation animation = Animation::New(1.0f);
+
+ KeyFrames keyFrames1 = KeyFrames::New();
+ keyFrames1.Add(0.0f, sourceOrthographic);
+ keyFrames1.Add(1.0f, targetOrthographic);
+
+ KeyFrames keyFrames2 = KeyFrames::New();
+ keyFrames2.Add(0.0f, sourceAspect);
+ keyFrames2.Add(1.0f, targetAspect);
+
+ animation.AnimateBetween(Property(camera, DevelCameraActor::Property::ORTHOGRAPHIC_SIZE), keyFrames1);
+ animation.AnimateBetween(Property(camera, CameraActor::Property::ASPECT_RATIO), keyFrames2);
+
+ animation.Play();
+ TestAnimationProgress();
+ }
+
+ // AnimateBy
+ {
+ tet_printf("AnimateBy - horizontal\n");
+ camera.SetProperty(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE, sourceOrthographic);
+ camera.SetProperty(CameraActor::Property::ASPECT_RATIO, sourceAspect);
+ Animation animation = Animation::New(1.0f);
+ animation.AnimateBy(Property(camera, DevelCameraActor::Property::ORTHOGRAPHIC_SIZE), targetOrthographic - sourceOrthographic);
+ animation.AnimateBy(Property(camera, CameraActor::Property::ASPECT_RATIO), targetAspect - sourceAspect);
+ animation.Play();
TestAnimationProgress();
}
END_TEST;
}
-int UtcDaliCameraActorSetOrthographicProjectionNegative01(void)
-{
- TestApplication application;
- Dali::CameraActor instance;
- try
- {
- float arg1(0.0f);
- float arg2(0.0f);
- float arg3(0.0f);
- float arg4(0.0f);
- float arg5(0.0f);
- float arg6(0.0f);
- instance.SetOrthographicProjection(arg1, arg2, arg3, arg4, arg5, arg6);
- DALI_TEST_CHECK(false); // Should not get here
- }
- catch(...)
- {
- DALI_TEST_CHECK(true); // We expect an assert
- }
- END_TEST;
-}
-
int UtcDaliCameraActorSetOrthographicProjectionNegative02(void)
{
TestApplication application;
// Check that the properties match to that screen size
float value;
actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(value);
- DALI_TEST_EQUALS(800.0f / 480.0f, value, FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(480.0f / 800.0f, value, FLOAT_EPSILON, TEST_LOCATION);
actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(value);
DALI_TEST_EQUALS(800.0f, value, FLOAT_EPSILON, TEST_LOCATION);
// Check that the properties match to that screen size
float value;
actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(value);
- DALI_TEST_EQUALS(800.0f / 480.0f, value, FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(480.0f / 800.0f, value, FLOAT_EPSILON, TEST_LOCATION);
actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(value);
DALI_TEST_EQUALS(800.0f, value, FLOAT_EPSILON, TEST_LOCATION);
camera.Reset();
camera = CameraActor::New();
- camera.SetProperty(Dali::CameraActor::Property::LEFT_PLANE_DISTANCE, 1.0f);
- application.GetScene().Add(camera);
- DALI_TEST_EQUALS(1.0f, camera.GetProperty<float>(Dali::CameraActor::Property::LEFT_PLANE_DISTANCE), TEST_LOCATION);
- camera.Unparent();
- camera.Reset();
-
- camera = CameraActor::New();
- camera.SetProperty(Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE, 1.0f);
- application.GetScene().Add(camera);
- DALI_TEST_EQUALS(1.0f, camera.GetProperty<float>(Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE), TEST_LOCATION);
- camera.Unparent();
- camera.Reset();
-
- camera = CameraActor::New();
- camera.SetProperty(Dali::CameraActor::Property::TOP_PLANE_DISTANCE, 1.0f);
- application.GetScene().Add(camera);
- DALI_TEST_EQUALS(1.0f, camera.GetProperty<float>(Dali::CameraActor::Property::TOP_PLANE_DISTANCE), TEST_LOCATION);
- camera.Unparent();
- camera.Reset();
-
- camera = CameraActor::New();
- camera.SetProperty(Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE, 1.0f);
- application.GetScene().Add(camera);
- DALI_TEST_EQUALS(1.0f, camera.GetProperty<float>(Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE), TEST_LOCATION);
- camera.Unparent();
- camera.Reset();
-
- camera = CameraActor::New();
camera.SetProperty(Dali::Actor::Property::POSITION, Vector3(100.0f, 100.0f, 100.0f));
application.GetScene().Add(camera);
DALI_TEST_EQUALS(Vector3(100.0f, 100.0f, 100.0f), camera.GetProperty<Vector3>(Dali::Actor::Property::POSITION), TEST_LOCATION);
*/
// clang-format off
DALI_PROPERTY_TABLE_BEGIN
-DALI_PROPERTY( "type", INTEGER, true, false, true, Dali::CameraActor::Property::TYPE )
-DALI_PROPERTY( "projectionMode", INTEGER, true, false, true, Dali::CameraActor::Property::PROJECTION_MODE )
-DALI_PROPERTY( "fieldOfView", FLOAT, true, true, true, Dali::CameraActor::Property::FIELD_OF_VIEW )
-DALI_PROPERTY( "aspectRatio", FLOAT, true, false, true, Dali::CameraActor::Property::ASPECT_RATIO )
-DALI_PROPERTY( "nearPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::NEAR_PLANE_DISTANCE )
-DALI_PROPERTY( "farPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::FAR_PLANE_DISTANCE )
-DALI_PROPERTY( "leftPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::LEFT_PLANE_DISTANCE )
-DALI_PROPERTY( "rightPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE )
-DALI_PROPERTY( "topPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::TOP_PLANE_DISTANCE )
-DALI_PROPERTY( "bottomPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE )
-DALI_PROPERTY( "targetPosition", VECTOR3, true, false, true, Dali::CameraActor::Property::TARGET_POSITION )
-DALI_PROPERTY( "projectionMatrix", MATRIX, false, false, true, Dali::CameraActor::Property::PROJECTION_MATRIX )
-DALI_PROPERTY( "viewMatrix", MATRIX, false, false, true, Dali::CameraActor::Property::VIEW_MATRIX )
-DALI_PROPERTY( "invertYAxis", BOOLEAN, true, false, true, Dali::CameraActor::Property::INVERT_Y_AXIS )
+DALI_PROPERTY( "type", INTEGER, true, false, true, Dali::CameraActor::Property::TYPE )
+DALI_PROPERTY( "projectionMode", INTEGER, true, false, true, Dali::CameraActor::Property::PROJECTION_MODE )
+DALI_PROPERTY( "fieldOfView", FLOAT, true, true, true, Dali::CameraActor::Property::FIELD_OF_VIEW )
+DALI_PROPERTY( "aspectRatio", FLOAT, true, true, true, Dali::CameraActor::Property::ASPECT_RATIO )
+DALI_PROPERTY( "nearPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::NEAR_PLANE_DISTANCE )
+DALI_PROPERTY( "farPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::FAR_PLANE_DISTANCE )
+DALI_PROPERTY( "leftPlaneDistance", FLOAT, false, false, true, Dali::CameraActor::Property::LEFT_PLANE_DISTANCE )
+DALI_PROPERTY( "rightPlaneDistance", FLOAT, false, false, true, Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE )
+DALI_PROPERTY( "topPlaneDistance", FLOAT, false, false, true, Dali::CameraActor::Property::TOP_PLANE_DISTANCE )
+DALI_PROPERTY( "bottomPlaneDistance", FLOAT, false, false, true, Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE )
+DALI_PROPERTY( "targetPosition", VECTOR3, true, false, true, Dali::CameraActor::Property::TARGET_POSITION )
+DALI_PROPERTY( "projectionMatrix", MATRIX, false, false, true, Dali::CameraActor::Property::PROJECTION_MATRIX )
+DALI_PROPERTY( "viewMatrix", MATRIX, false, false, true, Dali::CameraActor::Property::VIEW_MATRIX )
+DALI_PROPERTY( "invertYAxis", BOOLEAN, true, false, true, Dali::CameraActor::Property::INVERT_Y_AXIS )
+DALI_PROPERTY( "orthographicSize", FLOAT, true, true, true, Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE )
+DALI_PROPERTY( "projectionDirection", INTEGER, true, false, true, Dali::DevelCameraActor::Property::PROJECTION_DIRECTION )
DALI_PROPERTY_TABLE_END( DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX, CameraDefaultProperties )
// clang-format on
rayDir.w = 1.0f;
}
+/**
+ * @brief Helper class to calculate left/right/top/bottom plane distance by orthographicSize and something other info.
+ * It will resolve some confuse case of plane distance value.
+ * (Something like, Is top plane distance is positive or negative? is aspect ratio is width/height or height/width?)
+ */
+struct OrthographicSizeConverter
+{
+ constexpr OrthographicSizeConverter(float orthographicSize, float aspectRatio, Dali::DevelCameraActor::ProjectionDirection projectionDirection)
+ : mOrthographicSize(orthographicSize),
+ mAspectRatio(aspectRatio),
+ mProjectionDirection(projectionDirection)
+ {
+ }
+
+ inline float LeftPlaneDistance() const
+ {
+ return -(mProjectionDirection == DevelCameraActor::ProjectionDirection::VERTICAL ? mOrthographicSize * mAspectRatio : mOrthographicSize);
+ }
+
+ inline float RightPlaneDistance() const
+ {
+ return (mProjectionDirection == DevelCameraActor::ProjectionDirection::VERTICAL ? mOrthographicSize * mAspectRatio : mOrthographicSize);
+ }
+
+ inline float TopPlaneDistance() const
+ {
+ return (mProjectionDirection == DevelCameraActor::ProjectionDirection::VERTICAL ? mOrthographicSize : mOrthographicSize / mAspectRatio);
+ }
+
+ inline float BottomPlaneDistance() const
+ {
+ return -(mProjectionDirection == DevelCameraActor::ProjectionDirection::VERTICAL ? mOrthographicSize : mOrthographicSize / mAspectRatio);
+ }
+
+ float mOrthographicSize;
+ float mAspectRatio;
+ Dali::DevelCameraActor::ProjectionDirection mProjectionDirection;
+};
+
} // namespace
CameraActorPtr CameraActor::New(const Size& size)
mProjectionMode(SceneGraph::Camera::DEFAULT_MODE),
mProjectionDirection(SceneGraph::Camera::DEFAULT_PROJECTION_DIRECTION),
mFieldOfView(SceneGraph::Camera::DEFAULT_FIELD_OF_VIEW),
+ mOrthographicSize(SceneGraph::Camera::DEFAULT_ORTHOGRAPHIC_SIZE),
mAspectRatio(SceneGraph::Camera::DEFAULT_ASPECT_RATIO),
mNearClippingPlane(SceneGraph::Camera::DEFAULT_NEAR_CLIPPING_PLANE),
mFarClippingPlane(SceneGraph::Camera::DEFAULT_FAR_CLIPPING_PLANE),
- mLeftClippingPlane(SceneGraph::Camera::DEFAULT_LEFT_CLIPPING_PLANE),
- mRightClippingPlane(SceneGraph::Camera::DEFAULT_RIGHT_CLIPPING_PLANE),
- mTopClippingPlane(SceneGraph::Camera::DEFAULT_TOP_CLIPPING_PLANE),
- mBottomClippingPlane(SceneGraph::Camera::DEFAULT_BOTTOM_CLIPPING_PLANE),
mInvertYAxis(SceneGraph::Camera::DEFAULT_INVERT_Y_AXIS),
mPropertyChanged(false)
{
return GetCameraSceneObject().GetFieldOfView(GetEventThreadServices().GetEventBufferIndex());
}
+void CameraActor::SetOrthographicSize(float orthographicSize)
+{
+ mPropertyChanged = true;
+ if(!Equals(orthographicSize, mOrthographicSize))
+ {
+ mOrthographicSize = orthographicSize;
+
+ // sceneObject is being used in a separate thread; queue a message to set
+ BakeOrthographicSizeMessage(GetEventThreadServices(), GetCameraSceneObject(), mOrthographicSize);
+ }
+}
+
+float CameraActor::GetOrthographicSize() const
+{
+ return mOrthographicSize;
+}
+
+float CameraActor::GetCurrentOrthographicSize() const
+{
+ // node is being used in a separate thread; copy the value from the previous update
+ return GetCameraSceneObject().GetOrthographicSize(GetEventThreadServices().GetEventBufferIndex());
+}
+
void CameraActor::SetAspectRatio(float aspectRatio)
{
mPropertyChanged = true;
mAspectRatio = aspectRatio;
// sceneObject is being used in a separate thread; queue a message to set
- SetAspectRatioMessage(GetEventThreadServices(), GetCameraSceneObject(), mAspectRatio);
+ BakeAspectRatioMessage(GetEventThreadServices(), GetCameraSceneObject(), mAspectRatio);
}
}
return mAspectRatio;
}
+float CameraActor::GetCurrentAspectRatio() const
+{
+ // node is being used in a separate thread; copy the value from the previous update
+ return GetCameraSceneObject().GetAspectRatio(GetEventThreadServices().GetEventBufferIndex());
+}
+
void CameraActor::SetNearClippingPlane(float nearClippingPlane)
{
mPropertyChanged = true;
return mFarClippingPlane;
}
-void CameraActor::SetLeftClippingPlane(float leftClippingPlane)
-{
- mPropertyChanged = true;
- if(!Equals(leftClippingPlane, mLeftClippingPlane))
- {
- mLeftClippingPlane = leftClippingPlane;
-
- // sceneObject is being used in a separate thread; queue a message to set
- SetLeftClippingPlaneMessage(GetEventThreadServices(), GetCameraSceneObject(), mLeftClippingPlane);
- }
-}
-
-void CameraActor::SetRightClippingPlane(float rightClippingPlane)
-{
- mPropertyChanged = true;
- if(!Equals(rightClippingPlane, mRightClippingPlane))
- {
- mRightClippingPlane = rightClippingPlane;
-
- // sceneObject is being used in a separate thread; queue a message to set
- SetRightClippingPlaneMessage(GetEventThreadServices(), GetCameraSceneObject(), mRightClippingPlane);
- }
-}
-
-void CameraActor::SetTopClippingPlane(float topClippingPlane)
-{
- mPropertyChanged = true;
- if(!Equals(topClippingPlane, mTopClippingPlane))
- {
- mTopClippingPlane = topClippingPlane;
-
- // sceneObject is being used in a separate thread; queue a message to set
- SetTopClippingPlaneMessage(GetEventThreadServices(), GetCameraSceneObject(), mTopClippingPlane);
- }
-}
-
-void CameraActor::SetBottomClippingPlane(float bottomClippingPlane)
-{
- mPropertyChanged = true;
- if(!Equals(bottomClippingPlane, mBottomClippingPlane))
- {
- mBottomClippingPlane = bottomClippingPlane;
-
- // sceneObject is being used in a separate thread; queue a message to set
- SetBottomClippingPlaneMessage(GetEventThreadServices(), GetCameraSceneObject(), mBottomClippingPlane);
- }
-}
-
void CameraActor::SetInvertYAxis(bool invertYAxis)
{
if(invertYAxis != mInvertYAxis)
void CameraActor::SetPerspectiveProjection(const Size& size)
{
SetProjectionMode(Dali::Camera::PERSPECTIVE_PROJECTION);
- mCanvasSize = size;
+ mCanvasSize = static_cast<const Vector2>(size);
if((size.width < Math::MACHINE_EPSILON_1000) || (size.height < Math::MACHINE_EPSILON_1000))
{
return;
}
}
-
- float width = mCanvasSize.width;
- float height = mCanvasSize.height;
-
- float nearClippingPlane;
- float farClippingPlane;
- float cameraZ;
- CalculateClippingAndZ(width, height, nearClippingPlane, farClippingPlane, cameraZ);
-
- // calculate the position of the camera to have the desired aspect ratio
- const float fieldOfView = 2.0f * std::atan((mProjectionDirection == DevelCameraActor::ProjectionDirection::VERTICAL ? height : width) * 0.5f / cameraZ);
-
- // unless it is too small, we want at least as much space to the back as we have torwards the front
- const float minClippingFarPlane = 2.f * nearClippingPlane;
- if(farClippingPlane < minClippingFarPlane)
- {
- farClippingPlane = minClippingFarPlane;
- }
-
- const float aspectRatio = width / height;
-
- // sceneObject is being used in a separate thread; queue a message to set
- SetFieldOfView(fieldOfView);
- SetNearClippingPlane(nearClippingPlane);
- SetFarClippingPlane(farClippingPlane);
- SetLeftClippingPlane(width * -0.5f);
- SetRightClippingPlane(width * 0.5f);
- SetTopClippingPlane(height * 0.5f); // Top is +ve to keep consistency with orthographic values
- SetBottomClippingPlane(height * -0.5f); // Bottom is -ve to keep consistency with orthographic values
- SetAspectRatio(aspectRatio);
- SetZ(cameraZ);
+ ApplyDefaultProjection();
}
-void CameraActor::SetOrthographicProjection(const Vector2& size)
+void CameraActor::SetOrthographicProjection(const Size& size)
{
SetProjectionMode(Dali::Camera::ORTHOGRAPHIC_PROJECTION);
- mCanvasSize = size;
+ mCanvasSize = static_cast<const Vector2>(size);
if((size.width < Math::MACHINE_EPSILON_1000) || (size.height < Math::MACHINE_EPSILON_1000))
{
}
}
+ ApplyDefaultProjection();
+}
+
+void CameraActor::ApplyDefaultProjection()
+{
+ const float width = mCanvasSize.width;
+ const float height = mCanvasSize.height;
+
// Choose near, far and Z parameters to match the SetPerspectiveProjection above.
float nearClippingPlane;
float farClippingPlane;
float cameraZ;
- CalculateClippingAndZ(size.width, size.height, nearClippingPlane, farClippingPlane, cameraZ);
- SetOrthographicProjection(-size.x * 0.5f, size.x * 0.5f, size.y * 0.5f, size.y * -0.5f, nearClippingPlane, farClippingPlane);
- SetZ(cameraZ);
-}
+ CalculateClippingAndZ(width, height, nearClippingPlane, farClippingPlane, cameraZ);
-void CameraActor::SetOrthographicProjection(float left, float right, float top, float bottom, float near, float far)
-{
- SetProjectionMode(Dali::Camera::ORTHOGRAPHIC_PROJECTION);
- SetLeftClippingPlane(left);
- SetRightClippingPlane(right);
- SetTopClippingPlane(top);
- SetBottomClippingPlane(bottom);
- SetNearClippingPlane(near);
- SetFarClippingPlane(far);
+ // calculate orthographic size.
+ const float orthographicSize = (mProjectionDirection == DevelCameraActor::ProjectionDirection::VERTICAL ? height : width) * 0.5f;
+
+ // calculate the position of the camera to have the desired aspect ratio
+ const float fieldOfView = 2.0f * std::atan(orthographicSize / cameraZ);
+
+ // unless it is too small, we want at least as much space to the back as we have torwards the front
+ const float minClippingFarPlane = 2.f * nearClippingPlane;
+ if(farClippingPlane < minClippingFarPlane)
+ {
+ farClippingPlane = minClippingFarPlane;
+ }
+
+ const float aspectRatio = width / height;
+
+ // sceneObject is being used in a separate thread; queue a message to set
+ SetFieldOfView(fieldOfView);
+ SetNearClippingPlane(nearClippingPlane);
+ SetFarClippingPlane(farClippingPlane);
+ SetAspectRatio(aspectRatio);
+ SetOrthographicSize(orthographicSize);
+ SetZ(cameraZ);
}
bool CameraActor::BuildPickingRay(const Vector2& screenCoordinates,
SetFieldOfView(propertyValue.Get<float>()); // set to 0 in case property is not float
break;
}
+ case Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE:
+ {
+ SetOrthographicSize(propertyValue.Get<float>()); // set to 0 in case property is not float
+ break;
+ }
case Dali::CameraActor::Property::ASPECT_RATIO:
{
SetAspectRatio(propertyValue.Get<float>()); // set to 0 in case property is not float
}
case Dali::CameraActor::Property::LEFT_PLANE_DISTANCE:
{
- SetLeftClippingPlane(propertyValue.Get<float>()); // set to 0 in case property is not float
+ DALI_LOG_WARNING("LEFT_PLANE_DISTANCE is read-only\n");
break;
}
case Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE:
{
- SetRightClippingPlane(propertyValue.Get<float>()); // set to 0 in case property is not float
+ DALI_LOG_WARNING("RIGHT_PLANE_DISTANCE is read-only\n");
break;
}
case Dali::CameraActor::Property::TOP_PLANE_DISTANCE:
{
- SetTopClippingPlane(propertyValue.Get<float>()); // set to 0 in case property is not float
+ DALI_LOG_WARNING("TOP_PLANE_DISTANCE is read-only\n");
break;
}
case Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE:
{
- SetBottomClippingPlane(propertyValue.Get<float>()); // set to 0 in case property is not float
+ DALI_LOG_WARNING("BOTTOM_PLANE_DISTANCE is read-only\n");
break;
}
case Dali::CameraActor::Property::TARGET_POSITION:
ret = mFieldOfView;
break;
}
+ case Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE:
+ {
+ ret = mOrthographicSize;
+ break;
+ }
case Dali::CameraActor::Property::ASPECT_RATIO:
{
ret = mAspectRatio;
}
case Dali::CameraActor::Property::LEFT_PLANE_DISTANCE:
{
- ret = mLeftClippingPlane;
+ ret = OrthographicSizeConverter(mOrthographicSize, mAspectRatio, mProjectionDirection).LeftPlaneDistance();
break;
}
case Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE:
{
- ret = mRightClippingPlane;
+ ret = OrthographicSizeConverter(mOrthographicSize, mAspectRatio, mProjectionDirection).RightPlaneDistance();
break;
}
case Dali::CameraActor::Property::TOP_PLANE_DISTANCE:
{
- ret = mTopClippingPlane;
+ ret = OrthographicSizeConverter(mOrthographicSize, mAspectRatio, mProjectionDirection).TopPlaneDistance();
break;
}
case Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE:
{
- ret = mBottomClippingPlane;
+ ret = OrthographicSizeConverter(mOrthographicSize, mAspectRatio, mProjectionDirection).BottomPlaneDistance();
break;
}
case Dali::CameraActor::Property::TARGET_POSITION:
ret = GetCurrentFieldOfView();
break;
}
+ case Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE:
+ {
+ ret = GetCurrentOrthographicSize();
+ break;
+ }
+ case Dali::CameraActor::Property::ASPECT_RATIO:
+ {
+ ret = GetCurrentAspectRatio();
+ break;
+ }
+ case Dali::CameraActor::Property::LEFT_PLANE_DISTANCE:
+ {
+ ret = OrthographicSizeConverter(GetCurrentOrthographicSize(), GetCurrentAspectRatio(), mProjectionDirection).LeftPlaneDistance();
+ break;
+ }
+ case Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE:
+ {
+ ret = OrthographicSizeConverter(GetCurrentOrthographicSize(), GetCurrentAspectRatio(), mProjectionDirection).RightPlaneDistance();
+ break;
+ }
+ case Dali::CameraActor::Property::TOP_PLANE_DISTANCE:
+ {
+ ret = OrthographicSizeConverter(GetCurrentOrthographicSize(), GetCurrentAspectRatio(), mProjectionDirection).TopPlaneDistance();
+ break;
+ }
+ case Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE:
+ {
+ ret = OrthographicSizeConverter(GetCurrentOrthographicSize(), GetCurrentAspectRatio(), mProjectionDirection).BottomPlaneDistance();
+ break;
+ }
default:
{
ret = GetDefaultProperty(index); // Most are event-side properties, the scene-graph properties are only on the scene-graph
value.Get(mFieldOfView);
break;
}
+ case Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE:
+ {
+ value.Get(mOrthographicSize);
+ break;
+ }
+ case Dali::CameraActor::Property::ASPECT_RATIO:
+ {
+ value.Get(mAspectRatio);
+ break;
+ }
}
break;
}
AdjustValue<float>(mFieldOfView, value);
break;
}
+ case Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE:
+ {
+ AdjustValue<float>(mOrthographicSize, value);
+ break;
+ }
+ case Dali::CameraActor::Property::ASPECT_RATIO:
+ {
+ AdjustValue<float>(mAspectRatio, value);
+ break;
+ }
}
break;
}
property = GetCameraSceneObject().GetFieldOfView();
break;
}
+ case Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE:
+ {
+ property = GetCameraSceneObject().GetOrthographicSize();
+ break;
+ }
+ case Dali::CameraActor::Property::ASPECT_RATIO:
+ {
+ property = GetCameraSceneObject().GetAspectRatio();
+ break;
+ }
// no default on purpose as we chain method up to actor
}
if(!property)
return property;
}
+
const PropertyInputImpl* CameraActor::GetSceneObjectInputProperty(Property::Index index) const
{
const PropertyInputImpl* property(nullptr);
property = GetCameraSceneObject().GetFieldOfView();
break;
}
+ case Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE:
+ {
+ property = GetCameraSceneObject().GetOrthographicSize();
+ break;
+ }
+ case Dali::CameraActor::Property::ASPECT_RATIO:
+ {
+ property = GetCameraSceneObject().GetAspectRatio();
+ break;
+ }
case Dali::CameraActor::Property::PROJECTION_MATRIX:
{
property = GetCameraSceneObject().GetProjectionMatrix();