X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Factors%2Fcamera-actor-impl.cpp;h=a0faef31a93fc65759cce09e095b663f7ecf1d8a;hb=d353bae63798f48237dc24c078c2e8cb2aa0bc62;hp=ae63c9f7ec169f3609e0e99b2618eccad889ad23;hpb=c8fd068ebed118f2ffc6d5f1f01cfd6b43960b78;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/actors/camera-actor-impl.cpp b/dali/internal/event/actors/camera-actor-impl.cpp index ae63c9f..a0faef3 100644 --- a/dali/internal/event/actors/camera-actor-impl.cpp +++ b/dali/internal/event/actors/camera-actor-impl.cpp @@ -25,6 +25,7 @@ // INTERNAL INCLUDES #include #include +#include #include #include #include @@ -199,6 +200,23 @@ void CameraActor::OnInitialize() AddCameraMessage( GetEventThreadServices().GetUpdateManager(), sceneGraphCameraOwner ); } +void CameraActor::OnStageConnectionInternal() +{ + // If the canvas size has not been set, then use the size of the scene we've been added to to set up the perspective projection + if( ( mCanvasSize.width < Math::MACHINE_EPSILON_1000 ) || ( mCanvasSize.height < Math::MACHINE_EPSILON_1000 ) ) + { + SetPerspectiveProjection( GetScene().GetSize() ); + } +} + +void CameraActor::SetReflectByPlane(const Vector4& plane) { + SceneGraph::Camera* cam = const_cast(GetCamera()); + if (cam) + { + cam->SetReflectByPlane(plane); + } +} + void CameraActor::SetTarget( const Vector3& target ) { if( target != mTarget ) // using range epsilon @@ -372,15 +390,26 @@ bool CameraActor::GetInvertYAxis() const void CameraActor::SetPerspectiveProjection( const Size& size ) { + mCanvasSize = size; + if( ( size.width < Math::MACHINE_EPSILON_1000 ) || ( size.height < Math::MACHINE_EPSILON_1000 ) ) { - // Not allowed to set the canvas size to be 0. - DALI_LOG_ERROR( "Canvas size can not be 0\n" ); - return; + // If the size given is invalid, i.e. ZERO, then check if we've been added to a scene + if( OnStage() ) + { + // We've been added to a scene already, set the canvas size to the scene's size + mCanvasSize = GetScene().GetSize(); + } + else + { + // We've not been added to a scene yet, so just return. + // We'll set the canvas size when we get added to a scene later + return; + } } - float width = size.width; - float height = size.height; + float width = mCanvasSize.width; + float height = mCanvasSize.height; float nearClippingPlane; float farClippingPlane; @@ -502,6 +531,12 @@ const SceneGraph::Camera* CameraActor::GetCamera() const return mSceneObject; } +void CameraActor::RotateProjection( int rotationAngle ) +{ + // sceneObject is being used in a separate thread; queue a message to set + RotateProjectionMessage( GetEventThreadServices(), *mSceneObject, rotationAngle ); +} + void CameraActor::SetDefaultProperty( Property::Index index, const Property::Value& propertyValue ) { if(index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT) @@ -598,6 +633,12 @@ void CameraActor::SetDefaultProperty( Property::Index index, const Property::Val SetInvertYAxis( propertyValue.Get() ); // set to false in case property is not bool break; } + case Dali::DevelCameraActor::Property::REFLECTION_PLANE: + { + SetReflectByPlane( propertyValue.Get() ); + break; + } + default: { DALI_LOG_WARNING( "Unknown property (%d)\n", index );