DALI_TEST_CHECK( frameBuffer );
frameBuffer.AttachColorTexture( texture, 0u, 1u );
+ Geometry geometry = CreateQuadGeometry();
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
+
application.SendNotification();
application.Render(16);
texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
- PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat );
- DALI_TEST_EQUALS( (bool)propertyBuffer, true, TEST_LOCATION );
+ {
+ PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat );
+ DALI_TEST_EQUALS( (bool)propertyBuffer, true, TEST_LOCATION );
- const float halfQuadSize = .5f;
- struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; };
- TexturedQuadVertex texturedQuadVertexData[4] = {
- { Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f) },
- { Vector2( halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f) },
- { Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f) },
- { Vector2( halfQuadSize, halfQuadSize), Vector2(1.f, 1.f) } };
+ const float halfQuadSize = .5f;
+ struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; };
+ TexturedQuadVertex texturedQuadVertexData[4] = {
+ { Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f) },
+ { Vector2( halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f) },
+ { Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f) },
+ { Vector2( halfQuadSize, halfQuadSize), Vector2(1.f, 1.f) } };
- propertyBuffer.SetData( texturedQuadVertexData, 4 );
+ propertyBuffer.SetData( texturedQuadVertexData, 4 );
- Geometry geometry = Geometry::New();
- geometry.AddVertexBuffer( propertyBuffer );
+ Geometry geometry = Geometry::New();
+ geometry.AddVertexBuffer( propertyBuffer );
- Shader shader = CreateShader();
- Renderer renderer = Renderer::New(geometry, shader);
- Actor actor = Actor::New();
- actor.SetSize(Vector3::ONE * 100.f);
- actor.AddRenderer(renderer);
- Stage::GetCurrent().Add(actor);
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
+ Actor actor = Actor::New();
+ actor.SetSize(Vector3::ONE * 100.f);
+ actor.AddRenderer(renderer);
+ Stage::GetCurrent().Add(actor);
- application.SendNotification();
- application.Render(0);
- application.Render();
- application.SendNotification();
+ application.SendNotification();
+ application.Render(0);
+ application.Render();
+ application.SendNotification();
- const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
- application.GetGlAbstraction().GetBufferDataCalls();
+ const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
+ application.GetGlAbstraction().GetBufferDataCalls();
+
+ DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( bufferDataCalls[0], sizeof(texturedQuadVertexData), TEST_LOCATION );
- DALI_TEST_EQUALS( bufferDataCalls[0], sizeof(texturedQuadVertexData), TEST_LOCATION );
+ }
+ // end of scope to let the buffer and geometry die; do another notification and render to get the deletion processed
+ application.SendNotification();
+ application.Render(0);
END_TEST;
}
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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 <iostream>
#include <stdlib.h>
#include <dali/public-api/dali-core.h>
+#include <dali/devel-api/common/dali-vector-devel.h>
#include <dali-test-suite-utils.h>
using namespace Dali;
END_TEST;
}
+int UtcDaliVectorCpp11ForP(void)
+{
+ Vector< Vector3 > classvector;
+ for ( auto i : classvector )
+ {
+ std::ignore = i;
+ tet_result( TET_FAIL );
+ }
+
+ classvector.PushBack( Vector3( 0.1f, 0.2f, 0.3f ) );
+ classvector.PushBack( Vector3( 0.1f, 0.2f, 0.3f ) );
+ classvector.PushBack( Vector3( 0.1f, 0.2f, 0.3f ) );
+
+ for ( auto i : classvector )
+ {
+ DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), i, TEST_LOCATION );
+ }
+
+ END_TEST;
+}
+
+
/*
* this does not compile at the moment
* Vector< Actor > classvector; this does not compile yet either
--- /dev/null
+#ifndef DALI_VECTOR_DEVEL_H
+#define DALI_VECTOR_DEVEL_H
+
+/*
+ * Copyright (c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-vector.h>
+
+namespace Dali
+{
+/**
+ * Dali::Vector support for C++11 Range-based for loop: for( item : container )
+ *
+ * @param vector The vector to iterate
+ * @return The start iterator
+ */
+template< class T >
+typename T::Iterator begin( T& vector )
+{
+ return vector.Begin();
+}
+
+/**
+ * Dali::Vector support for C++11 Range-based for loop: for( item : container )
+ *
+ * @param vector The vector to iterate
+ * @return The end iterator
+ */
+template< class T >
+typename T::Iterator end( T& vector )
+{
+ return vector.End();
+}
+
+} // namespace Dali
+
+#endif /* DALI_VECTOR_DEVEL_H */
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/common/dali-vector.h>
+#include <dali/devel-api/common/dali-vector-devel.h>
namespace Dali
{
$(devel_api_src_dir)/animation/animation-devel.h
devel_api_core_common_header_files = \
+ $(devel_api_src_dir)/common/dali-vector-devel.h \
$(devel_api_src_dir)/common/hash.h \
$(devel_api_src_dir)/common/map-wrapper.h \
$(devel_api_src_dir)/common/owner-container.h \
namespace SceneGraph
{
-typedef OwnerContainer< Render::Renderer* > RendererOwnerContainer;
-typedef RendererOwnerContainer::Iterator RendererOwnerIter;
-
-typedef OwnerContainer< Render::Geometry* > GeometryOwnerContainer;
-typedef GeometryOwnerContainer::Iterator GeometryOwnerIter;
-
-typedef OwnerContainer< Render::Sampler* > SamplerOwnerContainer;
-typedef SamplerOwnerContainer::Iterator SamplerOwnerIter;
-
-typedef OwnerContainer< Render::Texture* > TextureOwnerContainer;
-typedef TextureOwnerContainer::Iterator TextureOwnerIter;
-
-typedef OwnerContainer< Render::FrameBuffer* > FrameBufferOwnerContainer;
-typedef FrameBufferOwnerContainer::Iterator FrameBufferOwnerIter;
-
-typedef OwnerContainer< Render::PropertyBuffer* > PropertyBufferOwnerContainer;
-typedef PropertyBufferOwnerContainer::Iterator PropertyBufferOwnerIter;
-
-typedef OwnerContainer< Render::RenderTracker* > RenderTrackerContainer;
-typedef RenderTrackerContainer::Iterator RenderTrackerIter;
-typedef RenderTrackerContainer::ConstIterator RenderTrackerConstIter;
-
/**
* Structure to contain internal data
*/
void UpdateTrackers()
{
- for(RenderTrackerIter iter = mRenderTrackers.Begin(), end = mRenderTrackers.End(); iter != end; ++iter)
+ for( auto&& iter : mRenderTrackers )
{
- (*iter)->PollSyncObject();
+ iter->PollSyncObject();
}
}
// the order is important for destruction,
// programs are owned by context at the moment.
- Context context; ///< holds the GL state
- Integration::GlSyncAbstraction& glSyncAbstraction; ///< GL sync abstraction
- RenderQueue renderQueue; ///< A message queue for receiving messages from the update-thread.
+ Context context; ///< holds the GL state
+ Integration::GlSyncAbstraction& glSyncAbstraction; ///< GL sync abstraction
+ RenderQueue renderQueue; ///< A message queue for receiving messages from the update-thread.
// Render instructions describe what should be rendered during RenderManager::Render()
// Owned by RenderManager. Update manager updates instructions for the next frame while we render the current one
- RenderInstructionContainer instructions;
+ RenderInstructionContainer instructions;
- Vector4 backgroundColor; ///< The glClear color used at the beginning of each frame.
+ Vector4 backgroundColor; ///< The glClear color used at the beginning of each frame.
- unsigned int frameCount; ///< The current frame count
- BufferIndex renderBufferIndex; ///< The index of the buffer to read from; this is opposite of the "update" buffer
+ unsigned int frameCount; ///< The current frame count
+ BufferIndex renderBufferIndex; ///< The index of the buffer to read from; this is opposite of the "update" buffer
- Rect<int> defaultSurfaceRect; ///< Rectangle for the default surface we are rendering to
+ Rect<int> defaultSurfaceRect; ///< Rectangle for the default surface we are rendering to
- RendererOwnerContainer rendererContainer; ///< List of owned renderers
- SamplerOwnerContainer samplerContainer; ///< List of owned samplers
- TextureOwnerContainer textureContainer; ///< List of owned textures
- FrameBufferOwnerContainer frameBufferContainer; ///< List of owned framebuffers
- PropertyBufferOwnerContainer propertyBufferContainer; ///< List of owned property buffers
- GeometryOwnerContainer geometryContainer; ///< List of owned Geometries
+ OwnerContainer< Render::Renderer* > rendererContainer; ///< List of owned renderers
+ OwnerContainer< Render::Sampler* > samplerContainer; ///< List of owned samplers
+ OwnerContainer< Render::Texture* > textureContainer; ///< List of owned textures
+ OwnerContainer< Render::FrameBuffer* > frameBufferContainer; ///< List of owned framebuffers
+ OwnerContainer< Render::PropertyBuffer* > propertyBufferContainer; ///< List of owned property buffers
+ OwnerContainer< Render::Geometry* > geometryContainer; ///< List of owned Geometries
- bool lastFrameWasRendered; ///< Keeps track of the last frame being rendered due to having render instructions
+ bool lastFrameWasRendered; ///< Keeps track of the last frame being rendered due to having render instructions
- RenderTrackerContainer mRenderTrackers; ///< List of render trackers
+ OwnerContainer< Render::RenderTracker* > mRenderTrackers; ///< List of render trackers
- ProgramController programController; ///< Owner of the GL programs
+ ProgramController programController; ///< Owner of the GL programs
};
mImpl->programController.GlContextDestroyed();
//Inform textures
- for( TextureOwnerIter iter = mImpl->textureContainer.Begin(); iter != mImpl->textureContainer.End(); ++iter )
+ for( auto&& texture : mImpl->textureContainer )
{
- (*iter)->GlContextDestroyed();
+ texture->GlContextDestroyed();
}
//Inform framebuffers
- for( FrameBufferOwnerIter iter = mImpl->frameBufferContainer.Begin(); iter != mImpl->frameBufferContainer.End(); ++iter )
+ for( auto&& framebuffer : mImpl->frameBufferContainer )
{
- (*iter)->GlContextDestroyed();
+ framebuffer->GlContextDestroyed();
}
// inform renderers
- RendererOwnerContainer::Iterator end = mImpl->rendererContainer.End();
- RendererOwnerContainer::Iterator iter = mImpl->rendererContainer.Begin();
- for( ; iter != end; ++iter )
+ for( auto&& renderer : mImpl->rendererContainer )
{
- GlResourceOwner* renderer = *iter;
- renderer->GlContextDestroyed(); // Clear up vertex buffers
+ renderer->GlContextDestroyed();
}
}
{
DALI_ASSERT_DEBUG( NULL != texture );
- TextureOwnerContainer& textures = mImpl->textureContainer;
-
- // Find the texture
- for ( TextureOwnerIter iter = textures.Begin(); iter != textures.End(); ++iter )
+ // Find the texture, use reference to pointer so we can do the erase safely
+ for ( auto&& iter : mImpl->textureContainer )
{
- if ( *iter == texture )
+ if ( iter == texture )
{
texture->Destroy( mImpl->context );
- textures.Erase( iter ); // Texture found; now destroy it
- break;
+ mImpl->textureContainer.Erase( &iter ); // Texture found; now destroy it
+ return;
}
}
}
{
DALI_ASSERT_DEBUG( NULL != frameBuffer );
- FrameBufferOwnerContainer& framebuffers = mImpl->frameBufferContainer;
-
- // Find the sampler
- for ( FrameBufferOwnerIter iter = framebuffers.Begin(); iter != framebuffers.End(); ++iter )
+ // Find the sampler, use reference so we can safely do the erase
+ for ( auto&& iter : mImpl->frameBufferContainer )
{
- if ( *iter == frameBuffer )
+ if ( iter == frameBuffer )
{
frameBuffer->Destroy( mImpl->context );
- framebuffers.Erase( iter ); // frameBuffer found; now destroy it
+ mImpl->frameBufferContainer.Erase( &iter ); // frameBuffer found; now destroy it
break;
}
}
{
DALI_ASSERT_DEBUG( NULL != geometry );
- GeometryOwnerContainer& geometries = mImpl->geometryContainer;
-
- // Find the renderer
- for ( GeometryOwnerIter iter = geometries.Begin(); iter != geometries.End(); ++iter )
+ // Find the geometry
+ for ( auto&& iter : mImpl->geometryContainer )
{
- if ( *iter == geometry )
+ if ( iter == geometry )
{
- (*iter)->AddPropertyBuffer( propertyBuffer );
+ iter->AddPropertyBuffer( propertyBuffer );
break;
}
}
{
DALI_ASSERT_DEBUG( NULL != geometry );
- GeometryOwnerContainer& geometries = mImpl->geometryContainer;
-
- // Find the renderer
- for ( GeometryOwnerIter iter = geometries.Begin(); iter != geometries.End(); ++iter )
+ // Find the geometry
+ for ( auto&& iter : mImpl->geometryContainer )
{
- if ( *iter == geometry )
+ if ( iter == geometry )
{
- (*iter)->RemovePropertyBuffer( propertyBuffer );
+ iter->RemovePropertyBuffer( propertyBuffer );
break;
}
}
mImpl->UpdateTrackers();
//Notify RenderGeometries that rendering has finished
- for ( GeometryOwnerIter iter = mImpl->geometryContainer.Begin(); iter != mImpl->geometryContainer.End(); ++iter )
+ for ( auto&& iter : mImpl->geometryContainer )
{
- (*iter)->OnRenderFinished();
+ iter->OnRenderFinished();
}
}
inline void ResetToBaseValues( OwnerContainer<T*>& container, BufferIndex updateBufferIndex )
{
// Reset animatable properties to base values
- typename OwnerContainer<T*>::Iterator iter = container.Begin();
- const typename OwnerContainer<T*>::ConstIterator endIter = container.End();
- for ( ; iter != endIter; ++iter )
+ // use reference to avoid extra copies of the iterator
+ for( auto&& iter : container )
{
- (*iter)->ResetToBaseValues( updateBufferIndex );
+ iter->ResetToBaseValues( updateBufferIndex );
}
}
{
DALI_ASSERT_DEBUG( object && "NULL object not allowed" );
- typename OwnerContainer<T*>::Iterator iter = container.Begin();
- const typename OwnerContainer<T*>::ConstIterator endIter = container.End();
- for ( ; iter != endIter; ++iter )
+ // need to use the reference version of auto as we need the pointer to the pointer for the Release call below
+ for( auto&& iter : container )
{
- if ( *iter == object )
+ if ( iter == object )
{
// Transfer ownership to the discard queue, this keeps the object alive, until the render-thread has finished with it
- discardQueue.Add( updateBufferIndex, container.Release( iter ) );
- return;
+ discardQueue.Add( updateBufferIndex, container.Release( &iter ) ); // take the address of the reference to a pointer (iter)
+ return; // return as we only ever remove one object. Iterators to container are now invalidated as well so cannot continue
}
}
}
}
-typedef OwnerContainer< Shader* > ShaderOwner;
-typedef ShaderOwner::Iterator ShaderIter;
-typedef std::vector<Internal::ShaderDataPtr> ShaderDataBinaryQueue;
-
-typedef OwnerContainer< TextureSet* > TextureSetOwner;
-typedef TextureSetOwner::Iterator TextureSetIter;
-
-typedef OwnerContainer<Renderer*> RendererOwner;
-typedef RendererOwner::Iterator RendererIter;
-
-typedef OwnerContainer< Camera* > CameraOwner;
-typedef OwnerContainer< PropertyOwner* > CustomObjectOwner;
-
/**
* Structure to contain UpdateManager internal data
*/
{
// Disconnect render tasks from nodes, before destroying the nodes
RenderTaskList::RenderTaskContainer& tasks = taskList.GetTasks();
- for (RenderTaskList::RenderTaskContainer::Iterator iter = tasks.Begin(); iter != tasks.End(); ++iter)
+ for ( auto&& iter : tasks )
{
- (*iter)->SetSourceNode( NULL );
+ iter->SetSourceNode( NULL );
}
// ..repeat for system level RenderTasks
RenderTaskList::RenderTaskContainer& systemLevelTasks = systemLevelTaskList.GetTasks();
- for (RenderTaskList::RenderTaskContainer::Iterator iter = systemLevelTasks.Begin(); iter != systemLevelTasks.End(); ++iter)
+ for ( auto&& iter : systemLevelTasks )
{
- (*iter)->SetSourceNode( NULL );
+ iter->SetSourceNode( NULL );
}
// UpdateManager owns the Nodes. Although Nodes are pool allocated they contain heap allocated parts
delete sceneController;
}
- SceneGraphBuffers sceneGraphBuffers; ///< Used to keep track of which buffers are being written or read
- RenderMessageDispatcher renderMessageDispatcher; ///< Used for passing messages to the render-thread
- NotificationManager& notificationManager; ///< Queues notification messages for the event-thread.
- TransformManager transformManager; ///< Used to update the transformation matrices of the nodes
- CompleteNotificationInterface& animationPlaylist; ///< Holds handles to all the animations
- PropertyNotifier& propertyNotifier; ///< Provides notification to applications when properties are modified.
- ShaderSaver* shaderSaver; ///< Saves shader binaries.
- DiscardQueue& discardQueue; ///< Nodes are added here when disconnected from the scene-graph.
- RenderController& renderController; ///< render controller
- SceneControllerImpl* sceneController; ///< scene controller
- RenderManager& renderManager; ///< This is responsible for rendering the results of each "update"
- RenderQueue& renderQueue; ///< Used to queue messages for the next render
- RenderInstructionContainer& renderInstructions; ///< Used to prepare the render instructions
- RenderTaskProcessor& renderTaskProcessor; ///< Handles RenderTasks and RenderInstrucitons
+ SceneGraphBuffers sceneGraphBuffers; ///< Used to keep track of which buffers are being written or read
+ RenderMessageDispatcher renderMessageDispatcher; ///< Used for passing messages to the render-thread
+ NotificationManager& notificationManager; ///< Queues notification messages for the event-thread.
+ TransformManager transformManager; ///< Used to update the transformation matrices of the nodes
+ CompleteNotificationInterface& animationPlaylist; ///< Holds handles to all the animations
+ PropertyNotifier& propertyNotifier; ///< Provides notification to applications when properties are modified.
+ ShaderSaver* shaderSaver; ///< Saves shader binaries.
+ DiscardQueue& discardQueue; ///< Nodes are added here when disconnected from the scene-graph.
+ RenderController& renderController; ///< render controller
+ SceneControllerImpl* sceneController; ///< scene controller
+ RenderManager& renderManager; ///< This is responsible for rendering the results of each "update"
+ RenderQueue& renderQueue; ///< Used to queue messages for the next render
+ RenderInstructionContainer& renderInstructions; ///< Used to prepare the render instructions
+ RenderTaskProcessor& renderTaskProcessor; ///< Handles RenderTasks and RenderInstrucitons
- Vector4 backgroundColor; ///< The glClear color used at the beginning of each frame.
+ Vector4 backgroundColor; ///< The glClear color used at the beginning of each frame.
- RenderTaskList taskList; ///< The list of scene graph render-tasks
- RenderTaskList systemLevelTaskList; ///< Separate render-tasks for system-level content
+ RenderTaskList taskList; ///< The list of scene graph render-tasks
+ RenderTaskList systemLevelTaskList; ///< Separate render-tasks for system-level content
- Layer* root; ///< The root node (root is a layer)
- Layer* systemLevelRoot; ///< A separate root-node for system-level content
+ Layer* root; ///< The root node (root is a layer)
+ Layer* systemLevelRoot; ///< A separate root-node for system-level content
- Vector<Node*> nodes; ///< A container of all instantiated nodes
+ Vector<Node*> nodes; ///< A container of all instantiated nodes
- SortedLayerPointers sortedLayers; ///< A container of Layer pointers sorted by depth
- SortedLayerPointers systemLevelSortedLayers; ///< A separate container of system-level Layers
+ SortedLayerPointers sortedLayers; ///< A container of Layer pointers sorted by depth
+ SortedLayerPointers systemLevelSortedLayers; ///< A separate container of system-level Layers
- CameraOwner cameras; ///< A container of cameras
- CustomObjectOwner customObjects; ///< A container of owned objects (with custom properties)
+ OwnerContainer< Camera* > cameras; ///< A container of cameras
+ OwnerContainer< PropertyOwner* > customObjects; ///< A container of owned objects (with custom properties)
- AnimationContainer animations; ///< A container of owned animations
- PropertyNotificationContainer propertyNotifications; ///< A container of owner property notifications.
+ AnimationContainer animations; ///< A container of owned animations
+ PropertyNotificationContainer propertyNotifications; ///< A container of owner property notifications.
- RendererOwner renderers; ///< A container of owned renderers
- TextureSetOwner textureSets; ///< A container of owned texture sets
- ShaderOwner shaders; ///< A container of owned shaders
- OwnerPointer<PanGesture> panGestureProcessor; ///< Owned pan gesture processor; it lives for the lifecycle of UpdateManager
+ OwnerContainer< Renderer* > renderers; ///< A container of owned renderers
+ OwnerContainer< TextureSet* > textureSets; ///< A container of owned texture sets
+ OwnerContainer< Shader* > shaders; ///< A container of owned shaders
+ OwnerPointer< PanGesture > panGestureProcessor; ///< Owned pan gesture processor; it lives for the lifecycle of UpdateManager
- MessageQueue messageQueue; ///< The messages queued from the event-thread
- ShaderDataBinaryQueue renderCompiledShaders; ///< Shaders compiled on Render thread are inserted here for update thread to pass on to event thread.
- ShaderDataBinaryQueue updateCompiledShaders; ///< Shaders to be sent from Update to Event
- Mutex compiledShaderMutex; ///< lock to ensure no corruption on the renderCompiledShaders
+ MessageQueue messageQueue; ///< The messages queued from the event-thread
+ std::vector<Internal::ShaderDataPtr> renderCompiledShaders; ///< Shaders compiled on Render thread are inserted here for update thread to pass on to event thread.
+ std::vector<Internal::ShaderDataPtr> updateCompiledShaders; ///< Shaders to be sent from Update to Event
+ Mutex compiledShaderMutex; ///< lock to ensure no corruption on the renderCompiledShaders
- float keepRenderingSeconds; ///< Set via Dali::Stage::KeepRendering
- int nodeDirtyFlags; ///< cumulative node dirty flags from previous frame
- int frameCounter; ///< Frame counter used in debugging to choose which frame to debug and which to ignore.
+ float keepRenderingSeconds; ///< Set via Dali::Stage::KeepRendering
+ int nodeDirtyFlags; ///< cumulative node dirty flags from previous frame
+ int frameCounter; ///< Frame counter used in debugging to choose which frame to debug and which to ignore.
- bool animationFinishedDuringUpdate; ///< Flag whether any animations finished during the Update()
- bool previousUpdateScene; ///< True if the scene was updated in the previous frame (otherwise it was optimized out)
- bool renderTaskWaiting; ///< A REFRESH_ONCE render task is waiting to be rendered
- bool renderersAdded; ///< Flag to keep track when renderers have been added to avoid unnecessary processing
+ bool animationFinishedDuringUpdate; ///< Flag whether any animations finished during the Update()
+ bool previousUpdateScene; ///< True if the scene was updated in the previous frame (otherwise it was optimized out)
+ bool renderTaskWaiting; ///< A REFRESH_ONCE render task is waiting to be rendered
+ bool renderersAdded; ///< Flag to keep track when renderers have been added to avoid unnecessary processing
private:
bool UpdateManager::IsAnimationRunning() const
{
- bool isRunning(false);
- AnimationContainer& animations = mImpl->animations;
-
// Find any animation that isn't stopped or paused
-
- const AnimationIter endIter = animations.End();
- for ( AnimationIter iter = animations.Begin(); !isRunning && iter != endIter; ++iter )
+ for ( auto&& iter : mImpl->animations )
{
- const Animation::State state = (*iter)->GetState();
+ const Animation::State state = iter->GetState();
if (state != Animation::Stopped &&
state != Animation::Paused)
{
- isRunning = true;
+ return true; // stop iteration as soon as first one is found
}
}
- return isRunning;
+ return false;
}
void UpdateManager::AddPropertyNotification( OwnerPointer< PropertyNotification >& propertyNotification )
void UpdateManager::ConstrainCustomObjects( BufferIndex bufferIndex )
{
//Constrain custom objects (in construction order)
- OwnerContainer< PropertyOwner* >& customObjects = mImpl->customObjects;
- const OwnerContainer< PropertyOwner* >::Iterator endIter = customObjects.End();
- for ( OwnerContainer< PropertyOwner* >::Iterator iter = customObjects.Begin(); endIter != iter; ++iter )
+ for ( auto&& object : mImpl->customObjects )
{
- PropertyOwner& object = **iter;
- ConstrainPropertyOwner( object, bufferIndex );
+ ConstrainPropertyOwner( *object, bufferIndex );
}
}
{
// Constrain system-level render-tasks
const RenderTaskList::RenderTaskContainer& systemLevelTasks = mImpl->systemLevelTaskList.GetTasks();
- for ( RenderTaskList::RenderTaskContainer::ConstIterator iter = systemLevelTasks.Begin(); iter != systemLevelTasks.End(); ++iter )
+ for ( auto&& task : systemLevelTasks )
{
- RenderTask& task = **iter;
- ConstrainPropertyOwner( task, bufferIndex );
+ ConstrainPropertyOwner( *task, bufferIndex );
}
// Constrain render-tasks
const RenderTaskList::RenderTaskContainer& tasks = mImpl->taskList.GetTasks();
- for ( RenderTaskList::RenderTaskContainer::ConstIterator iter = tasks.Begin(); iter != tasks.End(); ++iter )
+ for ( auto&& task : tasks )
{
- RenderTask& task = **iter;
- ConstrainPropertyOwner( task, bufferIndex );
+ ConstrainPropertyOwner( *task, bufferIndex );
}
}
void UpdateManager::ConstrainShaders( BufferIndex bufferIndex )
{
// constrain shaders... (in construction order)
- ShaderOwner& shaders = mImpl->shaders;
- for ( ShaderIter iter = shaders.Begin(); iter != shaders.End(); ++iter )
+ for ( auto&& shader : mImpl->shaders )
{
- Shader& shader = **iter;
- ConstrainPropertyOwner( shader, bufferIndex );
+ ConstrainPropertyOwner( *shader, bufferIndex );
}
}
void UpdateManager::ProcessPropertyNotifications( BufferIndex bufferIndex )
{
- PropertyNotificationContainer ¬ifications = mImpl->propertyNotifications;
- PropertyNotificationIter iter = notifications.Begin();
-
- while ( iter != notifications.End() )
+ for( auto&& notification : mImpl->propertyNotifications )
{
- PropertyNotification* notification = *iter;
bool valid = notification->Check( bufferIndex );
if(valid)
{
mImpl->notificationManager.QueueMessage( PropertyChangedMessage( mImpl->propertyNotifier, notification, notification->GetValidity() ) );
}
- ++iter;
}
}
if( mImpl->updateCompiledShaders.size() > 0 )
{
ShaderSaver& factory = *mImpl->shaderSaver;
- ShaderDataBinaryQueue::iterator i = mImpl->updateCompiledShaders.begin();
- ShaderDataBinaryQueue::iterator end = mImpl->updateCompiledShaders.end();
- for( ; i != end; ++i )
+ for( auto&& shader : mImpl->updateCompiledShaders )
{
- mImpl->notificationManager.QueueMessage( ShaderCompiledMessage( factory, *i ) );
+ mImpl->notificationManager.QueueMessage( ShaderCompiledMessage( factory, shader ) );
}
// we don't need them in update anymore
mImpl->updateCompiledShaders.clear();
ProcessPropertyNotifications( bufferIndex );
//Update cameras
- const CameraOwner::Iterator endCameraIterator = mImpl->cameras.End();
- for( CameraOwner::Iterator cameraIterator = mImpl->cameras.Begin(); endCameraIterator != cameraIterator; ++cameraIterator )
+ for( auto&& cameraIterator : mImpl->cameras )
{
- ( *cameraIterator )->Update( bufferIndex );
+ cameraIterator->Update( bufferIndex );
}
//Process the RenderTasks if renderers exist. This creates the instructions for rendering the next frame.
// check the countdown and notify (note, at the moment this is only done for normal tasks, not for systemlevel tasks)
bool doRenderOnceNotify = false;
mImpl->renderTaskWaiting = false;
- const RenderTaskList::RenderTaskContainer& tasks = mImpl->taskList.GetTasks();
- for ( RenderTaskList::RenderTaskContainer::ConstIterator iter = tasks.Begin(), endIter = tasks.End();
- endIter != iter; ++iter )
+ for ( auto&& renderTask : mImpl->taskList.GetTasks() )
{
- RenderTask& renderTask(*(*iter));
-
- renderTask.UpdateState();
+ renderTask->UpdateState();
- if( renderTask.IsWaitingToRender() &&
- renderTask.ReadyToRender( bufferIndex ) /*avoid updating forever when source actor is off-stage*/ )
+ if( renderTask->IsWaitingToRender() &&
+ renderTask->ReadyToRender( bufferIndex ) /*avoid updating forever when source actor is off-stage*/ )
{
mImpl->renderTaskWaiting = true; // keep update/render threads alive
}
- if( renderTask.HasRendered() )
+ if( renderTask->HasRendered() )
{
doRenderOnceNotify = true;
}
{
// note,this vector is already in depth order. It could be used as-is to
// remove sorting in update algorithm. However, it lacks layer boundary markers.
- for( std::vector<NodeDepthPair>::iterator iter = nodeDepths->nodeDepths.begin(),
- end = nodeDepths->nodeDepths.end() ;
- iter != end ; ++iter )
+ for( auto&& iter : nodeDepths->nodeDepths )
{
- iter->node->SetDepthIndex( iter->sortedDepth );
+ iter.node->SetDepthIndex( iter.sortedDepth );
}
}