2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/internal/event/actors/camera-actor-impl.h>
23 #include <cstring> // for strcmp
26 #include <dali/public-api/common/stage.h>
27 #include <dali/public-api/object/type-registry.h>
28 #include <dali/integration-api/debug.h>
29 #include <dali/internal/event/common/property-helper.h>
30 #include <dali/internal/event/common/stage-impl.h>
31 #include <dali/internal/event/render-tasks/render-task-impl.h>
32 #include <dali/internal/event/render-tasks/render-task-list-impl.h>
33 #include <dali/internal/event/common/projection.h>
34 #include <dali/internal/update/render-tasks/scene-graph-camera.h>
48 * We want to discourage the use of property strings (minimize string comparisons),
49 * particularly for the default properties.
50 * Name Type writable animatable constraint-input enum for index-checking
52 DALI_PROPERTY_TABLE_BEGIN
53 DALI_PROPERTY( "type", STRING, true, false, true, Dali::CameraActor::Property::TYPE )
54 DALI_PROPERTY( "projectionMode", STRING, true, false, true, Dali::CameraActor::Property::PROJECTION_MODE )
55 DALI_PROPERTY( "fieldOfView", FLOAT, true, false, true, Dali::CameraActor::Property::FIELD_OF_VIEW )
56 DALI_PROPERTY( "aspectRatio", FLOAT, true, false, true, Dali::CameraActor::Property::ASPECT_RATIO )
57 DALI_PROPERTY( "nearPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::NEAR_PLANE_DISTANCE )
58 DALI_PROPERTY( "farPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::FAR_PLANE_DISTANCE )
59 DALI_PROPERTY( "leftPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::LEFT_PLANE_DISTANCE )
60 DALI_PROPERTY( "rightPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE )
61 DALI_PROPERTY( "topPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::TOP_PLANE_DISTANCE )
62 DALI_PROPERTY( "bottomPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE )
63 DALI_PROPERTY( "targetPosition", VECTOR3, true, false, true, Dali::CameraActor::Property::TARGET_POSITION )
64 DALI_PROPERTY( "projectionMatrix", MATRIX, false, false, true, Dali::CameraActor::Property::PROJECTION_MATRIX )
65 DALI_PROPERTY( "viewMatrix", MATRIX, false, false, true, Dali::CameraActor::Property::VIEW_MATRIX )
66 DALI_PROPERTY( "invertYAxis", BOOLEAN, true, false, true, Dali::CameraActor::Property::INVERT_Y_AXIS )
67 DALI_PROPERTY_TABLE_END( DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX )
69 // calculate the far plane distance for a 16bit depth buffer with 4 bits per unit precision
70 void CalculateClippingAndZ( float width, float height, float& nearClippingPlane, float& farClippingPlane, float& cameraZ )
72 nearClippingPlane = std::max( width, height );
73 farClippingPlane = nearClippingPlane + static_cast<float>( 0xFFFF >> 4 );
74 cameraZ = 2.0f * nearClippingPlane;
79 return Dali::CameraActor::New();
82 TypeRegistration mType( typeid( Dali::CameraActor ), typeid( Dali::Actor ), Create );
85 * Builds the picking ray in the world reference system from an orthographic camera
86 * The ray origin is the screen coordinate in the near plane translated to a parallel
87 * plane at the camera origin. The ray direction is the direction the camera is facing
88 * (i.e. Z=-1 in view space).
90 void BuildOrthoPickingRay( const Matrix& viewMatrix,
91 const Matrix& projectionMatrix,
92 const Viewport& viewport,
97 float nearPlaneDistance )
99 // inv( modelMatrix ) inv( viewMatrix ) inv( projectionMatrix ) normalize
100 // <----------------- <----------------- <-------------- <-------------
101 // Local World Camera Normalized Screen
102 // reference reference reference clip coordinates
103 // system system system coordinates
104 // -----------------> -----------------> --------------> ------------->
105 // modelMatrix viewMatrix projectionMatrix viewport
107 // Transforms the touch point from the screen reference system to the world reference system.
108 Matrix invViewProjection( false ); // Don't initialize.
109 Matrix::Multiply( invViewProjection, viewMatrix, projectionMatrix );
110 if( !invViewProjection.Invert() )
112 DALI_ASSERT_DEBUG( false );
115 Vector4 near( screenX - static_cast<float>( viewport.x ),
116 static_cast<float>( viewport.height ) - (screenY - static_cast<float>( viewport.y ) ),
118 if( !Unproject( near, invViewProjection, static_cast<float>( viewport.width ), static_cast<float>( viewport.height ), rayOrigin ) )
120 DALI_ASSERT_DEBUG( false );
123 Matrix invView = viewMatrix;
124 if( !invView.Invert() )
126 DALI_ASSERT_DEBUG( false );
129 Vector4 cameraOrigin = invView * Vector4( 0.f, 0.f, 0.f, 1.f );
130 Vector4 nearPlaneOrigin = invView * Vector4( 0.0f, 0.0f, -nearPlaneDistance, 1.0f);
132 // Vector pointing from the camera to the near plane
133 rayDir = cameraOrigin - nearPlaneOrigin;
141 CameraActorPtr CameraActor::New( const Size& size )
143 CameraActorPtr actor( new CameraActor() );
145 // Second-phase construction
148 actor->SetName( "DefaultCamera" );
149 actor->SetPerspectiveProjection( size );
151 // By default Actors face in the positive Z direction in world space
152 // CameraActors should face in the negative Z direction, towards the other actors
153 actor->SetOrientation( Quaternion( Dali::ANGLE_180, Vector3::YAXIS ) );
158 CameraActor::CameraActor()
159 : Actor( Actor::BASIC ),
160 mSceneObject( NULL ),
161 mTarget( SceneGraph::Camera::DEFAULT_TARGET_POSITION ),
162 mType( SceneGraph::Camera::DEFAULT_TYPE ),
163 mProjectionMode( SceneGraph::Camera::DEFAULT_MODE ),
164 mFieldOfView( SceneGraph::Camera::DEFAULT_FIELD_OF_VIEW ),
165 mAspectRatio( SceneGraph::Camera::DEFAULT_ASPECT_RATIO ),
166 mNearClippingPlane( SceneGraph::Camera::DEFAULT_NEAR_CLIPPING_PLANE ),
167 mFarClippingPlane( SceneGraph::Camera::DEFAULT_FAR_CLIPPING_PLANE ),
168 mLeftClippingPlane( SceneGraph::Camera::DEFAULT_LEFT_CLIPPING_PLANE ),
169 mRightClippingPlane( SceneGraph::Camera::DEFAULT_RIGHT_CLIPPING_PLANE ),
170 mTopClippingPlane( SceneGraph::Camera::DEFAULT_TOP_CLIPPING_PLANE ),
171 mBottomClippingPlane( SceneGraph::Camera::DEFAULT_BOTTOM_CLIPPING_PLANE ),
172 mInvertYAxis( SceneGraph::Camera::DEFAULT_INVERT_Y_AXIS )
176 CameraActor::~CameraActor()
178 if( EventThreadServices::IsCoreRunning() )
180 // Create scene-object and transfer ownership through message
181 RemoveCameraMessage( GetEventThreadServices().GetUpdateManager(), mSceneObject );
185 void CameraActor::OnInitialize()
187 // Create scene-object and keep raw pointer for message passing.
188 SceneGraph::Camera* sceneGraphCamera = SceneGraph::Camera::New();
190 // Store a pointer to this camera node inside the scene-graph camera.
191 sceneGraphCamera->SetNode( mNode );
193 mSceneObject = sceneGraphCamera;
194 OwnerPointer< SceneGraph::Camera > sceneGraphCameraOwner( sceneGraphCamera );
196 // Send message to inform update of this camera (and move ownership).
197 AddCameraMessage( GetEventThreadServices().GetUpdateManager(), sceneGraphCameraOwner );
200 void CameraActor::SetTarget( const Vector3& target )
202 if( target != mTarget ) // using range epsilon
206 SetTargetPositionMessage( GetEventThreadServices(), *mSceneObject, mTarget );
210 Vector3 CameraActor::GetTarget() const
215 void CameraActor::SetType( Dali::Camera::Type type )
221 // sceneObject is being used in a separate thread; queue a message to set
222 SetTypeMessage( GetEventThreadServices(), *mSceneObject, mType );
226 Dali::Camera::Type CameraActor::GetType() const
231 void CameraActor::SetProjectionMode( Dali::Camera::ProjectionMode mode )
233 if( mode != mProjectionMode )
235 mProjectionMode = mode;
237 // sceneObject is being used in a separate thread; queue a message to set
238 SetProjectionModeMessage( GetEventThreadServices(), *mSceneObject, mProjectionMode );
242 Dali::Camera::ProjectionMode CameraActor::GetProjectionMode() const
244 return mProjectionMode;
247 void CameraActor::SetFieldOfView( float fieldOfView )
249 if( ! Equals( fieldOfView, mFieldOfView ) )
251 mFieldOfView = fieldOfView;
253 // sceneObject is being used in a separate thread; queue a message to set
254 SetFieldOfViewMessage( GetEventThreadServices(), *mSceneObject, mFieldOfView );
258 float CameraActor::GetFieldOfView() const
263 void CameraActor::SetAspectRatio( float aspectRatio )
265 if( ! Equals( aspectRatio, mAspectRatio ) )
267 mAspectRatio = aspectRatio;
269 // sceneObject is being used in a separate thread; queue a message to set
270 SetAspectRatioMessage( GetEventThreadServices(), *mSceneObject, mAspectRatio );
274 float CameraActor::GetAspectRatio() const
279 void CameraActor::SetNearClippingPlane( float nearClippingPlane )
281 if( ! Equals( nearClippingPlane, mNearClippingPlane ) )
283 mNearClippingPlane = nearClippingPlane;
285 // sceneObject is being used in a separate thread; queue a message to set
286 SetNearClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, mNearClippingPlane );
290 float CameraActor::GetNearClippingPlane() const
292 return mNearClippingPlane;
295 void CameraActor::SetFarClippingPlane( float farClippingPlane )
297 if( ! Equals( farClippingPlane, mFarClippingPlane ) )
299 mFarClippingPlane = farClippingPlane;
301 // sceneObject is being used in a separate thread; queue a message to set
302 SetFarClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, mFarClippingPlane );
306 float CameraActor::GetFarClippingPlane() const
308 return mFarClippingPlane;
311 void CameraActor::SetLeftClippingPlane( float leftClippingPlane )
313 if( ! Equals( leftClippingPlane, mLeftClippingPlane ) )
315 mLeftClippingPlane = leftClippingPlane;
317 // sceneObject is being used in a separate thread; queue a message to set
318 SetLeftClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, mLeftClippingPlane );
322 void CameraActor::SetRightClippingPlane( float rightClippingPlane )
324 if( ! Equals( rightClippingPlane, mRightClippingPlane ) )
326 mRightClippingPlane = rightClippingPlane;
328 // sceneObject is being used in a separate thread; queue a message to set
329 SetRightClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, mRightClippingPlane );
333 void CameraActor::SetTopClippingPlane( float topClippingPlane )
335 if( ! Equals( topClippingPlane, mTopClippingPlane ) )
337 mTopClippingPlane = topClippingPlane;
339 // sceneObject is being used in a separate thread; queue a message to set
340 SetTopClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, mTopClippingPlane );
344 void CameraActor::SetBottomClippingPlane( float bottomClippingPlane )
346 if( ! Equals( bottomClippingPlane, mBottomClippingPlane ) )
348 mBottomClippingPlane = bottomClippingPlane;
350 // sceneObject is being used in a separate thread; queue a message to set
351 SetBottomClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, mBottomClippingPlane );
355 void CameraActor::SetInvertYAxis(bool invertYAxis)
357 if( invertYAxis != mInvertYAxis )
359 mInvertYAxis = invertYAxis;
361 // sceneObject is being used in a separate thread; queue a message to set
362 SetInvertYAxisMessage( GetEventThreadServices(), *mSceneObject, mInvertYAxis );
366 bool CameraActor::GetInvertYAxis() const
371 void CameraActor::SetPerspectiveProjection( const Size& size, const Vector2& stereoBias /* = Vector2::ZERO */ )
373 float width = size.width;
374 float height = size.height;
376 if( Size::ZERO == size )
378 StagePtr stage = Stage::GetCurrent();
381 const Size& stageSize = stage->GetSize();
383 width = stageSize.width;
384 height = stageSize.height;
388 if( ( width < Math::MACHINE_EPSILON_1000 ) || ( height < Math::MACHINE_EPSILON_1000 ) )
390 // On the stage initialization this method is called but the size has not been set.
391 // There is no point to set any value if width or height is zero.
395 float nearClippingPlane;
396 float farClippingPlane;
398 CalculateClippingAndZ( width, height, nearClippingPlane, farClippingPlane, cameraZ );
400 // calculate the position of the camera to have the desired aspect ratio
401 const float fieldOfView = 2.0f * std::atan( height * 0.5f / cameraZ );
403 // unless it is too small, we want at least as much space to the back as we have torwards the front
404 const float minClippingFarPlane = 2.f * nearClippingPlane;
405 if ( farClippingPlane < minClippingFarPlane )
407 farClippingPlane = minClippingFarPlane;
410 const float aspectRatio = width / height;
412 SetProjectionMode(Dali::Camera::PERSPECTIVE_PROJECTION);
413 SetFieldOfView( fieldOfView );
414 SetNearClippingPlane( nearClippingPlane );
415 SetFarClippingPlane( farClippingPlane );
416 SetAspectRatio( aspectRatio );
417 // sceneObject is being used in a separate thread; queue a message to set
418 SetStereoBiasMessage( GetEventThreadServices(), *mSceneObject, stereoBias );
423 void CameraActor::SetOrthographicProjection( const Vector2& size )
425 // Choose near, far and Z parameters to match the SetPerspectiveProjection above.
426 float nearClippingPlane;
427 float farClippingPlane;
429 CalculateClippingAndZ( size.width, size.height, nearClippingPlane, farClippingPlane, cameraZ );
430 SetOrthographicProjection( -size.x*0.5f, size.x*0.5f, size.y*0.5f, -size.y*0.5f,
431 nearClippingPlane, farClippingPlane );
435 void CameraActor::SetOrthographicProjection( float left, float right, float top, float bottom, float near, float far )
437 SetLeftClippingPlane( left );
438 SetRightClippingPlane( right );
439 SetTopClippingPlane( top );
440 SetBottomClippingPlane( bottom );
441 SetNearClippingPlane( near );
442 SetFarClippingPlane( far );
443 SetProjectionMode( Dali::Camera::ORTHOGRAPHIC_PROJECTION );
446 bool CameraActor::BuildPickingRay( const Vector2& screenCoordinates,
447 const Viewport& viewport,
449 Vector4& rayDirection )
452 if( mProjectionMode == Dali::Camera::PERSPECTIVE_PROJECTION )
454 // Build a picking ray in the world reference system.
455 // ray starts from the camera world position
456 rayOrigin = mNode->GetWorldMatrix(0).GetTranslation();
459 // Transform the touch point from the screen coordinate system to the world coordinates system.
460 Vector4 near( screenCoordinates.x - static_cast<float>(viewport.x),
461 static_cast<float>( viewport.height ) - (screenCoordinates.y - static_cast<float>( viewport.y ) ),
463 const Matrix& inverseViewProjection = mSceneObject->GetInverseViewProjectionMatrix( GetEventThreadServices().GetEventBufferIndex() );
464 success = Unproject( near, inverseViewProjection, static_cast<float>( viewport.width ), static_cast<float>( viewport.height ), near );
466 // Compute the ray's director vector.
467 rayDirection.x = near.x - rayOrigin.x;
468 rayDirection.y = near.y - rayOrigin.y;
469 rayDirection.z = near.z - rayOrigin.z;
470 rayDirection.Normalize();
471 rayDirection.w = 1.f;
475 float nearPlaneDistance = GetNearClippingPlane();
476 BuildOrthoPickingRay( GetViewMatrix(),
477 GetProjectionMatrix(),
478 viewport, screenCoordinates.x,
488 const Matrix& CameraActor::GetViewMatrix() const
492 return mSceneObject->GetViewMatrix( GetEventThreadServices().GetEventBufferIndex() );
496 return Matrix::IDENTITY;
500 const Matrix& CameraActor::GetProjectionMatrix() const
504 return mSceneObject->GetProjectionMatrix( GetEventThreadServices().GetEventBufferIndex() );
508 return Matrix::IDENTITY;
511 const SceneGraph::Camera* CameraActor::GetCamera() const
516 unsigned int CameraActor::GetDefaultPropertyCount() const
518 return Actor::GetDefaultPropertyCount() + DEFAULT_PROPERTY_COUNT;
521 void CameraActor::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
523 Actor::GetDefaultPropertyIndices( indices ); // Actor class properties
525 indices.Reserve( indices.Size() + DEFAULT_PROPERTY_COUNT );
527 int index = DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX;
528 for ( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i, ++index )
530 indices.PushBack( index );
534 bool CameraActor::IsDefaultPropertyWritable( Property::Index index ) const
536 if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT )
538 return Actor::IsDefaultPropertyWritable( index );
541 return DEFAULT_PROPERTY_DETAILS[index - DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX].writable;
544 bool CameraActor::IsDefaultPropertyAnimatable( Property::Index index ) const
546 if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT )
548 return Actor::IsDefaultPropertyAnimatable( index );
551 return DEFAULT_PROPERTY_DETAILS[index - DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX].animatable;
554 bool CameraActor::IsDefaultPropertyAConstraintInput( Property::Index index ) const
556 if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT )
558 return Actor::IsDefaultPropertyAConstraintInput( index );
561 return DEFAULT_PROPERTY_DETAILS[index - DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX].constraintInput;
564 Property::Type CameraActor::GetDefaultPropertyType( Property::Index index ) const
566 if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT )
568 return Actor::GetDefaultPropertyType( index );
572 index -= DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX;
574 if ( ( index >= 0 ) && ( index < DEFAULT_PROPERTY_COUNT ) )
576 return DEFAULT_PROPERTY_DETAILS[index].type;
580 // index out-of-bounds
581 return Property::NONE;
586 const char* CameraActor::GetDefaultPropertyName( Property::Index index ) const
588 if(index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT)
590 return Actor::GetDefaultPropertyName(index);
594 index -= DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX;
596 if ( ( index >= 0 ) && ( index < DEFAULT_PROPERTY_COUNT ) )
598 return DEFAULT_PROPERTY_DETAILS[index].name;
604 Property::Index CameraActor::GetDefaultPropertyIndex(const std::string& name) const
606 Property::Index index = Property::INVALID_INDEX;
608 // Look for name in current class' default properties
609 for( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
611 if( 0 == strcmp( name.c_str(), DEFAULT_PROPERTY_DETAILS[i].name ) ) // dont want to convert rhs to string
613 index = i + DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX;
618 // If not found, check in base class
619 if( Property::INVALID_INDEX == index )
621 index = Actor::GetDefaultPropertyIndex( name );
627 void CameraActor::SetDefaultProperty( Property::Index index, const Property::Value& propertyValue )
629 if(index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT)
631 Actor::SetDefaultProperty(index, propertyValue);
637 case Dali::CameraActor::Property::TYPE:
639 std::string s( propertyValue.Get<std::string>() );
640 if(s == "LOOK_AT_TARGET")
642 SetType( Dali::Camera::LOOK_AT_TARGET );
644 else if(s == "FREE_LOOK")
646 SetType( Dali::Camera::FREE_LOOK );
650 case Dali::CameraActor::Property::PROJECTION_MODE:
652 std::string s( propertyValue.Get<std::string>() );
653 if( s == "PERSPECTIVE_PROJECTION" )
655 SetProjectionMode( Dali::Camera::PERSPECTIVE_PROJECTION );
657 else if( s == "ORTHOGRAPHIC_PROJECTION" )
659 SetProjectionMode( Dali::Camera::ORTHOGRAPHIC_PROJECTION );
663 case Dali::CameraActor::Property::FIELD_OF_VIEW:
665 SetFieldOfView( propertyValue.Get<float>() ); // set to 0 in case property is not float
668 case Dali::CameraActor::Property::ASPECT_RATIO:
670 SetAspectRatio( propertyValue.Get<float>() ); // set to 0 in case property is not float
673 case Dali::CameraActor::Property::NEAR_PLANE_DISTANCE:
675 SetNearClippingPlane( propertyValue.Get<float>() ); // set to 0 in case property is not float
678 case Dali::CameraActor::Property::FAR_PLANE_DISTANCE:
680 SetFarClippingPlane( propertyValue.Get<float>() ); // set to 0 in case property is not float
683 case Dali::CameraActor::Property::LEFT_PLANE_DISTANCE:
685 SetLeftClippingPlane( propertyValue.Get<float>() ); // set to 0 in case property is not float
688 case Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE:
690 SetRightClippingPlane( propertyValue.Get<float>() ); // set to 0 in case property is not float
693 case Dali::CameraActor::Property::TOP_PLANE_DISTANCE:
695 SetTopClippingPlane( propertyValue.Get<float>() ); // set to 0 in case property is not float
698 case Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE:
700 SetBottomClippingPlane( propertyValue.Get<float>() ); // set to 0 in case property is not float
703 case Dali::CameraActor::Property::TARGET_POSITION:
705 SetTarget( propertyValue.Get<Vector3>() ); // set to 0 in case property is not Vector3
708 case Dali::CameraActor::Property::PROJECTION_MATRIX:
710 DALI_LOG_WARNING( "projection-matrix is read-only\n" );
713 case Dali::CameraActor::Property::VIEW_MATRIX:
715 DALI_LOG_WARNING( "view-matrix is read-only\n" );
718 case Dali::CameraActor::Property::INVERT_Y_AXIS:
720 SetInvertYAxis( propertyValue.Get<bool>() ); // set to false in case property is not bool
725 DALI_LOG_WARNING( "Unknown property (%d)\n", index );
733 Property::Value CameraActor::GetDefaultProperty( Property::Index index ) const
736 if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT )
738 ret = Actor::GetDefaultProperty(index);
744 case Dali::CameraActor::Property::TYPE:
746 if( Dali::Camera::LOOK_AT_TARGET == mType )
748 ret = "LOOK_AT_TARGET";
750 else if( Dali::Camera::FREE_LOOK == mType )
756 case Dali::CameraActor::Property::PROJECTION_MODE:
758 if( Dali::Camera::PERSPECTIVE_PROJECTION == mProjectionMode )
760 ret = "PERSPECTIVE_PROJECTION";
762 else if( Dali::Camera::ORTHOGRAPHIC_PROJECTION == mProjectionMode )
764 ret = "ORTHOGRAPHIC_PROJECTION";
768 case Dali::CameraActor::Property::FIELD_OF_VIEW:
773 case Dali::CameraActor::Property::ASPECT_RATIO:
778 case Dali::CameraActor::Property::NEAR_PLANE_DISTANCE:
780 ret = mNearClippingPlane;
783 case Dali::CameraActor::Property::FAR_PLANE_DISTANCE:
785 ret = mFarClippingPlane;
788 case Dali::CameraActor::Property::LEFT_PLANE_DISTANCE:
790 ret = mLeftClippingPlane;
793 case Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE:
795 ret = mRightClippingPlane;
798 case Dali::CameraActor::Property::TOP_PLANE_DISTANCE:
800 ret = mTopClippingPlane;
803 case Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE:
805 ret = mBottomClippingPlane;
808 case Dali::CameraActor::Property::TARGET_POSITION:
813 case Dali::CameraActor::Property::PROJECTION_MATRIX:
815 ret = GetProjectionMatrix(); // Only on scene-graph
818 case Dali::CameraActor::Property::VIEW_MATRIX:
820 ret = GetViewMatrix(); // Only on scene-graph
823 case Dali::CameraActor::Property::INVERT_Y_AXIS:
834 Property::Value CameraActor::GetDefaultPropertyCurrentValue( Property::Index index ) const
837 if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT )
839 ret = Actor::GetDefaultPropertyCurrentValue(index);
843 ret = GetDefaultProperty( index ); // Most are event-side properties, the scene-graph properties are only on the scene-graph
849 const SceneGraph::PropertyBase* CameraActor::GetSceneObjectAnimatableProperty( Property::Index index ) const
851 DALI_ASSERT_ALWAYS( IsPropertyAnimatable(index) && "Property is not animatable" );
853 const SceneGraph::PropertyBase* property( NULL );
855 // This method should only return a property of an object connected to the scene-graph
861 // let actor handle animatable properties, we have no animatable properties
862 if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT )
864 property = Actor::GetSceneObjectAnimatableProperty(index);
870 const PropertyInputImpl* CameraActor::GetSceneObjectInputProperty( Property::Index index ) const
872 const PropertyInputImpl* property( NULL );
874 // This method should only return a property of an object connected to the scene-graph
880 // if its an actor default property or a custom property (actor already handles custom properties)
881 if( ( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT ) || ( index >= DEFAULT_PROPERTY_MAX_COUNT ) )
883 property = Actor::GetSceneObjectInputProperty( index );
889 case Dali::CameraActor::Property::PROJECTION_MATRIX:
891 property = mSceneObject->GetProjectionMatrix();
894 case Dali::CameraActor::Property::VIEW_MATRIX:
896 property = mSceneObject->GetViewMatrix();
900 DALI_LOG_WARNING("Not an input property (%d)\n", index);
908 } // namespace Internal