/*
- * 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.
#include <dali/public-api/common/constants.h>
#include <dali/public-api/common/dali-common.h>
+#include <dali/internal/update/common/resetter-manager.h> ///< For AddInitializeResetter
+
namespace
{
// Memory pool used to allocate new nodes. Memory used by this pool will be released when process dies
// or DALI library is unloaded
-Dali::Internal::MemoryPoolObjectAllocator<Dali::Internal::SceneGraph::Node> gNodeMemoryPool;
+Dali::Internal::MemoryPoolObjectAllocator<Dali::Internal::SceneGraph::Node>& GetNodeMemoryPool()
+{
+ static Dali::Internal::MemoryPoolObjectAllocator<Dali::Internal::SceneGraph::Node> gNodeMemoryPool;
+ return gNodeMemoryPool;
+}
#ifdef DEBUG_ENABLED
// keep track of nodes alive, to ensure we have 0 when the process exits or DALi library is unloaded
int32_t gNodeCount = 0;
Node* Node::New()
{
- return new(gNodeMemoryPool.AllocateRawThreadSafe()) Node;
+ return new(GetNodeMemoryPool().AllocateRawThreadSafe()) Node;
}
void Node::Delete(Node* node)
node->~Node();
// Mark the memory it used as free in the memory pool
- gNodeMemoryPool.FreeThreadSafe(node);
+ GetNodeMemoryPool().FreeThreadSafe(node);
}
else
{
}
Node::Node()
-: mOrientation(), // Initialized to identity by default
+: mTransformManagerData(), // Initialized to use invalid id by default
+ mOrientation(), // Initialized to identity by default
mWorldPosition(TRANSFORM_PROPERTY_WORLD_POSITION, Vector3(0.0f, 0.0f, 0.0f)), // Zero initialized by default
mWorldScale(TRANSFORM_PROPERTY_WORLD_SCALE, Vector3(1.0f, 1.0f, 1.0f)),
mWorldOrientation(), // Initialized to identity by default
mIsLayer(false),
mIsCamera(false),
mPositionUsesAnchorPoint(true),
- mTransparent(false)
+ mTransparent(false),
+ mUpdateAreaChanged(false),
+ mUseTextureUpdateArea(false)
{
#ifdef DEBUG_ENABLED
gNodeCount++;
return mIsConnectedToSceneGraph;
}
+void Node::AddInitializeResetter(ResetterManager& manager) const
+{
+ manager.AddNodeResetter(*this);
+}
+
void Node::ConnectChild(Node* childNode)
{
DALI_ASSERT_ALWAYS(this != childNode);
{
if(mRenderers[i] == renderer)
{
+ renderer->DetachFromNodeDataProvider(*this);
+
SetUpdated(true);
mRenderers.Erase(mRenderers.Begin() + i);
return;
flags |= NodePropertyFlags::COLOR;
}
- // Check whether the update area property has changed
- if(!mUpdateAreaHint.IsClean())
- {
- flags |= NodePropertyFlags::TRANSFORM;
- }
-
return flags;
}
void Node::ResetDirtyFlags(BufferIndex updateBufferIndex)
{
mDirtyFlags = NodePropertyFlags::NOTHING;
-}
-void Node::UpdateUniformHash(BufferIndex bufferIndex)
-{
- uint64_t hash = 0xc70f6907UL;
- for(uint32_t i = 0u, count = mUniformMaps.Count(); i < count; ++i)
- {
- hash = mUniformMaps[i].propertyPtr->Hash(bufferIndex, hash);
- }
- if(mUniformsHash != hash)
- {
- mUniformsHash = hash;
- SetUpdated(true);
- }
+ mUpdateAreaChanged = false;
}
void Node::SetParent(Node& parentNode)
uint32_t Node::GetMemoryPoolCapacity()
{
- return gNodeMemoryPool.GetCapacity();
+ return GetNodeMemoryPool().GetCapacity();
}
} // namespace SceneGraph