- these base classes are not used for anything anymore, they just take up RAM & ROM
Change-Id: Ib0fc20e6dd0360ad2ae01441153093e081395320
#include <dali/internal/event/actors/image-actor-impl.h>
#include <dali/internal/event/actors/layer-impl.h>
-#include <dali/internal/event/actor-attachments/actor-attachment-impl.h>
-#include <dali/internal/event/actor-attachments/camera-attachment-impl.h>
-
#include <dali/internal/event/animation/animation-impl.h>
#include <dali/internal/event/animation/animator-connector.h>
#include <dali/internal/event/animation/constraint-impl.h>
sizeof( Internal::SceneGraph::Constraint<float, Internal::PropertyAccessor<float> > ) );
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(
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(
+++ /dev/null
-#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 <dali/public-api/object/ref-object.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-class ActorAttachment;
-class CameraAttachment;
-class ImageAttachment;
-
-typedef IntrusivePtr<ActorAttachment> ActorAttachmentPtr;
-typedef IntrusivePtr<CameraAttachment> CameraAttachmentPtr;
-typedef IntrusivePtr<ImageAttachment> ImageAttachmentPtr;
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_ACTOR_ATTACHMENT_DECLARATIONS_H__
+++ /dev/null
-/*
- * 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 <dali/internal/event/actor-attachments/actor-attachment-impl.h>
-
-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
+++ /dev/null
-#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 <dali/public-api/object/ref-object.h>
-
-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__
+++ /dev/null
-/*
- * 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 <dali/internal/event/actor-attachments/camera-attachment-impl.h>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
-#include <dali/internal/event/common/event-thread-services.h>
-#include <dali/internal/update/manager/update-manager.h>
-#include <dali/internal/update/node-attachments/scene-graph-camera-attachment.h>
-
-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
+++ /dev/null
-#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 <dali/internal/event/actor-attachments/actor-attachment-impl.h>
-#include <dali/internal/event/actor-attachments/actor-attachment-declarations.h>
-#include <dali/internal/update/common/animatable-property.h>
-#include <dali/internal/update/common/inherited-property.h>
-#include <dali/public-api/actors/camera-actor.h>
-#include <dali/public-api/math/rect.h>
-
-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__
#include <dali/internal/event/common/property-helper.h>
#include <dali/internal/event/common/stage-impl.h>
#include <dali/internal/event/common/type-info-impl.h>
-#include <dali/internal/event/actor-attachments/actor-attachment-impl.h>
#include <dali/internal/event/animation/constraint-impl.h>
#include <dali/internal/event/common/projection.h>
#include <dali/internal/event/size-negotiation/relayout-controller-impl.h>
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;
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
ConnectNodeMessage( GetEventThreadServices().GetUpdateManager(), *(mParent->mNode), *mNode );
}
- // Notify attachment
- if( mAttachment )
- {
- mAttachment->Connect();
- }
-
unsigned int rendererCount( GetRendererCount() );
for( unsigned int i(0); i<rendererCount; ++i )
{
// Notification for Object::Observers
OnSceneObjectRemove();
- // Notify attachment
- if( mAttachment )
- {
- mAttachment->Disconnect();
- }
-
unsigned int rendererCount( GetRendererCount() );
for( unsigned int i(0); i<rendererCount; ++i )
{
#define __DALI_INTERNAL_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.
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/size-negotiation/relayout-container.h>
#include <dali/internal/event/actors/actor-declarations.h>
-#include <dali/internal/event/actor-attachments/actor-attachment-declarations.h>
#include <dali/internal/event/common/object-impl.h>
#include <dali/internal/event/common/stage-def.h>
#include <dali/internal/event/rendering/renderer-impl.h>
* 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
*/
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
/**
/**
* 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.
/**
* 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.
/**
* 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.
*/
/**
* 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.
*/
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;
// INTERNAL INCLUDES
#include <dali/public-api/common/stage.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/internal/event/actor-attachments/camera-attachment-impl.h>
+#include <dali/integration-api/debug.h>
#include <dali/internal/event/common/property-helper.h>
#include <dali/internal/event/common/stage-impl.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
#include <dali/internal/event/render-tasks/render-task-list-impl.h>
#include <dali/internal/event/common/projection.h>
-#include <dali/integration-api/debug.h>
+#include <dali/internal/update/node-attachments/scene-graph-camera-attachment.h>
namespace Dali
{
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 );
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 */ )
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 );
}
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,
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
// 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;
{
if ( OnStage() )
{
- return mCameraAttachment->GetViewMatrix();
+ return mSceneObject->GetViewMatrix( GetEventThreadServices().GetEventBufferIndex() );
}
else
{
{
if ( OnStage() )
{
- return mCameraAttachment->GetProjectionMatrix();
+ return mSceneObject->GetProjectionMatrix( GetEventThreadServices().GetEventBufferIndex() );
}
else
{
}
else
{
- DALI_ASSERT_DEBUG(mCameraAttachment && "where is the camera?");
switch(index)
{
case Dali::CameraActor::Property::TYPE:
std::string s( propertyValue.Get<std::string>() );
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<std::string>());
- if(s == "PERSPECTIVE_PROJECTION")
- {
- mCameraAttachment->SetProjectionMode(Dali::Camera::PERSPECTIVE_PROJECTION);
- }
- else if(s == "ORTHOGRAPHIC_PROJECTION")
+ std::string s( propertyValue.Get<std::string>() );
+ 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<float>());
+ SetFieldOfView( propertyValue.Get<float>() ); // set to 0 in case property is not float
break;
}
case Dali::CameraActor::Property::ASPECT_RATIO:
{
- mCameraAttachment->SetAspectRatio(propertyValue.Get<float>());
+ SetAspectRatio( propertyValue.Get<float>() ); // 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<float>());
+ SetNearClippingPlane( propertyValue.Get<float>() ); // 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<float>());
+ SetFarClippingPlane( propertyValue.Get<float>() ); // 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<float>());
+ SetLeftClippingPlane( propertyValue.Get<float>() ); // 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<float>());
+ SetRightClippingPlane( propertyValue.Get<float>() ); // 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<float>());
+ SetTopClippingPlane( propertyValue.Get<float>() ); // 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<float>());
+ SetBottomClippingPlane( propertyValue.Get<float>() ); // set to 0 in case property is not float
break;
}
case Dali::CameraActor::Property::TARGET_POSITION:
{
- mCameraAttachment->SetTargetPosition(propertyValue.Get<Vector3>());
+ SetTarget( propertyValue.Get<Vector3>() ); // 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<bool>());
+ SetInvertYAxis( propertyValue.Get<bool>() ); // 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)
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)
// 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
{
{
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:
return property;
}
-
} // namespace Internal
} // namespace Dali
#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.
*/
// INTERNAL INCLUES
-#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/actors/camera-actor.h>
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/actors/actor-declarations.h>
-#include <dali/internal/event/actor-attachments/actor-attachment-declarations.h>
namespace Dali
{
namespace Internal
{
+namespace SceneGraph
+{
+class CameraAttachment;
+}
+
/**
- * An actor with a conveniently pre-attached CameraAttachment.
+ * An actor with CameraAttachment.
*/
class CameraActor : public Actor
{
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
/**
* @copydoc Dali::CameraActor::GetFieldOfView
*/
- float GetFieldOfView( ) const;
+ float GetFieldOfView() const;
/**
* @copydoc Dali::CameraActor::SetAspectRatio
/**
* @copydoc Dali::CameraActor::GetAspectRatio
*/
- float GetAspectRatio( ) const;
+ float GetAspectRatio() const;
/**
* @copydoc Dali::CameraActor::SetNearClippingPlane
/**
* @copydoc Dali::CameraActor::GetNearClippingPlane
*/
- float GetNearClippingPlane( ) const;
+ float GetNearClippingPlane() const;
/**
* @copydoc Dali::CameraActor::SetFarClippingPlane
/**
* @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
*/
virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
-protected:
+private:
/**
- * Protected constructor; see also CameraActor::New()
+ * Constructor; see also CameraActor::New()
*/
CameraActor();
*/
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;
};
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
{
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;
/*
- * 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.
#include <dali/internal/event/actors/layer-impl.h>
#include <dali/internal/event/actors/layer-list.h>
#include <dali/internal/event/actors/camera-actor-impl.h>
-#include <dali/internal/event/actor-attachments/camera-attachment-impl.h>
#include <dali/internal/event/common/system-overlay-impl.h>
#include <dali/internal/event/common/thread-local-storage.h>
#include <dali/internal/event/common/property-notification-manager.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.
#include <dali/internal/event/actors/camera-actor-impl.h>
#include <dali/internal/event/actors/layer-impl.h>
#include <dali/internal/event/actors/layer-list.h>
-#include <dali/internal/event/actor-attachments/camera-attachment-impl.h>
#include <dali/internal/event/common/event-thread-services.h>
#include <dali/internal/event/render-tasks/render-task-list-impl.h>
#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.
bool IsPreMultipliedAlphaEnabled() const;
/**
- * @brief Get the scene graph object ( the node attachment )
+ * @brief Get the scene graph object
*
* @return the scene object
*/
$(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 \
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/actors/layer-impl.h>
#include <dali/internal/event/rendering/renderer-impl.h>
-#include <dali/internal/event/actor-attachments/actor-attachment-impl.h>
#include <dali/internal/event/animation/constraint-impl.h>
#include <dali/internal/event/size-negotiation/relayout-controller-impl.h>
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)