{
DALI_TEST_EQUALS(*iter, actor.GetPropertyIndex(actor.GetPropertyName(*iter)), TEST_LOCATION);
- if(*iter == CameraActor::Property::FIELD_OF_VIEW || *iter == CameraActor::Property::ASPECT_RATIO || *iter == DevelCameraActor::Property::ORTHOGRAPHIC_SIZE)
+ if(*iter == CameraActor::Property::FIELD_OF_VIEW || *iter == CameraActor::Property::ASPECT_RATIO || *iter == DevelCameraActor::Property::ORTHOGRAPHIC_SIZE || *iter == CameraActor::Property::NEAR_PLANE_DISTANCE || *iter == CameraActor::Property::FAR_PLANE_DISTANCE)
{
DALI_TEST_CHECK(actor.IsPropertyAnimatable(*iter));
}
{"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, 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},
+ {"nearPlaneDistance", Property::FLOAT, true, true, true, Dali::CameraActor::Property::NEAR_PLANE_DISTANCE},
+ {"farPlaneDistance", Property::FLOAT, true, true, true, Dali::CameraActor::Property::FAR_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},
Radian sourceFoV = Radian(0.6f);
float sourceAspect = 0.7f;
+ float sourceNearDistance = 0.5f;
+ float sourceFarDistance = 1000.0f;
Radian targetFoV = Radian(0.1f);
float targetAspect = 1.3f;
+ float targetNearDistance = 20.5f;
+ float targetFarDistance = 30.0f;
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.SetFieldOfView(sourceFoV.radian);
camera.SetAspectRatio(sourceAspect);
+ camera.SetNearClippingPlane(sourceNearDistance);
+ camera.SetFarClippingPlane(sourceFarDistance);
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);
+ camera.SetNearClippingPlane(sourceNearDistance * 0.6f + targetNearDistance * 0.4f);
+ camera.SetFarClippingPlane(sourceFarDistance * 0.6f + targetFarDistance * 0.4f);
application.SendNotification();
application.Render();
camera.GetProperty(CameraActor::Property::PROJECTION_MATRIX).Get(expectedProjectionMatrix2);
camera.SetFieldOfView(targetFoV.radian);
camera.SetAspectRatio(targetAspect);
+ camera.SetNearClippingPlane(targetNearDistance);
+ camera.SetFarClippingPlane(targetFarDistance);
application.SendNotification();
application.Render();
camera.GetProperty(CameraActor::Property::PROJECTION_MATRIX).Get(expectedProjectionMatrix3);
- auto TestAnimationProgress = [&]() {
+ auto TestAnimationProgress = [&]()
+ {
Matrix projectionMatrix;
application.SendNotification();
// 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);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::NEAR_PLANE_DISTANCE), sourceNearDistance, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::FAR_PLANE_DISTANCE), sourceFarDistance, 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);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::NEAR_PLANE_DISTANCE), sourceNearDistance * 0.6f + targetNearDistance * 0.4f, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::FAR_PLANE_DISTANCE), sourceFarDistance * 0.6f + targetFarDistance * 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);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::NEAR_PLANE_DISTANCE), targetNearDistance, TEST_LOCATION);
+ DALI_TEST_EQUALS(camera.GetCurrentProperty<float>(CameraActor::Property::FAR_PLANE_DISTANCE), targetFarDistance, 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);
+ camera.SetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE, sourceNearDistance);
+ camera.SetProperty(CameraActor::Property::FAR_PLANE_DISTANCE, sourceFarDistance);
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, CameraActor::Property::NEAR_PLANE_DISTANCE), targetNearDistance);
+ animation.AnimateTo(Property(camera, CameraActor::Property::FAR_PLANE_DISTANCE), targetFarDistance);
animation.AnimateTo(Property(camera, Actor::Property::POSITION_X), 0.0f); ///< For line coverage.
animation.Play();
keyFrames2.Add(0.0f, sourceAspect);
keyFrames2.Add(1.0f, targetAspect);
+ KeyFrames keyFrames3 = KeyFrames::New();
+ keyFrames3.Add(0.0f, sourceNearDistance);
+ keyFrames3.Add(1.0f, targetNearDistance);
+
+ KeyFrames keyFrames4 = KeyFrames::New();
+ keyFrames4.Add(0.0f, sourceFarDistance);
+ keyFrames4.Add(1.0f, targetFarDistance);
+
animation.AnimateBetween(Property(camera, CameraActor::Property::FIELD_OF_VIEW), keyFrames1);
animation.AnimateBetween(Property(camera, CameraActor::Property::ASPECT_RATIO), keyFrames2);
+ animation.AnimateBetween(Property(camera, CameraActor::Property::NEAR_PLANE_DISTANCE), keyFrames3);
+ animation.AnimateBetween(Property(camera, CameraActor::Property::FAR_PLANE_DISTANCE), keyFrames4);
animation.Play();
tet_printf("AnimateBy\n");
camera.SetProperty(CameraActor::Property::FIELD_OF_VIEW, sourceFoV.radian);
camera.SetProperty(CameraActor::Property::ASPECT_RATIO, sourceAspect);
+ camera.SetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE, sourceNearDistance);
+ camera.SetProperty(CameraActor::Property::FAR_PLANE_DISTANCE, sourceFarDistance);
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.AnimateBy(Property(camera, CameraActor::Property::NEAR_PLANE_DISTANCE), targetNearDistance - sourceNearDistance);
+ animation.AnimateBy(Property(camera, CameraActor::Property::FAR_PLANE_DISTANCE), targetFarDistance - sourceFarDistance);
animation.Play();
TestAnimationProgress();
END_TEST;
}
+
+int UtcDaliCameraActorConstraintInputProperty(void)
+{
+ TestApplication application;
+ tet_infoline("Testing Constraint input properties");
+
+ CameraActor camera = application.GetScene().GetRenderTaskList().GetTask(0u).GetCameraActor();
+ application.SendNotification();
+ application.Render(0);
+ application.Render();
+ application.SendNotification();
+ Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 4u, 4u);
+ Actor actor = CreateRenderableActor(image, RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ application.GetScene().Add(actor);
+
+ float projectionMode;
+ float projectionDirection;
+ float invertYAxis;
+ float nearClippingPlane;
+ float farClippingPlane;
+
+ camera.GetProperty(CameraActor::Property::PROJECTION_MODE).Get(projectionMode);
+ camera.GetProperty(DevelCameraActor::Property::PROJECTION_DIRECTION).Get(projectionDirection);
+ camera.GetProperty(CameraActor::Property::INVERT_Y_AXIS).Get(invertYAxis);
+ camera.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(nearClippingPlane);
+ camera.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(farClippingPlane);
+
+ Property::Index projectionModePropertyIndex = actor.RegisterProperty("projectionMode", 100.0f);
+ Property::Index projectionDirectionPropertyIndex = actor.RegisterProperty("projectionDirection", 100.0f);
+ Property::Index invertYAxisPropertyIndex = actor.RegisterProperty("invertYAxis", 100.0f);
+ Property::Index nearClippingPlanePropertyIndex = actor.RegisterProperty("nearClippingPlane", 100.0f);
+ Property::Index farClippingPlanePropertyIndex = actor.RegisterProperty("farClippingPlane", 100.0f);
+
+ application.SendNotification();
+ application.Render();
+
+ Constraint projectionModePropertyConstraint = Constraint::New<float>(actor, projectionModePropertyIndex, [](float& output, const PropertyInputContainer& inputs)
+ { output = static_cast<float>(inputs[0]->GetInteger()); });
+ Constraint projectionDirectionPropertyConstraint = Constraint::New<float>(actor, projectionDirectionPropertyIndex, [](float& output, const PropertyInputContainer& inputs)
+ { output = static_cast<float>(inputs[0]->GetInteger()); });
+ Constraint invertYAxisPropertyConstraint = Constraint::New<float>(actor, invertYAxisPropertyIndex, [](float& output, const PropertyInputContainer& inputs)
+ { output = static_cast<float>(inputs[0]->GetBoolean()); });
+ Constraint nearClippingPlanePropertyConstraint = Constraint::New<float>(actor, nearClippingPlanePropertyIndex, EqualToConstraint());
+ Constraint farClippingPlanePropertyConstraint = Constraint::New<float>(actor, farClippingPlanePropertyIndex, EqualToConstraint());
+
+ projectionModePropertyConstraint.AddSource(Source(camera, CameraActor::Property::PROJECTION_MODE));
+ projectionDirectionPropertyConstraint.AddSource(Source(camera, DevelCameraActor::Property::PROJECTION_DIRECTION));
+ invertYAxisPropertyConstraint.AddSource(Source(camera, CameraActor::Property::INVERT_Y_AXIS));
+ nearClippingPlanePropertyConstraint.AddSource(Source(camera, CameraActor::Property::NEAR_PLANE_DISTANCE));
+ farClippingPlanePropertyConstraint.AddSource(Source(camera, CameraActor::Property::FAR_PLANE_DISTANCE));
+
+ projectionModePropertyConstraint.Apply();
+ projectionDirectionPropertyConstraint.Apply();
+ invertYAxisPropertyConstraint.Apply();
+ nearClippingPlanePropertyConstraint.Apply();
+ farClippingPlanePropertyConstraint.Apply();
+
+ application.SendNotification();
+ application.Render();
+
+ float projectionModeResult = actor.GetCurrentProperty<float>(projectionModePropertyIndex);
+ float projectionDirectionResult = actor.GetCurrentProperty<float>(projectionDirectionPropertyIndex);
+ float invertYAxisResult = actor.GetCurrentProperty<float>(invertYAxisPropertyIndex);
+ float nearClippingPlaneResult = actor.GetCurrentProperty<float>(nearClippingPlanePropertyIndex);
+ float farClippingPlaneResult = actor.GetCurrentProperty<float>(farClippingPlanePropertyIndex);
+
+ DALI_TEST_EQUALS(projectionModeResult, projectionMode, TEST_LOCATION);
+ DALI_TEST_EQUALS(projectionDirectionResult, projectionDirection, TEST_LOCATION);
+ DALI_TEST_EQUALS(invertYAxisResult, invertYAxis, TEST_LOCATION);
+ DALI_TEST_EQUALS(nearClippingPlaneResult, nearClippingPlane, TEST_LOCATION);
+ DALI_TEST_EQUALS(farClippingPlaneResult, farClippingPlane, TEST_LOCATION);
+
+ END_TEST;
+}
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( "nearPlaneDistance", FLOAT, true, true, true, Dali::CameraActor::Property::NEAR_PLANE_DISTANCE )
+DALI_PROPERTY( "farPlaneDistance", FLOAT, true, true, 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 )
mNearClippingPlane = nearClippingPlane;
// sceneObject is being used in a separate thread; queue a message to set
- SetNearClippingPlaneMessage(GetEventThreadServices(), GetCameraSceneObject(), mNearClippingPlane);
+ BakeNearClippingPlaneMessage(GetEventThreadServices(), GetCameraSceneObject(), mNearClippingPlane);
}
}
return mNearClippingPlane;
}
+float CameraActor::GetCurrentNearClippingPlane() const
+{
+ return GetCameraSceneObject().GetNearClippingPlane(GetEventThreadServices().GetEventBufferIndex());
+}
+
void CameraActor::SetFarClippingPlane(float farClippingPlane)
{
mPropertyChanged = true;
mFarClippingPlane = farClippingPlane;
// sceneObject is being used in a separate thread; queue a message to set
- SetFarClippingPlaneMessage(GetEventThreadServices(), GetCameraSceneObject(), mFarClippingPlane);
+ BakeFarClippingPlaneMessage(GetEventThreadServices(), GetCameraSceneObject(), mFarClippingPlane);
}
}
return mFarClippingPlane;
}
+float CameraActor::GetCurrentFarClippingPlane() const
+{
+ return GetCameraSceneObject().GetFarClippingPlane(GetEventThreadServices().GetEventBufferIndex());
+}
+
void CameraActor::SetInvertYAxis(bool invertYAxis)
{
if(invertYAxis != mInvertYAxis)
ret = GetCurrentAspectRatio();
break;
}
+ case Dali::CameraActor::Property::NEAR_PLANE_DISTANCE:
+ {
+ ret = GetCurrentNearClippingPlane();
+ break;
+ }
+ case Dali::CameraActor::Property::FAR_PLANE_DISTANCE:
+ {
+ ret = GetCurrentFarClippingPlane();
+ break;
+ }
case Dali::CameraActor::Property::LEFT_PLANE_DISTANCE:
{
ret = OrthographicSizeConverter(GetCurrentOrthographicSize(), GetCurrentAspectRatio(), mProjectionDirection).LeftPlaneDistance();
value.Get(mAspectRatio);
break;
}
+ case Dali::CameraActor::Property::NEAR_PLANE_DISTANCE:
+ {
+ value.Get(mNearClippingPlane);
+ break;
+ }
+ case Dali::CameraActor::Property::FAR_PLANE_DISTANCE:
+ {
+ value.Get(mFarClippingPlane);
+ break;
+ }
}
break;
}
AdjustValue<float>(mAspectRatio, value);
break;
}
+ case Dali::CameraActor::Property::NEAR_PLANE_DISTANCE:
+ {
+ AdjustValue<float>(mNearClippingPlane, value);
+ break;
+ }
+ case Dali::CameraActor::Property::FAR_PLANE_DISTANCE:
+ {
+ AdjustValue<float>(mFarClippingPlane, value);
+ break;
+ }
}
break;
}
{
property = GetCameraSceneObject().GetAspectRatio();
break;
+ }
+ case Dali::CameraActor::Property::NEAR_PLANE_DISTANCE:
+ {
+ property = GetCameraSceneObject().GetNearPlaneDistance();
+ break;
+ }
+ case Dali::CameraActor::Property::FAR_PLANE_DISTANCE:
+ {
+ property = GetCameraSceneObject().GetFarPlaneDistance();
+ break;
}
// no default on purpose as we chain method up to actor
}
switch(index)
{
- case Dali::CameraActor::Property::FIELD_OF_VIEW:
+ case Dali::CameraActor::Property::PROJECTION_MODE:
{
- property = GetCameraSceneObject().GetFieldOfView();
+ property = GetCameraSceneObject().GetProjectionMode();
break;
}
- case Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE:
+ case Dali::CameraActor::Property::FIELD_OF_VIEW:
{
- property = GetCameraSceneObject().GetOrthographicSize();
+ property = GetCameraSceneObject().GetFieldOfView();
break;
}
case Dali::CameraActor::Property::ASPECT_RATIO:
property = GetCameraSceneObject().GetAspectRatio();
break;
}
+ case Dali::CameraActor::Property::NEAR_PLANE_DISTANCE:
+ {
+ property = GetCameraSceneObject().GetNearPlaneDistance();
+ break;
+ }
+ case Dali::CameraActor::Property::FAR_PLANE_DISTANCE:
+ {
+ property = GetCameraSceneObject().GetFarPlaneDistance();
+ break;
+ }
case Dali::CameraActor::Property::PROJECTION_MATRIX:
{
property = GetCameraSceneObject().GetProjectionMatrix();
{
property = GetCameraSceneObject().GetViewMatrix();
break;
+ }
+ case Dali::CameraActor::Property::INVERT_Y_AXIS:
+ {
+ property = GetCameraSceneObject().GetInvertYAxis();
+ break;
+ }
+ case Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE:
+ {
+ property = GetCameraSceneObject().GetOrthographicSize();
+ break;
+ }
+ case Dali::DevelCameraActor::Property::PROJECTION_DIRECTION:
+ {
+ property = GetCameraSceneObject().GetProjectionDirection();
+ break;
}
// no default on purpose as we chain method up to actor
}
*/
float GetCurrentAspectRatio() const;
+ /**
+ * @brief Retrieve the CameraActor's near clipping plane distance from update side.
+ * This is either the last value set, or the currently animating value.
+ * It may be defferent to GetNearClippingPlane() if the set message hasn't been processed yet.
+ * @return Near clipping plane distance.
+ */
+ float GetCurrentNearClippingPlane() const;
+
+ /**
+ * @brief Retrieve the CameraActor's far clipping plane distance from update side.
+ * This is either the last value set, or the currently animating value.
+ * It may be defferent to GetFarClippingPlane() if the set message hasn't been processed yet.
+ * @return Far clipping plane distance.
+ */
+ float GetCurrentFarClippingPlane() const;
+
private: // Data
Vector3 mTarget;
Vector2 mCanvasSize;
const Matrix& viewMatrix = renderTask.GetViewMatrix(updateBufferIndex);
const SceneGraph::Camera& camera = renderTask.GetCamera();
- const bool isOrthographicCamera = camera.mProjectionMode == Dali::Camera::ProjectionMode::ORTHOGRAPHIC_PROJECTION;
+ const bool isOrthographicCamera = camera.mProjectionMode[0] == Dali::Camera::ProjectionMode::ORTHOGRAPHIC_PROJECTION;
Viewport viewport;
bool viewportSet = renderTask.QueryViewport(updateBufferIndex, viewport);
AddResetterMessage(eventThreadServices.GetUpdateManager(), resetter);
}
-inline void SetNearClippingPlaneMessage(EventThreadServices& eventThreadServices, const Camera& camera, float parameter)
+inline void BakeNearClippingPlaneMessage(EventThreadServices& eventThreadServices, const Camera& camera, float parameter)
{
- using LocalType = MessageValue1<Camera, float>;
+ using LocalType = MessageDoubleBuffered1<Camera, float>;
// Reserve some memory inside the message queue
uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new(slot) LocalType(&camera, &Camera::SetNearClippingPlane, parameter);
+ new(slot) LocalType(&camera, &Camera::BakeNearClippingPlane, parameter);
+
+ OwnerPointer<SceneGraph::PropertyResetterBase> resetter(
+ new SceneGraph::BakerResetter(const_cast<SceneGraph::Camera*>(&camera),
+ const_cast<SceneGraph::AnimatableProperty<float>*>(&camera.mNearClippingPlane),
+ BakerResetter::Lifetime::BAKE));
+ AddResetterMessage(eventThreadServices.GetUpdateManager(), resetter);
}
-inline void SetFarClippingPlaneMessage(EventThreadServices& eventThreadServices, const Camera& camera, float parameter)
+inline void BakeFarClippingPlaneMessage(EventThreadServices& eventThreadServices, const Camera& camera, float parameter)
{
- using LocalType = MessageValue1<Camera, float>;
+ using LocalType = MessageDoubleBuffered1<Camera, float>;
// Reserve some memory inside the message queue
uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new(slot) LocalType(&camera, &Camera::SetFarClippingPlane, parameter);
+ new(slot) LocalType(&camera, &Camera::BakeFarClippingPlane, parameter);
+
+ OwnerPointer<SceneGraph::PropertyResetterBase> resetter(
+ new SceneGraph::BakerResetter(const_cast<SceneGraph::Camera*>(&camera),
+ const_cast<SceneGraph::AnimatableProperty<float>*>(&camera.mFarClippingPlane),
+ BakerResetter::Lifetime::BAKE));
+ AddResetterMessage(eventThreadServices.GetUpdateManager(), resetter);
}
inline void SetReflectByPlaneMessage(EventThreadServices& eventThreadServices, const Camera& camera, const Vector4& plane)
void Camera::SetProjectionMode(Dali::Camera::ProjectionMode mode)
{
- mProjectionMode = mode;
+ mProjectionMode.Bake(0, mode);
mUpdateProjectionFlag = UPDATE_COUNT;
}
void Camera::SetProjectionDirection(Dali::DevelCameraActor::ProjectionDirection direction)
{
- mProjectionDirection = direction;
+ mProjectionDirection.Bake(0, direction);
mUpdateProjectionFlag = UPDATE_COUNT;
}
void Camera::SetInvertYAxis(bool invertYAxis)
{
- mInvertYAxis = invertYAxis;
+ mInvertYAxis.Bake(0, invertYAxis);
mUpdateProjectionFlag = UPDATE_COUNT;
}
mUpdateProjectionFlag = UPDATE_COUNT;
}
-void Camera::SetNearClippingPlane(float nearClippingPlane)
+void Camera::BakeNearClippingPlane(BufferIndex updateBufferIndex, float nearClippingPlane)
{
- mNearClippingPlane = nearClippingPlane;
+ mNearClippingPlane.Bake(updateBufferIndex, nearClippingPlane);
mUpdateProjectionFlag = UPDATE_COUNT;
}
-void Camera::SetFarClippingPlane(float farClippingPlane)
+void Camera::BakeFarClippingPlane(BufferIndex updateBufferIndex, float farClippingPlane)
{
- mFarClippingPlane = farClippingPlane;
+ mFarClippingPlane.Bake(updateBufferIndex, farClippingPlane);
mUpdateProjectionFlag = UPDATE_COUNT;
}
return mFinalProjection[bufferIndex];
}
-const PropertyBase* Camera::GetFieldOfView() const
+const PropertyBase* Camera::GetProjectionMode() const
{
- return &mFieldOfView;
+ return &mProjectionMode;
}
-const PropertyBase* Camera::GetOrthographicSize() const
+const PropertyBase* Camera::GetFieldOfView() const
{
- return &mOrthographicSize;
+ return &mFieldOfView;
}
const PropertyBase* Camera::GetAspectRatio() const
return &mAspectRatio;
}
+const PropertyBase* Camera::GetNearPlaneDistance() const
+{
+ return &mNearClippingPlane;
+}
+
+const PropertyBase* Camera::GetFarPlaneDistance() const
+{
+ return &mFarClippingPlane;
+}
+
const PropertyInputImpl* Camera::GetProjectionMatrix() const
{
return &mProjectionMatrix;
return &mViewMatrix;
}
+const PropertyBase* Camera::GetInvertYAxis() const
+{
+ return &mInvertYAxis;
+}
+
+const PropertyBase* Camera::GetOrthographicSize() const
+{
+ return &mOrthographicSize;
+}
+
+const PropertyBase* Camera::GetProjectionDirection() const
+{
+ return &mProjectionDirection;
+}
+
void Camera::Update(BufferIndex updateBufferIndex)
{
// if this has changes in world position we need to update camera for next 2 frames
const float orthographicSize = mOrthographicSize[bufferIndex];
const float aspect = mAspectRatio[bufferIndex];
- const float halfWidth = mProjectionDirection == DevelCameraActor::ProjectionDirection::VERTICAL ? orthographicSize * aspect : orthographicSize;
- const float halfHeight = mProjectionDirection == DevelCameraActor::ProjectionDirection::VERTICAL ? orthographicSize : orthographicSize / aspect;
+ const float halfWidth = mProjectionDirection[0] == DevelCameraActor::ProjectionDirection::VERTICAL ? orthographicSize * aspect : orthographicSize;
+ const float halfHeight = mProjectionDirection[0] == DevelCameraActor::ProjectionDirection::VERTICAL ? orthographicSize : orthographicSize / aspect;
return Dali::Rect<int32_t>(-halfWidth, -halfHeight, halfWidth * 2.0f, halfHeight * 2.0f);
}
}
else // UPDATE_COUNT == mUpdateProjectionFlag
{
- switch(mProjectionMode)
+ switch(mProjectionMode[0])
{
case Dali::Camera::PERSPECTIVE_PROJECTION:
{
Matrix& projectionMatrix = mProjectionMatrix.Get(updateBufferIndex);
Perspective(projectionMatrix,
- mProjectionDirection,
+ static_cast<Dali::DevelCameraActor::ProjectionDirection>(mProjectionDirection[0]),
mFieldOfView[updateBufferIndex],
mAspectRatio[updateBufferIndex],
- mNearClippingPlane,
- mFarClippingPlane,
- mInvertYAxis);
+ mNearClippingPlane[updateBufferIndex],
+ mFarClippingPlane[updateBufferIndex],
+ mInvertYAxis[0]);
//need to apply custom clipping plane
if(mUseReflectionClip)
}
Vector4 customClipping = viewInv * adjReflectPlane;
- AdjustNearPlaneForPerspective(projectionMatrix, customClipping, mFarClippingPlane);
+ AdjustNearPlaneForPerspective(projectionMatrix, customClipping, mFarClippingPlane[updateBufferIndex]);
}
break;
}
{
Matrix& projectionMatrix = mProjectionMatrix.Get(updateBufferIndex);
Orthographic(projectionMatrix,
- mProjectionDirection,
+ static_cast<Dali::DevelCameraActor::ProjectionDirection>(mProjectionDirection[0]),
mOrthographicSize[updateBufferIndex],
mAspectRatio[updateBufferIndex],
- mNearClippingPlane,
- mFarClippingPlane,
- mInvertYAxis);
+ mNearClippingPlane[updateBufferIndex],
+ mFarClippingPlane[updateBufferIndex],
+ mInvertYAxis[0]);
//need to apply custom clipping plane
if(mUseReflectionClip)
}
Vector4 customClipping = viewInv * adjReflectPlane;
- AdjustNearPlaneForOrthographic(projectionMatrix, customClipping, mFarClippingPlane);
+ AdjustNearPlaneForOrthographic(projectionMatrix, customClipping, mFarClippingPlane[updateBufferIndex]);
}
break;
}
{
class SceneController;
+template<>
+class AnimatableProperty<Dali::Camera::ProjectionMode> : public AnimatableProperty<int>
+{
+public:
+ AnimatableProperty(Dali::Camera::ProjectionMode initialValue)
+ : AnimatableProperty<int>(static_cast<int>(initialValue))
+ {
+ }
+};
+template<>
+class AnimatableProperty<Dali::DevelCameraActor::ProjectionDirection> : public AnimatableProperty<int>
+{
+public:
+ AnimatableProperty(Dali::DevelCameraActor::ProjectionDirection initialValue)
+ : AnimatableProperty<int>(static_cast<int>(initialValue))
+ {
+ }
+};
+
/**
* Scene-graph camera object
*/
*/
bool IsYAxisInverted() const
{
- return mInvertYAxis;
+ return mInvertYAxis[0];
}
/**
*/
void SetBottomClippingPlane(float bottomClippingPlane);
- /**
- * @copydoc Dali::Internal::CameraActor::SetNearClippingPlane
- */
- void SetNearClippingPlane(float nearClippingPlane);
-
- /**
- * @copydoc Dali::Internal::CameraActor::SetFarClippingPlane
- */
- void SetFarClippingPlane(float farClippingPlane);
-
/**
* @copydoc Dali::Internal::CameraActor::RotateProjection
*/
return mAspectRatio[bufferIndex];
}
+ /**
+ * @brief Bakes the near clipping plane distance.
+ * @param[in] updateBufferIndex The current update buffer index.
+ * @param[in] nearClippingPlane The near clipping plane distance.
+ */
+ void BakeNearClippingPlane(BufferIndex updateBufferIndex, float nearClippingPlane);
+
+ /**
+ * @brief Retrieve the near clipping plane distance.
+ * @param[in] bufferIndex The buffer to read from.
+ * @return The near clipping plane distance.
+ */
+ float GetNearClippingPlane(BufferIndex bufferIndex) const
+ {
+ return mNearClippingPlane[bufferIndex];
+ }
+
+ /**
+ * @brief Bakes the far clipping plane distance.
+ * @param[in] updateBufferIndex The current update buffer index.
+ * @param[in] farClippingPlane The far clipping plane distance.
+ */
+ void BakeFarClippingPlane(BufferIndex updateBufferIndex, float farClippingPlane);
+
+ /**
+ * @brief Retrieve the far clipping plane distance.
+ * @param[in] bufferIndex The buffer to read from.
+ * @return The far clipping plane distance.
+ */
+ float GetFarClippingPlane(BufferIndex bufferIndex) const
+ {
+ return mFarClippingPlane[bufferIndex];
+ }
+
/**
* Sets the reflection plane
* @param[in] plane reflection plane
const Matrix& GetFinalProjectionMatrix(BufferIndex bufferIndex) const;
/**
- * Retrieve the field of view property querying interface.
+ * Retrieve the projection mode property querying interface.
* @pre The camera is on-stage.
- * @return The field of view property querying interface.
+ * @return The projection mode property querying interface.
*/
- const PropertyBase* GetFieldOfView() const;
+ const PropertyBase* GetProjectionMode() const;
/**
- * Retrieve the orthographic size property querying interface.
+ * Retrieve the field of view property querying interface.
* @pre The camera is on-stage.
- * @return The orthographic size property querying interface.
+ * @return The field of view property querying interface.
*/
- const PropertyBase* GetOrthographicSize() const;
+ const PropertyBase* GetFieldOfView() const;
/**
* Retrieve the aspect ratio property querying interface.
*/
const PropertyBase* GetAspectRatio() const;
+ /**
+ * Retrieve the near clipping plane distance property querying interface.
+ * @pre The camera is on-stage.
+ * @return The near clipping plane distance property querying interface.
+ */
+ const PropertyBase* GetNearPlaneDistance() const;
+
+ /**
+ * Retrieve the far clipping plane distance property querying interface.
+ * @pre The camera is on-stage.
+ * @return The far clipping plane distance property querying interface.
+ */
+ const PropertyBase* GetFarPlaneDistance() const;
+
/**
* Retrieve the projection-matrix property querying interface.
* @pre The camera is on-stage.
*/
const PropertyInputImpl* GetViewMatrix() const;
+ /**
+ * Retrieve the value of InvertYAxis property querying interface.
+ * @pre The camera is on-stage.
+ * @return The InvertYAxis property value querying interface.
+ */
+ const PropertyBase* GetInvertYAxis() const;
+
+ /**
+ * Retrieve the orthographic size property querying interface.
+ * @pre The camera is on-stage.
+ * @return The orthographic size property querying interface.
+ */
+ const PropertyBase* GetOrthographicSize() const;
+
+ /**
+ * Retrieve the value of Projection Direction property querying interface.
+ * @pre The camera is on-stage.
+ * @return The Projection Direction property value querying interface.
+ */
+ const PropertyBase* GetProjectionDirection() const;
+
/**
* Updates view and projection matrices.
* Called by the render task using the camera
uint32_t mUpdateProjectionFlag; ///< This is non-zero if the projection matrix requires an update
int mProjectionRotation; ///< The rotaion angle of the projection
-public: // PROPERTIES
- Dali::Camera::Type mType; // Non-animatable
- Dali::Camera::ProjectionMode mProjectionMode; // Non-animatable
- Dali::DevelCameraActor::ProjectionDirection mProjectionDirection; // Non-animatable
- bool mInvertYAxis; // Non-animatable
+public: // PROPERTIES
+ Dali::Camera::Type mType; // Non-animatable
+ AnimatableProperty<Dali::Camera::ProjectionMode> mProjectionMode; // Non-animatable, constraint_input
+ AnimatableProperty<Dali::DevelCameraActor::ProjectionDirection> mProjectionDirection; // Non-animatable, constraint_input
+ AnimatableProperty<bool> mInvertYAxis; // Non-animatable, constraint_input
- AnimatableProperty<float> mFieldOfView; // Animatable
- AnimatableProperty<float> mOrthographicSize; // Animatable
- AnimatableProperty<float> mAspectRatio; // Animatable
+ AnimatableProperty<float> mFieldOfView; // Animatable
+ AnimatableProperty<float> mOrthographicSize; // Animatable
+ AnimatableProperty<float> mAspectRatio; // Animatable
+ AnimatableProperty<float> mNearClippingPlane; // Animatable
+ AnimatableProperty<float> mFarClippingPlane; // Animatable
- float mNearClippingPlane;
- float mFarClippingPlane;
Vector3 mTargetPosition;
Dali::Matrix mReflectionMtx;
*/
enum
{
- TYPE = DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX, ///< name "type", type std::string @SINCE_1_0.0
- PROJECTION_MODE, ///< name "projectionMode", type std::string @SINCE_1_0.0
+ TYPE = DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX, ///< name "type", type int @SINCE_1_0.0
+ PROJECTION_MODE, ///< name "projectionMode", type int @SINCE_1_0.0
FIELD_OF_VIEW, ///< name "fieldOfView", type float @SINCE_1_0.0
ASPECT_RATIO, ///< name "aspectRatio", type float @SINCE_1_0.0
NEAR_PLANE_DISTANCE, ///< name "nearPlaneDistance", type float @SINCE_1_0.0