- case INHERIT_PARENT_POSITION : ///@see Dali::PositionInheritanceMode for how these modes are expected to work
- {
- Vector3 finalPosition(-0.5f, -0.5f, -0.5f);
-
- finalPosition += mParentOrigin.mValue;
- finalPosition *= mParent->GetSize(updateBufferIndex);
- finalPosition += mPosition[updateBufferIndex];
- finalPosition *= mParent->GetWorldScale(updateBufferIndex);
- const Quaternion& parentWorldRotation = mParent->GetWorldRotation(updateBufferIndex);
- if(!parentWorldRotation.IsIdentity())
- {
- finalPosition *= parentWorldRotation;
- }
-
- // check if a node needs to be offsetted locally (only applies when AnchorPoint is not central)
- // dont use operator== as that does a slower comparison (and involves function calls)
- Vector3 localOffset(0.5f, 0.5f, 0.5f); // AnchorPoint::CENTER
- localOffset -= mAnchorPoint.mValue;
-
- if( ( fabsf( localOffset.x ) >= Math::MACHINE_EPSILON_0 ) ||
- ( fabsf( localOffset.y ) >= Math::MACHINE_EPSILON_0 ) ||
- ( fabsf( localOffset.z ) >= Math::MACHINE_EPSILON_0 ) )
- {
- localOffset *= mSize[updateBufferIndex];
-
- Vector3 scale = mWorldScale[updateBufferIndex];
- if(GetTransmitGeometryScaling())
- {
- // Remove geometry scaling to get back to actor scale
- scale /= mGeometryScale;
- }
- // Also pick up sign of local scale
- if (mScale[updateBufferIndex].x < 0.0f)
- {
- scale.x = -scale.x;
- }
- if (mScale[updateBufferIndex].y < 0.0f)
- {
- scale.y = -scale.y;
- }
- if (mScale[updateBufferIndex].z < 0.0f)
- {
- scale.z = -scale.z;
- }
-
- // If the anchor-point is not central, then position is affected by the local rotation & scale
- localOffset *= scale;
- const Quaternion& localWorldRotation = mWorldRotation[updateBufferIndex];
- if(!localWorldRotation.IsIdentity())
- {
- localOffset *= localWorldRotation;
- }
- finalPosition += localOffset;
- }
-
- finalPosition += mParent->GetWorldPosition(updateBufferIndex);
- mWorldPosition.Set( updateBufferIndex, finalPosition );
- break;
- }
- case USE_PARENT_POSITION_PLUS_LOCAL_POSITION :
- {
- // copy parents position plus local transform
- mWorldPosition.Set( updateBufferIndex, mParent->GetWorldPosition(updateBufferIndex) + mPosition[updateBufferIndex] );
- break;
- }
- case USE_PARENT_POSITION :
- {
- // copy parents position
- mWorldPosition.Set( updateBufferIndex, mParent->GetWorldPosition(updateBufferIndex) );
- break;
- }
- case DONT_INHERIT_POSITION :
- {
- // use local position as world position
- mWorldPosition.Set( updateBufferIndex, mPosition[updateBufferIndex] );
- break;
- }