public:
FrameCallbackBasic() = default;
- virtual void Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds)
+ virtual bool Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds)
{
mCalled = true;
+ return false;
}
virtual void Reset()
{
}
- virtual void Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) override
+ virtual bool Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) override
{
FrameCallbackBasic::Update(updateProxy, elapsedSeconds);
updateProxy.GetPosition(mActorId, mPositionGetPositionCall);
updateProxy.GetWorldPositionScaleAndSize(mActorId, mWorldPosition, mWorldScale, mSizeGetWorldPositionAndSizeCall);
updateProxy.GetWorldTransformAndSize(mActorId, mWorldTransformPosition, mWorldTransformScale, mWorldTransformOrientation, mSizeGetWorldTransform);
+
+ return false;
}
const unsigned int mActorId;
{
}
- virtual void Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) override
+ virtual bool Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) override
{
Vector3 size;
FrameCallbackBasic::Update(updateProxy, elapsedSeconds);
updateProxy.GetColor(mActorId, mColorAfterSetting);
updateProxy.GetScale(mActorId, mScaleAfterSetting);
updateProxy.GetOrientation(mActorId, mOrientationAfterSetting);
+
+ return false;
}
const unsigned int mActorId;
{
}
- virtual void Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) override
+ virtual bool Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) override
{
Vector3 size;
FrameCallbackBasic::Update(updateProxy, elapsedSeconds);
updateProxy.GetColor(mActorId, mColorAfterSetting);
updateProxy.GetScale(mActorId, mScaleAfterSetting);
updateProxy.GetOrientation(mActorId, mOrientationAfterSetting);
+
+ return false;
}
const unsigned int mActorId;
{
}
- virtual void Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) override
+ virtual bool Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) override
{
FrameCallbackBasic::Update(updateProxy, elapsedSeconds);
for(auto&& i : mActorIds)
mPositions[i] = position;
mSizes[i] = size;
}
+
+ return false;
}
Vector<unsigned int> mActorIds;
{
}
- virtual void Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) override
+ virtual bool Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) override
{
FrameCallbackBasic::Update(updateProxy, elapsedSeconds);
Vector3 vec3;
mSetOrientationCallSuccess = updateProxy.SetOrientation(mActorId, quat);
mBakeOrientationCallSuccess = updateProxy.BakeOrientation(mActorId, quat);
mGetWorldTransformCallSuccess = updateProxy.GetWorldTransformAndSize(mActorId, vec3, vec3, quat, vec3);
+
+ return false;
}
virtual void Reset() override
END_TEST;
}
+
+int UtcDaliFrameCallbackGetExtension(void)
+{
+ FrameCallbackBasic frameCallback;
+ DALI_TEST_CHECK(frameCallback.GetExtension() == nullptr);
+
+ END_TEST;
+}
#define DALI_FRAME_CALLBACK_INTERFACE_H
/*
- * Copyright (c) 2020 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.
class DALI_CORE_API FrameCallbackInterface
{
public:
+ class Extension; ///< Forward declare future extension interface
+
/**
* @brief Called from the update-thread after the scene has been updated, and is ready to render.
* @param[in] updateProxy Use this to get/set required values for the Actor.
* @param[in] elapsedSeconds Time elapsed time since the last frame (in seconds)
+ * @return Whether we should keep rendering.
* @see FrameCallbackInterface
*/
- virtual void Update(UpdateProxy& updateProxy, float elapsedSeconds) = 0;
+ virtual bool Update(UpdateProxy& updateProxy, float elapsedSeconds) = 0;
+
+ /**
+ * @brief Retrieves the extension for the interface.
+ *
+ * @return The extension if available, nullptr otherwise
+ */
+ virtual Extension* GetExtension()
+ {
+ return nullptr;
+ }
protected:
/**
/*
- * 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.
mFrameCallbacks.erase(iter, mFrameCallbacks.end());
}
-void FrameCallbackProcessor::Update(BufferIndex bufferIndex, float elapsedSeconds)
+bool FrameCallbackProcessor::Update(BufferIndex bufferIndex, float elapsedSeconds)
{
+ bool keepRendering = false;
+
if(!mFrameCallbacks.empty())
{
DALI_TRACE_SCOPE(gTraceFilter, "DALI_FRAME_CALLBACK_UPDATE");
// If any of the FrameCallback::Update calls returns false, then they are no longer required & can be removed.
auto iter = std::remove_if(
mFrameCallbacks.begin(), mFrameCallbacks.end(), [&](OwnerPointer<FrameCallback>& frameCallback) {
- return !frameCallback->Update(bufferIndex, elapsedSeconds, mNodeHierarchyChanged);
+ FrameCallback::RequestFlags requests = frameCallback->Update(bufferIndex, elapsedSeconds, mNodeHierarchyChanged);
+ keepRendering |= (requests & FrameCallback::KEEP_RENDERING);
+ return (requests & FrameCallback::CONTINUE_CALLING) == 0;
});
mFrameCallbacks.erase(iter, mFrameCallbacks.end());
}
mNodeHierarchyChanged = false;
+
+ return keepRendering;
}
} // namespace SceneGraph
#define DALI_INTERNAL_SCENE_GRAPH_FRAME_CALLBACK_PROCESSOR_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.
* Called on Update by the UpdateManager.
* @param[in] bufferIndex The bufferIndex to use
* @param[in] elapsedSeconds Time elapsed time since the last frame (in seconds)
+ * @return Whether we should keep rendering.
*/
- void Update(BufferIndex bufferIndex, float elapsedSeconds);
+ bool Update(BufferIndex bufferIndex, float elapsedSeconds);
/**
* Called by the UpdateManager when the node hierarchy changes.
/*
- * 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.
rootNode.AddObserver(*this);
}
-bool FrameCallback::Update(BufferIndex bufferIndex, float elapsedSeconds, bool nodeHierarchyChanged)
+FrameCallback::RequestFlags FrameCallback::Update(BufferIndex bufferIndex, float elapsedSeconds, bool nodeHierarchyChanged)
{
bool continueCalling = false;
+ bool keepRendering = false;
+
if(mUpdateProxy)
{
mUpdateProxy->SetCurrentBufferIndex(bufferIndex);
if(mFrameCallbackInterface && mValid)
{
Dali::UpdateProxy updateProxy(*mUpdateProxy);
- mFrameCallbackInterface->Update(updateProxy, elapsedSeconds);
+ keepRendering = mFrameCallbackInterface->Update(updateProxy, elapsedSeconds);
continueCalling = true;
}
}
- return continueCalling;
+
+ return static_cast<FrameCallback::RequestFlags>(continueCalling | (keepRendering << 1));
}
void FrameCallback::Invalidate()
#define DALI_INTERNAL_SCENE_GRAPH_FRAME_CALLBACK_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.
{
public:
/**
+ * A set of bit mask options that, when combined, define the requests from this FrameCallback
+ * after being called from the update-thread.
+ */
+ enum RequestFlags
+ {
+ CONTINUE_CALLING = 1 << 0, ///< True if we request to continue calling this FrameCallback.
+ KEEP_RENDERING = 1 << 1 ///< True if we request to keep rendering
+ };
+
+ /**
* Creates a new FrameCallback.
* @param[in] frameCallbackInterface A reference to the FrameCallbackInterface implementation
* @return A new FrameCallback.
* @param[in] bufferIndex The bufferIndex to use
* @param[in] elapsedSeconds Time elapsed time since the last frame (in seconds)
* @param[in] nodeHierarchyChanged Whether the node hierarchy has changed
- * @return Whether to continue calling this FrameCallback or not.
+ * @return The requests from this FrameCallback.
*/
- bool Update(BufferIndex bufferIndex, float elapsedSeconds, bool nodeHierarchyChanged);
+ RequestFlags Update(BufferIndex bufferIndex, float elapsedSeconds, bool nodeHierarchyChanged);
/**
* Invalidates this FrameCallback and will no longer be associated with the FrameCallbackInterface.
// Call the frame-callback-processor if set
if(mImpl->frameCallbackProcessor)
{
- mImpl->frameCallbackProcessor->Update(bufferIndex, elapsedSeconds);
+ keepRendererRendering |= mImpl->frameCallbackProcessor->Update(bufferIndex, elapsedSeconds);
}
// Update node hierarchy, apply constraints,