#define DALI_INTERNAL_SCENE_GRAPH_CONSTRAINT_BASE_H
/*
- * Copyright (c) 2021 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.
bool mFirstApply : 1;
bool mDisconnected : 1;
+ PropertyOwnerContainer mObservedOwners; ///< A set of pointers to each observed object. Not owned.
+
private:
- PropertyOwnerContainer mObservedOwners; ///< A set of pointers to each observed object. Not owned.
- LifecycleObserver* mLifecycleObserver; ///< Resetter observers this object
+ LifecycleObserver* mLifecycleObserver; ///< Resetter observers this object
#ifdef DEBUG_ENABLED
static uint32_t mCurrentInstanceCount; ///< The current number of Constraint instances in existence.
#define DALI_INTERNAL_SCENE_GRAPH_CONSTRAINT_H
/*
- * Copyright (c) 2021 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(mFunc->InputsInitialized())
{
PropertyType current = mTargetProperty.Get(updateBufferIndex);
+ PropertyType old = mTargetProperty.Get(!updateBufferIndex);
+
mFunc->Apply(updateBufferIndex, current);
+ // Compare with value of the previous frame
+ if constexpr(std::is_same_v<PropertyType, float>)
+ {
+ if(!Equals(old, current))
+ {
+ if(!mObservedOwners.Empty())
+ {
+ // The first observer is the target of the constraint
+ mObservedOwners[0]->SetUpdated(true);
+ }
+ }
+ }
+ else
+ {
+ if(old != current)
+ {
+ if(!mObservedOwners.Empty())
+ {
+ // The first observer is the target of the constraint
+ mObservedOwners[0]->SetUpdated(true);
+ }
+ }
+ }
+
// Optionally bake the final value
if(Dali::Constraint::BAKE == mRemoveAction)
{
void Initialize()
{
mPropertyOwner->AddObserver(*this);
+ mPropertyOwner->SetUpdated(true);
}
/**
Lifetime lifetime)
: PropertyResetterBase(propertyOwner, baseProperty)
{
- mRunning = lifetime == Lifetime::BAKE ? ACTIVE : AGING;
+ mRunning = lifetime == Lifetime::BAKE ? AGING : ACTIVE;
}
/**
mRunning--;
mBaseProperty->ResetToBaseValue(updateBufferIndex);
- // @todo Consider adding mPropertyOwner->SetUpdated(true) here.
+ if(mRunning > 0)
+ {
+ mPropertyOwner->SetUpdated(true);
+ }
}
}
};
/*
- * 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.
UpdateNodeOpacity(node, nodeDirtyFlags, updateBufferIndex);
- node.UpdateUniformHash(updateBufferIndex);
-
// For partial update, mark all children of an animating node as updated.
if(updated) // Only set to updated if parent was updated.
{
renderer->ResetDirtyFlag();
}
+ for(auto&& shader : mImpl->shaders)
+ {
+ shader->SetUpdated(false);
+ }
+
for(auto&& scene : mImpl->scenes)
{
scene->root->SetUpdatedTree(false);
mUpdateAreaChanged = false;
}
-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);
- }
-}
-
void Node::SetParent(Node& parentNode)
{
DALI_ASSERT_ALWAYS(this != &parentNode);
*/
void ResetDirtyFlags(BufferIndex updateBufferIndex);
- /**
- * Update uniform hash
- * @param[in] bufferIndex The buffer to read from.
- */
- void UpdateUniformHash(BufferIndex bufferIndex);
-
protected:
/**
* Set the parent of a Node.
InheritedColor mWorldColor; ///< Full inherited color
Vector4 mUpdateAreaHint; ///< Update area hint is provided for damaged area calculation. (x, y, width, height)
- uint64_t mUniformsHash{0u}; ///< Hash of uniform map property values
uint32_t mClippingSortModifier; ///< Contains bit-packed clipping information for quick access when sorting
const uint32_t mId; ///< The Unique ID of the node.
mRegenerateUniformMap = false;
SetUpdated(true);
}
-
- uint64_t hash = 0xc70f6907UL;
- const SceneGraph::UniformMapDataProvider& uniformMapDataProvider = GetUniformMapDataProvider();
- const SceneGraph::CollectedUniformMap& collectedUniformMap = uniformMapDataProvider.GetCollectedUniformMap();
- for(uint32_t i = 0u, count = collectedUniformMap.Count(); i < count; ++i)
- {
- hash = collectedUniformMap.mUniformMap[i].propertyPtr->Hash(updateBufferIndex, hash);
- }
- if(mUniformsHash != hash)
- {
- mUniformsHash = hash;
- SetUpdated(true);
- }
}
void Renderer::SetDrawCommands(Dali::DevelRenderer::DrawCommand* pDrawCommands, uint32_t size)
return mCollectedUniformMap;
}
+bool Renderer::IsUpdated() const
+{
+ if(Updated() || (mShader && mShader->Updated()))
+ {
+ return true;
+ }
+ return false;
+}
+
Vector4 Renderer::GetVisualTransformedUpdateArea(BufferIndex updateBufferIndex, const Vector4& originalUpdateArea) noexcept
{
if(mVisualProperties)
/**
* @copydoc RenderDataProvider::IsUpdated()
*/
- bool IsUpdated() const override
- {
- return Updated();
- }
+ bool IsUpdated() const override;
/**
* @copydoc RenderDataProvider::GetVisualTransformedUpdateArea()
Dali::Internal::Render::Renderer::StencilParameters mStencilParameters; ///< Struct containing all stencil related options
- uint64_t mUniformsHash{0}; ///< Hash of uniform map property values
uint32_t mIndexedDrawFirstElement; ///< first element index to be drawn using indexed draw
uint32_t mIndexedDrawElementsCount; ///< number of elements to be drawn using indexed draw
uint32_t mBlendBitmask; ///< The bitmask of blending options