-#ifndef __DALI_INTERNAL_SCENE_GRAPH_CAMERA_H__
-#define __DALI_INTERNAL_SCENE_GRAPH_CAMERA_H__
+#ifndef DALI_INTERNAL_SCENE_GRAPH_CAMERA_H
+#define DALI_INTERNAL_SCENE_GRAPH_CAMERA_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
~Camera();
/**
+ * Set the node this scene graph camera belongs to.
+ * @param[in] node The owning node.
+ */
+ void SetNode( const Node* node );
+
+ /**
* @copydoc Dali::Internal::CameraActor::SetType
*/
void SetType( Dali::Camera::Type type );
*/
void SetAspectRatio( float aspectRatio );
- /**
- * @copydoc Dali::Internal::CameraActor::SetStereoBias
- */
- void SetStereoBias(const Vector2& stereoBias);
-
/**
* @copydoc Dali::Internal::CameraActor::SetLeftClippingPlane
*/
void SetFarClippingPlane( float farClippingPlane );
/**
+ * @copydoc Dali::Internal::CameraActor::RotateProjection
+ */
+ void RotateProjection( int rotationAngle );
+
+ /**
* @copydoc Dali::Internal::CameraActor::SetTarget
*/
void SetTargetPosition( const Vector3& targetPosition );
const Matrix& GetInverseViewProjectionMatrix( BufferIndex bufferIndex ) const;
/**
+ * Retrieve the final projection-matrix; this is double buffered for input handling.
+ * @param[in] bufferIndex The buffer to read from.
+ * @return The projection-matrix that should be used to render.
+ */
+ const Matrix& GetFinalProjectionMatrix( BufferIndex bufferIndex ) const;
+
+ /**
* Retrieve the projection-matrix property querying interface.
* @pre The camera is on-stage.
* @return The projection-matrix property querying interface.
* Updates view and projection matrices.
* Called by the render task using the camera
* @param[in] updateBufferIndex The buffer to read from.
- * @param[in] owningNode The node that owns the camera
*/
- void Update( BufferIndex updateBufferIndex, const Node& owningNode );
+ void Update( BufferIndex updateBufferIndex );
/**
* @return true if the view matrix of camera is updated this or the previous frame
/**
* Recalculates the view matrix.
* @param[in] bufferIndex The current update buffer index.
- * @param[in] owningNode to use for calculations.
* @return count how many frames ago the matrix was changed.
*/
- unsigned int UpdateViewMatrix( BufferIndex updateBufferIndex, const Node& owningNode );
+ uint32_t UpdateViewMatrix( BufferIndex updateBufferIndex );
/**
* Recalculates the projection matrix.
* @param[in] bufferIndex The current update buffer index.
* @return count how many frames ago the matrix was changed.
*/
- unsigned int UpdateProjection( BufferIndex updateBufferIndex );
+ uint32_t UpdateProjection( BufferIndex updateBufferIndex );
private:
*/
void UpdateFrustum( BufferIndex updateBufferIndex, bool normalize = true );
- unsigned int mUpdateViewFlag; ///< This is non-zero if the view matrix requires an update
- unsigned int mUpdateProjectionFlag; ///< This is non-zero if the projection matrix requires an update
+ uint32_t mUpdateViewFlag; ///< This is non-zero if the view matrix requires an update
+ uint32_t mUpdateProjectionFlag; ///< This is non-zero if the projection matrix requires an update
+ int mProjectionRotation; ///< The rotaion angle of the projection
+ const Node* mNode; ///< The node this scene graph camera belongs to
public: // PROPERTIES
Dali::Camera::Type mType; // Non-animatable
float mBottomClippingPlane;
float mNearClippingPlane;
float mFarClippingPlane;
- Vector2 mStereoBias;
Vector3 mTargetPosition;
InheritedMatrix mViewMatrix; ///< The viewMatrix; this is double buffered for input handling.
DoubleBuffered< FrustumPlanes > mFrustum; ///< Clipping frustum; double buffered for input handling
DoubleBuffered< Matrix > mInverseViewProjection; ///< Inverted viewprojection; double buffered for input handling
+ DoubleBuffered< Matrix > mFinalProjection; ///< Final projection matrix; double buffered for input handling
};
typedef MessageValue1< Camera, Dali::Camera::Type > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetType, parameter );
typedef MessageValue1< Camera, Dali::Camera::ProjectionMode > LocalProjectionMode;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalProjectionMode ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalProjectionMode ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalProjectionMode( &camera, &Camera::SetProjectionMode, parameter );
typedef MessageValue1< Camera, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetFieldOfView, parameter );
typedef MessageValue1< Camera, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetAspectRatio, parameter );
}
-inline void SetStereoBiasMessage( EventThreadServices& eventThreadServices, const Camera& camera, const Vector2& parameter )
-{
- typedef MessageValue1< Camera, Vector2 > LocalType;
-
- // Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
- // Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &camera, &Camera::SetStereoBias, parameter );
-}
-
inline void SetLeftClippingPlaneMessage( EventThreadServices& eventThreadServices, const Camera& camera, float parameter )
{
typedef MessageValue1< Camera, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetLeftClippingPlane, parameter );
typedef MessageValue1< Camera, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetRightClippingPlane, parameter );
typedef MessageValue1< Camera, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetTopClippingPlane, parameter );
typedef MessageValue1< Camera, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetBottomClippingPlane, parameter );
typedef MessageValue1< Camera, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetNearClippingPlane, parameter );
typedef MessageValue1< Camera, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetFarClippingPlane, parameter );
typedef MessageValue1< Camera, Vector3 > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetTargetPosition, parameter );
typedef MessageValue1< Camera, bool > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetInvertYAxis, parameter );
}
+inline void RotateProjectionMessage( EventThreadServices& eventThreadServices, const Camera& camera, int parameter )
+{
+ typedef MessageValue1< Camera, int > LocalType;
+
+ // Reserve some memory inside the message queue
+ unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new (slot) LocalType( &camera, &Camera::RotateProjection, parameter );
+}
+
} // namespace SceneGraph
} // namespace Internal
} // namespace Dali
-#endif // __DALI_INTERNAL_SCENE_GRAPH_CAMERA_H__
+#endif // DALI_INTERNAL_SCENE_GRAPH_CAMERA_H