X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Factors%2Fcamera-actor-impl.cpp;h=f73497a443bd04a10fdbe48453d15833209ef9e2;hb=df2736dfa4617e3ba2f25f2b8a769c6ffe14f632;hp=ae63c9f7ec169f3609e0e99b2618eccad889ad23;hpb=2621da5375804bf824d6b202cadec49416483875;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..f73497a 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) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -23,17 +23,11 @@ #include // for strcmp // INTERNAL INCLUDES -#include #include -#include +#include #include -#include -#include -#include -#include #include #include -#include namespace Dali { @@ -199,6 +193,23 @@ void CameraActor::OnInitialize() AddCameraMessage( GetEventThreadServices().GetUpdateManager(), sceneGraphCameraOwner ); } +void CameraActor::OnSceneConnectionInternal() +{ + // 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 +383,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( OnScene() ) + { + // 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; @@ -476,7 +498,7 @@ bool CameraActor::BuildPickingRay( const Vector2& screenCoordinates, const Matrix& CameraActor::GetViewMatrix() const { - if ( OnStage() ) + if ( OnScene() ) { return mSceneObject->GetViewMatrix( GetEventThreadServices().GetEventBufferIndex() ); } @@ -488,7 +510,7 @@ const Matrix& CameraActor::GetViewMatrix() const const Matrix& CameraActor::GetProjectionMatrix() const { - if ( OnStage() ) + if ( OnScene() ) { return mSceneObject->GetProjectionMatrix( GetEventThreadServices().GetEventBufferIndex() ); } @@ -598,6 +620,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 );