1 #ifndef DALI_INTERNAL_SCENE_GRAPH_FRAME_CALLBACK_PROCESSOR_H
2 #define DALI_INTERNAL_SCENE_GRAPH_FRAME_CALLBACK_PROCESSOR_H
5 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/common/vector-wrapper.h>
23 #include <dali/internal/common/buffer-index.h>
24 #include <dali/internal/update/common/property-owner.h>
29 class FrameCallbackInterface;
40 class TransformManager;
43 * This class processes all the registered frame-callbacks.
45 class FrameCallbackProcessor : public PropertyOwner::Observer
50 * Construct a new FrameCallbackProcessor.
52 FrameCallbackProcessor( TransformManager& transformManager, Node& rootNode );
55 * Non-virtual Destructor.
57 ~FrameCallbackProcessor();
59 // Movable but not copyable
61 FrameCallbackProcessor( const FrameCallbackProcessor& ) = delete; ///< Deleted copy constructor.
62 FrameCallbackProcessor( FrameCallbackProcessor&& ) = default; ///< Default move constructor.
63 FrameCallbackProcessor& operator=( const FrameCallbackProcessor& ) = delete; ///< Deleted copy assignment operator.
64 FrameCallbackProcessor& operator=( FrameCallbackProcessor&& ) = default; ///< Default move assignment operator.
67 * Adds an implementation of the FrameCallbackInterface.
68 * @param[in] frameCallback A pointer to the implementation of the FrameCallbackInterface
69 * @param[in] rootNode A pointer to the root node to apply the FrameCallback to
71 void AddFrameCallback( FrameCallbackInterface* frameCallback, const Node* rootNode );
74 * Removes the specified implementation of FrameCallbackInterface.
75 * @param[in] frameCallback A pointer to the implementation of the FrameCallbackInterface to remove.
77 void RemoveFrameCallback( FrameCallbackInterface* frameCallback );
80 * Called on Update by the UpdateManager.
81 * @param[in] bufferIndex The bufferIndex to use
82 * @param[in] elapsedSeconds Time elapsed time since the last frame (in seconds)
84 void Update( BufferIndex bufferIndex, float elapsedSeconds );
87 * Called by the UpdateManager when the node hierarchy changes.
89 void NodeHierarchyChanged()
91 mNodeHierarchyChanged = true;
96 // From PropertyOwner::Observer
99 * @copydoc PropertyOwner::Observer::PropertyOwnerConnected()
101 virtual void PropertyOwnerConnected( PropertyOwner& owner ) { /* Nothing to do */ }
104 * @copydoc PropertyOwner::Observer::PropertyOwnerDisconnected()
106 virtual void PropertyOwnerDisconnected( BufferIndex updateBufferIndex, PropertyOwner& owner ) { /* Nothing to do */ }
109 * @copydoc PropertyOwner::Observer::PropertyOwnerDisconnected()
111 * Will use this to disconnect the frame-callback if the accompanying node is destroyed
113 virtual void PropertyOwnerDestroyed( PropertyOwner& owner );
117 struct FrameCallbackInfo
119 FrameCallbackInterface* frameCallback;
120 UpdateProxy* updateProxyImpl;
123 std::vector< FrameCallbackInfo > mFrameCallbacks;
125 TransformManager& mTransformManager;
128 bool mNodeHierarchyChanged;
131 } // namespace SceneGraph
133 } // namespace Internal
137 #endif // DALI_INTERNAL_SCENE_GRAPH_FRAME_CALLBACK_PROCESSOR_H