/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
if(mScene)
{
BufferIndex bufferIndex = GetEventThreadServices().GetEventBufferIndex();
- return CalculateActorScreenPosition(*this, bufferIndex);
+ if(mLayer3DParentsCount == 0)
+ {
+ // We can assume that this actor is under 2d layer. Use faster, but imprecise algorithm
+ return CalculateActorScreenPosition(*this, bufferIndex);
+ }
+ else
+ {
+ return CalculateActorScreenPositionRenderTaskList(*this, bufferIndex);
+ }
}
return Vector2::ZERO;
}
mName(),
mSortedDepth(0u),
mDepth(0u),
+ mLayer3DParentsCount(0),
mIsRoot(ROOT_LAYER == derivedType),
mIsLayer(LAYER == derivedType || ROOT_LAYER == derivedType),
mIsOnScene(false),
mParentImpl.UnparentChildren();
}
-void Actor::ConnectToScene(uint32_t parentDepth, bool notify)
+void Actor::ConnectToScene(uint32_t parentDepth, uint32_t layer3DParentsCount, bool notify)
{
// This container is used instead of walking the Actor hierarchy.
// It protects us when the Actor hierarchy is modified during OnSceneConnectionExternal callbacks.
}
// This stage is not interrupted by user callbacks.
- mParentImpl.RecursiveConnectToScene(connectionList, parentDepth + 1);
+ mParentImpl.RecursiveConnectToScene(connectionList, layer3DParentsCount, parentDepth + 1);
// Notify applications about the newly connected actors.
for(const auto& actor : connectionList)
Actor* parentActor = static_cast<Actor*>(parent);
mScene = parentActor->mScene;
- if(EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction
+ if(!EventThreadServices::IsShuttingDown() && // Don't emit signals or send messages during Core destruction
parentActor->OnScene())
{
// Instruct each actor to create a corresponding node in the scene graph
- ConnectToScene(parentActor->GetHierarchyDepth(), notify);
+ ConnectToScene(parentActor->GetHierarchyDepth(), parentActor->GetLayer3DParentCount(), notify);
}
// Resolve the name and index for the child properties if any
mParent = nullptr;
- if(EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction
+ if(!EventThreadServices::IsShuttingDown() && // Don't emit signals or send messages during Core destruction
OnScene())
{
// Disconnect the Node & its children from the scene-graph.
Rect<> Actor::CalculateScreenExtents() const
{
- auto screenPosition = GetCurrentScreenPosition();
- BufferIndex bufferIndex = GetEventThreadServices().GetEventBufferIndex();
- return CalculateActorScreenExtents(*this, screenPosition, bufferIndex);
+ if(mLayer3DParentsCount == 0)
+ {
+ // We can assume that this actor is under 2d layer. Use faster, but imprecise algorithm
+ auto screenPosition = GetCurrentScreenPosition();
+ BufferIndex bufferIndex = GetEventThreadServices().GetEventBufferIndex();
+ return CalculateActorScreenExtents(*this, screenPosition, bufferIndex);
+ }
+ else
+ {
+ BufferIndex bufferIndex = GetEventThreadServices().GetEventBufferIndex();
+ return CalculateActorScreenExtentsRenderTaskList(*this, bufferIndex);
+ }
}
Vector3 Actor::GetAnchorPointForPosition() const