2 * Copyright (c) 2016 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/update/manager/transform-manager.h>
26 #include <dali/public-api/common/constants.h>
27 #include <dali/public-api/common/compile-time-assert.h>
28 #include <dali/internal/common/math.h>
41 //Default values for scale (1.0,1.0,1.0), orientation (Identity) and position (0.0,0.0,0.0)
42 static const float gDefaultTransformComponentAnimatableData[] = { 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f };
44 //Default values for anchor point (CENTER) and parent origin (TOP_LEFT)
45 static const float gDefaultTransformComponentStaticData[] = { 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 0.5f };
47 DALI_COMPILE_TIME_ASSERT( sizeof(gDefaultTransformComponentAnimatableData) == sizeof(TransformComponentAnimatable) );
48 DALI_COMPILE_TIME_ASSERT( sizeof(gDefaultTransformComponentStaticData) == sizeof(TransformComponentStatic) );
51 TransformManager::TransformManager()
56 TransformManager::~TransformManager()
59 TransformId TransformManager::CreateTransform()
61 //Get id for the new component
62 TransformId id = mIds.Add(mComponentCount);
64 if( mTxComponentAnimatable.Size() <= mComponentCount )
66 //Make room for another component
67 mTxComponentAnimatable.PushBack(TransformComponentAnimatable());
68 mTxComponentStatic.PushBack(TransformComponentStatic());
69 mInheritanceMode.PushBack(INHERIT_ALL);
70 mComponentId.PushBack(id);
71 mSize.PushBack(Vector3(0.0f,0.0f,0.0f));
72 mParent.PushBack(INVALID_TRANSFORM_ID);
73 mWorld.PushBack(Matrix::IDENTITY);
74 mLocal.PushBack(Matrix::IDENTITY);
75 mBoundingSpheres.PushBack( Vector4(0.0f,0.0f,0.0f,0.0f) );
76 mTxComponentAnimatableBaseValue.PushBack(TransformComponentAnimatable());
77 mSizeBase.PushBack(Vector3(0.0f,0.0f,0.0f));
78 mComponentDirty.PushBack(false);
79 mLocalMatrixDirty.PushBack(false);
84 memcpy( &mTxComponentAnimatable[mComponentCount], &gDefaultTransformComponentAnimatableData, sizeof( TransformComponentAnimatable ) );
85 memcpy( &mTxComponentStatic[mComponentCount], &gDefaultTransformComponentStaticData, sizeof( TransformComponentStatic ) );
86 memcpy( &mTxComponentAnimatableBaseValue[mComponentCount], &gDefaultTransformComponentAnimatableData, sizeof( TransformComponentAnimatable ) );
87 mInheritanceMode[mComponentCount] = INHERIT_ALL;
88 mComponentId[mComponentCount] = id;
89 mSize[mComponentCount] = Vector3(0.0f,0.0f,0.0f);
90 mParent[mComponentCount] = INVALID_TRANSFORM_ID;
91 mLocal[mComponentCount].SetIdentity();
92 mWorld[mComponentCount].SetIdentity();
93 mBoundingSpheres[mComponentCount] = Vector4(0.0f,0.0f,0.0f,0.0f);
94 mSizeBase[mComponentCount] = Vector3(0.0f,0.0f,0.0f);
95 mComponentDirty[mComponentCount] = false;
96 mLocalMatrixDirty[mComponentCount] = false;
103 void TransformManager::RemoveTransform(TransformId id)
105 //Move the last element to the gap
107 unsigned int index = mIds[id];
108 mTxComponentAnimatable[index] = mTxComponentAnimatable[mComponentCount];
109 mTxComponentStatic[index] = mTxComponentStatic[mComponentCount];
110 mInheritanceMode[index] = mInheritanceMode[mComponentCount];
111 mSize[index] = mSize[mComponentCount];
112 mParent[index] = mParent[mComponentCount];
113 mWorld[index] = mWorld[mComponentCount];
114 mLocal[index] = mLocal[mComponentCount];
115 mTxComponentAnimatableBaseValue[index] = mTxComponentAnimatableBaseValue[mComponentCount];
116 mSizeBase[index] = mSizeBase[mComponentCount];
117 mComponentDirty[index] = mComponentDirty[mComponentCount];
118 mLocalMatrixDirty[index] = mLocalMatrixDirty[mComponentCount];
119 mBoundingSpheres[index] = mBoundingSpheres[mComponentCount];
121 TransformId lastItemId = mComponentId[mComponentCount];
122 mIds[ lastItemId ] = index;
123 mComponentId[index] = lastItemId;
129 void TransformManager::SetParent( TransformId id, TransformId parentId )
131 DALI_ASSERT_ALWAYS( id != parentId );
132 mParent[ mIds[id] ] = parentId;
136 const Matrix& TransformManager::GetWorldMatrix( TransformId id ) const
138 return mWorld[ mIds[id] ];
141 Matrix& TransformManager::GetWorldMatrix( TransformId id )
143 return mWorld[ mIds[id] ];
146 void TransformManager::SetInheritPosition( TransformId id, bool inherit )
148 unsigned int index = mIds[id];
151 mInheritanceMode[ index ] |= INHERIT_POSITION;
155 mInheritanceMode[ index ] &= ~INHERIT_POSITION;
158 mComponentDirty[index] = true;
161 void TransformManager::SetInheritScale( TransformId id, bool inherit )
163 unsigned int index = mIds[id];
166 mInheritanceMode[ index ] |= INHERIT_SCALE;
170 mInheritanceMode[ index ] &= ~INHERIT_SCALE;
173 mComponentDirty[index] = true;
176 void TransformManager::SetInheritOrientation( TransformId id, bool inherit )
178 unsigned int index = mIds[id];
181 mInheritanceMode[ index ] |= INHERIT_ORIENTATION;
185 mInheritanceMode[ index ] &= ~INHERIT_ORIENTATION;
188 mComponentDirty[index] = true;
191 void TransformManager::ResetToBaseValue()
193 if( mComponentCount )
195 memcpy( &mTxComponentAnimatable[0], &mTxComponentAnimatableBaseValue[0], sizeof(TransformComponentAnimatable)*mComponentCount );
196 memcpy( &mSize[0], &mSizeBase[0], sizeof(Vector3)*mComponentCount );
197 memset( &mLocalMatrixDirty[0], false, sizeof(bool)*mComponentCount );
201 void TransformManager::Update()
205 //If some transform component has change its parent or has been removed since last update
206 //we need to reorder the vectors
211 //Iterate through all components to compute its world matrix
212 Vector3 anchorPosition;
213 Vector3 localPosition;
214 Vector3 half( 0.5f,0.5f,0.5f );
215 for( unsigned int i(0); i<mComponentCount; ++i )
217 if( DALI_LIKELY( mInheritanceMode[i] != DONT_INHERIT_TRANSFORM && mParent[i] != INVALID_TRANSFORM_ID ) )
219 const unsigned int& parentIndex = mIds[mParent[i] ];
220 if( DALI_LIKELY( mInheritanceMode[i] == INHERIT_ALL ) )
222 if( mComponentDirty[i] || mLocalMatrixDirty[parentIndex])
224 //Full transform inherited
225 mComponentDirty[i] = false;
226 mLocalMatrixDirty[i] = true;
228 anchorPosition = ( half - mTxComponentStatic[i].mAnchorPoint ) * mSize[i] * mTxComponentAnimatable[i].mScale;
229 anchorPosition *= mTxComponentAnimatable[i].mOrientation;
230 localPosition = mTxComponentAnimatable[i].mPosition + anchorPosition + ( mTxComponentStatic[i].mParentOrigin - half ) * mSize[parentIndex];
231 mLocal[i].SetTransformComponents( mTxComponentAnimatable[i].mScale,mTxComponentAnimatable[i].mOrientation, localPosition );
234 //Update the world matrix
235 Matrix::Multiply( mWorld[i], mLocal[i], mWorld[parentIndex]);
239 //Some components are not inherited
240 Vector3 parentPosition, parentScale;
241 Quaternion parentOrientation;
242 const Matrix& parentMatrix = mWorld[parentIndex];
243 parentMatrix.GetTransformComponents( parentPosition, parentOrientation, parentScale );
245 Vector3 localScale = mTxComponentAnimatable[i].mScale;
246 if( (mInheritanceMode[i] & INHERIT_SCALE) == 0 )
248 //Don't inherit scale
249 localScale /= parentScale;
252 Quaternion localOrientation( mTxComponentAnimatable[i].mOrientation );
253 if( (mInheritanceMode[i] & INHERIT_ORIENTATION) == 0 )
255 //Don't inherit orientation
256 parentOrientation.Invert();
257 localOrientation = parentOrientation * mTxComponentAnimatable[i].mOrientation;
260 if( (mInheritanceMode[i] & INHERIT_POSITION) == 0 )
262 //Don't inherit position
263 mLocal[i].SetTransformComponents( localScale, localOrientation, Vector3::ZERO );
264 Matrix::Multiply( mWorld[i], mLocal[i], parentMatrix );
265 mWorld[i].SetTranslation( mTxComponentAnimatable[i].mPosition);
269 anchorPosition = ( half - mTxComponentStatic[i].mAnchorPoint ) * mSize[i] * mTxComponentAnimatable[i].mScale;
270 anchorPosition *= mTxComponentAnimatable[i].mOrientation;
271 localPosition = mTxComponentAnimatable[i].mPosition + anchorPosition + ( mTxComponentStatic[i].mParentOrigin - half ) * mSize[parentIndex];
272 mLocal[i].SetTransformComponents( localScale, localOrientation, localPosition );
273 Matrix::Multiply( mWorld[i], mLocal[i], parentMatrix );
277 else //Component has no parent or doesn't inherit transform
279 anchorPosition = ( half - mTxComponentStatic[i].mAnchorPoint ) * mSize[i] * mTxComponentAnimatable[i].mScale;
280 anchorPosition *= mTxComponentAnimatable[i].mOrientation;
281 localPosition = mTxComponentAnimatable[i].mPosition + anchorPosition;
282 mWorld[i].SetTransformComponents( mTxComponentAnimatable[i].mScale, mTxComponentAnimatable[i].mOrientation, localPosition );
285 //Update the bounding sphere
286 Vec3 centerToEdge = { mSize[i].Length() * 0.5f, 0.0f, 0.0f };
287 Vec3 centerToEdgeWorldSpace;
288 TransformVector3( centerToEdgeWorldSpace, mWorld[i].AsFloat(), centerToEdge );
290 mBoundingSpheres[i] = mWorld[i].GetTranslation();
291 mBoundingSpheres[i].w = Length( centerToEdgeWorldSpace );
295 void TransformManager::SwapComponents( unsigned int i, unsigned int j )
297 std::swap( mTxComponentAnimatable[i], mTxComponentAnimatable[j] );
298 std::swap( mTxComponentStatic[i], mTxComponentStatic[j] );
299 std::swap( mInheritanceMode[i], mInheritanceMode[j] );
300 std::swap( mSize[i], mSize[j] );
301 std::swap( mParent[i], mParent[j] );
302 std::swap( mComponentId[i], mComponentId[j] );
303 std::swap( mTxComponentAnimatableBaseValue[i], mTxComponentAnimatableBaseValue[j] );
304 std::swap( mSizeBase[i], mSizeBase[j] );
305 std::swap( mLocal[i], mLocal[j] );
306 std::swap( mComponentDirty[i], mComponentDirty[j] );
307 std::swap( mBoundingSpheres[i], mBoundingSpheres[j] );
309 mIds[ mComponentId[i] ] = i;
310 mIds[ mComponentId[j] ] = j;
313 void TransformManager::ReorderComponents()
315 mOrderedComponents.Resize(mComponentCount);
317 TransformId parentId;
318 for( size_t i(0); i<mComponentCount; ++i )
320 mOrderedComponents[i].id = mComponentId[i];
321 mOrderedComponents[i].level = 0u;
323 parentId = mParent[i];
324 while( parentId != INVALID_TRANSFORM_ID )
326 mOrderedComponents[i].level++;
327 parentId = mParent[ mIds[parentId] ];
331 std::sort( mOrderedComponents.Begin(), mOrderedComponents.End());
332 for( size_t i(0); i<mComponentCount-1; ++i )
334 SwapComponents( mIds[mOrderedComponents[i].id], i);
338 Vector3& TransformManager::GetVector3PropertyValue( TransformId id, TransformManagerProperty property )
342 case TRANSFORM_PROPERTY_POSITION:
344 unsigned int index( mIds[id] );
345 mComponentDirty[ index ] = true;
346 return mTxComponentAnimatable[ index ].mPosition;
348 case TRANSFORM_PROPERTY_SCALE:
350 unsigned int index( mIds[id] );
351 mComponentDirty[ index ] = true;
352 return mTxComponentAnimatable[ index ].mScale;
354 case TRANSFORM_PROPERTY_PARENT_ORIGIN:
356 unsigned int index( mIds[id] );
357 mComponentDirty[ index ] = true;
358 return mTxComponentStatic[ index ].mParentOrigin;
360 case TRANSFORM_PROPERTY_ANCHOR_POINT:
362 unsigned int index( mIds[id] );
363 mComponentDirty[ index ] = true;
364 return mTxComponentStatic[ index ].mAnchorPoint;
366 case TRANSFORM_PROPERTY_SIZE:
368 unsigned int index( mIds[id] );
369 mComponentDirty[ index ] = true;
370 return mSize[ index ];
374 DALI_ASSERT_ALWAYS(false);
375 return mTxComponentAnimatable[ mIds[id] ].mPosition;
380 const Vector3& TransformManager::GetVector3PropertyValue( TransformId id, TransformManagerProperty property ) const
384 case TRANSFORM_PROPERTY_POSITION:
386 return mTxComponentAnimatable[ mIds[id] ].mPosition;
388 case TRANSFORM_PROPERTY_SCALE:
390 return mTxComponentAnimatable[ mIds[id] ].mScale;
392 case TRANSFORM_PROPERTY_PARENT_ORIGIN:
394 return mTxComponentStatic[ mIds[id] ].mParentOrigin;
396 case TRANSFORM_PROPERTY_ANCHOR_POINT:
398 return mTxComponentStatic[ mIds[id] ].mAnchorPoint;
400 case TRANSFORM_PROPERTY_SIZE:
402 return mSize[ mIds[id] ];
406 DALI_ASSERT_ALWAYS(false);
407 return mTxComponentAnimatable[ mIds[id] ].mPosition;
412 const float& TransformManager::GetVector3PropertyComponentValue(TransformId id, TransformManagerProperty property, unsigned int component ) const
416 case TRANSFORM_PROPERTY_POSITION:
418 return mTxComponentAnimatable[ mIds[id] ].mPosition[component];
420 case TRANSFORM_PROPERTY_SCALE:
422 return mTxComponentAnimatable[ mIds[id] ].mScale[component];
424 case TRANSFORM_PROPERTY_PARENT_ORIGIN:
426 return mTxComponentStatic[ mIds[id] ].mParentOrigin[component];
428 case TRANSFORM_PROPERTY_ANCHOR_POINT:
430 return mTxComponentStatic[ mIds[id] ].mAnchorPoint[component];
432 case TRANSFORM_PROPERTY_SIZE:
434 return mSize[ mIds[id] ][component];
438 DALI_ASSERT_ALWAYS(false);
439 return mTxComponentAnimatable[ mIds[id] ].mPosition[component];
444 void TransformManager::SetVector3PropertyValue( TransformId id, TransformManagerProperty property, const Vector3& value )
446 unsigned int index( mIds[id] );
447 mComponentDirty[ index ] = true;
451 case TRANSFORM_PROPERTY_POSITION:
453 mTxComponentAnimatable[ index ].mPosition = value;
456 case TRANSFORM_PROPERTY_SCALE:
458 mTxComponentAnimatable[ index ].mScale = value;
461 case TRANSFORM_PROPERTY_PARENT_ORIGIN:
463 mTxComponentStatic[ index ].mParentOrigin = value;
466 case TRANSFORM_PROPERTY_ANCHOR_POINT:
468 mTxComponentStatic[ index ].mAnchorPoint = value;
471 case TRANSFORM_PROPERTY_SIZE:
473 mSize[ index ] = value;
478 DALI_ASSERT_ALWAYS(false);
483 void TransformManager::SetVector3PropertyComponentValue( TransformId id, TransformManagerProperty property, float value, unsigned int component )
485 unsigned int index( mIds[id] );
486 mComponentDirty[ index ] = true;
490 case TRANSFORM_PROPERTY_POSITION:
492 mTxComponentAnimatable[ index ].mPosition[component] = value;
495 case TRANSFORM_PROPERTY_SCALE:
497 mTxComponentAnimatable[ index ].mScale[component] = value;
500 case TRANSFORM_PROPERTY_PARENT_ORIGIN:
502 mTxComponentStatic[ index ].mParentOrigin[component] = value;
505 case TRANSFORM_PROPERTY_ANCHOR_POINT:
507 mTxComponentStatic[ index ].mAnchorPoint[component] = value;
510 case TRANSFORM_PROPERTY_SIZE:
512 mSize[ index ][component] = value;
517 DALI_ASSERT_ALWAYS(false);
522 void TransformManager::BakeVector3PropertyValue( TransformId id, TransformManagerProperty property, const Vector3& value )
524 unsigned int index( mIds[id] );
525 mComponentDirty[ index ] = true;
529 case TRANSFORM_PROPERTY_POSITION:
531 mTxComponentAnimatable[ index ].mPosition = mTxComponentAnimatableBaseValue[index].mPosition = value;
534 case TRANSFORM_PROPERTY_SCALE:
536 mTxComponentAnimatable[ index ].mScale = mTxComponentAnimatableBaseValue[index].mScale = value;
539 case TRANSFORM_PROPERTY_PARENT_ORIGIN:
541 mTxComponentStatic[ index ].mParentOrigin = value;
544 case TRANSFORM_PROPERTY_ANCHOR_POINT:
546 mTxComponentStatic[ index ].mAnchorPoint = value;
549 case TRANSFORM_PROPERTY_SIZE:
551 mSize[ index ] = mSizeBase[index] = value;
556 DALI_ASSERT_ALWAYS(false);
561 void TransformManager::BakeRelativeVector3PropertyValue( TransformId id, TransformManagerProperty property, const Vector3& value )
563 unsigned int index( mIds[id] );
564 mComponentDirty[ index ] = true;
568 case TRANSFORM_PROPERTY_POSITION:
570 mTxComponentAnimatable[ index ].mPosition = mTxComponentAnimatableBaseValue[index].mPosition = mTxComponentAnimatable[ index ].mPosition + value;
573 case TRANSFORM_PROPERTY_SCALE:
575 mTxComponentAnimatable[ index ].mScale = mTxComponentAnimatableBaseValue[index].mScale = mTxComponentAnimatable[ index ].mScale + value;
578 case TRANSFORM_PROPERTY_PARENT_ORIGIN:
580 mTxComponentStatic[ index ].mParentOrigin = mTxComponentStatic[ index ].mParentOrigin + value;
583 case TRANSFORM_PROPERTY_ANCHOR_POINT:
585 mTxComponentStatic[ index ].mAnchorPoint = mTxComponentStatic[ index ].mAnchorPoint + value;
588 case TRANSFORM_PROPERTY_SIZE:
590 mSize[ index ] = mSizeBase[index] = mSize[ index ] + value;
595 DALI_ASSERT_ALWAYS(false);
600 void TransformManager::BakeMultiplyVector3PropertyValue( TransformId id, TransformManagerProperty property, const Vector3& value )
602 unsigned int index( mIds[id] );
603 mComponentDirty[ index ] = true;
607 case TRANSFORM_PROPERTY_POSITION:
609 mTxComponentAnimatable[ index ].mPosition = mTxComponentAnimatableBaseValue[index].mPosition = mTxComponentAnimatable[ index ].mPosition * value;
612 case TRANSFORM_PROPERTY_SCALE:
614 mTxComponentAnimatable[ index ].mScale = mTxComponentAnimatableBaseValue[index].mScale = mTxComponentAnimatable[ index ].mScale * value;
617 case TRANSFORM_PROPERTY_PARENT_ORIGIN:
619 mTxComponentStatic[ index ].mParentOrigin = mTxComponentStatic[ index ].mParentOrigin * value;
622 case TRANSFORM_PROPERTY_ANCHOR_POINT:
624 mTxComponentStatic[ index ].mAnchorPoint = mTxComponentStatic[ index ].mAnchorPoint * value;
627 case TRANSFORM_PROPERTY_SIZE:
629 mSize[ index ] = mSizeBase[index] = mSize[ index ] * value;
634 DALI_ASSERT_ALWAYS(false);
639 void TransformManager::BakeVector3PropertyComponentValue( TransformId id, TransformManagerProperty property, float value, unsigned int component )
641 unsigned int index( mIds[id] );
642 mComponentDirty[ index ] = true;
646 case TRANSFORM_PROPERTY_POSITION:
648 mTxComponentAnimatable[ index ].mPosition[component] = mTxComponentAnimatableBaseValue[index].mPosition[component] = value;
651 case TRANSFORM_PROPERTY_SCALE:
653 mTxComponentAnimatable[ index ].mScale[component] = mTxComponentAnimatableBaseValue[index].mScale[component] = value;
656 case TRANSFORM_PROPERTY_PARENT_ORIGIN:
658 mTxComponentStatic[ index ].mParentOrigin[component] = value;
661 case TRANSFORM_PROPERTY_ANCHOR_POINT:
663 mTxComponentStatic[ index ].mAnchorPoint[component] = value;
666 case TRANSFORM_PROPERTY_SIZE:
668 mSize[ index ][component] = mSizeBase[index][component] = value;
673 DALI_ASSERT_ALWAYS(false);
678 void TransformManager::BakeXVector3PropertyValue( TransformId id, TransformManagerProperty property, float value )
680 unsigned int index( mIds[id] );
681 mComponentDirty[ index ] = true;
685 case TRANSFORM_PROPERTY_POSITION:
687 mTxComponentAnimatable[ index ].mPosition.x = mTxComponentAnimatableBaseValue[index].mPosition.x = value;
690 case TRANSFORM_PROPERTY_SCALE:
692 mTxComponentAnimatable[ index ].mScale.x = mTxComponentAnimatableBaseValue[index].mScale.x = value;
695 case TRANSFORM_PROPERTY_PARENT_ORIGIN:
697 mTxComponentStatic[ index ].mParentOrigin.x = value;
700 case TRANSFORM_PROPERTY_ANCHOR_POINT:
702 mTxComponentStatic[ index ].mAnchorPoint.x = value;
705 case TRANSFORM_PROPERTY_SIZE:
707 mSize[ index ].x = mSizeBase[index].x = value;
712 DALI_ASSERT_ALWAYS(false);
717 void TransformManager::BakeYVector3PropertyValue( TransformId id, TransformManagerProperty property, float value )
719 unsigned int index( mIds[id] );
720 mComponentDirty[ index ] = true;
724 case TRANSFORM_PROPERTY_POSITION:
726 mTxComponentAnimatable[ index ].mPosition.y = mTxComponentAnimatableBaseValue[index].mPosition.y = value;
729 case TRANSFORM_PROPERTY_SCALE:
731 mTxComponentAnimatable[ index ].mScale.y = mTxComponentAnimatableBaseValue[index].mScale.y = value;
734 case TRANSFORM_PROPERTY_PARENT_ORIGIN:
736 mTxComponentStatic[ index ].mParentOrigin.y = value;
739 case TRANSFORM_PROPERTY_ANCHOR_POINT:
741 mTxComponentStatic[ index ].mAnchorPoint.y = value;
744 case TRANSFORM_PROPERTY_SIZE:
746 mSize[ index ].y = mSizeBase[index].y = value;
751 DALI_ASSERT_ALWAYS(false);
756 void TransformManager::BakeZVector3PropertyValue( TransformId id, TransformManagerProperty property, float value )
758 unsigned int index( mIds[id] );
759 mComponentDirty[ index ] = true;
763 case TRANSFORM_PROPERTY_POSITION:
765 mTxComponentAnimatable[ index ].mPosition.z = mTxComponentAnimatableBaseValue[index].mPosition.z = value;
768 case TRANSFORM_PROPERTY_SCALE:
770 mTxComponentAnimatable[ index ].mScale.z = mTxComponentAnimatableBaseValue[index].mScale.z = value;
773 case TRANSFORM_PROPERTY_PARENT_ORIGIN:
775 mTxComponentStatic[ index ].mParentOrigin.z = value;
778 case TRANSFORM_PROPERTY_ANCHOR_POINT:
780 mTxComponentStatic[ index ].mAnchorPoint.z = value;
783 case TRANSFORM_PROPERTY_SIZE:
785 mSize[ index ].z = mSizeBase[index].z = value;
790 DALI_ASSERT_ALWAYS(false);
795 Quaternion& TransformManager::GetQuaternionPropertyValue( TransformId id )
797 unsigned int index( mIds[id] );
798 mComponentDirty[ index ] = true;
799 return mTxComponentAnimatable[ index ].mOrientation;
802 const Quaternion& TransformManager::GetQuaternionPropertyValue( TransformId id ) const
804 return mTxComponentAnimatable[ mIds[id] ].mOrientation;
807 void TransformManager::SetQuaternionPropertyValue( TransformId id, const Quaternion& q )
809 unsigned int index( mIds[id] );
810 mTxComponentAnimatable[ index ].mOrientation = q;
811 mComponentDirty[ index ] = true;
814 void TransformManager::BakeQuaternionPropertyValue( TransformId id, const Quaternion& q )
816 unsigned int index( mIds[id] );
817 mTxComponentAnimatable[ index ].mOrientation = mTxComponentAnimatableBaseValue[index].mOrientation = q;
818 mComponentDirty[ index ] = true;
821 void TransformManager::BakeRelativeQuaternionPropertyValue( TransformId id, const Quaternion& q )
823 unsigned int index( mIds[id] );
824 mTxComponentAnimatable[ index ].mOrientation = mTxComponentAnimatableBaseValue[index].mOrientation = mTxComponentAnimatable[ index ].mOrientation * q;
825 mComponentDirty[ index ] = true;
828 const Vector4& TransformManager::GetBoundingSphere( TransformId id ) const
830 return mBoundingSpheres[ mIds[id] ];
833 void TransformManager::GetWorldMatrixAndSize( TransformId id, Matrix& worldMatrix, Vector3& size ) const
835 unsigned int index = mIds[id];
836 worldMatrix = mWorld[index];
840 } //namespace SceneGraph
841 } //namespace Internal