#define DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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/vector-wrapper.h>
#include <dali/public-api/common/dali-common.h>
+#include <dali/devel-api/common/stage-devel.h>
+
#include <dali/internal/common/message.h>
#include <dali/internal/common/type-abstraction-enums.h>
#include <dali/internal/common/shader-saver.h>
#include <dali/internal/event/common/event-thread-services.h>
#include <dali/internal/update/animation/scene-graph-animation.h>
+#include <dali/internal/update/common/property-resetter.h>
#include <dali/internal/update/common/scene-graph-buffers.h>
#include <dali/internal/update/common/scene-graph-property-notification.h>
#include <dali/internal/update/nodes/node.h>
namespace Dali
{
+class FrameCallbackInterface;
+
namespace Integration
{
class GlSyncAbstraction;
struct NodeDepths
{
- NodeDepths( int reserveSize )
+ NodeDepths()
{
- nodeDepths.reserve(reserveSize);
}
void Add( SceneGraph::Node* node, uint32_t sortedDepth )
/**
* Construct a new UpdateManager.
* @param[in] notificationManager This should be notified when animations have finished.
- * @param[in] animationFinishedNotifier The CompleteNotificationInterface that handles animation completions
+ * @param[in] animationPlaylist The CompleteNotificationInterface that handles the animations
* @param[in] propertyNotifier The PropertyNotifier
* @param[in] discardQueue Nodes are added here when disconnected from the scene-graph.
* @param[in] controller After messages are flushed, we request a render from the RenderController.
* @param[in] renderTaskProcessor Handles RenderTasks and RenderInstrucitons.
*/
UpdateManager( NotificationManager& notificationManager,
- CompleteNotificationInterface& animationFinishedNotifier,
+ CompleteNotificationInterface& animationPlaylist,
PropertyNotifier& propertyNotifier,
DiscardQueue& discardQueue,
Integration::RenderController& controller,
/**
* Add a camera on scene
- * @param[in] camera to add
+ * @param[in] camera The camera to add
*/
void AddCamera( OwnerPointer< Camera >& camera );
*/
bool IsAnimationRunning() const;
+ /**
+ * Add a property resetter. UpdateManager takes ownership of the object.
+ * It will be killed by UpdateManager when the associated animator or
+ * constraint has finished; or the property owner of the property is destroyed.
+ */
+ void AddPropertyResetter( OwnerPointer<PropertyResetterBase>& propertyResetter );
+
// Property Notification
/**
* @param[in] elapsedSeconds The elapsed time that should be applied to animations.
* @param[in] lastVSyncTimeMilliseconds The last time, in milliseconds, that we had a VSync.
* @param[in] nextVSyncTimeMilliseconds The estimated time, in milliseconds, of the next VSync.
+ * @param[in] renderToFboEnabled Whether rendering into the Frame Buffer Object is enabled.
+ * @param[in] isRenderingToFbo Whether this frame is being rendered into the Frame Buffer Object.
* @return True if further updates are required e.g. during animations.
*/
- unsigned int Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds );
+ unsigned int Update( float elapsedSeconds,
+ unsigned int lastVSyncTimeMilliseconds,
+ unsigned int nextVSyncTimeMilliseconds,
+ bool renderToFboEnabled,
+ bool isRenderingToFbo );
/**
* Set the background color i.e. the glClear color used at the beginning of each frame.
void KeepRendering( float durationSeconds );
/**
+ * @copydoc Dali::DevelStage::SetRenderingBehavior()
+ */
+ void SetRenderingBehavior( DevelStage::Rendering renderingBehavior );
+
+ /**
* Sets the depths of all layers.
* @param layers The layers in depth order.
* @param[in] systemLevel True if using the system-level overlay.
*/
void SetDepthIndices( OwnerPointer< NodeDepths >& nodeDepths );
+ /**
+ * Query wheter the default surface rect is changed or not.
+ * @return true if the default surface rect is changed.
+ */
+ bool IsDefaultSurfaceRectChanged();
+
+ /**
+ * Adds an implementation of the FrameCallbackInterface.
+ * @param[in] frameCallback A pointer to the implementation of the FrameCallbackInterface
+ * @param[in] rootNode A pointer to the root node to apply the FrameCallback to
+ */
+ void AddFrameCallback( FrameCallbackInterface* frameCallback, const Node* rootNode );
+
+ /**
+ * Removes the specified implementation of FrameCallbackInterface.
+ * @param[in] frameCallback A pointer to the implementation of the FrameCallbackInterface to remove.
+ */
+ void RemoveFrameCallback( FrameCallbackInterface* frameCallback );
+
private:
// Undefined
new (slot) LocalType( &manager, &UpdateManager::KeepRendering, durationSeconds );
}
+inline void SetRenderingBehaviorMessage( UpdateManager& manager, DevelStage::Rendering renderingBehavior )
+{
+ typedef MessageValue1< UpdateManager, DevelStage::Rendering > LocalType;
+
+ // Reserve some memory inside the message queue
+ unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new (slot) LocalType( &manager, &UpdateManager::SetRenderingBehavior, renderingBehavior );
+}
+
/**
* Create a message for setting the depth of a layer
* @param[in] manager The update manager
new (slot) LocalType( &manager, &UpdateManager::SetDepthIndices, nodeDepths );
}
+inline void AddResetterMessage( UpdateManager& manager, OwnerPointer<PropertyResetterBase> resetter )
+{
+ typedef MessageValue1< UpdateManager, OwnerPointer<PropertyResetterBase> > LocalType;
+
+ // Reserve some memory inside the message queue
+ unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new (slot) LocalType( &manager, &UpdateManager::AddPropertyResetter, resetter );
+}
+
+inline void AddFrameCallbackMessage( UpdateManager& manager, FrameCallbackInterface& frameCallback, const Node& rootNode )
+{
+ typedef MessageValue2< UpdateManager, FrameCallbackInterface*, const Node* > LocalType;
+
+ // Reserve some memory inside the message queue
+ unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new (slot) LocalType( &manager, &UpdateManager::AddFrameCallback, &frameCallback, &rootNode );
+}
+
+inline void RemoveFrameCallbackMessage( UpdateManager& manager, FrameCallbackInterface& frameCallback )
+{
+ typedef MessageValue1< UpdateManager, FrameCallbackInterface* > LocalType;
+
+ // Reserve some memory inside the message queue
+ unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new (slot) LocalType( &manager, &UpdateManager::RemoveFrameCallback, &frameCallback );
+}
+
} // namespace SceneGraph
} // namespace Internal