// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
-#include <dali/internal/event/common/stage-impl.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>
-using namespace std;
-
namespace Dali
{
namespace Internal
{
-CameraAttachmentPtr CameraAttachment::New( const SceneGraph::Node& parentNode )
+CameraAttachmentPtr CameraAttachment::New( EventThreadServices& eventThreadServices, const SceneGraph::Node& parentNode )
{
- StagePtr stage = Stage::GetCurrent();
-
- CameraAttachmentPtr attachment( new CameraAttachment( *stage ) );
+ CameraAttachmentPtr attachment( new CameraAttachment( eventThreadServices ) );
// Transfer object ownership of scene-object to message
SceneGraph::CameraAttachment* sceneObject = CreateSceneObject();
- AttachToNodeMessage( stage->GetUpdateManager(), parentNode, sceneObject );
+ AttachToNodeMessage( eventThreadServices.GetUpdateManager(), parentNode, sceneObject );
// Keep raw pointer for message passing
attachment->mSceneObject = sceneObject;
return attachment;
}
-CameraAttachment::CameraAttachment( Stage& stage )
-: ActorAttachment( stage ),
+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 ),
- mStereoBias( SceneGraph::CameraAttachment::DEFAULT_STEREO_BIAS ),
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 )
{
}
mType = type;
// sceneObject is being used in a separate thread; queue a message to set
- SetTypeMessage( mStage->GetUpdateInterface(), *mSceneObject, type );
+ SetTypeMessage( GetEventThreadServices(), *mSceneObject, type );
}
}
mProjectionMode = projectionMode;
// sceneObject is being used in a separate thread; queue a message to set
- SetProjectionModeMessage( mStage->GetUpdateInterface(), *mSceneObject, projectionMode );
+ SetProjectionModeMessage( GetEventThreadServices(), *mSceneObject, projectionMode );
}
}
mFieldOfView = fieldOfView;
// sceneObject is being used in a separate thread; queue a message to set
- SetFieldOfViewMessage( mStage->GetUpdateInterface(), *mSceneObject, fieldOfView );
+ SetFieldOfViewMessage( GetEventThreadServices(), *mSceneObject, fieldOfView );
}
}
mAspectRatio = aspectRatio;
// sceneObject is being used in a separate thread; queue a message to set
- SetAspectRatioMessage( mStage->GetUpdateInterface(), *mSceneObject, aspectRatio );
+ SetAspectRatioMessage( GetEventThreadServices(), *mSceneObject, aspectRatio );
}
}
return mAspectRatio;
}
-void CameraAttachment::SetStereoBias(float stereoBias)
+void CameraAttachment::SetStereoBias(const Vector2& stereoBias)
{
- if( ! Equals(stereoBias, mStereoBias) )
+ 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( mStage->GetUpdateInterface(), *mSceneObject, stereoBias );
+ SetStereoBiasMessage( GetEventThreadServices(), *mSceneObject, stereoBias );
}
}
-float CameraAttachment::GetStereoBias(float stereoBias) const
+Vector2 CameraAttachment::GetStereoBias() const
{
return mStereoBias;
}
mLeftClippingPlane = leftClippingPlane;
// sceneObject is being used in a separate thread; queue a message to set
- SetLeftClippingPlaneMessage( mStage->GetUpdateInterface(), *mSceneObject, leftClippingPlane );
+ SetLeftClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, leftClippingPlane );
}
}
mRightClippingPlane = rightClippingPlane;
// sceneObject is being used in a separate thread; queue a message to set
- SetRightClippingPlaneMessage( mStage->GetUpdateInterface(), *mSceneObject, rightClippingPlane );
+ SetRightClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, rightClippingPlane );
}
}
mTopClippingPlane = topClippingPlane;
// sceneObject is being used in a separate thread; queue a message to set
- SetTopClippingPlaneMessage( mStage->GetUpdateInterface(), *mSceneObject, topClippingPlane );
+ SetTopClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, topClippingPlane );
}
}
mBottomClippingPlane = bottomClippingPlane;
// sceneObject is being used in a separate thread; queue a message to set
- SetBottomClippingPlaneMessage( mStage->GetUpdateInterface(), *mSceneObject, bottomClippingPlane );
+ SetBottomClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, bottomClippingPlane );
}
}
mNearClippingPlane = nearClippingPlane;
// sceneObject is being used in a separate thread; queue a message to set
- SetNearClippingPlaneMessage( mStage->GetUpdateInterface(), *mSceneObject, nearClippingPlane );
+ SetNearClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, nearClippingPlane );
}
}
mFarClippingPlane = farClippingPlane;
// sceneObject is being used in a separate thread; queue a message to set
- SetFarClippingPlaneMessage( mStage->GetUpdateInterface(), *mSceneObject, farClippingPlane );
+ SetFarClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, farClippingPlane );
}
}
{
mTargetPosition = targetPosition;
- SetTargetPositionMessage( mStage->GetUpdateInterface(), *mSceneObject, targetPosition );
+ SetTargetPositionMessage( GetEventThreadServices(), *mSceneObject, targetPosition );
}
}
mInvertYAxis = invertYAxis;
// sceneObject is being used in a separate thread; queue a message to set
- SetInvertYAxisMessage( mStage->GetUpdateInterface(), *mSceneObject, invertYAxis );
+ SetInvertYAxisMessage( GetEventThreadServices(), *mSceneObject, invertYAxis );
}
}
{
const SceneGraph::CameraAttachment& sceneObject = *mSceneObject;
- return sceneObject.GetViewMatrix( mStage->GetEventBufferIndex() );
+ return sceneObject.GetViewMatrix( GetEventThreadServices().GetEventBufferIndex() );
}
const Matrix& CameraAttachment::GetProjectionMatrix() const
{
const SceneGraph::CameraAttachment& sceneObject = *mSceneObject;
- return sceneObject.GetProjectionMatrix( mStage->GetEventBufferIndex() );
+ return sceneObject.GetProjectionMatrix( GetEventThreadServices().GetEventBufferIndex() );
}
const Matrix& CameraAttachment::GetInverseViewProjectionMatrix() const
{
const SceneGraph::CameraAttachment& sceneObject = *mSceneObject;
- return sceneObject.GetInverseViewProjectionMatrix( mStage->GetEventBufferIndex() );
+ return sceneObject.GetInverseViewProjectionMatrix( GetEventThreadServices().GetEventBufferIndex() );
}
const PropertyInputImpl* CameraAttachment::GetViewMatrixProperty() const