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=3d2138389d9f0a5e915e1d87beb1078f0ec4bd39;hpb=fa05bc1478e8734fa836b3816ff3eb557df10e5a;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 3d21383..a0faef3 100644 --- a/dali/internal/event/actors/camera-actor-impl.cpp +++ b/dali/internal/event/actors/camera-actor-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -25,12 +25,15 @@ // INTERNAL INCLUDES #include #include +#include #include #include #include +#include #include #include #include +#include #include namespace Dali @@ -197,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 @@ -368,29 +388,28 @@ bool CameraActor::GetInvertYAxis() const return mInvertYAxis; } -void CameraActor::SetPerspectiveProjection( const Size& size, const Vector2& stereoBias /* = Vector2::ZERO */ ) +void CameraActor::SetPerspectiveProjection( const Size& size ) { - float width = size.width; - float height = size.height; + mCanvasSize = size; - if( Size::ZERO == size ) + if( ( size.width < Math::MACHINE_EPSILON_1000 ) || ( size.height < Math::MACHINE_EPSILON_1000 ) ) { - StagePtr stage = Stage::GetCurrent(); - if( stage ) + // If the size given is invalid, i.e. ZERO, then check if we've been added to a scene + if( OnStage() ) { - const Size& stageSize = stage->GetSize(); - - width = stageSize.width; - height = stageSize.height; + // 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; } } - if( ( width < Math::MACHINE_EPSILON_1000 ) || ( height < Math::MACHINE_EPSILON_1000 ) ) - { - // On the stage initialization this method is called but the size has not been set. - // There is no point to set any value if width or height is zero. - return; - } + float width = mCanvasSize.width; + float height = mCanvasSize.height; float nearClippingPlane; float farClippingPlane; @@ -512,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) @@ -608,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 );