From: Kimmo Hoikka Date: Tue, 19 Apr 2016 10:53:48 +0000 (+0100) Subject: Removal of unnecessary Actor-attachment classes, part I - event thread X-Git-Tag: dali_1.1.31~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F49%2F66549%2F12;p=platform%2Fcore%2Fuifw%2Fdali-core.git Removal of unnecessary Actor-attachment classes, part I - event thread - these base classes are not used for anything anymore, they just take up RAM & ROM Change-Id: Ib0fc20e6dd0360ad2ae01441153093e081395320 --- diff --git a/dali/integration-api/profiling.cpp b/dali/integration-api/profiling.cpp index d5c7b31..28a04bc 100644 --- a/dali/integration-api/profiling.cpp +++ b/dali/integration-api/profiling.cpp @@ -29,9 +29,6 @@ #include #include -#include -#include - #include #include #include @@ -101,12 +98,10 @@ const int CONSTRAINT_MEMORY_SIZE( sizeof( Internal::SceneGraph::Constraint > ) ); const int ACTOR_MEMORY_SIZE( sizeof( Internal::Actor ) + - sizeof( Internal::ActorAttachment ) + sizeof( Internal::SceneGraph::Node ) + sizeof( Internal::SceneGraph::NodeAttachment )); const int CAMERA_ACTOR_MEMORY_SIZE( sizeof( Internal::CameraActor ) + - sizeof( Internal::CameraAttachment ) + sizeof( Internal::SceneGraph::Node ) + sizeof( Internal::SceneGraph::CameraAttachment ) ); const int IMAGE_ACTOR_MEMORY_SIZE( @@ -115,7 +110,6 @@ const int IMAGE_ACTOR_MEMORY_SIZE( sizeof( Internal::Render::Renderer )); const int LAYER_MEMORY_SIZE( sizeof( Internal::Layer ) + - sizeof( Internal::ActorAttachment ) + sizeof( Internal::SceneGraph::Layer ) + sizeof( Internal::SceneGraph::NodeAttachment ) ); const int IMAGE_MEMORY_SIZE( diff --git a/dali/internal/event/actor-attachments/actor-attachment-declarations.h b/dali/internal/event/actor-attachments/actor-attachment-declarations.h deleted file mode 100644 index 8dbd795..0000000 --- a/dali/internal/event/actor-attachments/actor-attachment-declarations.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef __DALI_INTERNAL_ACTOR_ATTACHMENT_DECLARATIONS_H__ -#define __DALI_INTERNAL_ACTOR_ATTACHMENT_DECLARATIONS_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -namespace Internal -{ - -class ActorAttachment; -class CameraAttachment; -class ImageAttachment; - -typedef IntrusivePtr ActorAttachmentPtr; -typedef IntrusivePtr CameraAttachmentPtr; -typedef IntrusivePtr ImageAttachmentPtr; - -} // namespace Internal - -} // namespace Dali - -#endif // __DALI_INTERNAL_ACTOR_ATTACHMENT_DECLARATIONS_H__ diff --git a/dali/internal/event/actor-attachments/actor-attachment-impl.cpp b/dali/internal/event/actor-attachments/actor-attachment-impl.cpp deleted file mode 100644 index fcd6e8c..0000000 --- a/dali/internal/event/actor-attachments/actor-attachment-impl.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -namespace Dali -{ - -namespace Internal -{ - -bool ActorAttachment::OnStage() const -{ - return mIsOnStage; -} - -/** - * This method is called by the parent actor. - */ -void ActorAttachment::Connect() -{ - mIsOnStage = true; - - // Notification for derived classes - OnStageConnection(); -} - -/** - * This method is called by the parent actor. - */ -void ActorAttachment::Disconnect() -{ - // Notification for derived classes - OnStageDisconnection(); - - mIsOnStage = false; -} - -ActorAttachment::ActorAttachment( EventThreadServices& eventThreadServices ) -: mEventThreadServices( eventThreadServices ), - mIsOnStage( false ) -{ -} - -ActorAttachment::~ActorAttachment() -{ -} - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/event/actor-attachments/actor-attachment-impl.h b/dali/internal/event/actor-attachments/actor-attachment-impl.h deleted file mode 100644 index 7bfef97..0000000 --- a/dali/internal/event/actor-attachments/actor-attachment-impl.h +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef __DALI_INTERNAL_ACTOR_ATTACHMENT_H__ -#define __DALI_INTERNAL_ACTOR_ATTACHMENT_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -namespace Internal -{ - -class EventThreadServices; - -/** - * An abstract base class for attachments, such a renderable objects and lights. - * ActorAttachments must be attached to an actor, in order to be displayed. - */ -class ActorAttachment : public Dali::RefObject -{ -public: - - /** - * Query whether the attachment is connected to the stage. - * @return True if the attachment is connected to the stage. - */ - bool OnStage() const; - - /** - * Called by the attached actor, when connected to the Stage. - */ - void Connect(); - - /** - * Called by the attached actor, when the actor is disconnected from the Stage. - */ - void Disconnect(); - -protected: - - /** - * Construct a new attachment. - * @param[in] eventThreadServices Used for messaging to and reading from scene-graph. - */ - ActorAttachment( EventThreadServices& eventThreadServices ); - - /** - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~ActorAttachment(); - -private: - - // Undefined - ActorAttachment(const ActorAttachment&); - - // Undefined - ActorAttachment& operator=(const ActorAttachment& rhs); - - /** - * For use in derived classes, called after ConnectToStage() - */ - virtual void OnStageConnection() = 0; - - /** - * For use in derived classes, called after DisconnectFromStage() - */ - virtual void OnStageDisconnection() = 0; - -protected: - /** - * For use in message sending to and property reading from the scene graph - * Inlined for speed - * @return The EventThreadServices object - */ - inline EventThreadServices& GetEventThreadServices() - { - return mEventThreadServices; - } - - /** - * For use in message sending to and property reading from the scene graph - * Inlined for speed - */ - inline const EventThreadServices& GetEventThreadServices() const - { - return mEventThreadServices; - } - -private: - EventThreadServices& mEventThreadServices; ///< Used to send messages to scene-graph; valid until Core destruction - -protected: - bool mIsOnStage : 1; ///< Flag to identify whether the attachment is on-stage - -}; - -} // namespace Internal - -} // namespace Dali - -#endif // __DALI_INTERNAL_ACTOR_ATTACHMENT_H__ diff --git a/dali/internal/event/actor-attachments/camera-attachment-impl.cpp b/dali/internal/event/actor-attachments/camera-attachment-impl.cpp deleted file mode 100644 index aa66cd7..0000000 --- a/dali/internal/event/actor-attachments/camera-attachment-impl.cpp +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL INCLUDES -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -CameraAttachmentPtr CameraAttachment::New( EventThreadServices& eventThreadServices, const SceneGraph::Node& parentNode ) -{ - CameraAttachmentPtr attachment( new CameraAttachment( eventThreadServices ) ); - - // Transfer object ownership of scene-object to message - SceneGraph::CameraAttachment* sceneObject = CreateSceneObject(); - AttachToNodeMessage( eventThreadServices.GetUpdateManager(), parentNode, sceneObject ); - - // Keep raw pointer for message passing - attachment->mSceneObject = sceneObject; - - return attachment; -} - -CameraAttachment::CameraAttachment( EventThreadServices& eventThreadServices ) -: ActorAttachment( eventThreadServices ), - mSceneObject( NULL ), - mType( SceneGraph::CameraAttachment::DEFAULT_TYPE ), - mProjectionMode( SceneGraph::CameraAttachment::DEFAULT_MODE ), - mInvertYAxis( SceneGraph::CameraAttachment::DEFAULT_INVERT_Y_AXIS ), - mFieldOfView( SceneGraph::CameraAttachment::DEFAULT_FIELD_OF_VIEW ), - mAspectRatio( SceneGraph::CameraAttachment::DEFAULT_ASPECT_RATIO ), - mLeftClippingPlane( SceneGraph::CameraAttachment::DEFAULT_LEFT_CLIPPING_PLANE ), - mRightClippingPlane( SceneGraph::CameraAttachment::DEFAULT_RIGHT_CLIPPING_PLANE ), - mTopClippingPlane( SceneGraph::CameraAttachment::DEFAULT_TOP_CLIPPING_PLANE ), - mBottomClippingPlane( SceneGraph::CameraAttachment::DEFAULT_BOTTOM_CLIPPING_PLANE ), - mNearClippingPlane( SceneGraph::CameraAttachment::DEFAULT_NEAR_CLIPPING_PLANE ), - mFarClippingPlane( SceneGraph::CameraAttachment::DEFAULT_FAR_CLIPPING_PLANE ), - mStereoBias( SceneGraph::CameraAttachment::DEFAULT_STEREO_BIAS ), - mTargetPosition( SceneGraph::CameraAttachment::DEFAULT_TARGET_POSITION ) -{ -} - -CameraAttachment::~CameraAttachment() -{ -} - -SceneGraph::CameraAttachment* CameraAttachment::CreateSceneObject() -{ - return SceneGraph::CameraAttachment::New(); -} - -void CameraAttachment::SetType(Dali::Camera::Type type) -{ - if( type != mType ) - { - mType = type; - - // sceneObject is being used in a separate thread; queue a message to set - SetTypeMessage( GetEventThreadServices(), *mSceneObject, type ); - } -} - -Dali::Camera::Type CameraAttachment::GetType() const -{ - return mType; -} - -void CameraAttachment::SetProjectionMode(Dali::Camera::ProjectionMode projectionMode) -{ - if( ! Equals(projectionMode, mProjectionMode) ) - { - mProjectionMode = projectionMode; - - // sceneObject is being used in a separate thread; queue a message to set - SetProjectionModeMessage( GetEventThreadServices(), *mSceneObject, projectionMode ); - } -} - -Dali::Camera::ProjectionMode CameraAttachment::GetProjectionMode() const -{ - return mProjectionMode; -} - -void CameraAttachment::SetFieldOfView( float fieldOfView ) -{ - if( ! Equals(fieldOfView, mFieldOfView) ) - { - mFieldOfView = fieldOfView; - - // sceneObject is being used in a separate thread; queue a message to set - SetFieldOfViewMessage( GetEventThreadServices(), *mSceneObject, fieldOfView ); - } -} - -float CameraAttachment::GetFieldOfView() const -{ - return mFieldOfView; -} - -void CameraAttachment::SetAspectRatio( float aspectRatio ) -{ - if( ! Equals(aspectRatio, mAspectRatio) ) - { - mAspectRatio = aspectRatio; - - // sceneObject is being used in a separate thread; queue a message to set - SetAspectRatioMessage( GetEventThreadServices(), *mSceneObject, aspectRatio ); - } -} - -float CameraAttachment::GetAspectRatio() const -{ - return mAspectRatio; -} - -void CameraAttachment::SetStereoBias(const Vector2& stereoBias) -{ - if( ! Equals(stereoBias.x, mStereoBias.x ) || ! Equals(stereoBias.y, mStereoBias.y ) ) - { - mStereoBias = stereoBias; - - // sceneObject is being used in a separate thread; queue a message to set - SetStereoBiasMessage( GetEventThreadServices(), *mSceneObject, stereoBias ); - } -} - -Vector2 CameraAttachment::GetStereoBias() const -{ - return mStereoBias; -} - -void CameraAttachment::SetLeftClippingPlane( float leftClippingPlane ) -{ - if( ! Equals(leftClippingPlane, mLeftClippingPlane ) ) - { - mLeftClippingPlane = leftClippingPlane; - - // sceneObject is being used in a separate thread; queue a message to set - SetLeftClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, leftClippingPlane ); - } -} - -float CameraAttachment::GetLeftClippingPlane() const -{ - return mLeftClippingPlane; -} - -void CameraAttachment::SetRightClippingPlane( float rightClippingPlane ) -{ - if( ! Equals(rightClippingPlane, mRightClippingPlane ) ) - { - mRightClippingPlane = rightClippingPlane; - - // sceneObject is being used in a separate thread; queue a message to set - SetRightClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, rightClippingPlane ); - } -} - -float CameraAttachment::GetRightClippingPlane() const -{ - return mRightClippingPlane; -} - -void CameraAttachment::SetTopClippingPlane( float topClippingPlane ) -{ - if( ! Equals(topClippingPlane, mTopClippingPlane ) ) - { - mTopClippingPlane = topClippingPlane; - - // sceneObject is being used in a separate thread; queue a message to set - SetTopClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, topClippingPlane ); - } -} - -float CameraAttachment::GetTopClippingPlane() const -{ - return mTopClippingPlane; -} - -void CameraAttachment::SetBottomClippingPlane( float bottomClippingPlane ) -{ - if( ! Equals(bottomClippingPlane, mBottomClippingPlane ) ) - { - mBottomClippingPlane = bottomClippingPlane; - - // sceneObject is being used in a separate thread; queue a message to set - SetBottomClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, bottomClippingPlane ); - } -} - -float CameraAttachment::GetBottomClippingPlane() const -{ - return mBottomClippingPlane; -} - -void CameraAttachment::SetNearClippingPlane( float nearClippingPlane ) -{ - if( ! Equals(nearClippingPlane, mNearClippingPlane ) ) - { - mNearClippingPlane = nearClippingPlane; - - // sceneObject is being used in a separate thread; queue a message to set - SetNearClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, nearClippingPlane ); - } -} - -float CameraAttachment::GetNearClippingPlane() const -{ - return mNearClippingPlane; -} - -void CameraAttachment::SetFarClippingPlane( float farClippingPlane ) -{ - if( ! Equals( farClippingPlane, mFarClippingPlane ) ) - { - mFarClippingPlane = farClippingPlane; - - // sceneObject is being used in a separate thread; queue a message to set - SetFarClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, farClippingPlane ); - } -} - -float CameraAttachment::GetFarClippingPlane() const -{ - return mFarClippingPlane; -} - -void CameraAttachment::SetTargetPosition( Vector3 targetPosition ) -{ - if( targetPosition != mTargetPosition ) - { - mTargetPosition = targetPosition; - - SetTargetPositionMessage( GetEventThreadServices(), *mSceneObject, targetPosition ); - } -} - -Vector3 CameraAttachment::GetTargetPosition() -{ - return mTargetPosition; -} - -void CameraAttachment::SetInvertYAxis( bool invertYAxis ) -{ - if( invertYAxis != mInvertYAxis ) - { - mInvertYAxis = invertYAxis; - - // sceneObject is being used in a separate thread; queue a message to set - SetInvertYAxisMessage( GetEventThreadServices(), *mSceneObject, invertYAxis ); - } -} - -bool CameraAttachment::GetInvertYAxis() const -{ - return mInvertYAxis; -} - -const Matrix& CameraAttachment::GetViewMatrix() const -{ - const SceneGraph::CameraAttachment& sceneObject = *mSceneObject; - - return sceneObject.GetViewMatrix( GetEventThreadServices().GetEventBufferIndex() ); -} - -const Matrix& CameraAttachment::GetProjectionMatrix() const -{ - const SceneGraph::CameraAttachment& sceneObject = *mSceneObject; - - return sceneObject.GetProjectionMatrix( GetEventThreadServices().GetEventBufferIndex() ); -} - -const Matrix& CameraAttachment::GetInverseViewProjectionMatrix() const -{ - const SceneGraph::CameraAttachment& sceneObject = *mSceneObject; - - return sceneObject.GetInverseViewProjectionMatrix( GetEventThreadServices().GetEventBufferIndex() ); -} - -const PropertyInputImpl* CameraAttachment::GetViewMatrixProperty() const -{ - DALI_ASSERT_DEBUG( OnStage() ); - - const SceneGraph::CameraAttachment& sceneObject = *mSceneObject; - - return sceneObject.GetViewMatrix(); -} - -const PropertyInputImpl* CameraAttachment::GetProjectionMatrixProperty() const -{ - DALI_ASSERT_DEBUG( OnStage() ); - - const SceneGraph::CameraAttachment& sceneObject = *mSceneObject; - - return sceneObject.GetProjectionMatrix(); -} - -void CameraAttachment::OnStageConnection() -{ - // do nothing -} - -void CameraAttachment::OnStageDisconnection() -{ - // do nothing -} - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/event/actor-attachments/camera-attachment-impl.h b/dali/internal/event/actor-attachments/camera-attachment-impl.h deleted file mode 100644 index 4e3eedc..0000000 --- a/dali/internal/event/actor-attachments/camera-attachment-impl.h +++ /dev/null @@ -1,299 +0,0 @@ -#ifndef __DALI_INTERNAL_CAMERA_ATTACHMENT_H__ -#define __DALI_INTERNAL_CAMERA_ATTACHMENT_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL INCLUDES -#include -#include -#include -#include -#include -#include - -namespace Dali -{ - -class Matrix; -struct Vector3; - -namespace Internal -{ - -class Camera; - -namespace SceneGraph -{ -class CameraAttachment; -class Node; -} - -/** - * An attachment for managing the properties of a camera in the scene - */ -class CameraAttachment : public ActorAttachment -{ -public: - /** - * Create an initialised CameraAttachment. - * @param[in] eventThreadServices to use - * @param[in] parentNode The node to attach a scene-object to. - * @return A handle to a newly allocated Dali resource. - */ - static CameraAttachmentPtr New( EventThreadServices& eventThreadServices, const SceneGraph::Node& parentNode ); - - /** - * @copydoc Dali::Camera::SetType - */ - void SetType(Dali::Camera::Type type); - - /** - * @copydoc Dali::Camera::GetType - */ - Dali::Camera::Type GetType() const; - - /** - * Set whether the Y Axis is inverted or not. - * Default camera inverts the Y axis to provide a +ve Y down LHS coordinate system - * Some cameras may require no inversion. - * @param[in] invertYAxis True if inverted, false otherwise - */ - void SetInvertYAxis( bool invertYAxis ); - - /** - * Get the setting of InvertYAxis - * @return True if the Y Axis is inverted. - */ - bool GetInvertYAxis() const; - - /** - * @copydoc Dali::Camera::SetProjectionMode - */ - void SetProjectionMode(Dali::Camera::ProjectionMode projectionMode); - - /** - * @copydoc Dali::Camera::GetProjectionMode - */ - Dali::Camera::ProjectionMode GetProjectionMode() const; - - /** - * @copydoc Dali::Camera::SetFieldOfView - */ - void SetFieldOfView(float fieldOfView); - - /** - * @copydoc Dali::Camera::GetFieldOfView - */ - float GetFieldOfView() const; - - /** - * @copydoc Dali::Camera::SetAspectRatio - */ - void SetAspectRatio(float aspectRatio); - - /** - * @copydoc Dali::Camera::GetAspectRatio - */ - float GetAspectRatio() const; - - /** - * @copydoc Dali::Camera::SetLeftClippingPlane * Set stereo bias. The frustum offset for a 3D camera - * @param[in] stereoBias The frustum offset for the 3D camera - */ - void SetStereoBias(const Vector2& stereoBias); - - /** - * Get stereo bias. The frustum offset for a 3D camera - * @return The frustum offset for the 3D camera - */ - Vector2 GetStereoBias() const; - - /** - * @copydoc Dali::Camera::SetLeftClippingPlane - */ - void SetLeftClippingPlane(float leftClippingPlane); - - /** - * @copydoc Dali::Camera::GetLeftClippingPlane - */ - float GetLeftClippingPlane() const; - - /** - * @copydoc Dali::Camera::SetRightClippingPlane - */ - void SetRightClippingPlane(float rightClippingPlane); - - /** - * @copydoc Dali::Camera::GetRightClippingPlane - */ - float GetRightClippingPlane() const; - - /** - * @copydoc Dali::Camera::SetTopClippingPlane - */ - void SetTopClippingPlane(float topClippingPlane); - - /** - * @copydoc Dali::Camera::GetTopClippingPlane - */ - float GetTopClippingPlane() const; - - /** - * @copydoc Dali::Camera::SetBottomClippingPlane - */ - void SetBottomClippingPlane(float bottomClippingPlane); - - /** - * @copydoc Dali::Camera::GetBottomClippingPlane - */ - float GetBottomClippingPlane() const; - - /** - * @copydoc Dali::Camera::SetNearClippingPlane - */ - void SetNearClippingPlane(float nearClippingPlane); - - /** - * @copydoc Dali::Camera::GetNearClippingPlane - */ - float GetNearClippingPlane() const; - - /** - * @copydoc Dali::Camera::SetFarClippingPlane - */ - void SetFarClippingPlane(float farClippingPlane); - - /** - * @copydoc Dali::Camera::GetFarClippingPlane - */ - float GetFarClippingPlane() const; - - /** - * Set the (lookAt) target for the camera - * @pre The Camera owned by this object must be of the type Camera::LookAtTarget - * @param target Position of object we want to look at - */ - void SetTargetPosition(Vector3 target); - - /** - * Get the (lookAt) target for the camera - * @return the last set target - */ - Vector3 GetTargetPosition(); - - /** - * Retrieve the view-matrix. - * @pre The attachment is on-stage. - * @return The view-matrix. - */ - const Matrix& GetViewMatrix() const; - - /** - * Retrieve the projection-matrix. - * @pre The attachment is on-stage. - * @return The projection-matrix. - */ - const Matrix& GetProjectionMatrix() const; - - /** - * Returns the inverse view-projection matrix - * @pre The attachment is on-stage. - * @return The inverse view-projection-matrix. - */ - const Matrix& GetInverseViewProjectionMatrix() const; - - /** - * Retrieve the view-matrix property querying interface. - * @pre The attachment is on-stage. - * @return The view-matrix property querying interface. - */ - const PropertyInputImpl* GetViewMatrixProperty() const; - - /** - * Retrieve the projection-matrix property querying interface. - * @pre The attachment is on-stage. - * @return The projection-matrix property querying interface. - */ - const PropertyInputImpl* GetProjectionMatrixProperty() const; - - /** - * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty() - */ - const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const; - - /** - * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty() - */ - const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const; - - -private: - - /** - * First stage construction of a CameraAttachment. - * @param[in] eventThreadServices Used for messaging to and reading from scene-graph. - */ - CameraAttachment( EventThreadServices& eventThreadServices ); - - /** - * Creates the corresponding scene-graph CameraAttachment. - * @return A newly allocated scene object. - */ - static SceneGraph::CameraAttachment* CreateSceneObject(); - - /** - * @copydoc Dali::Internal::ActorAttachment::OnStageConnection() - */ - virtual void OnStageConnection(); - - /** - * @copydoc Dali::Internal::ActorAttachment::OnStageDisconnection() - */ - virtual void OnStageDisconnection(); - -protected: - - /** - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~CameraAttachment(); - -private: - - const SceneGraph::CameraAttachment* mSceneObject; ///< Not owned - - Dali::Camera::Type mType; - Dali::Camera::ProjectionMode mProjectionMode; - bool mInvertYAxis; - float mFieldOfView; - float mAspectRatio; - float mLeftClippingPlane; - float mRightClippingPlane; - float mTopClippingPlane; - float mBottomClippingPlane; - float mNearClippingPlane; - float mFarClippingPlane; - Vector2 mStereoBias; - Vector3 mTargetPosition; -}; - -} // namespace Internal - -} // namespace Dali - -#endif // __DALI_INTERNAL_CAMERA_ATTACHMENT_H__ diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp index 40c302f..8ca6d3a 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include @@ -336,23 +335,6 @@ unsigned int Actor::GetId() const return mId; } -void Actor::Attach( ActorAttachment& attachment ) -{ - DALI_ASSERT_DEBUG( !mAttachment && "An Actor can only have one attachment" ); - - if( OnStage() ) - { - attachment.Connect(); - } - - mAttachment = ActorAttachmentPtr( &attachment ); -} - -ActorAttachmentPtr Actor::GetAttachment() -{ - return mAttachment; -} - bool Actor::OnStage() const { return mIsOnStage; @@ -1917,7 +1899,6 @@ Actor::Actor( DerivedType derivedType ) mAnchorPoint( NULL ), mRelayoutData( NULL ), mGestureData( NULL ), - mAttachment(), mTargetSize( 0.0f, 0.0f, 0.0f ), mName(), mId( ++mActorCounter ), // actor ID is initialised to start from 1, and 0 is reserved @@ -2057,12 +2038,6 @@ void Actor::ConnectToSceneGraph() ConnectNodeMessage( GetEventThreadServices().GetUpdateManager(), *(mParent->mNode), *mNode ); } - // Notify attachment - if( mAttachment ) - { - mAttachment->Connect(); - } - unsigned int rendererCount( GetRendererCount() ); for( unsigned int i(0); iDisconnect(); - } - unsigned int rendererCount( GetRendererCount() ); for( unsigned int i(0); i #include #include -#include #include #include #include @@ -66,8 +65,8 @@ typedef RendererContainer::iterator RendererIter; * Multi-Touch events are received through signals emitted by the actor tree. * * An Actor is a proxy for a Node in the scene graph. - * When an Actor is added to the Stage, it creates a node and attaches it to the scene graph. - * The scene-graph can be updated in a separate thread, so the attachment is done using an asynchronous message. + * When an Actor is added to the Stage, it creates a node and connects it to the scene graph. + * The scene-graph can be updated in a separate thread, so the connection is done using an asynchronous message. * When a tree of Actors is detached from the Stage, a message is sent to destroy the associated nodes. */ class Actor : public Object @@ -133,21 +132,6 @@ public: */ unsigned int GetId() const; - // Attachments - - /** - * Attach an object to an actor. - * @pre The actor does not already have an attachment. - * @param[in] attachment The object to attach. - */ - void Attach( ActorAttachment& attachment ); - - /** - * Retreive the object attached to an actor. - * @return The attachment. - */ - ActorAttachmentPtr GetAttachment(); - // Containment /** @@ -253,7 +237,6 @@ public: /** * Sets the size of an actor. - * ActorAttachments attached to the actor, can be scaled to fit within this area. * This does not interfere with the actors scale factor. * @param [in] width The new width. * @param [in] height The new height. @@ -262,7 +245,6 @@ public: /** * Sets the size of an actor. - * ActorAttachments attached to the actor, can be scaled to fit within this area. * This does not interfere with the actors scale factor. * @param [in] width The size of the actor along the x-axis. * @param [in] height The size of the actor along the y-axis. @@ -272,7 +254,6 @@ public: /** * Sets the size of an actor. - * ActorAttachments attached to the actor, can be scaled to fit within this area. * This does not interfere with the actors scale factor. * @param [in] size The new size. */ @@ -287,7 +268,6 @@ public: /** * Sets the size of an actor. - * ActorAttachments attached to the actor, can be scaled to fit within this area. * This does not interfere with the actors scale factor. * @param [in] size The new size. */ @@ -1807,8 +1787,6 @@ protected: ActorGestureData* mGestureData; ///< Optional Gesture data. Only created when actor requires gestures - ActorAttachmentPtr mAttachment; ///< Optional referenced attachment - // Signals Dali::Actor::TouchSignalType mTouchedSignal; Dali::Actor::HoverSignalType mHoveredSignal; diff --git a/dali/internal/event/actors/camera-actor-impl.cpp b/dali/internal/event/actors/camera-actor-impl.cpp index 18e8676..28d809b 100644 --- a/dali/internal/event/actors/camera-actor-impl.cpp +++ b/dali/internal/event/actors/camera-actor-impl.cpp @@ -25,13 +25,13 @@ // INTERNAL INCLUDES #include #include -#include +#include #include #include #include #include #include -#include +#include namespace Dali { @@ -146,10 +146,12 @@ CameraActorPtr CameraActor::New( const Size& size ) actor->SetName("DefaultCamera"); - // Create the attachment - actor->mCameraAttachment = CameraAttachment::New( actor->GetEventThreadServices(), *actor->mNode ); + // Create scene-object and transfer ownership through message + SceneGraph::CameraAttachment* sceneObject = SceneGraph::CameraAttachment::New(); + AttachToNodeMessage( actor->GetEventThreadServices().GetUpdateManager(), *actor->mNode, sceneObject ); - actor->Attach(*actor->mCameraAttachment); + // Keep raw pointer for message passing + actor->mSceneObject = sceneObject; actor->SetPerspectiveProjection( size ); @@ -160,97 +162,197 @@ CameraActorPtr CameraActor::New( const Size& size ) return actor; } -void CameraActor::OnInitialize() +CameraActor::CameraActor() +: Actor( Actor::BASIC ), + mSceneObject( NULL ), + mTarget( SceneGraph::CameraAttachment::DEFAULT_TARGET_POSITION ), + mType( SceneGraph::CameraAttachment::DEFAULT_TYPE ), + mProjectionMode( SceneGraph::CameraAttachment::DEFAULT_MODE ), + mFieldOfView( SceneGraph::CameraAttachment::DEFAULT_FIELD_OF_VIEW ), + mAspectRatio( SceneGraph::CameraAttachment::DEFAULT_ASPECT_RATIO ), + mNearClippingPlane( SceneGraph::CameraAttachment::DEFAULT_NEAR_CLIPPING_PLANE ), + mFarClippingPlane( SceneGraph::CameraAttachment::DEFAULT_FAR_CLIPPING_PLANE ), + mLeftClippingPlane( SceneGraph::CameraAttachment::DEFAULT_LEFT_CLIPPING_PLANE ), + mRightClippingPlane( SceneGraph::CameraAttachment::DEFAULT_RIGHT_CLIPPING_PLANE ), + mTopClippingPlane( SceneGraph::CameraAttachment::DEFAULT_TOP_CLIPPING_PLANE ), + mBottomClippingPlane( SceneGraph::CameraAttachment::DEFAULT_BOTTOM_CLIPPING_PLANE ), + mInvertYAxis( SceneGraph::CameraAttachment::DEFAULT_INVERT_Y_AXIS ) { } -CameraActor::CameraActor() -: Actor( Actor::BASIC ) +CameraActor::~CameraActor() { } -CameraActor::~CameraActor() +void CameraActor::SetTarget( const Vector3& target ) +{ + if( target != mTarget ) // using range epsilon + { + mTarget = target; + + SetTargetPositionMessage( GetEventThreadServices(), *mSceneObject, mTarget ); + } +} + +Vector3 CameraActor::GetTarget() const { + return mTarget; } void CameraActor::SetType( Dali::Camera::Type type ) { - mCameraAttachment->SetType(type); + if( type != mType ) + { + mType = type; + + // sceneObject is being used in a separate thread; queue a message to set + SetTypeMessage( GetEventThreadServices(), *mSceneObject, mType ); + } } Dali::Camera::Type CameraActor::GetType() const { - return mCameraAttachment->GetType(); + return mType; } void CameraActor::SetProjectionMode( Dali::Camera::ProjectionMode mode ) { - mCameraAttachment->SetProjectionMode(mode); + if( mode != mProjectionMode ) + { + mProjectionMode = mode; + + // sceneObject is being used in a separate thread; queue a message to set + SetProjectionModeMessage( GetEventThreadServices(), *mSceneObject, mProjectionMode ); + } } Dali::Camera::ProjectionMode CameraActor::GetProjectionMode() const { - return mCameraAttachment->GetProjectionMode(); + return mProjectionMode; } void CameraActor::SetFieldOfView( float fieldOfView ) { - mCameraAttachment->SetFieldOfView(fieldOfView); + if( ! Equals( fieldOfView, mFieldOfView ) ) + { + mFieldOfView = fieldOfView; + + // sceneObject is being used in a separate thread; queue a message to set + SetFieldOfViewMessage( GetEventThreadServices(), *mSceneObject, mFieldOfView ); + } } -float CameraActor::GetFieldOfView( ) const +float CameraActor::GetFieldOfView() const { - return mCameraAttachment->GetFieldOfView(); + return mFieldOfView; } void CameraActor::SetAspectRatio( float aspectRatio ) { - mCameraAttachment->SetAspectRatio(aspectRatio); + if( ! Equals( aspectRatio, mAspectRatio ) ) + { + mAspectRatio = aspectRatio; + + // sceneObject is being used in a separate thread; queue a message to set + SetAspectRatioMessage( GetEventThreadServices(), *mSceneObject, mAspectRatio ); + } } -float CameraActor::GetAspectRatio( ) const +float CameraActor::GetAspectRatio() const { - return mCameraAttachment->GetAspectRatio(); + return mAspectRatio; } void CameraActor::SetNearClippingPlane( float nearClippingPlane ) { - mCameraAttachment->SetNearClippingPlane(nearClippingPlane); + if( ! Equals( nearClippingPlane, mNearClippingPlane ) ) + { + mNearClippingPlane = nearClippingPlane; + + // sceneObject is being used in a separate thread; queue a message to set + SetNearClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, mNearClippingPlane ); + } } -float CameraActor::GetNearClippingPlane( ) const +float CameraActor::GetNearClippingPlane() const { - return mCameraAttachment->GetNearClippingPlane(); + return mNearClippingPlane; } void CameraActor::SetFarClippingPlane( float farClippingPlane ) { - mCameraAttachment->SetFarClippingPlane(farClippingPlane); + if( ! Equals( farClippingPlane, mFarClippingPlane ) ) + { + mFarClippingPlane = farClippingPlane; + + // sceneObject is being used in a separate thread; queue a message to set + SetFarClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, mFarClippingPlane ); + } } -float CameraActor::GetFarClippingPlane( ) const +float CameraActor::GetFarClippingPlane() const { - return mCameraAttachment->GetFarClippingPlane(); + return mFarClippingPlane; } -void CameraActor::SetTargetPosition(const Vector3& target) +void CameraActor::SetLeftClippingPlane( float leftClippingPlane ) { - mCameraAttachment->SetTargetPosition(target); + if( ! Equals( leftClippingPlane, mLeftClippingPlane ) ) + { + mLeftClippingPlane = leftClippingPlane; + + // sceneObject is being used in a separate thread; queue a message to set + SetLeftClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, mLeftClippingPlane ); + } } -Vector3 CameraActor::GetTargetPosition() const +void CameraActor::SetRightClippingPlane( float rightClippingPlane ) { - return mCameraAttachment->GetTargetPosition(); + if( ! Equals( rightClippingPlane, mRightClippingPlane ) ) + { + mRightClippingPlane = rightClippingPlane; + + // sceneObject is being used in a separate thread; queue a message to set + SetRightClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, mRightClippingPlane ); + } +} + +void CameraActor::SetTopClippingPlane( float topClippingPlane ) +{ + if( ! Equals( topClippingPlane, mTopClippingPlane ) ) + { + mTopClippingPlane = topClippingPlane; + + // sceneObject is being used in a separate thread; queue a message to set + SetTopClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, mTopClippingPlane ); + } +} + +void CameraActor::SetBottomClippingPlane( float bottomClippingPlane ) +{ + if( ! Equals( bottomClippingPlane, mBottomClippingPlane ) ) + { + mBottomClippingPlane = bottomClippingPlane; + + // sceneObject is being used in a separate thread; queue a message to set + SetBottomClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, mBottomClippingPlane ); + } } void CameraActor::SetInvertYAxis(bool invertYAxis) { - mCameraAttachment->SetInvertYAxis(invertYAxis); + if( invertYAxis != mInvertYAxis ) + { + mInvertYAxis = invertYAxis; + + // sceneObject is being used in a separate thread; queue a message to set + SetInvertYAxisMessage( GetEventThreadServices(), *mSceneObject, mInvertYAxis ); + } } bool CameraActor::GetInvertYAxis() const { - return mCameraAttachment->GetInvertYAxis(); + return mInvertYAxis; } void CameraActor::SetPerspectiveProjection( const Size& size, const Vector2& stereoBias /* = Vector2::ZERO */ ) @@ -299,7 +401,8 @@ void CameraActor::SetPerspectiveProjection( const Size& size, const Vector2& ste SetNearClippingPlane( nearClippingPlane ); SetFarClippingPlane( farClippingPlane ); SetAspectRatio( aspectRatio ); - mCameraAttachment->SetStereoBias( stereoBias ); + // sceneObject is being used in a separate thread; queue a message to set + SetStereoBiasMessage( GetEventThreadServices(), *mSceneObject, stereoBias ); SetZ( cameraZ ); } @@ -318,13 +421,13 @@ void CameraActor::SetOrthographicProjection( const Vector2& size ) void CameraActor::SetOrthographicProjection( float left, float right, float top, float bottom, float near, float far ) { - mCameraAttachment->SetLeftClippingPlane(left); - mCameraAttachment->SetRightClippingPlane(right); - mCameraAttachment->SetTopClippingPlane(top); - mCameraAttachment->SetBottomClippingPlane(bottom); + SetLeftClippingPlane( left ); + SetRightClippingPlane( right ); + SetTopClippingPlane( top ); + SetBottomClippingPlane( bottom ); SetNearClippingPlane( near ); SetFarClippingPlane( far ); - SetProjectionMode(Dali::Camera::ORTHOGRAPHIC_PROJECTION); + SetProjectionMode( Dali::Camera::ORTHOGRAPHIC_PROJECTION ); } bool CameraActor::BuildPickingRay( const Vector2& screenCoordinates, @@ -333,7 +436,7 @@ bool CameraActor::BuildPickingRay( const Vector2& screenCoordinates, Vector4& rayDirection ) { bool success = true; - if( GetProjectionMode() == Dali::Camera::PERSPECTIVE_PROJECTION ) + if( mProjectionMode == Dali::Camera::PERSPECTIVE_PROJECTION ) { // Build a picking ray in the world reference system. // ray starts from the camera world position @@ -342,11 +445,8 @@ bool CameraActor::BuildPickingRay( const Vector2& screenCoordinates, // Transform the touch point from the screen coordinate system to the world coordinates system. Vector4 near( screenCoordinates.x - viewport.x, viewport.height - (screenCoordinates.y - viewport.y), 0.f, 1.f ); - if( !Unproject( near, mCameraAttachment->GetInverseViewProjectionMatrix(), viewport.width, viewport.height, near ) ) - { - // unproject failed so no picking ray possible - success = false; - } + const Matrix& inverseViewProjection = mSceneObject->GetInverseViewProjectionMatrix( GetEventThreadServices().GetEventBufferIndex() ); + success = Unproject( near, inverseViewProjection, viewport.width, viewport.height, near ); // Compute the ray's director vector. rayDirection.x = near.x - rayOrigin.x; @@ -374,7 +474,7 @@ const Matrix& CameraActor::GetViewMatrix() const { if ( OnStage() ) { - return mCameraAttachment->GetViewMatrix(); + return mSceneObject->GetViewMatrix( GetEventThreadServices().GetEventBufferIndex() ); } else { @@ -386,7 +486,7 @@ const Matrix& CameraActor::GetProjectionMatrix() const { if ( OnStage() ) { - return mCameraAttachment->GetProjectionMatrix(); + return mSceneObject->GetProjectionMatrix( GetEventThreadServices().GetEventBufferIndex() ); } else { @@ -513,7 +613,6 @@ void CameraActor::SetDefaultProperty( Property::Index index, const Property::Val } else { - DALI_ASSERT_DEBUG(mCameraAttachment && "where is the camera?"); switch(index) { case Dali::CameraActor::Property::TYPE: @@ -521,98 +620,90 @@ void CameraActor::SetDefaultProperty( Property::Index index, const Property::Val std::string s( propertyValue.Get() ); if(s == "LOOK_AT_TARGET") { - mCameraAttachment->SetType(Dali::Camera::LOOK_AT_TARGET); + SetType( Dali::Camera::LOOK_AT_TARGET ); } else if(s == "FREE_LOOK") { - mCameraAttachment->SetType(Dali::Camera::FREE_LOOK); - } - else - { - DALI_LOG_WARNING("Unknown camera type\n"); + SetType( Dali::Camera::FREE_LOOK ); } break; } case Dali::CameraActor::Property::PROJECTION_MODE: { - std::string s(propertyValue.Get()); - if(s == "PERSPECTIVE_PROJECTION") - { - mCameraAttachment->SetProjectionMode(Dali::Camera::PERSPECTIVE_PROJECTION); - } - else if(s == "ORTHOGRAPHIC_PROJECTION") + std::string s( propertyValue.Get() ); + if( s == "PERSPECTIVE_PROJECTION" ) { - mCameraAttachment->SetProjectionMode(Dali::Camera::ORTHOGRAPHIC_PROJECTION); + SetProjectionMode( Dali::Camera::PERSPECTIVE_PROJECTION ); } - else + else if( s == "ORTHOGRAPHIC_PROJECTION" ) { - DALI_LOG_WARNING("Unknown projection mode\n"); + SetProjectionMode( Dali::Camera::ORTHOGRAPHIC_PROJECTION ); } break; } case Dali::CameraActor::Property::FIELD_OF_VIEW: { - mCameraAttachment->SetFieldOfView(propertyValue.Get()); + SetFieldOfView( propertyValue.Get() ); // set to 0 in case property is not float break; } case Dali::CameraActor::Property::ASPECT_RATIO: { - mCameraAttachment->SetAspectRatio(propertyValue.Get()); + SetAspectRatio( propertyValue.Get() ); // set to 0 in case property is not float break; } - case Dali::CameraActor::Property::LEFT_PLANE_DISTANCE: + case Dali::CameraActor::Property::NEAR_PLANE_DISTANCE: { - mCameraAttachment->SetLeftClippingPlane(propertyValue.Get()); + SetNearClippingPlane( propertyValue.Get() ); // set to 0 in case property is not float break; } - case Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE: + case Dali::CameraActor::Property::FAR_PLANE_DISTANCE: { - mCameraAttachment->SetRightClippingPlane(propertyValue.Get()); + SetFarClippingPlane( propertyValue.Get() ); // set to 0 in case property is not float break; } - case Dali::CameraActor::Property::TOP_PLANE_DISTANCE: + case Dali::CameraActor::Property::LEFT_PLANE_DISTANCE: { - mCameraAttachment->SetTopClippingPlane(propertyValue.Get()); + SetLeftClippingPlane( propertyValue.Get() ); // set to 0 in case property is not float break; } - case Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE: + case Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE: { - mCameraAttachment->SetBottomClippingPlane(propertyValue.Get()); + SetRightClippingPlane( propertyValue.Get() ); // set to 0 in case property is not float break; } - case Dali::CameraActor::Property::NEAR_PLANE_DISTANCE: + case Dali::CameraActor::Property::TOP_PLANE_DISTANCE: { - mCameraAttachment->SetNearClippingPlane(propertyValue.Get()); + SetTopClippingPlane( propertyValue.Get() ); // set to 0 in case property is not float break; } - case Dali::CameraActor::Property::FAR_PLANE_DISTANCE: + case Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE: { - mCameraAttachment->SetFarClippingPlane(propertyValue.Get()); + SetBottomClippingPlane( propertyValue.Get() ); // set to 0 in case property is not float break; } case Dali::CameraActor::Property::TARGET_POSITION: { - mCameraAttachment->SetTargetPosition(propertyValue.Get()); + SetTarget( propertyValue.Get() ); // set to 0 in case property is not Vector3 break; } case Dali::CameraActor::Property::PROJECTION_MATRIX: { - DALI_LOG_WARNING("projection-matrix property is not animatable \n"); + DALI_LOG_WARNING( "projection-matrix is read-only\n" ); break; } case Dali::CameraActor::Property::VIEW_MATRIX: { - DALI_LOG_WARNING("view-matrix property is not animatable \n"); + DALI_LOG_WARNING( "view-matrix is read-only\n" ); break; } case Dali::CameraActor::Property::INVERT_Y_AXIS: { - mCameraAttachment->SetInvertYAxis(propertyValue.Get()); + SetInvertYAxis( propertyValue.Get() ); // set to false in case property is not bool break; } default: { - DALI_LOG_WARNING("Unknown property (%d)\n", index); + DALI_LOG_WARNING( "Unknown property (%d)\n", index ); break; } } // switch(index) @@ -623,112 +714,96 @@ void CameraActor::SetDefaultProperty( Property::Index index, const Property::Val Property::Value CameraActor::GetDefaultProperty( Property::Index index ) const { Property::Value ret; - if(index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT) + if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT ) { ret = Actor::GetDefaultProperty(index); } else { - DALI_ASSERT_DEBUG(mCameraAttachment && "where is the camera?"); switch(index) { case Dali::CameraActor::Property::TYPE: { - if(mCameraAttachment->GetType() == Dali::Camera::LOOK_AT_TARGET) + if( Dali::Camera::LOOK_AT_TARGET == mType ) { ret = "LOOK_AT_TARGET"; } - else if(mCameraAttachment->GetType() == Dali::Camera::FREE_LOOK) + else if( Dali::Camera::FREE_LOOK == mType ) { ret = "FREE_LOOK"; } - else - { - ret = ""; - DALI_ASSERT_DEBUG("Unknown camera type\n"); - } break; } case Dali::CameraActor::Property::PROJECTION_MODE: { - if(mCameraAttachment->GetProjectionMode() == Dali::Camera::PERSPECTIVE_PROJECTION) + if( Dali::Camera::PERSPECTIVE_PROJECTION == mProjectionMode ) { ret = "PERSPECTIVE_PROJECTION"; } - else if(mCameraAttachment->GetProjectionMode() == Dali::Camera::ORTHOGRAPHIC_PROJECTION) + else if( Dali::Camera::ORTHOGRAPHIC_PROJECTION == mProjectionMode ) { ret = "ORTHOGRAPHIC_PROJECTION"; } - else - { - ret = ""; - DALI_ASSERT_DEBUG("Unknown projection mode\n"); - } break; } case Dali::CameraActor::Property::FIELD_OF_VIEW: { - ret = mCameraAttachment->GetFieldOfView(); + ret = mFieldOfView; break; } case Dali::CameraActor::Property::ASPECT_RATIO: { - ret = mCameraAttachment->GetAspectRatio(); + ret = mAspectRatio; break; } - case Dali::CameraActor::Property::LEFT_PLANE_DISTANCE: + case Dali::CameraActor::Property::NEAR_PLANE_DISTANCE: { - ret = mCameraAttachment->GetLeftClippingPlane(); + ret = mNearClippingPlane; break; } - case Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE: + case Dali::CameraActor::Property::FAR_PLANE_DISTANCE: { - ret = mCameraAttachment->GetRightClippingPlane(); + ret = mFarClippingPlane; break; } - case Dali::CameraActor::Property::TOP_PLANE_DISTANCE: + case Dali::CameraActor::Property::LEFT_PLANE_DISTANCE: { - ret = mCameraAttachment->GetTopClippingPlane(); + ret = mLeftClippingPlane; break; } - case Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE: + case Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE: { - ret = mCameraAttachment->GetBottomClippingPlane(); + ret = mRightClippingPlane; break; } - case Dali::CameraActor::Property::NEAR_PLANE_DISTANCE: + case Dali::CameraActor::Property::TOP_PLANE_DISTANCE: { - ret = mCameraAttachment->GetNearClippingPlane(); + ret = mTopClippingPlane; break; } - case Dali::CameraActor::Property::FAR_PLANE_DISTANCE: + case Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE: { - ret = mCameraAttachment->GetFarClippingPlane(); + ret = mBottomClippingPlane; break; } case Dali::CameraActor::Property::TARGET_POSITION: { - ret = mCameraAttachment->GetTargetPosition(); + ret = mTarget; break; } case Dali::CameraActor::Property::PROJECTION_MATRIX: { - ret = mCameraAttachment->GetProjectionMatrix(); + ret = GetProjectionMatrix(); break; } case Dali::CameraActor::Property::VIEW_MATRIX: { - ret = mCameraAttachment->GetViewMatrix(); + ret = GetViewMatrix(); break; } case Dali::CameraActor::Property::INVERT_Y_AXIS: { - ret = mCameraAttachment->GetInvertYAxis(); - break; - } - default: - { - DALI_LOG_WARNING("Unknown property (%d)\n", index); + ret = mInvertYAxis; break; } } // switch(index) @@ -771,7 +846,7 @@ const PropertyInputImpl* CameraActor::GetSceneObjectInputProperty( Property::Ind // if its an actor default property or a custom property (actor already handles custom properties) if( ( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT ) || ( index >= DEFAULT_PROPERTY_MAX_COUNT ) ) { - property = Actor::GetSceneObjectInputProperty(index); + property = Actor::GetSceneObjectInputProperty( index ); } else { @@ -779,12 +854,12 @@ const PropertyInputImpl* CameraActor::GetSceneObjectInputProperty( Property::Ind { case Dali::CameraActor::Property::PROJECTION_MATRIX: { - property = mCameraAttachment->GetProjectionMatrixProperty(); + property = mSceneObject->GetProjectionMatrix(); break; } case Dali::CameraActor::Property::VIEW_MATRIX: { - property = mCameraAttachment->GetViewMatrixProperty(); + property = mSceneObject->GetViewMatrix(); break; } default: @@ -796,7 +871,6 @@ const PropertyInputImpl* CameraActor::GetSceneObjectInputProperty( Property::Ind return property; } - } // namespace Internal } // namespace Dali diff --git a/dali/internal/event/actors/camera-actor-impl.h b/dali/internal/event/actors/camera-actor-impl.h index 3cd8d59..5ffa230 100644 --- a/dali/internal/event/actors/camera-actor-impl.h +++ b/dali/internal/event/actors/camera-actor-impl.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_CAMERA_ACTOR_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,9 @@ */ // INTERNAL INCLUES -#include #include #include #include -#include namespace Dali { @@ -31,8 +29,13 @@ namespace Dali namespace Internal { +namespace SceneGraph +{ +class CameraAttachment; +} + /** - * An actor with a conveniently pre-attached CameraAttachment. + * An actor with CameraAttachment. */ class CameraActor : public Actor { @@ -50,18 +53,14 @@ public: static CameraActorPtr New( const Size& size ); /** - * @copydoc Dali::Actor::OnInitialize + * @copydoc Dali::CameraActor::SetTargetPosition */ - void OnInitialize(); + void SetTarget( const Vector3& targetPosition ); /** - * Retrieve the camera attachment. - * @return The attachment. + * @copydoc Dali::CameraActor::GetTargetPosition */ - CameraAttachment& GetCameraAttachment() - { - return *mCameraAttachment; - } + Vector3 GetTarget() const; /** * @copydoc Dali::CameraActor::SetType @@ -91,7 +90,7 @@ public: /** * @copydoc Dali::CameraActor::GetFieldOfView */ - float GetFieldOfView( ) const; + float GetFieldOfView() const; /** * @copydoc Dali::CameraActor::SetAspectRatio @@ -101,7 +100,7 @@ public: /** * @copydoc Dali::CameraActor::GetAspectRatio */ - float GetAspectRatio( ) const; + float GetAspectRatio() const; /** * @copydoc Dali::CameraActor::SetNearClippingPlane @@ -111,7 +110,7 @@ public: /** * @copydoc Dali::CameraActor::GetNearClippingPlane */ - float GetNearClippingPlane( ) const; + float GetNearClippingPlane() const; /** * @copydoc Dali::CameraActor::SetFarClippingPlane @@ -121,22 +120,32 @@ public: /** * @copydoc Dali::CameraActor::GetFarClippingPlane */ - float GetFarClippingPlane( ) const; + float GetFarClippingPlane() const; /** - * @copydoc Dali::CameraActor::SetTargetPosition + * @param leftClippingPlane to use */ - void SetTargetPosition( const Vector3& targetPosition ); + void SetLeftClippingPlane( float leftClippingPlane ); /** - * @copydoc Dali::CameraActor::GetTargetPosition + * @param rightClippingPlane to use + */ + void SetRightClippingPlane( float rightClippingPlane ); + + /** + * @param topClippingPlane to use + */ + void SetTopClippingPlane( float topClippingPlane ); + + /** + * @param bottomClippingPlane to use */ - Vector3 GetTargetPosition() const; + void SetBottomClippingPlane( float bottomClippingPlane ); /** * @copydoc Dali::CameraActor::SetInvertYAxis */ - void SetInvertYAxis(bool invertYAxis); + void SetInvertYAxis( bool invertYAxis ); /** * @copydoc Dali::CameraActor::GetCurrentInvertYAxis @@ -243,10 +252,10 @@ public: // properties */ virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const; -protected: +private: /** - * Protected constructor; see also CameraActor::New() + * Constructor; see also CameraActor::New() */ CameraActor(); @@ -255,9 +264,22 @@ protected: */ virtual ~CameraActor(); -private: - - CameraAttachmentPtr mCameraAttachment; +private: // Data + + const SceneGraph::CameraAttachment* mSceneObject; ///< Not owned + + Vector3 mTarget; + Dali::Camera::Type mType; + Dali::Camera::ProjectionMode mProjectionMode; + float mFieldOfView; + float mAspectRatio; + float mNearClippingPlane; + float mFarClippingPlane; + float mLeftClippingPlane; + float mRightClippingPlane; + float mTopClippingPlane; + float mBottomClippingPlane; + bool mInvertYAxis; }; diff --git a/dali/internal/event/actors/image-actor-impl.h b/dali/internal/event/actors/image-actor-impl.h index 4e7148d..cd2ebe3 100644 --- a/dali/internal/event/actors/image-actor-impl.h +++ b/dali/internal/event/actors/image-actor-impl.h @@ -38,17 +38,7 @@ namespace Internal class Image; /** - * An actor which displays an Image object. - * - * This handles image fade-in if required, waiting for the image to load. - * - * If a new image is set on the actor, then this ensures that the old image - * is displayed until the new image is ready to render to prevent flashing - * to the actor color. This will also happen if the image is reloaded. - * - * This is achieved by using two connector objects to Image: mImageNext and - * mImageAttachment's member object. The first one points to the Image object that is going to - * be displayed next, the second one to the Image that is currently being displayed. + * An actor which displays an Image. */ class ImageActor : public Actor { @@ -74,7 +64,7 @@ public: void SetImage( ImagePtr& image ); /** - * Retrieve the image rendered by the actor's attachment. + * Retrieve the image rendered by the actor. * @return smart pointer to the image or an empty one if no image is assigned */ ImagePtr GetImage() const; diff --git a/dali/internal/event/common/stage-impl.cpp b/dali/internal/event/common/stage-impl.cpp index 2f5c9fc..2358018 100644 --- a/dali/internal/event/common/stage-impl.cpp +++ b/dali/internal/event/common/stage-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/dali/internal/event/common/system-overlay-impl.cpp b/dali/internal/event/common/system-overlay-impl.cpp index 2733568..8003cbd 100644 --- a/dali/internal/event/common/system-overlay-impl.cpp +++ b/dali/internal/event/common/system-overlay-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,6 @@ #include #include #include -#include #include #include diff --git a/dali/internal/event/rendering/renderer-impl.h b/dali/internal/event/rendering/renderer-impl.h index c0cdb08..7943a70 100644 --- a/dali/internal/event/rendering/renderer-impl.h +++ b/dali/internal/event/rendering/renderer-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_RENDERER_H /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -172,7 +172,7 @@ public: bool IsPreMultipliedAlphaEnabled() const; /** - * @brief Get the scene graph object ( the node attachment ) + * @brief Get the scene graph object * * @return the scene object */ diff --git a/dali/internal/file.list b/dali/internal/file.list index bc539c7..90de749 100644 --- a/dali/internal/file.list +++ b/dali/internal/file.list @@ -10,8 +10,6 @@ internal_src_files = \ $(internal_src_dir)/common/image-attributes.cpp \ $(internal_src_dir)/common/fixed-size-memory-pool.cpp \ \ - $(internal_src_dir)/event/actor-attachments/actor-attachment-impl.cpp \ - $(internal_src_dir)/event/actor-attachments/camera-attachment-impl.cpp \ $(internal_src_dir)/event/actors/actor-impl.cpp \ $(internal_src_dir)/event/actors/custom-actor-internal.cpp \ $(internal_src_dir)/event/actors/image-actor-impl.cpp \ diff --git a/dali/public-api/actors/actor.cpp b/dali/public-api/actors/actor.cpp index 34b8690..7a7d0bd 100644 --- a/dali/public-api/actors/actor.cpp +++ b/dali/public-api/actors/actor.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include diff --git a/dali/public-api/actors/camera-actor.cpp b/dali/public-api/actors/camera-actor.cpp index d763bcd..f6aa02b 100644 --- a/dali/public-api/actors/camera-actor.cpp +++ b/dali/public-api/actors/camera-actor.cpp @@ -130,12 +130,12 @@ float CameraActor::GetFarClippingPlane( ) void CameraActor::SetTargetPosition( const Vector3& targetPosition ) { - GetImplementation(*this).SetTargetPosition(targetPosition); + GetImplementation(*this).SetTarget(targetPosition); } Vector3 CameraActor::GetTargetPosition() const { - return GetImplementation(*this).GetTargetPosition(); + return GetImplementation(*this).GetTarget(); } void CameraActor::SetInvertYAxis(bool invertYAxis)