/*
- * 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.
#include <dali/integration-api/debug.h>
#include <dali/internal/event/common/property-helper.h>
#include <dali/internal/event/common/stage-impl.h>
+#include <dali/internal/event/common/scene-impl.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
#include <dali/internal/event/render-tasks/render-task-list-impl.h>
#include <dali/internal/event/common/projection.h>
+#include <dali/internal/event/common/thread-local-storage.h>
#include <dali/internal/update/render-tasks/scene-graph-camera.h>
namespace Dali
SceneGraph::Camera* sceneGraphCamera = SceneGraph::Camera::New();
// Store a pointer to this camera node inside the scene-graph camera.
- sceneGraphCamera->SetNode( &mNode );
+ sceneGraphCamera->SetNode( &GetNode() );
mSceneObject = sceneGraphCamera;
OwnerPointer< SceneGraph::Camera > sceneGraphCameraOwner( sceneGraphCamera );
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;
-
- if( Size::ZERO == size )
+ if( ( size.width < Math::MACHINE_EPSILON_1000 ) || ( size.height < Math::MACHINE_EPSILON_1000 ) )
{
- StagePtr stage = Stage::GetCurrent();
- if( stage )
- {
- const Size& stageSize = stage->GetSize();
-
- width = stageSize.width;
- height = stageSize.height;
- }
- }
-
- 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.
+ // Not allowed to set the canvas size to be 0.
+ DALI_LOG_ERROR( "Canvas size can not be 0\n" );
return;
}
+ float width = size.width;
+ float height = size.height;
+
float nearClippingPlane;
float farClippingPlane;
float cameraZ;
{
// Build a picking ray in the world reference system.
// ray starts from the camera world position
- rayOrigin = mNode.GetWorldMatrix(0).GetTranslation();
+ rayOrigin = GetNode().GetWorldMatrix(0).GetTranslation();
rayOrigin.w = 1.0f;
// Transform the touch point from the screen coordinate system to the world coordinates system.
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)
return ret;
}
-const SceneGraph::PropertyBase* CameraActor::GetSceneObjectAnimatableProperty( Property::Index index ) const
-{
- DALI_ASSERT_ALWAYS( IsPropertyAnimatable(index) && "Property is not animatable" );
-
- const SceneGraph::PropertyBase* property( NULL );
-
- // This method should only return a property of an object connected to the scene-graph
- if ( !OnStage() )
- {
- return property;
- }
-
- // let actor handle animatable properties, we have no animatable properties
- if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT )
- {
- property = Actor::GetSceneObjectAnimatableProperty(index);
- }
-
- return property;
-}
-
const PropertyInputImpl* CameraActor::GetSceneObjectInputProperty( Property::Index index ) const
{
const PropertyInputImpl* property( NULL );
- // This method should only return a property of an object connected to the scene-graph
- if ( !OnStage() )
+ switch( index )
{
- return property;
+ case Dali::CameraActor::Property::PROJECTION_MATRIX:
+ {
+ property = mSceneObject->GetProjectionMatrix();
+ break;
+ }
+ case Dali::CameraActor::Property::VIEW_MATRIX:
+ {
+ property = mSceneObject->GetViewMatrix();
+ break;
+ }
+ // no default on purpose as we chain method up to actor
}
-
- // if its an actor default property or a custom property (actor already handles custom properties)
- if( ( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT ) || ( index >= DEFAULT_PROPERTY_MAX_COUNT ) )
+ if( !property )
{
property = Actor::GetSceneObjectInputProperty( index );
}
- else
- {
- switch( index )
- {
- case Dali::CameraActor::Property::PROJECTION_MATRIX:
- {
- property = mSceneObject->GetProjectionMatrix();
- break;
- }
- case Dali::CameraActor::Property::VIEW_MATRIX:
- {
- property = mSceneObject->GetViewMatrix();
- break;
- }
- default:
- DALI_LOG_WARNING("Not an input property (%d)\n", index);
- break;
- }
- }
return property;
}