actor-impl.h unnecessarily included update-manager.h.
Modified header to remove dependency, and fixed up errors, moving
to use forward declarations where possible, and moving inline
dependencies into source files.
Change-Id: I330a70fc374eb11a414ae257e34858ab061d84ca
Signed-off-by: David Steele <david.steele@samsung.com>
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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/internal/event/actors/camera-actor-impl.h>
#include <dali/internal/event/actors/layer-impl.h>
+#include <dali/internal/event/rendering/geometry-impl.h>
+#include <dali/internal/event/rendering/renderer-impl.h>
+#include <dali/internal/event/rendering/sampler-impl.h>
+#include <dali/internal/event/rendering/shader-impl.h>
+#include <dali/internal/event/rendering/texture-set-impl.h>
+#include <dali/internal/event/rendering/vertex-buffer-impl.h>
+
#include <dali/internal/event/animation/animation-impl.h>
#include <dali/internal/event/animation/animator-connector.h>
#include <dali/internal/event/animation/constraint-impl.h>
{
class Processor;
class RenderController;
+class GlAbstraction;
class PlatformAbstraction;
class UpdateStatus;
class RenderStatus;
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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/internal/event/events/actor-gesture-data.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
#include <dali/internal/event/render-tasks/render-task-list-impl.h>
+#include <dali/internal/event/rendering/renderer-impl.h>
#include <dali/internal/event/size-negotiation/relayout-controller-impl.h>
+#include <dali/internal/update/manager/update-manager.h>
#include <dali/internal/update/nodes/node-messages.h>
using Dali::Internal::SceneGraph::AnimatableProperty;
// check that we have a node AND the new size width, height or depth is at least a little bit different from the old one
Vector3 currentSize = GetCurrentSize();
- if( ( fabsf( mTargetSize.width - size.width ) > Math::MACHINE_EPSILON_1 )||
- ( fabsf( mTargetSize.height- size.height ) > Math::MACHINE_EPSILON_1 )||
- ( fabsf( mTargetSize.depth - size.depth ) > Math::MACHINE_EPSILON_1 )||
- ( fabsf( mTargetSize.width - currentSize.width ) > Math::MACHINE_EPSILON_1 )||
- ( fabsf( mTargetSize.height- currentSize.height ) > Math::MACHINE_EPSILON_1 )||
- ( fabsf( mTargetSize.depth - currentSize.depth ) > Math::MACHINE_EPSILON_1 ) )
+ if((fabsf(mTargetSize.width - size.width) > Math::MACHINE_EPSILON_1) ||
+ (fabsf(mTargetSize.height - size.height) > Math::MACHINE_EPSILON_1) ||
+ (fabsf(mTargetSize.depth - size.depth) > Math::MACHINE_EPSILON_1) ||
+ (fabsf(mTargetSize.width - currentSize.width) > Math::MACHINE_EPSILON_1) ||
+ (fabsf(mTargetSize.height - currentSize.height) > Math::MACHINE_EPSILON_1) ||
+ (fabsf(mTargetSize.depth - currentSize.depth) > Math::MACHINE_EPSILON_1))
{
mTargetSize = size;
return componentIndex;
}
+const SceneGraph::Node& Actor::GetNode() const
+{
+ return *static_cast<const SceneGraph::Node*>(mUpdateObject);
+}
+
void Actor::Raise()
{
if(mParent)
#define DALI_INTERNAL_ACTOR_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
// INTERNAL INCLUDES
#include <dali/devel-api/actors/actor-devel.h>
+#include <dali/devel-api/rendering/renderer-devel.h>
#include <dali/internal/common/internal-constants.h>
#include <dali/internal/common/memory-pool-object-allocator.h>
#include <dali/internal/event/actors/actor-declarations.h>
#include <dali/internal/event/actors/actor-parent.h>
#include <dali/internal/event/common/object-impl.h>
#include <dali/internal/event/common/stage-def.h>
-#include <dali/internal/event/rendering/renderer-impl.h>
-#include <dali/internal/update/manager/update-manager.h>
#include <dali/internal/update/nodes/node-declarations.h>
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/common/dali-common.h>
class Renderer;
class Scene;
+using RendererPtr = IntrusivePtr<Renderer>;
using RendererContainer = std::vector<RendererPtr>;
using RendererIter = RendererContainer::iterator;
* Retrieve the actor's node.
* @return The node used by this actor
*/
- const SceneGraph::Node& GetNode() const
- {
- return *static_cast<const SceneGraph::Node*>(mUpdateObject);
- }
+ const SceneGraph::Node& GetNode() const;
/**
* @copydoc Dali::DevelActor::Raise()
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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/internal/event/actors/actor-relayouter.h>
// INTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+#include <dali/internal/event/size-negotiation/relayout-controller-impl.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/math/vector3.h>
-#include <dali/internal/event/size-negotiation/relayout-controller-impl.h>
namespace
{
#if defined(DEBUG_ENABLED)
-Debug::Filter* gLogRelayoutFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_RELAYOUT_TIMER" );
+Debug::Filter* gLogRelayoutFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_RELAYOUT_TIMER");
#endif
} // unnamed namespace
namespace Dali
{
-
namespace Internal
{
-
Actor::Relayouter::Relayouter()
-: sizeModeFactor( DEFAULT_SIZE_MODE_FACTOR ),
- preferredSize( DEFAULT_PREFERRED_SIZE ),
- sizeSetPolicy( DEFAULT_SIZE_SCALE_POLICY ),
- relayoutEnabled( false ),
- insideRelayout( false )
+: sizeModeFactor(DEFAULT_SIZE_MODE_FACTOR),
+ preferredSize(DEFAULT_PREFERRED_SIZE),
+ sizeSetPolicy(DEFAULT_SIZE_SCALE_POLICY),
+ relayoutEnabled(false),
+ insideRelayout(false)
{
// Set size negotiation defaults
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- resizePolicies[ i ] = ResizePolicy::DEFAULT;
- useAssignedSize[ i ] = false;
- negotiatedDimensions[ i ] = 0.0f;
- dimensionNegotiated[ i ] = false;
- dimensionDirty[ i ] = false;
- dimensionDependencies[ i ] = Dimension::ALL_DIMENSIONS;
- dimensionPadding[ i ] = DEFAULT_DIMENSION_PADDING;
- minimumSize[ i ] = 0.0f;
- maximumSize[ i ] = FLT_MAX;
+ resizePolicies[i] = ResizePolicy::DEFAULT;
+ useAssignedSize[i] = false;
+ negotiatedDimensions[i] = 0.0f;
+ dimensionNegotiated[i] = false;
+ dimensionDirty[i] = false;
+ dimensionDependencies[i] = Dimension::ALL_DIMENSIONS;
+ dimensionPadding[i] = DEFAULT_DIMENSION_PADDING;
+ minimumSize[i] = 0.0f;
+ maximumSize[i] = FLT_MAX;
}
}
-ResizePolicy::Type Actor::Relayouter::GetResizePolicy( Dimension::Type dimension ) const
+ResizePolicy::Type Actor::Relayouter::GetResizePolicy(Dimension::Type dimension) const
{
// If more than one dimension is requested, just return the first one found
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- if( ( dimension & ( 1 << i ) ) )
+ if((dimension & (1 << i)))
{
- if( useAssignedSize[ i ] )
+ if(useAssignedSize[i])
{
return ResizePolicy::USE_ASSIGNED_SIZE;
}
else
{
- return resizePolicies[ i ];
+ return resizePolicies[i];
}
}
}
return ResizePolicy::DEFAULT;
}
-void Actor::Relayouter::SetPadding( const Vector2& padding, Dimension::Type dimension )
+void Actor::Relayouter::SetPadding(const Vector2& padding, Dimension::Type dimension)
{
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- if( dimension & ( 1 << i ) )
+ if(dimension & (1 << i))
{
- dimensionPadding[ i ] = padding;
+ dimensionPadding[i] = padding;
}
}
}
-void Actor::Relayouter::SetLayoutNegotiated( bool negotiated, Dimension::Type dimension )
+void Actor::Relayouter::SetLayoutNegotiated(bool negotiated, Dimension::Type dimension)
{
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- if( dimension & ( 1 << i ) )
+ if(dimension & (1 << i))
{
- dimensionNegotiated[ i ] = negotiated;
+ dimensionNegotiated[i] = negotiated;
}
}
}
-bool Actor::Relayouter::IsLayoutNegotiated( Dimension::Type dimension ) const
+bool Actor::Relayouter::IsLayoutNegotiated(Dimension::Type dimension) const
{
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- if( ( dimension & ( 1 << i ) ) && dimensionNegotiated[ i ] )
+ if((dimension & (1 << i)) && dimensionNegotiated[i])
{
return true;
}
return false;
}
-Vector2 Actor::Relayouter::ApplySizeSetPolicy( Internal::Actor& actor, const Vector2& size )
+Vector2 Actor::Relayouter::ApplySizeSetPolicy(Internal::Actor& actor, const Vector2& size)
{
- switch( sizeSetPolicy )
+ switch(sizeSetPolicy)
{
case SizeScalePolicy::USE_SIZE_SET:
{
{
// Scale size to fit within the original size bounds, keeping the natural size aspect ratio
const Vector3 naturalSize = actor.GetNaturalSize();
- if( naturalSize.width > 0.0f && naturalSize.height > 0.0f && size.width > 0.0f && size.height > 0.0f )
+ if(naturalSize.width > 0.0f && naturalSize.height > 0.0f && size.width > 0.0f && size.height > 0.0f)
{
- const float sizeRatio = size.width / size.height;
+ const float sizeRatio = size.width / size.height;
const float naturalSizeRatio = naturalSize.width / naturalSize.height;
- if( naturalSizeRatio < sizeRatio )
+ if(naturalSizeRatio < sizeRatio)
{
- return Vector2( naturalSizeRatio * size.height, size.height );
+ return Vector2(naturalSizeRatio * size.height, size.height);
}
- else if( naturalSizeRatio > sizeRatio )
+ else if(naturalSizeRatio > sizeRatio)
{
- return Vector2( size.width, size.width / naturalSizeRatio );
+ return Vector2(size.width, size.width / naturalSizeRatio);
}
else
{
{
// Scale size to fill the original size bounds, keeping the natural size aspect ratio. Potentially exceeding the original bounds.
const Vector3 naturalSize = actor.GetNaturalSize();
- if( naturalSize.width > 0.0f && naturalSize.height > 0.0f && size.width > 0.0f && size.height > 0.0f )
+ if(naturalSize.width > 0.0f && naturalSize.height > 0.0f && size.width > 0.0f && size.height > 0.0f)
{
- const float sizeRatio = size.width / size.height;
+ const float sizeRatio = size.width / size.height;
const float naturalSizeRatio = naturalSize.width / naturalSize.height;
- if( naturalSizeRatio < sizeRatio )
+ if(naturalSizeRatio < sizeRatio)
{
- return Vector2( size.width, size.width / naturalSizeRatio );
+ return Vector2(size.width, size.width / naturalSizeRatio);
}
- else if( naturalSizeRatio > sizeRatio )
+ else if(naturalSizeRatio > sizeRatio)
{
- return Vector2( naturalSizeRatio * size.height, size.height );
+ return Vector2(naturalSizeRatio * size.height, size.height);
}
else
{
return size;
}
-void Actor::Relayouter::SetUseAssignedSize( bool use, Dimension::Type dimension )
+void Actor::Relayouter::SetUseAssignedSize(bool use, Dimension::Type dimension)
{
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- if( dimension & ( 1 << i ) )
+ if(dimension & (1 << i))
{
- useAssignedSize[ i ] = use;
+ useAssignedSize[i] = use;
}
}
}
-bool Actor::Relayouter::GetUseAssignedSize( Dimension::Type dimension ) const
+bool Actor::Relayouter::GetUseAssignedSize(Dimension::Type dimension) const
{
// If more than one dimension is requested, just return the first one found
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- if( dimension & ( 1 << i ) )
+ if(dimension & (1 << i))
{
- return useAssignedSize[ i ];
+ return useAssignedSize[i];
}
}
return false;
}
-void Actor::Relayouter::SetMinimumSize( float size, Dimension::Type dimension )
+void Actor::Relayouter::SetMinimumSize(float size, Dimension::Type dimension)
{
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- if( dimension & ( 1 << i ) )
+ if(dimension & (1 << i))
{
- minimumSize[ i ] = size;
+ minimumSize[i] = size;
}
}
}
-float Actor::Relayouter::GetMinimumSize( Dimension::Type dimension ) const
+float Actor::Relayouter::GetMinimumSize(Dimension::Type dimension) const
{
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- if( dimension & ( 1 << i ) )
+ if(dimension & (1 << i))
{
- return minimumSize[ i ];
+ return minimumSize[i];
}
}
- return 0.0f; // Default
+ return 0.0f; // Default
}
-void Actor::Relayouter::SetMaximumSize( float size, Dimension::Type dimension )
+void Actor::Relayouter::SetMaximumSize(float size, Dimension::Type dimension)
{
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- if( dimension & ( 1 << i ) )
+ if(dimension & (1 << i))
{
- maximumSize[ i ] = size;
+ maximumSize[i] = size;
}
}
}
-float Actor::Relayouter::GetMaximumSize( Dimension::Type dimension ) const
+float Actor::Relayouter::GetMaximumSize(Dimension::Type dimension) const
{
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- if( dimension & ( 1 << i ) )
+ if(dimension & (1 << i))
{
- return maximumSize[ i ];
+ return maximumSize[i];
}
}
- return FLT_MAX; // Default
+ return FLT_MAX; // Default
}
-void Actor::Relayouter::SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension, Vector3& targetSize )
+void Actor::Relayouter::SetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension, Vector3& targetSize)
{
- ResizePolicy::Type originalWidthPolicy = GetResizePolicy(Dimension::WIDTH);
+ ResizePolicy::Type originalWidthPolicy = GetResizePolicy(Dimension::WIDTH);
ResizePolicy::Type originalHeightPolicy = GetResizePolicy(Dimension::HEIGHT);
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- if( dimension & ( 1 << i ) )
+ if(dimension & (1 << i))
{
- if ( policy == ResizePolicy::USE_ASSIGNED_SIZE )
+ if(policy == ResizePolicy::USE_ASSIGNED_SIZE)
{
- useAssignedSize[ i ] = true;
+ useAssignedSize[i] = true;
}
else
{
- resizePolicies[ i ] = policy;
- useAssignedSize[ i ] = false;
+ resizePolicies[i] = policy;
+ useAssignedSize[i] = false;
}
}
}
- if( policy == ResizePolicy::DIMENSION_DEPENDENCY )
+ if(policy == ResizePolicy::DIMENSION_DEPENDENCY)
{
- if( dimension & Dimension::WIDTH )
+ if(dimension & Dimension::WIDTH)
{
- SetDimensionDependency( Dimension::WIDTH, Dimension::HEIGHT );
+ SetDimensionDependency(Dimension::WIDTH, Dimension::HEIGHT);
}
- if( dimension & Dimension::HEIGHT )
+ if(dimension & Dimension::HEIGHT)
{
- SetDimensionDependency( Dimension::HEIGHT, Dimension::WIDTH );
+ SetDimensionDependency(Dimension::HEIGHT, Dimension::WIDTH);
}
}
// should be overrided by the target size. Otherwise the target
// size should be overrided by the preferred size.
- if( dimension & Dimension::WIDTH )
+ if(dimension & Dimension::WIDTH)
{
- if( originalWidthPolicy != ResizePolicy::FIXED && policy == ResizePolicy::FIXED )
+ if(originalWidthPolicy != ResizePolicy::FIXED && policy == ResizePolicy::FIXED)
{
preferredSize.width = targetSize.width;
}
- else if( originalWidthPolicy == ResizePolicy::FIXED && policy != ResizePolicy::FIXED )
+ else if(originalWidthPolicy == ResizePolicy::FIXED && policy != ResizePolicy::FIXED)
{
targetSize.width = preferredSize.width;
}
}
- if( dimension & Dimension::HEIGHT )
+ if(dimension & Dimension::HEIGHT)
{
- if( originalHeightPolicy != ResizePolicy::FIXED && policy == ResizePolicy::FIXED )
+ if(originalHeightPolicy != ResizePolicy::FIXED && policy == ResizePolicy::FIXED)
{
preferredSize.height = targetSize.height;
}
- else if( originalHeightPolicy == ResizePolicy::FIXED && policy != ResizePolicy::FIXED )
+ else if(originalHeightPolicy == ResizePolicy::FIXED && policy != ResizePolicy::FIXED)
{
targetSize.height = preferredSize.height;
}
}
}
-void Actor::Relayouter::SetDimensionDependency( Dimension::Type dimension, Dimension::Type dependency )
+void Actor::Relayouter::SetDimensionDependency(Dimension::Type dimension, Dimension::Type dependency)
{
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- if( dimension & ( 1 << i ) )
+ if(dimension & (1 << i))
{
- dimensionDependencies[ i ] = dependency;
+ dimensionDependencies[i] = dependency;
}
}
}
-Dimension::Type Actor::Relayouter::GetDimensionDependency( Dimension::Type dimension ) const
+Dimension::Type Actor::Relayouter::GetDimensionDependency(Dimension::Type dimension) const
{
// If more than one dimension is requested, just return the first one found
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- if( ( dimension & ( 1 << i ) ) )
+ if((dimension & (1 << i)))
{
- return dimensionDependencies[ i ];
+ return dimensionDependencies[i];
}
}
- return Dimension::ALL_DIMENSIONS; // Default
+ return Dimension::ALL_DIMENSIONS; // Default
}
-void Actor::Relayouter::SetLayoutDirty( bool dirty, Dimension::Type dimension )
+void Actor::Relayouter::SetLayoutDirty(bool dirty, Dimension::Type dimension)
{
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- if( dimension & ( 1 << i ) )
+ if(dimension & (1 << i))
{
- dimensionDirty[ i ] = dirty;
+ dimensionDirty[i] = dirty;
}
}
}
-bool Actor::Relayouter::IsLayoutDirty( Dimension::Type dimension ) const
+bool Actor::Relayouter::IsLayoutDirty(Dimension::Type dimension) const
{
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- if( ( dimension & ( 1 << i ) ) && dimensionDirty[ i ] )
+ if((dimension & (1 << i)) && dimensionDirty[i])
{
return true;
}
return false;
}
-void Actor::Relayouter::SetPreferredSize( Actor& actor, const Vector2& size )
+void Actor::Relayouter::SetPreferredSize(Actor& actor, const Vector2& size)
{
// If valid width or height, then set the resize policy to FIXED
// A 0 width or height may also be required so if the resize policy has not been changed, i.e. is still set to DEFAULT,
// then change to FIXED as well
- if( size.width > 0.0f || GetResizePolicy( Dimension::WIDTH ) == ResizePolicy::DEFAULT )
+ if(size.width > 0.0f || GetResizePolicy(Dimension::WIDTH) == ResizePolicy::DEFAULT)
{
- actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::WIDTH );
+ actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::WIDTH);
}
- if( size.height > 0.0f || GetResizePolicy( Dimension::HEIGHT ) == ResizePolicy::DEFAULT )
+ if(size.height > 0.0f || GetResizePolicy(Dimension::HEIGHT) == ResizePolicy::DEFAULT)
{
- actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT );
+ actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::HEIGHT);
}
actor.mRelayoutData->preferredSize = size;
actor.RelayoutRequest();
}
-float Actor::Relayouter::ClampDimension( const Internal::Actor& actor, float size, Dimension::Type dimension )
+float Actor::Relayouter::ClampDimension(const Internal::Actor& actor, float size, Dimension::Type dimension)
{
- const float minSize = actor.GetMinimumSize( dimension );
- const float maxSize = actor.GetMaximumSize( dimension );
+ const float minSize = actor.GetMinimumSize(dimension);
+ const float maxSize = actor.GetMaximumSize(dimension);
- return std::max( minSize, std::min( size, maxSize ) );
+ return std::max(minSize, std::min(size, maxSize));
}
-void Actor::Relayouter::NegotiateDimension( Actor& actor, Dimension::Type dimension, const Vector2& allocatedSize, Actor::ActorDimensionStack& recursionStack )
+void Actor::Relayouter::NegotiateDimension(Actor& actor, Dimension::Type dimension, const Vector2& allocatedSize, Actor::ActorDimensionStack& recursionStack)
{
// Check if it needs to be negotiated
- if( actor.IsLayoutDirty( dimension ) && !actor.IsLayoutNegotiated( dimension ) )
+ if(actor.IsLayoutDirty(dimension) && !actor.IsLayoutNegotiated(dimension))
{
// Check that we havn't gotten into an infinite loop
- Actor::ActorDimensionPair searchActor = Actor::ActorDimensionPair( &actor, dimension );
- bool recursionFound = false;
- for( auto& element : recursionStack )
+ Actor::ActorDimensionPair searchActor = Actor::ActorDimensionPair(&actor, dimension);
+ bool recursionFound = false;
+ for(auto& element : recursionStack)
{
- if( element == searchActor )
+ if(element == searchActor)
{
recursionFound = true;
break;
}
}
- if( !recursionFound )
+ if(!recursionFound)
{
// Record the path that we have taken
- recursionStack.push_back( Actor::ActorDimensionPair( &actor, dimension ) );
+ recursionStack.push_back(Actor::ActorDimensionPair(&actor, dimension));
// Dimension dependency check
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- Dimension::Type dimensionToCheck = static_cast< Dimension::Type >( 1 << i );
+ Dimension::Type dimensionToCheck = static_cast<Dimension::Type>(1 << i);
- if( actor.RelayoutDependentOnDimension( dimension, dimensionToCheck ) )
+ if(actor.RelayoutDependentOnDimension(dimension, dimensionToCheck))
{
- NegotiateDimension( actor, dimensionToCheck, allocatedSize, recursionStack );
+ NegotiateDimension(actor, dimensionToCheck, allocatedSize, recursionStack);
}
}
// Parent dependency check
Actor* parent = actor.GetParent();
- if( parent && actor.RelayoutDependentOnParent( dimension ) )
+ if(parent && actor.RelayoutDependentOnParent(dimension))
{
- NegotiateDimension( *parent, dimension, allocatedSize, recursionStack );
+ NegotiateDimension(*parent, dimension, allocatedSize, recursionStack);
}
// Children dependency check
- if( actor.RelayoutDependentOnChildren( dimension ) )
+ if(actor.RelayoutDependentOnChildren(dimension))
{
- for( uint32_t i = 0, count = actor.GetChildCount(); i < count; ++i )
+ for(uint32_t i = 0, count = actor.GetChildCount(); i < count; ++i)
{
- ActorPtr child = actor.GetChildAt( i );
+ ActorPtr child = actor.GetChildAt(i);
// Only relayout child first if it is not dependent on this actor
- if( !child->RelayoutDependentOnParent( dimension ) )
+ if(!child->RelayoutDependentOnParent(dimension))
{
- NegotiateDimension( *child, dimension, allocatedSize, recursionStack );
+ NegotiateDimension(*child, dimension, allocatedSize, recursionStack);
}
}
}
// For deriving classes
- actor.OnCalculateRelayoutSize( dimension );
+ actor.OnCalculateRelayoutSize(dimension);
// All dependencies checked, calculate the size and set negotiated flag
- const float newSize = ClampDimension( actor, actor.CalculateSize( dimension, allocatedSize ), dimension );
+ const float newSize = ClampDimension(actor, actor.CalculateSize(dimension, allocatedSize), dimension);
- actor.SetNegotiatedDimension( newSize, dimension );
- actor.SetLayoutNegotiated( true, dimension );
+ actor.SetNegotiatedDimension(newSize, dimension);
+ actor.SetLayoutNegotiated(true, dimension);
// For deriving classes
- actor.OnLayoutNegotiated( newSize, dimension );
+ actor.OnLayoutNegotiated(newSize, dimension);
// This actor has been successfully processed, pop it off the recursion stack
recursionStack.pop_back();
else
{
// TODO: Break infinite loop
- actor.SetLayoutNegotiated( true, dimension );
+ actor.SetLayoutNegotiated(true, dimension);
}
}
}
// Negotiate all dimensions that require it
ActorDimensionStack recursionStack;
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- const Dimension::Type dimension = static_cast< Dimension::Type >( 1 << i );
+ const Dimension::Type dimension = static_cast<Dimension::Type>(1 << i);
// Negotiate
NegotiateDimension(actor, dimension, allocatedSize, recursionStack);
// relayout container afterwards, the dirty flags would still be clear...
// causing a relayout to be skipped. Here we force any actors added to the
// container to be relayed out.
- DALI_LOG_TIMER_START( NegSizeTimer1 );
+ DALI_LOG_TIMER_START(NegSizeTimer1);
- if( actor.GetUseAssignedSize(Dimension::WIDTH ) )
+ if(actor.GetUseAssignedSize(Dimension::WIDTH))
{
- actor.SetLayoutNegotiated( false, Dimension::WIDTH );
+ actor.SetLayoutNegotiated(false, Dimension::WIDTH);
}
- if( actor.GetUseAssignedSize( Dimension::HEIGHT ) )
+ if(actor.GetUseAssignedSize(Dimension::HEIGHT))
{
- actor.SetLayoutNegotiated( false, Dimension::HEIGHT );
+ actor.SetLayoutNegotiated(false, Dimension::HEIGHT);
}
// Do the negotiation
NegotiateDimensions(actor, allocatedSize);
// Set the actor size
- actor.SetNegotiatedSize( container );
+ actor.SetNegotiatedSize(container);
// Negotiate down to children
- for( uint32_t i = 0, count = actor.GetChildCount(); i < count; ++i )
+ for(uint32_t i = 0, count = actor.GetChildCount(); i < count; ++i)
{
- ActorPtr child = actor.GetChildAt( i );
+ ActorPtr child = actor.GetChildAt(i);
// Forces children that have already been laid out to be relayed out
// if they have assigned size during relayout.
- if( child->GetUseAssignedSize(Dimension::WIDTH) )
+ if(child->GetUseAssignedSize(Dimension::WIDTH))
{
child->SetLayoutNegotiated(false, Dimension::WIDTH);
child->SetLayoutDirty(true, Dimension::WIDTH);
}
- if( child->GetUseAssignedSize(Dimension::HEIGHT) )
+ if(child->GetUseAssignedSize(Dimension::HEIGHT))
{
child->SetLayoutNegotiated(false, Dimension::HEIGHT);
child->SetLayoutDirty(true, Dimension::HEIGHT);
}
// Only relayout if required
- if( child->RelayoutRequired() )
+ if(child->RelayoutRequired())
{
- container.Add( Dali::Actor( child.Get() ), actor.mTargetSize.GetVectorXY() );
+ container.Add(Dali::Actor(child.Get()), actor.mTargetSize.GetVectorXY());
}
}
- DALI_LOG_TIMER_END( NegSizeTimer1, gLogRelayoutFilter, Debug::Concise, "NegotiateSize() took: ");
+ DALI_LOG_TIMER_END(NegSizeTimer1, gLogRelayoutFilter, Debug::Concise, "NegotiateSize() took: ");
}
} // namespace Internal
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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 <cstring> // for strcmp
// INTERNAL INCLUDES
-#include <dali/public-api/object/type-registry.h>
#include <dali/devel-api/actors/camera-actor-devel.h>
-#include <dali/internal/event/common/property-helper.h>
#include <dali/internal/event/common/projection.h>
+#include <dali/internal/event/common/property-helper.h>
#include <dali/internal/event/common/thread-local-storage.h>
+#include <dali/public-api/object/type-registry.h>
+
+#include <dali/internal/update/manager/update-manager.h>
namespace Dali
{
-
namespace Internal
{
-
namespace
{
-
// Properties
/**
* particularly for the default properties.
* Name Type writable animatable constraint-input enum for index-checking
*/
+// clang-format off
DALI_PROPERTY_TABLE_BEGIN
DALI_PROPERTY( "type", STRING, true, false, true, Dali::CameraActor::Property::TYPE )
DALI_PROPERTY( "projectionMode", STRING, true, false, true, Dali::CameraActor::Property::PROJECTION_MODE )
DALI_PROPERTY( "viewMatrix", MATRIX, false, false, true, Dali::CameraActor::Property::VIEW_MATRIX )
DALI_PROPERTY( "invertYAxis", BOOLEAN, true, false, true, Dali::CameraActor::Property::INVERT_Y_AXIS )
DALI_PROPERTY_TABLE_END( DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX, CameraDefaultProperties )
+// clang-format on
// calculate the far plane distance for a 16bit depth buffer with 4 bits per unit precision
-void CalculateClippingAndZ( float width, float height, float& nearClippingPlane, float& farClippingPlane, float& cameraZ )
+void CalculateClippingAndZ(float width, float height, float& nearClippingPlane, float& farClippingPlane, float& cameraZ)
{
- nearClippingPlane = std::max( width, height );
- farClippingPlane = nearClippingPlane + static_cast<float>( 0xFFFF >> 4 );
- cameraZ = 2.0f * nearClippingPlane;
+ nearClippingPlane = std::max(width, height);
+ farClippingPlane = nearClippingPlane + static_cast<float>(0xFFFF >> 4);
+ cameraZ = 2.0f * nearClippingPlane;
}
BaseHandle Create()
return Dali::CameraActor::New();
}
-TypeRegistration mType( typeid( Dali::CameraActor ), typeid( Dali::Actor ), Create, CameraDefaultProperties );
+TypeRegistration mType(typeid(Dali::CameraActor), typeid(Dali::Actor), Create, CameraDefaultProperties);
/**
* Builds the picking ray in the world reference system from an orthographic camera
* plane at the camera origin. The ray direction is the direction the camera is facing
* (i.e. Z=-1 in view space).
*/
-void BuildOrthoPickingRay( const Matrix& viewMatrix,
- const Matrix& projectionMatrix,
- const Viewport& viewport,
- float screenX,
- float screenY,
- Vector4& rayOrigin,
- Vector4& rayDir,
- float nearPlaneDistance )
+void BuildOrthoPickingRay(const Matrix& viewMatrix,
+ const Matrix& projectionMatrix,
+ const Viewport& viewport,
+ float screenX,
+ float screenY,
+ Vector4& rayOrigin,
+ Vector4& rayDir,
+ float nearPlaneDistance)
{
// inv( modelMatrix ) inv( viewMatrix ) inv( projectionMatrix ) normalize
// <----------------- <----------------- <-------------- <-------------
// modelMatrix viewMatrix projectionMatrix viewport
// Transforms the touch point from the screen reference system to the world reference system.
- Matrix invViewProjection( false ); // Don't initialize.
- Matrix::Multiply( invViewProjection, viewMatrix, projectionMatrix );
- if( !invViewProjection.Invert() )
+ Matrix invViewProjection(false); // Don't initialize.
+ Matrix::Multiply(invViewProjection, viewMatrix, projectionMatrix);
+ if(!invViewProjection.Invert())
{
- DALI_ASSERT_DEBUG( false );
+ DALI_ASSERT_DEBUG(false);
}
- Vector4 near( screenX - static_cast<float>( viewport.x ),
- static_cast<float>( viewport.height ) - (screenY - static_cast<float>( viewport.y ) ),
- 0.f, 1.f );
- if( !Unproject( near, invViewProjection, static_cast<float>( viewport.width ), static_cast<float>( viewport.height ), rayOrigin ) )
+ Vector4 near(screenX - static_cast<float>(viewport.x),
+ static_cast<float>(viewport.height) - (screenY - static_cast<float>(viewport.y)),
+ 0.f,
+ 1.f);
+ if(!Unproject(near, invViewProjection, static_cast<float>(viewport.width), static_cast<float>(viewport.height), rayOrigin))
{
- DALI_ASSERT_DEBUG( false );
+ DALI_ASSERT_DEBUG(false);
}
Matrix invView = viewMatrix;
- if( !invView.Invert() )
+ if(!invView.Invert())
{
- DALI_ASSERT_DEBUG( false );
+ DALI_ASSERT_DEBUG(false);
}
- Vector4 cameraOrigin = invView * Vector4( 0.f, 0.f, 0.f, 1.f );
- Vector4 nearPlaneOrigin = invView * Vector4( 0.0f, 0.0f, -nearPlaneDistance, 1.0f);
+ Vector4 cameraOrigin = invView * Vector4(0.f, 0.f, 0.f, 1.f);
+ Vector4 nearPlaneOrigin = invView * Vector4(0.0f, 0.0f, -nearPlaneDistance, 1.0f);
// Vector pointing from the camera to the near plane
rayDir = cameraOrigin - nearPlaneOrigin;
} // namespace
-CameraActorPtr CameraActor::New( const Size& size )
+CameraActorPtr CameraActor::New(const Size& size)
{
- CameraActorPtr actor( new CameraActor( *CreateNode() ) );
+ CameraActorPtr actor(new CameraActor(*CreateNode()));
// Second-phase construction
actor->Initialize();
- actor->SetName( "DefaultCamera" );
- actor->SetPerspectiveProjection( size );
+ actor->SetName("DefaultCamera");
+ actor->SetPerspectiveProjection(size);
// By default Actors face in the positive Z direction in world space
// CameraActors should face in the negative Z direction, towards the other actors
- actor->SetOrientation( Quaternion( Dali::ANGLE_180, Vector3::YAXIS ) );
+ actor->SetOrientation(Quaternion(Dali::ANGLE_180, Vector3::YAXIS));
return actor;
}
-CameraActor::CameraActor( const SceneGraph::Node& node )
-: Actor( Actor::BASIC, node ),
- mSceneObject( nullptr ),
- mTarget( SceneGraph::Camera::DEFAULT_TARGET_POSITION ),
- mType( SceneGraph::Camera::DEFAULT_TYPE ),
- mProjectionMode( SceneGraph::Camera::DEFAULT_MODE ),
- mFieldOfView( SceneGraph::Camera::DEFAULT_FIELD_OF_VIEW ),
- mAspectRatio( SceneGraph::Camera::DEFAULT_ASPECT_RATIO ),
- mNearClippingPlane( SceneGraph::Camera::DEFAULT_NEAR_CLIPPING_PLANE ),
- mFarClippingPlane( SceneGraph::Camera::DEFAULT_FAR_CLIPPING_PLANE ),
- mLeftClippingPlane( SceneGraph::Camera::DEFAULT_LEFT_CLIPPING_PLANE ),
- mRightClippingPlane( SceneGraph::Camera::DEFAULT_RIGHT_CLIPPING_PLANE ),
- mTopClippingPlane( SceneGraph::Camera::DEFAULT_TOP_CLIPPING_PLANE ),
- mBottomClippingPlane( SceneGraph::Camera::DEFAULT_BOTTOM_CLIPPING_PLANE ),
- mInvertYAxis( SceneGraph::Camera::DEFAULT_INVERT_Y_AXIS )
+CameraActor::CameraActor(const SceneGraph::Node& node)
+: Actor(Actor::BASIC, node),
+ mSceneObject(nullptr),
+ mTarget(SceneGraph::Camera::DEFAULT_TARGET_POSITION),
+ mType(SceneGraph::Camera::DEFAULT_TYPE),
+ mProjectionMode(SceneGraph::Camera::DEFAULT_MODE),
+ mFieldOfView(SceneGraph::Camera::DEFAULT_FIELD_OF_VIEW),
+ mAspectRatio(SceneGraph::Camera::DEFAULT_ASPECT_RATIO),
+ mNearClippingPlane(SceneGraph::Camera::DEFAULT_NEAR_CLIPPING_PLANE),
+ mFarClippingPlane(SceneGraph::Camera::DEFAULT_FAR_CLIPPING_PLANE),
+ mLeftClippingPlane(SceneGraph::Camera::DEFAULT_LEFT_CLIPPING_PLANE),
+ mRightClippingPlane(SceneGraph::Camera::DEFAULT_RIGHT_CLIPPING_PLANE),
+ mTopClippingPlane(SceneGraph::Camera::DEFAULT_TOP_CLIPPING_PLANE),
+ mBottomClippingPlane(SceneGraph::Camera::DEFAULT_BOTTOM_CLIPPING_PLANE),
+ mInvertYAxis(SceneGraph::Camera::DEFAULT_INVERT_Y_AXIS)
{
}
CameraActor::~CameraActor()
{
- if( EventThreadServices::IsCoreRunning() )
+ if(EventThreadServices::IsCoreRunning())
{
// Create scene-object and transfer ownership through message
- RemoveCameraMessage( GetEventThreadServices().GetUpdateManager(), mSceneObject );
+ RemoveCameraMessage(GetEventThreadServices().GetUpdateManager(), mSceneObject);
}
}
SceneGraph::Camera* sceneGraphCamera = SceneGraph::Camera::New();
// Store a pointer to this camera node inside the scene-graph camera.
- sceneGraphCamera->SetNode( &GetNode() );
+ sceneGraphCamera->SetNode(&GetNode());
mSceneObject = sceneGraphCamera;
- OwnerPointer< SceneGraph::Camera > sceneGraphCameraOwner( sceneGraphCamera );
+ OwnerPointer<SceneGraph::Camera> sceneGraphCameraOwner(sceneGraphCamera);
// Send message to inform update of this camera (and move ownership).
- AddCameraMessage( GetEventThreadServices().GetUpdateManager(), sceneGraphCameraOwner );
+ AddCameraMessage(GetEventThreadServices().GetUpdateManager(), sceneGraphCameraOwner);
}
void CameraActor::OnSceneConnectionInternal()
{
// If the canvas size has not been set, then use the size of the scene we've been added to to set up the perspective projection
- if( ( mCanvasSize.width < Math::MACHINE_EPSILON_1000 ) || ( mCanvasSize.height < Math::MACHINE_EPSILON_1000 ) )
+ if((mCanvasSize.width < Math::MACHINE_EPSILON_1000) || (mCanvasSize.height < Math::MACHINE_EPSILON_1000))
{
- SetPerspectiveProjection( GetScene().GetSize() );
+ SetPerspectiveProjection(GetScene().GetSize());
}
}
-void CameraActor::SetReflectByPlane(const Vector4& plane) {
+void CameraActor::SetReflectByPlane(const Vector4& plane)
+{
SceneGraph::Camera* cam = const_cast<SceneGraph::Camera*>(GetCamera());
- if (cam)
+ if(cam)
{
cam->SetReflectByPlane(plane);
}
}
-void CameraActor::SetTarget( const Vector3& target )
+void CameraActor::SetTarget(const Vector3& target)
{
- if( target != mTarget ) // using range epsilon
+ if(target != mTarget) // using range epsilon
{
mTarget = target;
- SetTargetPositionMessage( GetEventThreadServices(), *mSceneObject, mTarget );
+ SetTargetPositionMessage(GetEventThreadServices(), *mSceneObject, mTarget);
}
}
return mTarget;
}
-void CameraActor::SetType( Dali::Camera::Type type )
+void CameraActor::SetType(Dali::Camera::Type type)
{
- if( type != mType )
+ if(type != mType)
{
mType = type;
// sceneObject is being used in a separate thread; queue a message to set
- SetTypeMessage( GetEventThreadServices(), *mSceneObject, mType );
+ SetTypeMessage(GetEventThreadServices(), *mSceneObject, mType);
}
}
return mType;
}
-void CameraActor::SetProjectionMode( Dali::Camera::ProjectionMode mode )
+void CameraActor::SetProjectionMode(Dali::Camera::ProjectionMode mode)
{
- if( mode != mProjectionMode )
+ if(mode != mProjectionMode)
{
mProjectionMode = mode;
// sceneObject is being used in a separate thread; queue a message to set
- SetProjectionModeMessage( GetEventThreadServices(), *mSceneObject, mProjectionMode );
+ SetProjectionModeMessage(GetEventThreadServices(), *mSceneObject, mProjectionMode);
}
}
return mProjectionMode;
}
-void CameraActor::SetFieldOfView( float fieldOfView )
+void CameraActor::SetFieldOfView(float fieldOfView)
{
- if( ! Equals( fieldOfView, mFieldOfView ) )
+ if(!Equals(fieldOfView, mFieldOfView))
{
mFieldOfView = fieldOfView;
// sceneObject is being used in a separate thread; queue a message to set
- SetFieldOfViewMessage( GetEventThreadServices(), *mSceneObject, mFieldOfView );
+ SetFieldOfViewMessage(GetEventThreadServices(), *mSceneObject, mFieldOfView);
}
}
return mFieldOfView;
}
-void CameraActor::SetAspectRatio( float aspectRatio )
+void CameraActor::SetAspectRatio(float aspectRatio)
{
- if( ! Equals( aspectRatio, mAspectRatio ) )
+ if(!Equals(aspectRatio, mAspectRatio))
{
mAspectRatio = aspectRatio;
// sceneObject is being used in a separate thread; queue a message to set
- SetAspectRatioMessage( GetEventThreadServices(), *mSceneObject, mAspectRatio );
+ SetAspectRatioMessage(GetEventThreadServices(), *mSceneObject, mAspectRatio);
}
}
return mAspectRatio;
}
-void CameraActor::SetNearClippingPlane( float nearClippingPlane )
+void CameraActor::SetNearClippingPlane(float nearClippingPlane)
{
- if( ! Equals( nearClippingPlane, mNearClippingPlane ) )
+ if(!Equals(nearClippingPlane, mNearClippingPlane))
{
mNearClippingPlane = nearClippingPlane;
// sceneObject is being used in a separate thread; queue a message to set
- SetNearClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, mNearClippingPlane );
+ SetNearClippingPlaneMessage(GetEventThreadServices(), *mSceneObject, mNearClippingPlane);
}
}
return mNearClippingPlane;
}
-void CameraActor::SetFarClippingPlane( float farClippingPlane )
+void CameraActor::SetFarClippingPlane(float farClippingPlane)
{
- if( ! Equals( farClippingPlane, mFarClippingPlane ) )
+ if(!Equals(farClippingPlane, mFarClippingPlane))
{
mFarClippingPlane = farClippingPlane;
// sceneObject is being used in a separate thread; queue a message to set
- SetFarClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, mFarClippingPlane );
+ SetFarClippingPlaneMessage(GetEventThreadServices(), *mSceneObject, mFarClippingPlane);
}
}
return mFarClippingPlane;
}
-void CameraActor::SetLeftClippingPlane( float leftClippingPlane )
+void CameraActor::SetLeftClippingPlane(float leftClippingPlane)
{
- if( ! Equals( leftClippingPlane, mLeftClippingPlane ) )
+ if(!Equals(leftClippingPlane, mLeftClippingPlane))
{
mLeftClippingPlane = leftClippingPlane;
// sceneObject is being used in a separate thread; queue a message to set
- SetLeftClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, mLeftClippingPlane );
+ SetLeftClippingPlaneMessage(GetEventThreadServices(), *mSceneObject, mLeftClippingPlane);
}
}
-void CameraActor::SetRightClippingPlane( float rightClippingPlane )
+void CameraActor::SetRightClippingPlane(float rightClippingPlane)
{
- if( ! Equals( rightClippingPlane, mRightClippingPlane ) )
+ if(!Equals(rightClippingPlane, mRightClippingPlane))
{
mRightClippingPlane = rightClippingPlane;
// sceneObject is being used in a separate thread; queue a message to set
- SetRightClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, mRightClippingPlane );
+ SetRightClippingPlaneMessage(GetEventThreadServices(), *mSceneObject, mRightClippingPlane);
}
}
-void CameraActor::SetTopClippingPlane( float topClippingPlane )
+void CameraActor::SetTopClippingPlane(float topClippingPlane)
{
- if( ! Equals( topClippingPlane, mTopClippingPlane ) )
+ if(!Equals(topClippingPlane, mTopClippingPlane))
{
mTopClippingPlane = topClippingPlane;
// sceneObject is being used in a separate thread; queue a message to set
- SetTopClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, mTopClippingPlane );
+ SetTopClippingPlaneMessage(GetEventThreadServices(), *mSceneObject, mTopClippingPlane);
}
}
-void CameraActor::SetBottomClippingPlane( float bottomClippingPlane )
+void CameraActor::SetBottomClippingPlane(float bottomClippingPlane)
{
- if( ! Equals( bottomClippingPlane, mBottomClippingPlane ) )
+ if(!Equals(bottomClippingPlane, mBottomClippingPlane))
{
mBottomClippingPlane = bottomClippingPlane;
// sceneObject is being used in a separate thread; queue a message to set
- SetBottomClippingPlaneMessage( GetEventThreadServices(), *mSceneObject, mBottomClippingPlane );
+ SetBottomClippingPlaneMessage(GetEventThreadServices(), *mSceneObject, mBottomClippingPlane);
}
}
void CameraActor::SetInvertYAxis(bool invertYAxis)
{
- if( invertYAxis != mInvertYAxis )
+ if(invertYAxis != mInvertYAxis)
{
mInvertYAxis = invertYAxis;
// sceneObject is being used in a separate thread; queue a message to set
- SetInvertYAxisMessage( GetEventThreadServices(), *mSceneObject, mInvertYAxis );
+ SetInvertYAxisMessage(GetEventThreadServices(), *mSceneObject, mInvertYAxis);
}
}
return mInvertYAxis;
}
-void CameraActor::SetPerspectiveProjection( const Size& size )
+void CameraActor::SetPerspectiveProjection(const Size& size)
{
mCanvasSize = size;
- if( ( size.width < Math::MACHINE_EPSILON_1000 ) || ( size.height < Math::MACHINE_EPSILON_1000 ) )
+ if((size.width < Math::MACHINE_EPSILON_1000) || (size.height < Math::MACHINE_EPSILON_1000))
{
// If the size given is invalid, i.e. ZERO, then check if we've been added to a scene
- if( OnScene() )
+ if(OnScene())
{
// We've been added to a scene already, set the canvas size to the scene's size
mCanvasSize = GetScene().GetSize();
}
}
- float width = mCanvasSize.width;
+ float width = mCanvasSize.width;
float height = mCanvasSize.height;
float nearClippingPlane;
float farClippingPlane;
float cameraZ;
- CalculateClippingAndZ( width, height, nearClippingPlane, farClippingPlane, cameraZ );
+ CalculateClippingAndZ(width, height, nearClippingPlane, farClippingPlane, cameraZ);
// calculate the position of the camera to have the desired aspect ratio
- const float fieldOfView = 2.0f * std::atan( height * 0.5f / cameraZ );
+ const float fieldOfView = 2.0f * std::atan(height * 0.5f / cameraZ);
// unless it is too small, we want at least as much space to the back as we have torwards the front
const float minClippingFarPlane = 2.f * nearClippingPlane;
- if ( farClippingPlane < minClippingFarPlane )
+ if(farClippingPlane < minClippingFarPlane)
{
farClippingPlane = minClippingFarPlane;
}
// sceneObject is being used in a separate thread; queue a message to set
SetProjectionMode(Dali::Camera::PERSPECTIVE_PROJECTION);
- SetFieldOfView( fieldOfView );
- SetNearClippingPlane( nearClippingPlane );
- SetFarClippingPlane( farClippingPlane );
- SetAspectRatio( aspectRatio );
- SetZ( cameraZ );
+ SetFieldOfView(fieldOfView);
+ SetNearClippingPlane(nearClippingPlane);
+ SetFarClippingPlane(farClippingPlane);
+ SetAspectRatio(aspectRatio);
+ SetZ(cameraZ);
}
-
-void CameraActor::SetOrthographicProjection( const Vector2& size )
+void CameraActor::SetOrthographicProjection(const Vector2& size)
{
// Choose near, far and Z parameters to match the SetPerspectiveProjection above.
float nearClippingPlane;
float farClippingPlane;
float cameraZ;
- CalculateClippingAndZ( size.width, size.height, nearClippingPlane, farClippingPlane, cameraZ );
- SetOrthographicProjection( -size.x*0.5f, size.x*0.5f, size.y*0.5f, -size.y*0.5f,
- nearClippingPlane, farClippingPlane );
- SetZ( cameraZ );
+ CalculateClippingAndZ(size.width, size.height, nearClippingPlane, farClippingPlane, cameraZ);
+ SetOrthographicProjection(-size.x * 0.5f, size.x * 0.5f, size.y * 0.5f, -size.y * 0.5f, nearClippingPlane, farClippingPlane);
+ SetZ(cameraZ);
}
-void CameraActor::SetOrthographicProjection( float left, float right, float top, float bottom, float near, float far )
+void CameraActor::SetOrthographicProjection(float left, float right, float top, float bottom, float near, float far)
{
- SetLeftClippingPlane( left );
- SetRightClippingPlane( right );
- SetTopClippingPlane( top );
- SetBottomClippingPlane( bottom );
- SetNearClippingPlane( near );
- SetFarClippingPlane( far );
- SetProjectionMode( Dali::Camera::ORTHOGRAPHIC_PROJECTION );
+ SetLeftClippingPlane(left);
+ SetRightClippingPlane(right);
+ SetTopClippingPlane(top);
+ SetBottomClippingPlane(bottom);
+ SetNearClippingPlane(near);
+ SetFarClippingPlane(far);
+ SetProjectionMode(Dali::Camera::ORTHOGRAPHIC_PROJECTION);
}
-bool CameraActor::BuildPickingRay( const Vector2& screenCoordinates,
- const Viewport& viewport,
- Vector4& rayOrigin,
- Vector4& rayDirection )
+bool CameraActor::BuildPickingRay(const Vector2& screenCoordinates,
+ const Viewport& viewport,
+ Vector4& rayOrigin,
+ Vector4& rayDirection)
{
bool success = true;
- if( mProjectionMode == Dali::Camera::PERSPECTIVE_PROJECTION )
+ if(mProjectionMode == Dali::Camera::PERSPECTIVE_PROJECTION)
{
// Build a picking ray in the world reference system.
// ray starts from the camera world position
- rayOrigin = GetNode().GetWorldMatrix(0).GetTranslation();
+ rayOrigin = GetNode().GetWorldMatrix(0).GetTranslation();
rayOrigin.w = 1.0f;
// Transform the touch point from the screen coordinate system to the world coordinates system.
- Vector4 near( screenCoordinates.x - static_cast<float>(viewport.x),
- static_cast<float>( viewport.height ) - (screenCoordinates.y - static_cast<float>( viewport.y ) ),
- 0.f, 1.f );
- const Matrix& inverseViewProjection = mSceneObject->GetInverseViewProjectionMatrix( GetEventThreadServices().GetEventBufferIndex() );
- success = Unproject( near, inverseViewProjection, static_cast<float>( viewport.width ), static_cast<float>( viewport.height ), near );
+ Vector4 near(screenCoordinates.x - static_cast<float>(viewport.x),
+ static_cast<float>(viewport.height) - (screenCoordinates.y - static_cast<float>(viewport.y)),
+ 0.f,
+ 1.f);
+ const Matrix& inverseViewProjection = mSceneObject->GetInverseViewProjectionMatrix(GetEventThreadServices().GetEventBufferIndex());
+ success = Unproject(near, inverseViewProjection, static_cast<float>(viewport.width), static_cast<float>(viewport.height), near);
// Compute the ray's director vector.
rayDirection.x = near.x - rayOrigin.x;
else
{
float nearPlaneDistance = GetNearClippingPlane();
- BuildOrthoPickingRay( GetViewMatrix(),
- GetProjectionMatrix(),
- viewport, screenCoordinates.x,
- screenCoordinates.y,
- rayOrigin,
- rayDirection,
- nearPlaneDistance );
+ BuildOrthoPickingRay(GetViewMatrix(),
+ GetProjectionMatrix(),
+ viewport,
+ screenCoordinates.x,
+ screenCoordinates.y,
+ rayOrigin,
+ rayDirection,
+ nearPlaneDistance);
}
return success;
const Matrix& CameraActor::GetViewMatrix() const
{
- if ( OnScene() )
+ if(OnScene())
{
- return mSceneObject->GetViewMatrix( GetEventThreadServices().GetEventBufferIndex() );
+ return mSceneObject->GetViewMatrix(GetEventThreadServices().GetEventBufferIndex());
}
else
{
const Matrix& CameraActor::GetProjectionMatrix() const
{
- if ( OnScene() )
+ if(OnScene())
{
- return mSceneObject->GetProjectionMatrix( GetEventThreadServices().GetEventBufferIndex() );
+ return mSceneObject->GetProjectionMatrix(GetEventThreadServices().GetEventBufferIndex());
}
else
{
RotateProjectionMessage(GetEventThreadServices(), *mSceneObject, rotationAngle);
}
-void CameraActor::SetDefaultProperty( Property::Index index, const Property::Value& propertyValue )
+void CameraActor::SetDefaultProperty(Property::Index index, const Property::Value& propertyValue)
{
if(index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT)
{
{
case Dali::CameraActor::Property::TYPE:
{
- std::string s( propertyValue.Get<std::string>() );
+ std::string s(propertyValue.Get<std::string>());
if(s == "LOOK_AT_TARGET")
{
- SetType( Dali::Camera::LOOK_AT_TARGET );
+ SetType(Dali::Camera::LOOK_AT_TARGET);
}
else if(s == "FREE_LOOK")
{
- SetType( Dali::Camera::FREE_LOOK );
+ SetType(Dali::Camera::FREE_LOOK);
}
break;
}
case Dali::CameraActor::Property::PROJECTION_MODE:
{
- std::string s( propertyValue.Get<std::string>() );
- if( s == "PERSPECTIVE_PROJECTION" )
+ std::string s(propertyValue.Get<std::string>());
+ if(s == "PERSPECTIVE_PROJECTION")
{
- SetProjectionMode( Dali::Camera::PERSPECTIVE_PROJECTION );
+ SetProjectionMode(Dali::Camera::PERSPECTIVE_PROJECTION);
}
- else if( s == "ORTHOGRAPHIC_PROJECTION" )
+ else if(s == "ORTHOGRAPHIC_PROJECTION")
{
- SetProjectionMode( Dali::Camera::ORTHOGRAPHIC_PROJECTION );
+ SetProjectionMode(Dali::Camera::ORTHOGRAPHIC_PROJECTION);
}
break;
}
case Dali::CameraActor::Property::FIELD_OF_VIEW:
{
- SetFieldOfView( propertyValue.Get<float>() ); // set to 0 in case property is not float
+ SetFieldOfView(propertyValue.Get<float>()); // set to 0 in case property is not float
break;
}
case Dali::CameraActor::Property::ASPECT_RATIO:
{
- SetAspectRatio( propertyValue.Get<float>() ); // set to 0 in case property is not float
+ SetAspectRatio(propertyValue.Get<float>()); // set to 0 in case property is not float
break;
}
case Dali::CameraActor::Property::NEAR_PLANE_DISTANCE:
{
- SetNearClippingPlane( propertyValue.Get<float>() ); // set to 0 in case property is not float
+ SetNearClippingPlane(propertyValue.Get<float>()); // set to 0 in case property is not float
break;
}
case Dali::CameraActor::Property::FAR_PLANE_DISTANCE:
{
- SetFarClippingPlane( propertyValue.Get<float>() ); // set to 0 in case property is not float
+ SetFarClippingPlane(propertyValue.Get<float>()); // set to 0 in case property is not float
break;
}
case Dali::CameraActor::Property::LEFT_PLANE_DISTANCE:
{
- SetLeftClippingPlane( propertyValue.Get<float>() ); // set to 0 in case property is not float
+ SetLeftClippingPlane(propertyValue.Get<float>()); // set to 0 in case property is not float
break;
}
case Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE:
{
- SetRightClippingPlane( propertyValue.Get<float>() ); // set to 0 in case property is not float
+ SetRightClippingPlane(propertyValue.Get<float>()); // set to 0 in case property is not float
break;
}
case Dali::CameraActor::Property::TOP_PLANE_DISTANCE:
{
- SetTopClippingPlane( propertyValue.Get<float>() ); // set to 0 in case property is not float
+ SetTopClippingPlane(propertyValue.Get<float>()); // set to 0 in case property is not float
break;
}
case Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE:
{
- SetBottomClippingPlane( propertyValue.Get<float>() ); // set to 0 in case property is not float
+ SetBottomClippingPlane(propertyValue.Get<float>()); // set to 0 in case property is not float
break;
}
case Dali::CameraActor::Property::TARGET_POSITION:
{
- SetTarget( propertyValue.Get<Vector3>() ); // set to 0 in case property is not Vector3
+ SetTarget(propertyValue.Get<Vector3>()); // set to 0 in case property is not Vector3
break;
}
case Dali::CameraActor::Property::PROJECTION_MATRIX:
{
- DALI_LOG_WARNING( "projection-matrix is read-only\n" );
+ DALI_LOG_WARNING("projection-matrix is read-only\n");
break;
}
case Dali::CameraActor::Property::VIEW_MATRIX:
{
- DALI_LOG_WARNING( "view-matrix is read-only\n" );
+ DALI_LOG_WARNING("view-matrix is read-only\n");
break;
}
case Dali::CameraActor::Property::INVERT_Y_AXIS:
{
- SetInvertYAxis( propertyValue.Get<bool>() ); // set to false in case property is not bool
+ SetInvertYAxis(propertyValue.Get<bool>()); // set to false in case property is not bool
break;
}
case Dali::DevelCameraActor::Property::REFLECTION_PLANE:
{
- SetReflectByPlane( propertyValue.Get<Vector4>() );
+ SetReflectByPlane(propertyValue.Get<Vector4>());
break;
}
default:
{
- DALI_LOG_WARNING( "Unknown property (%d)\n", index );
+ DALI_LOG_WARNING("Unknown property (%d)\n", index);
break;
}
} // switch(index)
} // else
}
-Property::Value CameraActor::GetDefaultProperty( Property::Index index ) const
+Property::Value CameraActor::GetDefaultProperty(Property::Index index) const
{
Property::Value ret;
- if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT )
+ if(index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT)
{
ret = Actor::GetDefaultProperty(index);
}
{
case Dali::CameraActor::Property::TYPE:
{
- if( Dali::Camera::LOOK_AT_TARGET == mType )
+ if(Dali::Camera::LOOK_AT_TARGET == mType)
{
ret = "LOOK_AT_TARGET";
}
- else if( Dali::Camera::FREE_LOOK == mType )
+ else if(Dali::Camera::FREE_LOOK == mType)
{
ret = "FREE_LOOK";
}
}
case Dali::CameraActor::Property::PROJECTION_MODE:
{
- if( Dali::Camera::PERSPECTIVE_PROJECTION == mProjectionMode )
+ if(Dali::Camera::PERSPECTIVE_PROJECTION == mProjectionMode)
{
ret = "PERSPECTIVE_PROJECTION";
}
- else if( Dali::Camera::ORTHOGRAPHIC_PROJECTION == mProjectionMode )
+ else if(Dali::Camera::ORTHOGRAPHIC_PROJECTION == mProjectionMode)
{
ret = "ORTHOGRAPHIC_PROJECTION";
}
return ret;
}
-Property::Value CameraActor::GetDefaultPropertyCurrentValue( Property::Index index ) const
+Property::Value CameraActor::GetDefaultPropertyCurrentValue(Property::Index index) const
{
Property::Value ret;
- if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT )
+ if(index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT)
{
ret = Actor::GetDefaultPropertyCurrentValue(index);
}
else
{
- ret = GetDefaultProperty( index ); // Most are event-side properties, the scene-graph properties are only on the scene-graph
+ ret = GetDefaultProperty(index); // Most are event-side properties, the scene-graph properties are only on the scene-graph
}
return ret;
}
-const PropertyInputImpl* CameraActor::GetSceneObjectInputProperty( Property::Index index ) const
+const PropertyInputImpl* CameraActor::GetSceneObjectInputProperty(Property::Index index) const
{
- const PropertyInputImpl* property( nullptr );
+ const PropertyInputImpl* property(nullptr);
- switch( index )
+ switch(index)
{
case Dali::CameraActor::Property::PROJECTION_MATRIX:
{
property = mSceneObject->GetViewMatrix();
break;
}
- // no default on purpose as we chain method up to actor
+ // no default on purpose as we chain method up to actor
}
- if( !property )
+ if(!property)
{
- property = Actor::GetSceneObjectInputProperty( index );
+ property = Actor::GetSceneObjectInputProperty(index);
}
return property;
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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/internal/event/common/property-helper.h>
#include <dali/internal/event/common/scene-impl.h>
+#include <dali/internal/update/manager/update-manager.h>
+#include <dali/internal/update/nodes/scene-graph-layer.h>
+
using Dali::Internal::SceneGraph::UpdateManager;
namespace Dali
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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 HEADER
#include <dali/internal/event/animation/animation-playlist.h>
-
// INTERNAL INCLUDES
-#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/integration-api/debug.h>
#include <dali/internal/event/animation/animation-impl.h>
-
+#include <dali/public-api/common/vector-wrapper.h>
namespace Dali
{
-
namespace Internal
{
-
AnimationPlaylist* AnimationPlaylist::New()
{
return new AnimationPlaylist();
AnimationPlaylist::~AnimationPlaylist() = default;
-void AnimationPlaylist::AnimationCreated( Animation& animation )
+void AnimationPlaylist::AnimationCreated(Animation& animation)
{
- mAnimations.PushBack( &animation );
+ mAnimations.PushBack(&animation);
}
-void AnimationPlaylist::AnimationDestroyed( Animation& animation )
+void AnimationPlaylist::AnimationDestroyed(Animation& animation)
{
- Dali::Vector< Animation* >::Iterator iter = std::find( mAnimations.Begin(), mAnimations.End(), &animation );
- DALI_ASSERT_ALWAYS( iter != mAnimations.End() && "Animation not found" );
+ Dali::Vector<Animation*>::Iterator iter = std::find(mAnimations.Begin(), mAnimations.End(), &animation);
+ DALI_ASSERT_ALWAYS(iter != mAnimations.End() && "Animation not found");
- mAnimations.Remove( iter );
+ mAnimations.Remove(iter);
}
-void AnimationPlaylist::OnPlay( Animation& animation )
+void AnimationPlaylist::OnPlay(Animation& animation)
{
- mPlaylist.push_back( Dali::Animation(&animation) );
+ mPlaylist.push_back(Dali::Animation(&animation));
}
-void AnimationPlaylist::OnClear( Animation& animation )
+void AnimationPlaylist::OnClear(Animation& animation)
{
- std::vector< Dali::Animation >::iterator iter = std::find( mPlaylist.begin(), mPlaylist.end(), Dali::Animation(&animation) );
- std::vector< Dali::Animation >::iterator last = mPlaylist.end();
- if( iter != last )
+ std::vector<Dali::Animation>::iterator iter = std::find(mPlaylist.begin(), mPlaylist.end(), Dali::Animation(&animation));
+ std::vector<Dali::Animation>::iterator last = mPlaylist.end();
+ if(iter != last)
{
- --last; // move to real last
- std::swap( *iter, *last ); // swap
- mPlaylist.resize( mPlaylist.size() - 1u );
+ --last; // move to real last
+ std::swap(*iter, *last); // swap
+ mPlaylist.resize(mPlaylist.size() - 1u);
}
}
void AnimationPlaylist::NotifyCompleted()
{
- std::vector< Dali::Animation > finishedAnimations;
+ std::vector<Dali::Animation> finishedAnimations;
// Since animations can be unreferenced during the signal emissions, iterators into animationPointers may be invalidated.
// First copy and reference the finished animations, then emit signals
- for ( Dali::Vector< Animation* >::Iterator iter = mAnimations.Begin(); iter != mAnimations.End(); ++iter )
+ for(Dali::Vector<Animation*>::Iterator iter = mAnimations.Begin(); iter != mAnimations.End(); ++iter)
{
Animation* animation = *iter;
- if ( animation->HasFinished() )
+ if(animation->HasFinished())
{
- finishedAnimations.push_back( Dali::Animation(animation) );
+ finishedAnimations.push_back(Dali::Animation(animation));
// The animation may be present in mPlaylist - remove if necessary
// Note that the animation "Finish" signal is emitted after Stop() has been called
- std::vector< Dali::Animation >::iterator iter = std::find( mPlaylist.begin(), mPlaylist.end(), Dali::Animation(animation) );
+ std::vector<Dali::Animation>::iterator iter = std::find(mPlaylist.begin(), mPlaylist.end(), Dali::Animation(animation));
DALI_ASSERT_DEBUG(iter != mPlaylist.end());
- mPlaylist.erase( iter );
+ mPlaylist.erase(iter);
}
}
// Now it's safe to emit the signals
- for ( std::vector< Dali::Animation >::iterator iter = finishedAnimations.begin(); iter != finishedAnimations.end(); ++iter )
+ for(std::vector<Dali::Animation>::iterator iter = finishedAnimations.begin(); iter != finishedAnimations.end(); ++iter)
{
Dali::Animation& handle = *iter;
}
}
-void AnimationPlaylist::NotifyProgressReached( const SceneGraph::Animation* sceneGraphAnimation )
+void AnimationPlaylist::NotifyProgressReached(const SceneGraph::Animation* sceneGraphAnimation)
{
- std::vector< Dali::Animation > notifyProgressAnimations; // Will own animations until all emits have been done
+ std::vector<Dali::Animation> notifyProgressAnimations; // Will own animations until all emits have been done
- for ( Dali::Vector< Animation* >::Iterator iter = mAnimations.Begin(); iter != mAnimations.End(); ++iter )
+ for(Dali::Vector<Animation*>::Iterator iter = mAnimations.Begin(); iter != mAnimations.End(); ++iter)
{
Animation* animation = *iter;
- if ( ( animation->GetSceneObject() ) == sceneGraphAnimation )
+ if((animation->GetSceneObject()) == sceneGraphAnimation)
{
// Store handles to animations that need signals emitted in the case of an animation being cleared in-between emits
- notifyProgressAnimations.push_back( Dali::Animation( animation ) );
+ notifyProgressAnimations.push_back(Dali::Animation(animation));
}
}
- for ( std::vector< Dali::Animation >::iterator iter = notifyProgressAnimations.begin(); iter != notifyProgressAnimations.end(); ++iter )
+ for(std::vector<Dali::Animation>::iterator iter = notifyProgressAnimations.begin(); iter != notifyProgressAnimations.end(); ++iter)
{
Dali::Animation& handle = *iter;
return mAnimations.Size();
}
-Dali::Animation AnimationPlaylist::GetAnimationAt( uint32_t index )
+Dali::Animation AnimationPlaylist::GetAnimationAt(uint32_t index)
{
- if( index >= mAnimations.Size() )
+ if(index >= mAnimations.Size())
{
- DALI_LOG_ERROR( "Animation index is out of bounds.\n" );
+ DALI_LOG_ERROR("Animation index is out of bounds.\n");
return Dali::Animation();
}
- return Dali::Animation( mAnimations[index] );
+ return Dali::Animation(mAnimations[index]);
}
} // namespace Internal
#define DALI_INTERNAL_ANIMATION_PLAYLIST_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
*/
// INTERNAL INCLUDES
+#include <dali/internal/common/message.h>
+#include <dali/internal/event/common/complete-notification-interface.h>
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/common/vector-wrapper.h>
-#include <dali/internal/common/message.h>
-#include <dali/internal/event/common/complete-notification-interface.h>
-#include <dali/internal/update/animation/scene-graph-animation.h>
namespace Dali
{
-
namespace Internal
{
+namespace SceneGraph
+{
+class Animation;
+}
class Animation;
class AnimationPlaylist : public CompleteNotificationInterface
{
public:
-
/**
* Create an AnimationPlaylist.
* @return A newly allocated animation playlist.
/**
* Called when an animation is constructed.
*/
- void AnimationCreated( Animation& animation );
+ void AnimationCreated(Animation& animation);
/**
* Called when an animation is destroyed.
*/
- void AnimationDestroyed( Animation& animation );
+ void AnimationDestroyed(Animation& animation);
/**
* Called when an animation is playing.
* @post The animation will be referenced by AnimationPlaylist, until the "Finished" signal is emitted.
*/
- void OnPlay( Animation& animation );
+ void OnPlay(Animation& animation);
/**
* Called when an animation is cleared.
* @post The animation will no longer be referenced by AnimationPlaylist.
*/
- void OnClear( Animation& animation );
+ void OnClear(Animation& animation);
/**
* @brief Notify that an animation has reached a progress marker
* @param[in] sceneGraphAnimation scene graph animation that has reached progress
*/
- void NotifyProgressReached( const SceneGraph::Animation* sceneGraphAnimation );
+ void NotifyProgressReached(const SceneGraph::Animation* sceneGraphAnimation);
/**
* @brief Retrive the number of Animations.
* @param[in] index The index of the Animation to retrieve
* @return The Dali::Animation for the given index or empty handle
*/
- Dali::Animation GetAnimationAt( uint32_t index );
+ Dali::Animation GetAnimationAt(uint32_t index);
private:
-
/**
* Create an AnimationPlaylist.
*/
AnimationPlaylist& operator=(const AnimationPlaylist& rhs);
private: // from CompleteNotificationInterface
-
/**
* @copydoc CompleteNotificationInterface::NotifyCompleted()
*/
void NotifyCompleted() override;
private:
-
- Dali::Vector< Animation* > mAnimations; ///< All existing animations (not owned)
- std::vector< Dali::Animation > mPlaylist; ///< The currently playing animations (owned through handle)
-
+ Dali::Vector<Animation*> mAnimations; ///< All existing animations (not owned)
+ std::vector<Dali::Animation> mPlaylist; ///< The currently playing animations (owned through handle)
};
/**
*
* Note animationPlaylist is of type CompleteNotificationInterface because of updateManager only knowing about the interface not actual playlist
*/
-inline MessageBase* NotifyProgressReachedMessage( CompleteNotificationInterface& animationPlaylist, const SceneGraph::Animation* animation )
+inline MessageBase* NotifyProgressReachedMessage(CompleteNotificationInterface& animationPlaylist, const SceneGraph::Animation* animation)
{
- return new MessageValue1< AnimationPlaylist, const SceneGraph::Animation* >( static_cast<AnimationPlaylist*>(&animationPlaylist), &AnimationPlaylist::NotifyProgressReached, animation );
+ return new MessageValue1<AnimationPlaylist, const SceneGraph::Animation*>(static_cast<AnimationPlaylist*>(&animationPlaylist), &AnimationPlaylist::NotifyProgressReached, animation);
}
} // namespace Internal
} // namespace Dali
#endif // DALI_INTERNAL_ANIMATION_PLAYLIST_H
-
#define DALI_INTERNAL_SCENE_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
// INTERNAL INCLUDES
#include <dali/integration-api/scene.h>
-#include <dali/public-api/math/vector2.h>
-#include <dali/public-api/actors/layer.h>
-#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/internal/common/owner-pointer.h>
#include <dali/internal/event/actors/layer-impl.h>
#include <dali/internal/event/events/event-processor.h>
#include <dali/internal/event/render-tasks/render-task-defaults.h>
+#include <dali/public-api/actors/layer.h>
+#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/render-tasks/render-task-list.h>
namespace Dali
{
-
namespace Integration
{
-
struct Event;
}
namespace Internal
{
+//@todo Break this dependence somehow.
+namespace Render
+{
+class Renderer;
+}
namespace SceneGraph
{
bool operator<(const DirtyRect& rhs) const
{
- if (node == rhs.node)
+ if(node == rhs.node)
{
- if (renderer == rhs.renderer)
+ if(renderer == rhs.renderer)
{
return frame > rhs.frame; // Most recent rects come first
}
}
}
- Node* node;
+ Node* node;
Render::Renderer* renderer;
- int frame;
+ int frame;
Rect<int> rect;
- bool visited;
+ bool visited;
};
-}
+} // namespace SceneGraph
class EventProcessor;
class Layer;
class FrameBuffer;
using FrameBufferPtr = IntrusivePtr<FrameBuffer>;
-using ScenePtr = IntrusivePtr<Scene>;
+using ScenePtr = IntrusivePtr<Scene>;
/**
* @brief Scene creates a "world" that can be bound to a surface for rendering.
*/
class Scene : public BaseObject, public RenderTaskDefaults
{
-
public:
/**
* @copydoc Dali::Integration::Scene::New
/**
* @copydoc Dali::Integration::Scene::SetDpi
*/
- void SetDpi( Vector2 dpi );
+ void SetDpi(Vector2 dpi);
/**
* @copydoc Dali::Integration::Scene::GetDpi
* @param[in] width The new width of the set surface
* @param[in] height The new height of the set surface
*/
- void SurfaceResized( float width, float height );
+ void SurfaceResized(float width, float height);
/**
* @copydoc Dali::Integration::Scene::SurfaceReplaced
* This function is called when an event is queued.
* @param[in] event A event to queue.
*/
- void QueueEvent( const Integration::Event& event );
+ void QueueEvent(const Integration::Event& event);
/**
* This function is called by Core when events are processed.
* @brief Sets the background color of the render surface.
* @param[in] color The new background color
*/
- void SetBackgroundColor( const Vector4& color );
+ void SetBackgroundColor(const Vector4& color);
/**
* @brief Gets the background color of the render surface.
* Emits the touched signal.
* @param[in] touch The touch event details.
*/
- void EmitTouchedSignal( const Dali::TouchEvent& touch );
+ void EmitTouchedSignal(const Dali::TouchEvent& touch);
/**
* Used by the EventProcessor to emit wheel event signals.
* @param[in] event The wheel event.
*/
- void EmitWheelEventSignal( const Dali::WheelEvent& event );
+ void EmitWheelEventSignal(const Dali::WheelEvent& event);
/**
* @copydoc Dali::Integration::Scene::AddFrameRenderedCallback
*/
- void AddFrameRenderedCallback( std::unique_ptr< CallbackBase > callback, int32_t frameId );
+ void AddFrameRenderedCallback(std::unique_ptr<CallbackBase> callback, int32_t frameId);
/**
* @copydoc Dali::Integration::Scene::AddFramePresentedCallback
*/
- void AddFramePresentedCallback( std::unique_ptr< CallbackBase > callback, int32_t frameId );
+ void AddFramePresentedCallback(std::unique_ptr<CallbackBase> callback, int32_t frameId);
/**
* @copydoc Dali::Integration::Scene::GetFrameRenderedCallback
*/
- void GetFrameRenderedCallback( Dali::Integration::Scene::FrameCallbackContainer& callbacks );
+ void GetFrameRenderedCallback(Dali::Integration::Scene::FrameCallbackContainer& callbacks);
/**
* @copydoc Dali::Integration::Scene::GetFramePresentedCallback
*/
- void GetFramePresentedCallback( Dali::Integration::Scene::FrameCallbackContainer& callbacks );
+ void GetFramePresentedCallback(Dali::Integration::Scene::FrameCallbackContainer& callbacks);
/**
* @copydoc Integration::Scene::KeyEventSignal()
*/
Integration::Scene::KeyEventSignalType& KeyEventSignal();
- /**
+ /**
* @copydoc Integration::Scene::KeyEventGeneratedSignal()
*/
Integration::Scene::KeyEventGeneratedSignalType& KeyEventGeneratedSignal();
std::vector<Dali::Internal::SceneGraph::DirtyRect>& GetItemsDirtyRects();
public:
-
/**
* From RenderTaskDefaults; retrieve the default root actor.
* @return The default root actor.
CameraActor& GetDefaultCameraActor() override;
private:
-
// Constructor
Scene();
// The list of render-tasks
IntrusivePtr<RenderTaskList> mRenderTaskList;
- bool mDepthTreeDirty:1; ///< True if the depth tree needs recalculating
+ bool mDepthTreeDirty : 1; ///< True if the depth tree needs recalculating
EventProcessor mEventProcessor;
int mSurfaceOrientation;
// The key event signal
- Integration::Scene::KeyEventSignalType mKeyEventSignal;
- Integration::Scene::KeyEventGeneratedSignalType mKeyEventGeneratedSignal;
+ Integration::Scene::KeyEventSignalType mKeyEventSignal;
+ Integration::Scene::KeyEventGeneratedSignalType mKeyEventGeneratedSignal;
// The event processing finished signal
Integration::Scene::EventProcessingFinishedSignalType mEventProcessingFinishedSignal;
// The wheel event signal
Integration::Scene::WheelEventSignalType mWheelEventSignal;
- std::vector<Dali::Internal::SceneGraph::DirtyRect> mItemsDirtyRects;
+ std::vector<Dali::Internal::SceneGraph::DirtyRect> mItemsDirtyRects;
};
-} // Internal
+} // namespace Internal
// Get impl of handle
inline Internal::Scene& GetImplementation(Dali::Integration::Scene& scene)
{
- DALI_ASSERT_ALWAYS( scene && "Scene handle is empty" );
+ DALI_ASSERT_ALWAYS(scene && "Scene handle is empty");
Dali::RefObject& object = scene.GetBaseObject();
return static_cast<Internal::Scene&>(object);
}
inline const Internal::Scene& GetImplementation(const Dali::Integration::Scene& scene)
{
- DALI_ASSERT_ALWAYS( scene && "Scene handle is empty" );
+ DALI_ASSERT_ALWAYS(scene && "Scene handle is empty");
const Dali::RefObject& object = scene.GetBaseObject();
return static_cast<const Internal::Scene&>(object);
}
-} // Dali
+} // namespace Dali
#endif // DALI_INTERNAL_SCENE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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/internal/event/common/thread-local-storage.h>
// INTERNAL INCLUDES
+#include <dali/integration-api/gl-abstraction.h>
+#include <dali/integration-api/processor-interface.h>
#include <dali/internal/common/core-impl.h>
-#include <dali/public-api/common/dali-common.h>
#include <dali/internal/event/common/event-thread-services.h>
-#include <dali/integration-api/processor-interface.h>
+#include <dali/public-api/common/dali-common.h>
#if defined(DEBUG_ENABLED)
#include <dali/integration-api/debug.h>
-Debug::Filter* gSingletonServiceLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_SINGLETON_SERVICE" );
+Debug::Filter* gSingletonServiceLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_SINGLETON_SERVICE");
// Need to define own macro as the log function is not installed when this object is created so no logging is shown with DALI_LOG_INFO at construction and destruction
-#define DALI_LOG_SINGLETON_SERVICE_DIRECT(level, message) \
- if(gSingletonServiceLogFilter && gSingletonServiceLogFilter->IsEnabledFor(level)) { std::string string(message); Dali::TizenPlatform::LogMessage( Debug::DebugInfo, string ); }
+#define DALI_LOG_SINGLETON_SERVICE_DIRECT(level, message) \
+ if(gSingletonServiceLogFilter && gSingletonServiceLogFilter->IsEnabledFor(level)) \
+ { \
+ std::string string(message); \
+ Dali::TizenPlatform::LogMessage(Debug::DebugInfo, string); \
+ }
-#define DALI_LOG_SINGLETON_SERVICE(level, format, ...) DALI_LOG_INFO(gSingletonServiceLogFilter, level, format, ## __VA_ARGS__ )
+#define DALI_LOG_SINGLETON_SERVICE(level, format, ...) DALI_LOG_INFO(gSingletonServiceLogFilter, level, format, ##__VA_ARGS__)
#else
#define DALI_LOG_SINGLETON_SERVICE_DIRECT(level, message)
namespace Dali
{
-
namespace Internal
{
-
namespace
{
thread_local ThreadLocalStorage* threadLocal = nullptr;
}
ThreadLocalStorage::ThreadLocalStorage(Core* core)
-: mCore( core )
+: mCore(core)
{
- DALI_ASSERT_ALWAYS( threadLocal == nullptr && "Cannot create more than one ThreadLocalStorage object" );
+ DALI_ASSERT_ALWAYS(threadLocal == nullptr && "Cannot create more than one ThreadLocalStorage object");
threadLocal = this;
}
Dali::SingletonService ThreadLocalStorage::GetSingletonService()
{
Dali::SingletonService singletonService;
- if ( threadLocal )
+ if(threadLocal)
{
- singletonService = Dali::SingletonService( threadLocal );
+ singletonService = Dali::SingletonService(threadLocal);
}
return singletonService;
}
return mCore->GetAnimationPlaylist();
}
-bool ThreadLocalStorage::IsBlendEquationSupported( DevelBlendEquation::Type blendEquation )
+bool ThreadLocalStorage::IsBlendEquationSupported(DevelBlendEquation::Type blendEquation)
{
- return mCore->GetGlAbstraction().IsBlendEquationSupported( blendEquation );
+ return mCore->GetGlAbstraction().IsBlendEquationSupported(blendEquation);
}
std::string ThreadLocalStorage::GetShaderVersionPrefix()
return mCore->GetGlAbstraction().GetFragmentShaderPrefix();
}
-void ThreadLocalStorage::AddScene( Scene* scene )
+void ThreadLocalStorage::AddScene(Scene* scene)
{
- mCore->AddScene( scene );
+ mCore->AddScene(scene);
}
-void ThreadLocalStorage::RemoveScene( Scene* scene )
+void ThreadLocalStorage::RemoveScene(Scene* scene)
{
- mCore->RemoveScene( scene );
+ mCore->RemoveScene(scene);
}
-void ThreadLocalStorage::Register( const std::type_info& info, BaseHandle singleton )
+void ThreadLocalStorage::Register(const std::type_info& info, BaseHandle singleton)
{
- if( singleton )
+ if(singleton)
{
- DALI_LOG_SINGLETON_SERVICE( Debug::General, "Singleton Added: %s\n", info.name() );
- mSingletonContainer.push_back( SingletonPair( info.name(), singleton ) );
+ DALI_LOG_SINGLETON_SERVICE(Debug::General, "Singleton Added: %s\n", info.name());
+ mSingletonContainer.push_back(SingletonPair(info.name(), singleton));
- Integration::Processor* processor = dynamic_cast<Integration::Processor*>( &singleton.GetBaseObject() );
- if( processor )
+ Integration::Processor* processor = dynamic_cast<Integration::Processor*>(&singleton.GetBaseObject());
+ if(processor)
{
- mCore->RegisterProcessor( *processor );
+ mCore->RegisterProcessor(*processor);
}
}
}
-void ThreadLocalStorage::UnregisterAll( )
+void ThreadLocalStorage::UnregisterAll()
{
mSingletonContainer.clear();
}
-BaseHandle ThreadLocalStorage::GetSingleton( const std::type_info& info ) const
+BaseHandle ThreadLocalStorage::GetSingleton(const std::type_info& info) const
{
BaseHandle object;
const SingletonContainer::const_iterator end = mSingletonContainer.end();
- for( SingletonContainer::const_iterator iter = mSingletonContainer.begin(); iter != end; ++iter )
+ for(SingletonContainer::const_iterator iter = mSingletonContainer.begin(); iter != end; ++iter)
{
// comparing the addresses as these are allocated statically per library
- if( ( *iter ).first == info.name() )
+ if((*iter).first == info.name())
{
- object = ( *iter ).second;
+ object = (*iter).second;
}
}
#define DALI_INTERNAL_THREAD_LOCAL_STORAGE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
// INTERNAL INCLUDES
#include <dali/devel-api/common/singleton-service.h>
-#include <dali/internal/event/common/stage-def.h>
#include <dali/internal/event/common/scene-impl.h>
+#include <dali/internal/event/common/stage-def.h>
namespace Dali
{
-
struct Vector2;
namespace Integration
namespace Internal
{
-
class Core;
class NotificationManager;
class ShaderFactory;
class RelayoutController;
class ObjectRegistry;
class EventThreadServices;
+class PropertyNotificationManager;
+class AnimationPlaylist;
namespace SceneGraph
{
class ThreadLocalStorage : public Dali::BaseObject
{
public:
-
/**
* Constructor
* Creates the TLS and adds a pointer to core
* @param[in] blendEquation blend equation to be checked.
* @return True if the blend equation supported.
*/
- bool IsBlendEquationSupported( DevelBlendEquation::Type blendEquation );
+ bool IsBlendEquationSupported(DevelBlendEquation::Type blendEquation);
/**
* @brief Returns shader prefix of shading language version.
* This is only used by the Scene to add itself to the core when the Scene is created.
* @param[in] scene The Scene.
*/
- void AddScene( Scene* scene );
+ void AddScene(Scene* scene);
/**
* Remove a Scene from the Core.
* This is only used by the Scene to remove itself from the core when the Scene is destroyed.
* @param[in] scene The Scene.
*/
- void RemoveScene( Scene* scene );
+ void RemoveScene(Scene* scene);
/**
* @copydoc Dali::SingletonService::Register()
*/
- void Register( const std::type_info& info, BaseHandle singleton );
+ void Register(const std::type_info& info, BaseHandle singleton);
/**
* @copydoc Dali::SingletonService::UnregisterAll()
/**
* @copydoc Dali::SingletonService::GetSingleton()
*/
- BaseHandle GetSingleton( const std::type_info& info ) const;
+ BaseHandle GetSingleton(const std::type_info& info) const;
private:
-
/**
* Virtual Destructor
*/
~ThreadLocalStorage() override;
// Undefined
- ThreadLocalStorage( const ThreadLocalStorage& );
- ThreadLocalStorage& operator=( ThreadLocalStorage& );
+ ThreadLocalStorage(const ThreadLocalStorage&);
+ ThreadLocalStorage& operator=(ThreadLocalStorage&);
private:
-
- Core* mCore; ///< reference to core
+ Core* mCore; ///< reference to core
// using the address of the type name string as compiler will allocate these once per library
// and we don't support un/re-loading of dali libraries while singleton service is alive
using SingletonConstIter = SingletonContainer::const_iterator;
SingletonContainer mSingletonContainer; ///< The container to look up singleton by its type name
-
};
} // namespace Internal
inline Internal::ThreadLocalStorage& GetImplementation(Dali::SingletonService& service)
{
- DALI_ASSERT_ALWAYS( service && "SingletonService handle is empty" );
+ DALI_ASSERT_ALWAYS(service && "SingletonService handle is empty");
BaseObject& handle = service.GetBaseObject();
inline const Internal::ThreadLocalStorage& GetImplementation(const Dali::SingletonService& service)
{
- DALI_ASSERT_ALWAYS( service && "SingletonService handle is empty" );
+ DALI_ASSERT_ALWAYS(service && "SingletonService handle is empty");
const BaseObject& handle = service.GetBaseObject();
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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/internal/event/events/hit-test-algorithm-impl.h>
// INTERNAL INCLUDES
-#include <dali/public-api/actors/layer.h>
-#include <dali/public-api/math/vector2.h>
-#include <dali/public-api/math/vector4.h>
#include <dali/integration-api/debug.h>
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/actors/camera-actor-impl.h>
#include <dali/internal/event/events/ray-test.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
#include <dali/internal/event/render-tasks/render-task-list-impl.h>
+#include <dali/internal/event/rendering/renderer-impl.h>
+#include <dali/public-api/actors/layer.h>
+#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/math/vector4.h>
namespace Dali
{
-
namespace Internal
{
-
namespace HitTestAlgorithm
{
-
namespace
{
-
struct HitActor
{
HitActor()
- : actor( nullptr ),
- distance( std::numeric_limits<float>::max() ),
- depth( std::numeric_limits<int>::min() )
+ : actor(nullptr),
+ distance(std::numeric_limits<float>::max()),
+ depth(std::numeric_limits<int>::min())
{
}
- Actor *actor; ///< The actor hit (if actor is hit, then this is initialised).
+ Actor* actor; ///< The actor hit (if actor is hit, then this is initialised).
Vector2 hitPosition; ///< Position of hit (only valid if actor valid).
- float distance; ///< Distance from ray origin to hit actor.
+ float distance; ///< Distance from ray origin to hit actor.
int32_t depth; ///< Depth index of this actor.
};
*
* @param[in] func HitTestFunction to call with an Actor handle.
*/
- HitTestFunctionWrapper( Dali::HitTestAlgorithm::HitTestFunction func )
- : mFunc( func )
+ HitTestFunctionWrapper(Dali::HitTestAlgorithm::HitTestFunction func)
+ : mFunc(func)
{
}
- bool IsActorHittable( Actor* actor ) override
+ bool IsActorHittable(Actor* actor) override
{
- return mFunc( Dali::Actor( actor ), Dali::HitTestAlgorithm::CHECK_ACTOR );
+ return mFunc(Dali::Actor(actor), Dali::HitTestAlgorithm::CHECK_ACTOR);
}
- bool DescendActorHierarchy( Actor* actor ) override
+ bool DescendActorHierarchy(Actor* actor) override
{
- return mFunc( Dali::Actor( actor ), Dali::HitTestAlgorithm::DESCEND_ACTOR_TREE );
+ return mFunc(Dali::Actor(actor), Dali::HitTestAlgorithm::DESCEND_ACTOR_TREE);
}
- bool DoesLayerConsumeHit( Layer* layer ) override
+ bool DoesLayerConsumeHit(Layer* layer) override
{
// Layer::IsTouchConsumed() focuses on touch only. Here we are a wrapper for the public-api
// where the caller may want to check for something completely different.
*/
struct ActorTouchableCheck : public HitTestInterface
{
- bool IsActorHittable( Actor* actor ) override
+ bool IsActorHittable(Actor* actor) override
{
return actor->GetTouchRequired() && // Does the Application or derived actor type require a touch event?
actor->IsHittable(); // Is actor sensitive, visible and on the scene?
}
- bool DescendActorHierarchy( Actor* actor ) override
+ bool DescendActorHierarchy(Actor* actor) override
{
return actor->IsVisible() && // Actor is visible, if not visible then none of its children are visible.
actor->IsSensitive(); // Actor is sensitive, if insensitive none of its children should be hittable either.
}
- bool DoesLayerConsumeHit( Layer* layer ) override
+ bool DoesLayerConsumeHit(Layer* layer) override
{
return layer->IsTouchConsumed();
}
/**
* Check to see if the actor we're about to hit test is exclusively owned by another rendertask?
*/
-bool IsActorExclusiveToAnotherRenderTask( const Actor& actor,
- const RenderTask& renderTask,
- const RenderTaskList::ExclusivesContainer& exclusives )
+bool IsActorExclusiveToAnotherRenderTask(const Actor& actor,
+ const RenderTask& renderTask,
+ const RenderTaskList::ExclusivesContainer& exclusives)
{
- if( exclusives.size() )
+ if(exclusives.size())
{
- for( const auto& exclusive : exclusives )
+ for(const auto& exclusive : exclusives)
{
- if( ( exclusive.renderTaskPtr != &renderTask ) && ( exclusive.actor.GetActor() == &actor ) )
+ if((exclusive.renderTaskPtr != &renderTask) && (exclusive.actor.GetActor() == &actor))
{
return true;
}
* - When comparing against renderable parents, if Actor is the same distance
* or closer than it's renderable parent, then it takes priority.
*/
-HitActor HitTestWithinLayer( Actor& actor,
- const RenderTask& renderTask,
- const RenderTaskList::ExclusivesContainer& exclusives,
- const Vector4& rayOrigin,
- const Vector4& rayDir,
- float& nearClippingPlane,
- float& farClippingPlane,
- HitTestInterface& hitCheck,
- bool& overlayHit,
- bool layerIs3d,
- uint32_t clippingDepth,
- uint32_t clippingBitPlaneMask,
- const RayTest& rayTest )
+HitActor HitTestWithinLayer(Actor& actor,
+ const RenderTask& renderTask,
+ const RenderTaskList::ExclusivesContainer& exclusives,
+ const Vector4& rayOrigin,
+ const Vector4& rayDir,
+ float& nearClippingPlane,
+ float& farClippingPlane,
+ HitTestInterface& hitCheck,
+ bool& overlayHit,
+ bool layerIs3d,
+ uint32_t clippingDepth,
+ uint32_t clippingBitPlaneMask,
+ const RayTest& rayTest)
{
HitActor hit;
- if( IsActorExclusiveToAnotherRenderTask( actor, renderTask, exclusives ) )
+ if(IsActorExclusiveToAnotherRenderTask(actor, renderTask, exclusives))
{
return hit;
}
// This is used later to ensure all nested clipped children have hit
// all clipping actors also for them to be counted as hit.
uint32_t newClippingDepth = clippingDepth;
- bool clippingActor = actor.GetClippingMode() != ClippingMode::DISABLED;
- if( clippingActor )
+ bool clippingActor = actor.GetClippingMode() != ClippingMode::DISABLED;
+ if(clippingActor)
{
++newClippingDepth;
}
// If we are a clipping actor or hittable...
- if( clippingActor || hitCheck.IsActorHittable( &actor ) )
+ if(clippingActor || hitCheck.IsActorHittable(&actor))
{
- Vector3 size( actor.GetCurrentSize() );
+ Vector3 size(actor.GetCurrentSize());
// Ensure the actor has a valid size.
// If so, perform a quick ray sphere test to see if our ray is close to the actor.
- if( size.x > 0.0f && size.y > 0.0f && rayTest.SphereTest( actor, rayOrigin, rayDir ) )
+ if(size.x > 0.0f && size.y > 0.0f && rayTest.SphereTest(actor, rayOrigin, rayDir))
{
Vector2 hitPointLocal;
- float distance;
+ float distance;
// Finally, perform a more accurate ray test to see if our ray actually hits the actor.
- if( rayTest.ActorTest( actor, rayOrigin, rayDir, hitPointLocal, distance ) )
+ if(rayTest.ActorTest(actor, rayOrigin, rayDir, hitPointLocal, distance))
{
- if( distance >= nearClippingPlane && distance <= farClippingPlane )
+ if(distance >= nearClippingPlane && distance <= farClippingPlane)
{
// If the hit has happened on a clipping actor, then add this clipping depth to the mask of hit clipping depths.
// This mask shows all the actors that have been hit at different clipping depths.
- if( clippingActor )
+ if(clippingActor)
{
clippingBitPlaneMask |= 1u << clippingDepth;
}
- if( overlayHit && !actor.IsOverlay() )
+ if(overlayHit && !actor.IsOverlay())
{
// If we have already hit an overlay and current actor is not an overlay ignore current actor.
}
else
{
- if( actor.IsOverlay() )
+ if(actor.IsOverlay())
{
overlayHit = true;
}
// Check if we are performing clipping. IE. if any actors so far have clipping enabled - not necessarily this one.
// We can do this by checking the clipping depth has a value 1 or above.
- if( newClippingDepth >= 1u )
+ if(newClippingDepth >= 1u)
{
// Now for us to count this actor as hit, we must have also hit
// all CLIPPING actors up to this point in the hierarchy as well.
// EG. a depth of 4 (10000 binary) = a mask of 1111 binary.
// This allows us a fast way of comparing all bits are set up to this depth.
// Note: If the current Actor has clipping, that is included in the depth mask too.
- uint32_t clippingDepthMask = ( 1u << newClippingDepth ) - 1u;
+ uint32_t clippingDepthMask = (1u << newClippingDepth) - 1u;
// The two masks must be equal to be a hit, as we are already assuming a hit
// (for non-clipping mode) then they must be not-equal to disqualify the hit.
- if( clippingBitPlaneMask != clippingDepthMask )
+ if(clippingBitPlaneMask != clippingDepthMask)
{
haveHitActor = false;
}
}
- if( haveHitActor )
+ if(haveHitActor)
{
- hit.actor = &actor;
+ hit.actor = &actor;
hit.hitPosition = hitPointLocal;
- hit.distance = distance;
- hit.depth = actor.GetSortingDepth() ;
+ hit.distance = distance;
+ hit.depth = actor.GetSortingDepth();
- if( actor.GetRendererCount() > 0 )
+ if(actor.GetRendererCount() > 0)
{
//Get renderer with maximum depth
- int rendererMaxDepth(actor.GetRendererAt( 0 ).Get()->GetDepthIndex());
- for( uint32_t i(1); i < actor.GetRendererCount(); ++i )
+ int rendererMaxDepth(actor.GetRendererAt(0).Get()->GetDepthIndex());
+ for(uint32_t i(1); i < actor.GetRendererCount(); ++i)
{
- int depth = actor.GetRendererAt( i ).Get()->GetDepthIndex();
- if( depth > rendererMaxDepth )
+ int depth = actor.GetRendererAt(i).Get()->GetDepthIndex();
+ if(depth > rendererMaxDepth)
{
rendererMaxDepth = depth;
}
// Find a child hit, until we run out of actors in the current layer.
HitActor childHit;
- if( actor.GetChildCount() > 0 )
+ if(actor.GetChildCount() > 0)
{
- childHit.distance = std::numeric_limits<float>::max();
- childHit.depth = std::numeric_limits<int32_t>::min();
+ childHit.distance = std::numeric_limits<float>::max();
+ childHit.depth = std::numeric_limits<int32_t>::min();
ActorContainer& children = actor.GetChildrenInternal();
// Hit test ALL children and calculate their distance.
bool parentIsRenderable = actor.IsRenderable();
- for( ActorIter iter = children.begin(), endIter = children.end(); iter != endIter; ++iter )
+ for(ActorIter iter = children.begin(), endIter = children.end(); iter != endIter; ++iter)
{
// Descend tree only if...
- if ( !( *iter )->IsLayer() && // Child is NOT a layer, hit testing current layer only
- ( hitCheck.DescendActorHierarchy( ( *iter ).Get() ) ) ) // We can descend into child hierarchy
+ if(!(*iter)->IsLayer() && // Child is NOT a layer, hit testing current layer only
+ (hitCheck.DescendActorHierarchy((*iter).Get()))) // We can descend into child hierarchy
{
- HitActor currentHit( HitTestWithinLayer( ( *iter->Get() ),
- renderTask,
- exclusives,
- rayOrigin,
- rayDir,
- nearClippingPlane,
- farClippingPlane,
- hitCheck,
- overlayHit,
- layerIs3d,
- newClippingDepth,
- clippingBitPlaneMask,
- rayTest ) );
+ HitActor currentHit(HitTestWithinLayer((*iter->Get()),
+ renderTask,
+ exclusives,
+ rayOrigin,
+ rayDir,
+ nearClippingPlane,
+ farClippingPlane,
+ hitCheck,
+ overlayHit,
+ layerIs3d,
+ newClippingDepth,
+ clippingBitPlaneMask,
+ rayTest));
bool updateChildHit = false;
- if( currentHit.distance >= 0.0f )
+ if(currentHit.distance >= 0.0f)
{
- if( layerIs3d )
+ if(layerIs3d)
{
- updateChildHit = ( ( currentHit.depth > childHit.depth ) ||
- ( ( currentHit.depth == childHit.depth ) && ( currentHit.distance < childHit.distance ) ) );
+ updateChildHit = ((currentHit.depth > childHit.depth) ||
+ ((currentHit.depth == childHit.depth) && (currentHit.distance < childHit.distance)));
}
else
{
}
}
- if( updateChildHit )
+ if(updateChildHit)
{
- if( !parentIsRenderable || currentHit.depth > hit.depth ||
- ( layerIs3d && ( currentHit.depth == hit.depth && currentHit.distance < hit.distance )) )
+ if(!parentIsRenderable || currentHit.depth > hit.depth ||
+ (layerIs3d && (currentHit.depth == hit.depth && currentHit.distance < hit.distance)))
{
childHit = currentHit;
}
}
}
- return ( childHit.actor ) ? childHit : hit;
+ return (childHit.actor) ? childHit : hit;
}
/**
* Return true if actor is sourceActor or a descendent of sourceActor
*/
-bool IsWithinSourceActors( const Actor& sourceActor, const Actor& actor )
+bool IsWithinSourceActors(const Actor& sourceActor, const Actor& actor)
{
- if ( &sourceActor == &actor )
+ if(&sourceActor == &actor)
{
return true;
}
Actor* parent = actor.GetParent();
- if ( parent )
+ if(parent)
{
- return IsWithinSourceActors( sourceActor, *parent );
+ return IsWithinSourceActors(sourceActor, *parent);
}
// Not within source actors
/**
* Returns true if the layer and all of the layer's parents are visible and sensitive.
*/
-inline bool IsActuallyHittable( Layer& layer, const Vector2& screenCoordinates, const Vector2& stageSize, HitTestInterface& hitCheck )
+inline bool IsActuallyHittable(Layer& layer, const Vector2& screenCoordinates, const Vector2& stageSize, HitTestInterface& hitCheck)
{
- bool hittable( true );
+ bool hittable(true);
- if( layer.IsClipping() )
+ if(layer.IsClipping())
{
ClippingBox box = layer.GetClippingBox();
- if( screenCoordinates.x < static_cast<float>( box.x )||
- screenCoordinates.x > static_cast<float>( box.x + box.width )||
- screenCoordinates.y < stageSize.y - static_cast<float>( box.y + box.height ) ||
- screenCoordinates.y > stageSize.y - static_cast<float>( box.y ) )
+ if(screenCoordinates.x < static_cast<float>(box.x) ||
+ screenCoordinates.x > static_cast<float>(box.x + box.width) ||
+ screenCoordinates.y < stageSize.y - static_cast<float>(box.y + box.height) ||
+ screenCoordinates.y > stageSize.y - static_cast<float>(box.y))
{
// Not touchable if clipping is enabled in the layer and the screen coordinate is outside the clip region.
hittable = false;
}
}
- if( hittable )
+ if(hittable)
{
- Actor* actor( &layer );
+ Actor* actor(&layer);
// Ensure that we can descend into the layer's (or any of its parent's) hierarchy.
- while( actor && hittable )
+ while(actor && hittable)
{
- if( ! hitCheck.DescendActorHierarchy( actor ) )
+ if(!hitCheck.DescendActorHierarchy(actor))
{
hittable = false;
break;
/**
* Gets the near and far clipping planes of the camera from which the scene is viewed in the render task.
*/
-void GetCameraClippingPlane( RenderTask& renderTask, float& nearClippingPlane, float& farClippingPlane )
+void GetCameraClippingPlane(RenderTask& renderTask, float& nearClippingPlane, float& farClippingPlane)
{
CameraActor* cameraActor = renderTask.GetCameraActor();
- nearClippingPlane = cameraActor->GetNearClippingPlane();
- farClippingPlane = cameraActor->GetFarClippingPlane();
+ nearClippingPlane = cameraActor->GetNearClippingPlane();
+ farClippingPlane = cameraActor->GetFarClippingPlane();
}
/**
* Hit test a RenderTask
*/
-bool HitTestRenderTask( const RenderTaskList::ExclusivesContainer& exclusives,
- const Vector2& sceneSize,
- LayerList& layers,
- RenderTask& renderTask,
- Vector2 screenCoordinates,
- Results& results,
- HitTestInterface& hitCheck,
- const RayTest& rayTest )
+bool HitTestRenderTask(const RenderTaskList::ExclusivesContainer& exclusives,
+ const Vector2& sceneSize,
+ LayerList& layers,
+ RenderTask& renderTask,
+ Vector2 screenCoordinates,
+ Results& results,
+ HitTestInterface& hitCheck,
+ const RayTest& rayTest)
{
- if ( renderTask.IsHittable( screenCoordinates ) )
+ if(renderTask.IsHittable(screenCoordinates))
{
Viewport viewport;
- renderTask.GetViewport( viewport );
- if( screenCoordinates.x < static_cast<float>( viewport.x ) ||
- screenCoordinates.x > static_cast<float>( viewport.x + viewport.width ) ||
- screenCoordinates.y < static_cast<float>( viewport.y ) ||
- screenCoordinates.y > static_cast<float>( viewport.y + viewport.height ) )
+ renderTask.GetViewport(viewport);
+ if(screenCoordinates.x < static_cast<float>(viewport.x) ||
+ screenCoordinates.x > static_cast<float>(viewport.x + viewport.width) ||
+ screenCoordinates.y < static_cast<float>(viewport.y) ||
+ screenCoordinates.y > static_cast<float>(viewport.y + viewport.height))
{
// The screen coordinate is outside the viewport of render task. The viewport clips all layers.
return false;
}
float nearClippingPlane, farClippingPlane;
- GetCameraClippingPlane( renderTask, nearClippingPlane, farClippingPlane );
+ GetCameraClippingPlane(renderTask, nearClippingPlane, farClippingPlane);
// Determine the layer depth of the source actor
- Actor* sourceActor( renderTask.GetSourceActor() );
- if( sourceActor )
+ Actor* sourceActor(renderTask.GetSourceActor());
+ if(sourceActor)
{
- Dali::Layer layer( sourceActor->GetLayer() );
- if( layer )
+ Dali::Layer layer(sourceActor->GetLayer());
+ if(layer)
{
- const uint32_t sourceActorDepth( layer.GetProperty< bool >( Dali::Layer::Property::DEPTH ) );
-
- CameraActor* cameraActor = renderTask.GetCameraActor();
- bool pickingPossible = cameraActor->BuildPickingRay(
- screenCoordinates,
- viewport,
- results.rayOrigin,
- results.rayDirection );
- if( !pickingPossible )
+ const uint32_t sourceActorDepth(layer.GetProperty<bool>(Dali::Layer::Property::DEPTH));
+
+ CameraActor* cameraActor = renderTask.GetCameraActor();
+ bool pickingPossible = cameraActor->BuildPickingRay(
+ screenCoordinates,
+ viewport,
+ results.rayOrigin,
+ results.rayDirection);
+ if(!pickingPossible)
{
return false;
}
// Hit test starting with the top layer, working towards the bottom layer.
HitActor hit;
- bool overlayHit = false;
- bool layerConsumesHit = false;
+ bool overlayHit = false;
+ bool layerConsumesHit = false;
- for( int32_t i = layers.GetLayerCount() - 1; i >= 0 && !( hit.actor ); --i )
+ for(int32_t i = layers.GetLayerCount() - 1; i >= 0 && !(hit.actor); --i)
{
- Layer* layer( layers.GetLayer( i ) );
+ Layer* layer(layers.GetLayer(i));
overlayHit = false;
// Ensure layer is touchable (also checks whether ancestors are also touchable)
- if( IsActuallyHittable( *layer, screenCoordinates, sceneSize, hitCheck ) )
+ if(IsActuallyHittable(*layer, screenCoordinates, sceneSize, hitCheck))
{
// Always hit-test the source actor; otherwise test whether the layer is below the source actor in the hierarchy
- if( sourceActorDepth == static_cast<uint32_t>( i ) )
+ if(sourceActorDepth == static_cast<uint32_t>(i))
{
// Recursively hit test the source actor & children, without crossing into other layers.
- hit = HitTestWithinLayer( *sourceActor,
- renderTask,
- exclusives,
- results.rayOrigin,
- results.rayDirection,
- nearClippingPlane,
- farClippingPlane,
- hitCheck,
- overlayHit,
- layer->GetBehavior() == Dali::Layer::LAYER_3D,
- 0u,
- 0u,
- rayTest );
+ hit = HitTestWithinLayer(*sourceActor,
+ renderTask,
+ exclusives,
+ results.rayOrigin,
+ results.rayDirection,
+ nearClippingPlane,
+ farClippingPlane,
+ hitCheck,
+ overlayHit,
+ layer->GetBehavior() == Dali::Layer::LAYER_3D,
+ 0u,
+ 0u,
+ rayTest);
}
- else if( IsWithinSourceActors( *sourceActor, *layer ) )
+ else if(IsWithinSourceActors(*sourceActor, *layer))
{
// Recursively hit test all the actors, without crossing into other layers.
- hit = HitTestWithinLayer( *layer,
- renderTask,
- exclusives,
- results.rayOrigin,
- results.rayDirection,
- nearClippingPlane,
- farClippingPlane,
- hitCheck,
- overlayHit,
- layer->GetBehavior() == Dali::Layer::LAYER_3D,
- 0u,
- 0u,
- rayTest );
+ hit = HitTestWithinLayer(*layer,
+ renderTask,
+ exclusives,
+ results.rayOrigin,
+ results.rayDirection,
+ nearClippingPlane,
+ farClippingPlane,
+ hitCheck,
+ overlayHit,
+ layer->GetBehavior() == Dali::Layer::LAYER_3D,
+ 0u,
+ 0u,
+ rayTest);
}
// If this layer is set to consume the hit, then do not check any layers behind it
- if( hitCheck.DoesLayerConsumeHit( layer ) )
+ if(hitCheck.DoesLayerConsumeHit(layer))
{
layerConsumesHit = true;
break;
}
}
- if( hit.actor )
+ if(hit.actor)
{
- results.renderTask = RenderTaskPtr( &renderTask );
- results.actor = Dali::Actor( hit.actor );
+ results.renderTask = RenderTaskPtr(&renderTask);
+ results.actor = Dali::Actor(hit.actor);
results.actorCoordinates = hit.hitPosition;
return true; // Success
}
- if( layerConsumesHit )
+ if(layerConsumesHit)
{
return true; // Also success if layer is consuming the hit
}
* @param[in] onScreen True to test on-screen, false to test off-screen
* @return True if we have a hit, false otherwise
*/
-bool HitTestRenderTaskList( const Vector2& sceneSize,
- LayerList& layers,
- RenderTaskList& taskList,
- const Vector2& screenCoordinates,
- Results& results,
- HitTestInterface& hitCheck,
- bool onScreen )
+bool HitTestRenderTaskList(const Vector2& sceneSize,
+ LayerList& layers,
+ RenderTaskList& taskList,
+ const Vector2& screenCoordinates,
+ Results& results,
+ HitTestInterface& hitCheck,
+ bool onScreen)
{
- RenderTaskList::RenderTaskContainer& tasks = taskList.GetTasks();
- RenderTaskList::RenderTaskContainer::reverse_iterator endIter = tasks.rend();
- const auto& exclusives = taskList.GetExclusivesList();
- RayTest rayTest;
+ RenderTaskList::RenderTaskContainer& tasks = taskList.GetTasks();
+ RenderTaskList::RenderTaskContainer::reverse_iterator endIter = tasks.rend();
+ const auto& exclusives = taskList.GetExclusivesList();
+ RayTest rayTest;
- for( RenderTaskList::RenderTaskContainer::reverse_iterator iter = tasks.rbegin(); endIter != iter; ++iter )
+ for(RenderTaskList::RenderTaskContainer::reverse_iterator iter = tasks.rbegin(); endIter != iter; ++iter)
{
- RenderTask& renderTask = *iter->Get();
- const bool isOffscreenRenderTask = renderTask.GetFrameBuffer();
- if( (onScreen && isOffscreenRenderTask) || (!onScreen && !isOffscreenRenderTask) )
+ RenderTask& renderTask = *iter->Get();
+ const bool isOffscreenRenderTask = renderTask.GetFrameBuffer();
+ if((onScreen && isOffscreenRenderTask) || (!onScreen && !isOffscreenRenderTask))
{
// Skip to next task
continue;
}
- if( HitTestRenderTask( exclusives, sceneSize, layers, renderTask, screenCoordinates, results, hitCheck, rayTest ) )
+ if(HitTestRenderTask(exclusives, sceneSize, layers, renderTask, screenCoordinates, results, hitCheck, rayTest))
{
// Return true when an actor is hit (or layer in our render-task consumes the hit)
return true; // don't bother checking off screen tasks
* @param[in] onScreen True to test on-screen, false to test off-screen
* @return True if we have a hit, false otherwise
*/
-bool HitTestForEachRenderTask( const Vector2& sceneSize,
- LayerList& layers,
- RenderTaskList& taskList,
- const Vector2& screenCoordinates,
- Results& results,
- HitTestInterface& hitCheck )
+bool HitTestForEachRenderTask(const Vector2& sceneSize,
+ LayerList& layers,
+ RenderTaskList& taskList,
+ const Vector2& screenCoordinates,
+ Results& results,
+ HitTestInterface& hitCheck)
{
bool result = false;
// Check on-screen tasks before off-screen ones.
// Hit test order should be reverse of draw order (see ProcessRenderTasks() where off-screen tasks are drawn first).
- if( HitTestRenderTaskList( sceneSize, layers, taskList, screenCoordinates, results, hitCheck, true ) ||
- HitTestRenderTaskList( sceneSize, layers, taskList, screenCoordinates, results, hitCheck, false ) )
+ if(HitTestRenderTaskList(sceneSize, layers, taskList, screenCoordinates, results, hitCheck, true) ||
+ HitTestRenderTaskList(sceneSize, layers, taskList, screenCoordinates, results, hitCheck, false))
{
// Found hit.
result = true;
HitTestInterface::~HitTestInterface() = default;
-bool HitTest( const Vector2& sceneSize, RenderTaskList& taskList, LayerList& layerList, const Vector2& screenCoordinates, Dali::HitTestAlgorithm::Results& results, Dali::HitTestAlgorithm::HitTestFunction func )
+bool HitTest(const Vector2& sceneSize, RenderTaskList& taskList, LayerList& layerList, const Vector2& screenCoordinates, Dali::HitTestAlgorithm::Results& results, Dali::HitTestAlgorithm::HitTestFunction func)
{
- bool wasHit( false );
+ bool wasHit(false);
// Hit-test the regular on-scene actors
- Results hitTestResults;
- HitTestFunctionWrapper hitTestFunctionWrapper( func );
- if( HitTestForEachRenderTask( sceneSize, layerList, taskList, screenCoordinates, hitTestResults, hitTestFunctionWrapper ) )
+ Results hitTestResults;
+ HitTestFunctionWrapper hitTestFunctionWrapper(func);
+ if(HitTestForEachRenderTask(sceneSize, layerList, taskList, screenCoordinates, hitTestResults, hitTestFunctionWrapper))
{
- results.actor = hitTestResults.actor;
+ results.actor = hitTestResults.actor;
results.actorCoordinates = hitTestResults.actorCoordinates;
- wasHit = true;
+ wasHit = true;
}
return wasHit;
}
-bool HitTest( const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, const Vector2& screenCoordinates, Results& results, HitTestInterface& hitTestInterface )
+bool HitTest(const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, const Vector2& screenCoordinates, Results& results, HitTestInterface& hitTestInterface)
{
- bool wasHit( false );
+ bool wasHit(false);
// Hit-test the regular on-scene actors
- if( !wasHit )
+ if(!wasHit)
{
- wasHit = HitTestForEachRenderTask( sceneSize, layerList, renderTaskList, screenCoordinates, results, hitTestInterface );
+ wasHit = HitTestForEachRenderTask(sceneSize, layerList, renderTaskList, screenCoordinates, results, hitTestInterface);
}
return wasHit;
}
-bool HitTest( const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, const Vector2& screenCoordinates, Results& results )
+bool HitTest(const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, const Vector2& screenCoordinates, Results& results)
{
ActorTouchableCheck actorTouchableCheck;
- return HitTest( sceneSize, renderTaskList, layerList, screenCoordinates, results, actorTouchableCheck );
+ return HitTest(sceneSize, renderTaskList, layerList, screenCoordinates, results, actorTouchableCheck);
}
} // namespace HitTestAlgorithm
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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 <algorithm>
// INTERNAL INCLUDES
-#include <dali/public-api/actors/actor.h>
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/events/pan-gesture.h>
-#include <dali/public-api/math/vector2.h>
-#include <dali/internal/event/events/pan-gesture/pan-gesture-event.h>
#include <dali/integration-api/debug.h>
#include <dali/internal/event/common/scene-impl.h>
-#include <dali/internal/event/render-tasks/render-task-impl.h>
-#include <dali/internal/update/gestures/scene-graph-pan-gesture.h>
+#include <dali/internal/event/events/gesture-requests.h>
#include <dali/internal/event/events/multi-point-event-util.h>
-#include <dali/internal/event/events/pan-gesture/pan-gesture-recognizer.h>
+#include <dali/internal/event/events/pan-gesture/pan-gesture-event.h>
#include <dali/internal/event/events/pan-gesture/pan-gesture-impl.h>
-#include <dali/internal/event/events/gesture-requests.h>
+#include <dali/internal/event/events/pan-gesture/pan-gesture-recognizer.h>
+#include <dali/internal/event/render-tasks/render-task-impl.h>
+#include <dali/internal/update/gestures/scene-graph-pan-gesture.h>
+#include <dali/internal/update/manager/update-manager.h>
+#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/events/pan-gesture.h>
+#include <dali/public-api/math/vector2.h>
namespace Dali
{
-
namespace Internal
{
-
namespace // unnamed namespace
{
-
#if defined(DEBUG_ENABLED)
-Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_PAN_PROCESSOR" );
+Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_PAN_PROCESSOR");
-const char * GESTURE_STATES[ 6 ] =
-{
- "CLEAR",
- "STARTED",
- "CONTINUING",
- "FINISHED",
- "CANCELLED",
- "POSSIBLE"
-};
+const char* GESTURE_STATES[6] =
+ {
+ "CLEAR",
+ "STARTED",
+ "CONTINUING",
+ "FINISHED",
+ "CANCELLED",
+ "POSSIBLE"};
#endif // defined(DEBUG_ENABLED)
-const unsigned long MAXIMUM_TIME_WITH_VALID_LAST_VELOCITY( 50u );
+const unsigned long MAXIMUM_TIME_WITH_VALID_LAST_VELOCITY(50u);
/**
* Functor which checks whether the specified actor is attached to the gesture detector.
{
bool remove(!detector->IsAttached(*actorToCheck));
- if (!remove)
+ if(!remove)
{
- PanGestureDetector* panDetector( static_cast< PanGestureDetector* >( detector ) );
+ PanGestureDetector* panDetector(static_cast<PanGestureDetector*>(detector));
// Ensure number of touch points is within the range of our emitter. If it isn't then remove
// this emitter and add it to the outsideTouchesRangeEmitters container
- if ( (numberOfTouches < panDetector->GetMinimumTouchesRequired()) ||
- (numberOfTouches > panDetector->GetMaximumTouchesRequired()) )
+ if((numberOfTouches < panDetector->GetMinimumTouchesRequired()) ||
+ (numberOfTouches > panDetector->GetMaximumTouchesRequired()))
{
remove = true;
outsideTouchesRangeEmitters.push_back(detector);
return remove;
}
- Actor* actorToCheck; ///< The actor to check whether it is attached or not.
- unsigned int numberOfTouches; ///< The number of touches in the pan event.
+ Actor* actorToCheck; ///< The actor to check whether it is attached or not.
+ unsigned int numberOfTouches; ///< The number of touches in the pan event.
GestureDetectorContainer& outsideTouchesRangeEmitters; ///< Emitters that are outside of the range of current pan.
};
} // unnamed namespace
-PanGestureProcessor::PanGestureProcessor( SceneGraph::UpdateManager& updateManager )
-: GestureProcessor( GestureType::PAN ),
+PanGestureProcessor::PanGestureProcessor(SceneGraph::UpdateManager& updateManager)
+: GestureProcessor(GestureType::PAN),
mPanGestureDetectors(),
mCurrentPanEmitters(),
mCurrentRenderTask(),
mPossiblePanPosition(),
- mMinTouchesRequired( 1 ),
- mMaxTouchesRequired( 1 ),
- mCurrentPanEvent( nullptr ),
- mSceneObject( SceneGraph::PanGesture::New() ) // Create scene object to store pan information.
+ mMinTouchesRequired(1),
+ mMaxTouchesRequired(1),
+ mCurrentPanEvent(nullptr),
+ mSceneObject(SceneGraph::PanGesture::New()) // Create scene object to store pan information.
{
// Pass ownership to scene-graph; scene object lives for the lifecycle of UpdateManager
- updateManager.SetPanGestureProcessor( mSceneObject );
+ updateManager.SetPanGestureProcessor(mSceneObject);
}
PanGestureProcessor::~PanGestureProcessor()
mSceneObject = nullptr; // mSceneObject is owned and destroyed by update manager (there is only one of these for now)
}
-void PanGestureProcessor::Process( Scene& scene, const PanGestureEvent& panEvent )
+void PanGestureProcessor::Process(Scene& scene, const PanGestureEvent& panEvent)
{
#if defined(DEBUG_ENABLED)
- DALI_LOG_TRACE_METHOD( gLogFilter );
+ DALI_LOG_TRACE_METHOD(gLogFilter);
- DALI_LOG_INFO( gLogFilter, Debug::General, " Pan Event\n");
- DALI_LOG_INFO( gLogFilter, Debug::General, " State: %s Touches: %d Time: %d TimeDelta: %d\n",
- GESTURE_STATES[static_cast<uint8_t>(panEvent.state)], panEvent.numberOfTouches, panEvent.time, panEvent.timeDelta);
- DALI_LOG_INFO( gLogFilter, Debug::General, " Positions: Current: (%.0f, %.0f), Previous: (%.0f, %.0f)\n",
- panEvent.currentPosition.x, panEvent.currentPosition.y, panEvent.previousPosition.x, panEvent.previousPosition.y);
+ DALI_LOG_INFO(gLogFilter, Debug::General, " Pan Event\n");
+ DALI_LOG_INFO(gLogFilter, Debug::General, " State: %s Touches: %d Time: %d TimeDelta: %d\n", GESTURE_STATES[static_cast<uint8_t>(panEvent.state)], panEvent.numberOfTouches, panEvent.time, panEvent.timeDelta);
+ DALI_LOG_INFO(gLogFilter, Debug::General, " Positions: Current: (%.0f, %.0f), Previous: (%.0f, %.0f)\n", panEvent.currentPosition.x, panEvent.currentPosition.y, panEvent.previousPosition.x, panEvent.previousPosition.y);
#endif
- switch( panEvent.state )
+ switch(panEvent.state)
{
case GestureState::POSSIBLE:
{
ResetActor();
HitTestAlgorithm::Results hitTestResults;
- if( HitTest( scene, panEvent.currentPosition, hitTestResults ) )
+ if(HitTest(scene, panEvent.currentPosition, hitTestResults))
{
- SetActor( &GetImplementation( hitTestResults.actor ) );
+ SetActor(&GetImplementation(hitTestResults.actor));
mPossiblePanPosition = panEvent.currentPosition;
}
break;
// it can be told when the gesture ends as well.
HitTestAlgorithm::Results hitTestResults;
- HitTest( scene, panEvent.previousPosition, hitTestResults ); // Hit Test previous position
+ HitTest(scene, panEvent.previousPosition, hitTestResults); // Hit Test previous position
- if ( hitTestResults.actor )
+ if(hitTestResults.actor)
{
// If the current hit actor is different from the one we touched down on then set accordingly & update initial pan position
- if( &GetImplementation( hitTestResults.actor ) != GetCurrentGesturedActor() )
+ if(&GetImplementation(hitTestResults.actor) != GetCurrentGesturedActor())
{
mPossiblePanPosition = panEvent.previousPosition;
- SetActor( &GetImplementation( hitTestResults.actor ) );
+ SetActor(&GetImplementation(hitTestResults.actor));
}
// Record the current render-task for Screen->Actor coordinate conversions
// Set mCurrentPanEvent to use inside overridden methods called in ProcessAndEmit()
mCurrentPanEvent = &panEvent;
- ProcessAndEmit( hitTestResults );
+ ProcessAndEmit(hitTestResults);
mCurrentPanEvent = nullptr;
}
else
// Check if actor is still touchable.
Actor* currentGesturedActor = GetCurrentGesturedActor();
- if ( currentGesturedActor )
+ if(currentGesturedActor)
{
- if ( currentGesturedActor->IsHittable() && !mCurrentPanEmitters.empty() && mCurrentRenderTask )
+ if(currentGesturedActor->IsHittable() && !mCurrentPanEmitters.empty() && mCurrentRenderTask)
{
GestureDetectorContainer outsideTouchesRangeEmitters;
// Removes emitters that no longer have the actor attached
// Also remove emitters whose touches are outside the range of the current pan event and add them to outsideTouchesRangeEmitters
- GestureDetectorContainer::iterator endIter = std::remove_if( mCurrentPanEmitters.begin(), mCurrentPanEmitters.end(),
- IsNotAttachedAndOutsideTouchesRangeFunctor(currentGesturedActor, panEvent.numberOfTouches, outsideTouchesRangeEmitters) );
- mCurrentPanEmitters.erase( endIter, mCurrentPanEmitters.end() );
+ GestureDetectorContainer::iterator endIter = std::remove_if(mCurrentPanEmitters.begin(), mCurrentPanEmitters.end(), IsNotAttachedAndOutsideTouchesRangeFunctor(currentGesturedActor, panEvent.numberOfTouches, outsideTouchesRangeEmitters));
+ mCurrentPanEmitters.erase(endIter, mCurrentPanEmitters.end());
Vector2 actorCoords;
- if ( !outsideTouchesRangeEmitters.empty() || !mCurrentPanEmitters.empty() )
+ if(!outsideTouchesRangeEmitters.empty() || !mCurrentPanEmitters.empty())
{
- currentGesturedActor->ScreenToLocal( *mCurrentRenderTask.Get(), actorCoords.x, actorCoords.y, panEvent.currentPosition.x, panEvent.currentPosition.y );
+ currentGesturedActor->ScreenToLocal(*mCurrentRenderTask.Get(), actorCoords.x, actorCoords.y, panEvent.currentPosition.x, panEvent.currentPosition.y);
// EmitPanSignal checks whether we have a valid actor and whether the container we are passing in has emitters before it emits the pan.
- EmitPanSignal( currentGesturedActor, outsideTouchesRangeEmitters, panEvent, actorCoords, GestureState::FINISHED, mCurrentRenderTask);
- EmitPanSignal( currentGesturedActor, mCurrentPanEmitters, panEvent, actorCoords, panEvent.state, mCurrentRenderTask);
+ EmitPanSignal(currentGesturedActor, outsideTouchesRangeEmitters, panEvent, actorCoords, GestureState::FINISHED, mCurrentRenderTask);
+ EmitPanSignal(currentGesturedActor, mCurrentPanEmitters, panEvent, actorCoords, panEvent.state, mCurrentRenderTask);
}
- if ( mCurrentPanEmitters.empty() )
+ if(mCurrentPanEmitters.empty())
{
// If we have no emitters attached then clear pan actor as well.
ResetActor();
}
// Clear current gesture detectors if pan gesture has ended or been cancelled.
- if ( ( panEvent.state == GestureState::FINISHED ) || ( panEvent.state == GestureState::CANCELLED ) )
+ if((panEvent.state == GestureState::FINISHED) || (panEvent.state == GestureState::CANCELLED))
{
mCurrentPanEmitters.clear();
ResetActor();
case GestureState::CLEAR:
{
- DALI_ABORT( "Incorrect state received from Integration layer: CLEAR\n" );
+ DALI_ABORT("Incorrect state received from Integration layer: CLEAR\n");
break;
}
}
}
-void PanGestureProcessor::AddGestureDetector( PanGestureDetector* gestureDetector, Scene& scene, int32_t minDistance, int32_t minPanEvents )
+void PanGestureProcessor::AddGestureDetector(PanGestureDetector* gestureDetector, Scene& scene, int32_t minDistance, int32_t minPanEvents)
{
bool firstRegistration(mPanGestureDetectors.empty());
mPanGestureDetectors.push_back(gestureDetector);
- if (firstRegistration)
+ if(firstRegistration)
{
mMinTouchesRequired = gestureDetector->GetMinimumTouchesRequired();
mMaxTouchesRequired = gestureDetector->GetMaximumTouchesRequired();
request.minTouches = mMinTouchesRequired;
request.maxTouches = mMaxTouchesRequired;
- Size size = scene.GetSize();
+ Size size = scene.GetSize();
mGestureRecognizer = new PanGestureRecognizer(*this, Vector2(size.width, size.height), static_cast<const PanGestureRequest&>(request), minDistance, minPanEvents);
}
else
}
}
-void PanGestureProcessor::RemoveGestureDetector( PanGestureDetector* gestureDetector )
+void PanGestureProcessor::RemoveGestureDetector(PanGestureDetector* gestureDetector)
{
- if (!mCurrentPanEmitters.empty())
+ if(!mCurrentPanEmitters.empty())
{
// Check if the removed detector was one that is currently being panned and remove it from emitters.
- GestureDetectorContainer::iterator endIter = std::remove( mCurrentPanEmitters.begin(), mCurrentPanEmitters.end(), gestureDetector );
- mCurrentPanEmitters.erase( endIter, mCurrentPanEmitters.end() );
+ GestureDetectorContainer::iterator endIter = std::remove(mCurrentPanEmitters.begin(), mCurrentPanEmitters.end(), gestureDetector);
+ mCurrentPanEmitters.erase(endIter, mCurrentPanEmitters.end());
// If we no longer have any emitters, then we should clear mCurrentGesturedActor as well
- if ( mCurrentPanEmitters.empty() )
+ if(mCurrentPanEmitters.empty())
{
ResetActor();
}
}
// Find the detector...
- PanGestureDetectorContainer::iterator endIter = std::remove( mPanGestureDetectors.begin(), mPanGestureDetectors.end(), gestureDetector );
- DALI_ASSERT_DEBUG( endIter != mPanGestureDetectors.end() );
+ PanGestureDetectorContainer::iterator endIter = std::remove(mPanGestureDetectors.begin(), mPanGestureDetectors.end(), gestureDetector);
+ DALI_ASSERT_DEBUG(endIter != mPanGestureDetectors.end());
// ...and remove it
mPanGestureDetectors.erase(endIter, mPanGestureDetectors.end());
- if (mPanGestureDetectors.empty())
+ if(mPanGestureDetectors.empty())
{
mGestureRecognizer = nullptr;
}
}
}
-void PanGestureProcessor::GestureDetectorUpdated( PanGestureDetector* gestureDetector )
+void PanGestureProcessor::GestureDetectorUpdated(PanGestureDetector* gestureDetector)
{
DALI_ASSERT_DEBUG(find(mPanGestureDetectors.begin(), mPanGestureDetectors.end(), gestureDetector) != mPanGestureDetectors.end());
UpdateDetection();
}
-bool PanGestureProcessor::SetPanGestureProperties( const Dali::PanGesture& pan )
+bool PanGestureProcessor::SetPanGestureProperties(const Dali::PanGesture& pan)
{
// If we are currently processing a pan gesture then just ignore
- if ( mCurrentPanEmitters.empty() && mSceneObject )
+ if(mCurrentPanEmitters.empty() && mSceneObject)
{
- const PanGesture& panImpl( GetImplementation(pan) );
+ const PanGesture& panImpl(GetImplementation(pan));
// We update the scene object directly rather than sending a message.
// Sending a message could cause unnecessary delays, the scene object ensure thread safe behaviour.
- mSceneObject->AddGesture( panImpl );
+ mSceneObject->AddGesture(panImpl);
- if( GestureState::STARTED == panImpl.GetState() || GestureState::CONTINUING == panImpl.GetState() )
+ if(GestureState::STARTED == panImpl.GetState() || GestureState::CONTINUING == panImpl.GetState())
{
mNeedsUpdate = true;
}
void PanGestureProcessor::SetPredictionMode(int mode)
{
- if( (mode < 0)
- || (mode >= SceneGraph::PanGesture::NUM_PREDICTION_MODES) )
+ if((mode < 0) || (mode >= SceneGraph::PanGesture::NUM_PREDICTION_MODES))
{
mode = SceneGraph::PanGesture::DEFAULT_PREDICTION_MODE;
}
void PanGestureProcessor::SetSmoothingMode(int mode)
{
- if( (mode < 0)
- || (mode >= SceneGraph::PanGesture::NUM_SMOOTHING_MODES) )
+ if((mode < 0) || (mode >= SceneGraph::PanGesture::NUM_SMOOTHING_MODES))
{
mode = SceneGraph::PanGesture::DEFAULT_SMOOTHING_MODE;
}
mSceneObject->SetSmoothingAmount(amount);
}
-void PanGestureProcessor::SetUseActualTimes( bool value )
+void PanGestureProcessor::SetUseActualTimes(bool value)
{
- mSceneObject->SetUseActualTimes( value );
+ mSceneObject->SetUseActualTimes(value);
}
-void PanGestureProcessor::SetInterpolationTimeRange( int value )
+void PanGestureProcessor::SetInterpolationTimeRange(int value)
{
- mSceneObject->SetInterpolationTimeRange( value );
+ mSceneObject->SetInterpolationTimeRange(value);
}
-void PanGestureProcessor::SetScalarOnlyPredictionEnabled( bool value )
+void PanGestureProcessor::SetScalarOnlyPredictionEnabled(bool value)
{
- mSceneObject->SetScalarOnlyPredictionEnabled( value );
+ mSceneObject->SetScalarOnlyPredictionEnabled(value);
}
-void PanGestureProcessor::SetTwoPointPredictionEnabled( bool value )
+void PanGestureProcessor::SetTwoPointPredictionEnabled(bool value)
{
- mSceneObject->SetTwoPointPredictionEnabled( value );
+ mSceneObject->SetTwoPointPredictionEnabled(value);
}
-void PanGestureProcessor::SetTwoPointInterpolatePastTime( int value )
+void PanGestureProcessor::SetTwoPointInterpolatePastTime(int value)
{
- mSceneObject->SetTwoPointInterpolatePastTime( value );
+ mSceneObject->SetTwoPointInterpolatePastTime(value);
}
-void PanGestureProcessor::SetTwoPointVelocityBias( float value )
+void PanGestureProcessor::SetTwoPointVelocityBias(float value)
{
- mSceneObject->SetTwoPointVelocityBias( value );
+ mSceneObject->SetTwoPointVelocityBias(value);
}
-void PanGestureProcessor::SetTwoPointAccelerationBias( float value )
+void PanGestureProcessor::SetTwoPointAccelerationBias(float value)
{
- mSceneObject->SetTwoPointAccelerationBias( value );
+ mSceneObject->SetTwoPointAccelerationBias(value);
}
-void PanGestureProcessor::SetMultitapSmoothingRange( int value )
+void PanGestureProcessor::SetMultitapSmoothingRange(int value)
{
- mSceneObject->SetMultitapSmoothingRange( value );
+ mSceneObject->SetMultitapSmoothingRange(value);
}
const SceneGraph::PanGesture& PanGestureProcessor::GetSceneObject() const
unsigned int minimumRequired = UINT_MAX;
unsigned int maximumRequired = 0;
- for ( PanGestureDetectorContainer::iterator iter = mPanGestureDetectors.begin(), endIter = mPanGestureDetectors.end(); iter != endIter; ++iter )
+ for(PanGestureDetectorContainer::iterator iter = mPanGestureDetectors.begin(), endIter = mPanGestureDetectors.end(); iter != endIter; ++iter)
{
PanGestureDetector* detector(*iter);
- if( detector )
+ if(detector)
{
unsigned int minimum = detector->GetMinimumTouchesRequired();
- if (minimum < minimumRequired)
+ if(minimum < minimumRequired)
{
minimumRequired = minimum;
}
unsigned int maximum = detector->GetMaximumTouchesRequired();
- if (maximum > maximumRequired)
+ if(maximum > maximumRequired)
{
maximumRequired = maximum;
}
}
}
- if ( (minimumRequired != mMinTouchesRequired)||(maximumRequired != mMaxTouchesRequired) )
+ if((minimumRequired != mMinTouchesRequired) || (maximumRequired != mMaxTouchesRequired))
{
mMinTouchesRequired = minimumRequired;
mMaxTouchesRequired = maximumRequired;
}
}
-void PanGestureProcessor::EmitPanSignal( Actor* actor,
- const GestureDetectorContainer& gestureDetectors,
- const PanGestureEvent& panEvent,
- Vector2 localCurrent,
- GestureState state,
- RenderTaskPtr renderTask )
+void PanGestureProcessor::EmitPanSignal(Actor* actor,
+ const GestureDetectorContainer& gestureDetectors,
+ const PanGestureEvent& panEvent,
+ Vector2 localCurrent,
+ GestureState state,
+ RenderTaskPtr renderTask)
{
- if ( actor && !gestureDetectors.empty() )
+ if(actor && !gestureDetectors.empty())
{
- Internal::PanGesturePtr pan( new Internal::PanGesture(state ) );
+ Internal::PanGesturePtr pan(new Internal::PanGesture(state));
- pan->SetTime( panEvent.time );
+ pan->SetTime(panEvent.time);
- pan->SetNumberOfTouches( panEvent.numberOfTouches );
- pan->SetScreenPosition( panEvent.currentPosition );
- pan->SetPosition( localCurrent );
+ pan->SetNumberOfTouches(panEvent.numberOfTouches);
+ pan->SetScreenPosition(panEvent.currentPosition);
+ pan->SetPosition(localCurrent);
- RenderTask& renderTaskImpl( *renderTask.Get() );
+ RenderTask& renderTaskImpl(*renderTask.Get());
Vector2 localPrevious;
- actor->ScreenToLocal( renderTaskImpl, localPrevious.x, localPrevious.y, panEvent.previousPosition.x, panEvent.previousPosition.y );
+ actor->ScreenToLocal(renderTaskImpl, localPrevious.x, localPrevious.y, panEvent.previousPosition.x, panEvent.previousPosition.y);
- pan->SetDisplacement( localCurrent - localPrevious );
- Vector2 previousPos( panEvent.previousPosition );
- if ( state == GestureState::STARTED )
+ pan->SetDisplacement(localCurrent - localPrevious);
+ Vector2 previousPos(panEvent.previousPosition);
+ if(state == GestureState::STARTED)
{
previousPos = mPossiblePanPosition;
}
- pan->SetScreenDisplacement( panEvent.currentPosition - previousPos );
+ pan->SetScreenDisplacement(panEvent.currentPosition - previousPos);
// Avoid dividing by 0
- if ( panEvent.timeDelta > 0 )
+ if(panEvent.timeDelta > 0)
{
Vector2 velocity;
- velocity.x = pan->GetDisplacement().x / static_cast<float>( panEvent.timeDelta );
- velocity.y = pan->GetDisplacement().y / static_cast<float>( panEvent.timeDelta );
- pan->SetVelocity( velocity );
+ velocity.x = pan->GetDisplacement().x / static_cast<float>(panEvent.timeDelta);
+ velocity.y = pan->GetDisplacement().y / static_cast<float>(panEvent.timeDelta);
+ pan->SetVelocity(velocity);
Vector2 screenVelocity;
- screenVelocity.x = pan->GetScreenDisplacement().x / static_cast<float>( panEvent.timeDelta );
- screenVelocity.y = pan->GetScreenDisplacement().y / static_cast<float>( panEvent.timeDelta );
- pan->SetScreenVelocity( screenVelocity );
+ screenVelocity.x = pan->GetScreenDisplacement().x / static_cast<float>(panEvent.timeDelta);
+ screenVelocity.y = pan->GetScreenDisplacement().y / static_cast<float>(panEvent.timeDelta);
+ pan->SetScreenVelocity(screenVelocity);
}
// When the gesture ends, we may incorrectly get a ZERO velocity (as we have lifted our finger without any movement)
// so we should use the last recorded velocity instead in this scenario.
- if ( ( state == GestureState::FINISHED ) && ( pan->GetScreenVelocity() == Vector2::ZERO ) &&
- ( panEvent.timeDelta < MAXIMUM_TIME_WITH_VALID_LAST_VELOCITY ) )
+ if((state == GestureState::FINISHED) && (pan->GetScreenVelocity() == Vector2::ZERO) &&
+ (panEvent.timeDelta < MAXIMUM_TIME_WITH_VALID_LAST_VELOCITY))
{
- pan->SetVelocity( mLastVelocity );
- pan->SetScreenVelocity( mLastScreenVelocity );
+ pan->SetVelocity(mLastVelocity);
+ pan->SetScreenVelocity(mLastScreenVelocity);
}
else
{
// Store the current velocity for future iterations.
- mLastVelocity = pan->GetVelocity();
+ mLastVelocity = pan->GetVelocity();
mLastScreenVelocity = pan->GetScreenVelocity();
}
- if ( mSceneObject )
+ if(mSceneObject)
{
// We update the scene object directly rather than sending a message.
// Sending a message could cause unnecessary delays, the scene object ensure thread safe behaviour.
- mSceneObject->AddGesture( *pan.Get() );
+ mSceneObject->AddGesture(*pan.Get());
}
- Dali::Actor actorHandle( actor );
+ Dali::Actor actorHandle(actor);
const GestureDetectorContainer::const_iterator endIter = gestureDetectors.end();
- for ( GestureDetectorContainer::const_iterator iter = gestureDetectors.begin(); iter != endIter; ++iter )
+ for(GestureDetectorContainer::const_iterator iter = gestureDetectors.begin(); iter != endIter; ++iter)
{
- static_cast< PanGestureDetector* >( *iter )->EmitPanGestureSignal( actorHandle, Dali::PanGesture( pan.Get() ) );
+ static_cast<PanGestureDetector*>(*iter)->EmitPanGestureSignal(actorHandle, Dali::PanGesture(pan.Get()));
}
}
}
mCurrentPanEmitters.clear();
}
-bool PanGestureProcessor::CheckGestureDetector( GestureDetector* detector, Actor* actor )
+bool PanGestureProcessor::CheckGestureDetector(GestureDetector* detector, Actor* actor)
{
- DALI_ASSERT_DEBUG( mCurrentPanEvent );
+ DALI_ASSERT_DEBUG(mCurrentPanEvent);
- bool retVal( false );
- PanGestureDetector* panDetector( static_cast< PanGestureDetector* >( detector ) );
+ bool retVal(false);
+ PanGestureDetector* panDetector(static_cast<PanGestureDetector*>(detector));
- if ( ( mCurrentPanEvent->numberOfTouches >= panDetector->GetMinimumTouchesRequired() ) &&
- ( mCurrentPanEvent->numberOfTouches <= panDetector->GetMaximumTouchesRequired() ) )
+ if((mCurrentPanEvent->numberOfTouches >= panDetector->GetMinimumTouchesRequired()) &&
+ (mCurrentPanEvent->numberOfTouches <= panDetector->GetMaximumTouchesRequired()))
{
// Check if the detector requires directional panning.
- if ( panDetector->RequiresDirectionalPan() && mCurrentRenderTask )
+ if(panDetector->RequiresDirectionalPan() && mCurrentRenderTask)
{
// It does, calculate the angle of the pan in local actor coordinates and ensures it fits
// the detector's criteria.
RenderTask& renderTaskImpl = *mCurrentRenderTask.Get();
Vector2 startPosition, currentPosition;
- actor->ScreenToLocal( renderTaskImpl, startPosition.x, startPosition.y, mPossiblePanPosition.x, mPossiblePanPosition.y );
- actor->ScreenToLocal( renderTaskImpl, currentPosition.x, currentPosition.y, mCurrentPanEvent->currentPosition.x, mCurrentPanEvent->currentPosition.y );
- Vector2 displacement( currentPosition - startPosition );
+ actor->ScreenToLocal(renderTaskImpl, startPosition.x, startPosition.y, mPossiblePanPosition.x, mPossiblePanPosition.y);
+ actor->ScreenToLocal(renderTaskImpl, currentPosition.x, currentPosition.y, mCurrentPanEvent->currentPosition.x, mCurrentPanEvent->currentPosition.y);
+ Vector2 displacement(currentPosition - startPosition);
- Radian angle( atanf( displacement.y / displacement.x ) );
+ Radian angle(atanf(displacement.y / displacement.x));
/////////////////////////////
// | //
// Quadrant 4: As is
/////////////////////////////
- if ( displacement.x < 0.0f )
+ if(displacement.x < 0.0f)
{
- if ( displacement.y >= 0.0f )
+ if(displacement.y >= 0.0f)
{
// Quadrant 2
angle.radian += Math::PI;
}
}
- if ( panDetector->CheckAngleAllowed( angle ) )
+ if(panDetector->CheckAngleAllowed(angle))
{
retVal = true;
}
return retVal;
}
-void PanGestureProcessor::EmitGestureSignal( Actor* actor, const GestureDetectorContainer& gestureDetectors, Vector2 actorCoordinates )
+void PanGestureProcessor::EmitGestureSignal(Actor* actor, const GestureDetectorContainer& gestureDetectors, Vector2 actorCoordinates)
{
- DALI_ASSERT_DEBUG ( mCurrentPanEvent );
+ DALI_ASSERT_DEBUG(mCurrentPanEvent);
mCurrentPanEmitters.clear();
ResetActor();
- actor->ScreenToLocal( *mCurrentRenderTask.Get(), actorCoordinates.x, actorCoordinates.y, mCurrentPanEvent->currentPosition.x, mCurrentPanEvent->currentPosition.y );
+ actor->ScreenToLocal(*mCurrentRenderTask.Get(), actorCoordinates.x, actorCoordinates.y, mCurrentPanEvent->currentPosition.x, mCurrentPanEvent->currentPosition.y);
- EmitPanSignal( actor, gestureDetectors, *mCurrentPanEvent, actorCoordinates, mCurrentPanEvent->state, mCurrentRenderTask );
+ EmitPanSignal(actor, gestureDetectors, *mCurrentPanEvent, actorCoordinates, mCurrentPanEvent->state, mCurrentRenderTask);
- if ( actor->OnScene() )
+ if(actor->OnScene())
{
mCurrentPanEmitters = gestureDetectors;
- SetActor( actor );
+ SetActor(actor);
}
}
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
// INTERNAL INCLUDES
#include <dali/public-api/events/wheel-event.h>
-#include <dali/public-api/math/vector2.h>
+#include <dali/integration-api/debug.h>
#include <dali/integration-api/events/wheel-event-integ.h>
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/common/scene-impl.h>
#include <dali/internal/event/events/hit-test-algorithm-impl.h>
#include <dali/internal/event/events/wheel-event-impl.h>
+#include <dali/public-api/math/vector2.h>
namespace Dali
{
-
namespace Internal
{
-
namespace
{
-
#if defined(DEBUG_ENABLED)
Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WHEEL_PROCESSOR");
#endif
/**
* Recursively deliver events to the actor and its parents, until the event is consumed or the stage is reached.
*/
-Dali::Actor EmitWheelSignals( Dali::Actor actor, const Dali::WheelEvent& event )
+Dali::Actor EmitWheelSignals(Dali::Actor actor, const Dali::WheelEvent& event)
{
Dali::Actor consumedActor;
- if ( actor )
+ if(actor)
{
- Dali::Actor oldParent( actor.GetParent() );
+ Dali::Actor oldParent(actor.GetParent());
- Actor& actorImpl( GetImplementation(actor) );
+ Actor& actorImpl(GetImplementation(actor));
- bool consumed( false );
+ bool consumed(false);
// Only do the conversion and emit the signal if the actor's wheel signal has connections.
- if ( actorImpl.GetWheelEventRequired() )
+ if(actorImpl.GetWheelEventRequired())
{
// Emit the signal to the parent
- consumed = actorImpl.EmitWheelEventSignal( event );
+ consumed = actorImpl.EmitWheelEventSignal(event);
}
- if ( consumed )
+ if(consumed)
{
// One of this actor's listeners has consumed the event so set this actor as the consumed actor.
- consumedActor = Dali::Actor( &actorImpl );
+ consumedActor = Dali::Actor(&actorImpl);
}
else
{
// The actor may have been removed/reparented during the signal callbacks.
Dali::Actor parent = actor.GetParent();
- if ( parent &&
- (parent == oldParent) )
+ if(parent &&
+ (parent == oldParent))
{
// One of the actor's parents may consumed the event and they should be set as the consumed actor.
- consumedActor = EmitWheelSignals( parent, event );
+ consumedActor = EmitWheelSignals(parent, event);
}
}
}
{
bool hittable = false;
- switch (type)
+ switch(type)
{
case Dali::HitTestAlgorithm::CHECK_ACTOR:
{
- if( GetImplementation(actor).GetWheelEventRequired() && // Does the Application or derived actor type require a wheel event?
- GetImplementation(actor).IsHittable() )
+ if(GetImplementation(actor).GetWheelEventRequired() && // Does the Application or derived actor type require a wheel event?
+ GetImplementation(actor).IsHittable())
{
hittable = true;
}
}
case Dali::HitTestAlgorithm::DESCEND_ACTOR_TREE:
{
- if( actor.GetProperty< bool >( Dali::Actor::Property::VISIBLE ) ) // Actor is visible, if not visible then none of its children are visible.
+ if(actor.GetProperty<bool>(Dali::Actor::Property::VISIBLE)) // Actor is visible, if not visible then none of its children are visible.
{
hittable = true;
}
} // unnamed namespace
-
-WheelEventProcessor::WheelEventProcessor( Scene& scene )
-: mScene( scene )
+WheelEventProcessor::WheelEventProcessor(Scene& scene)
+: mScene(scene)
{
}
WheelEventProcessor::~WheelEventProcessor() = default;
-void WheelEventProcessor::ProcessWheelEvent( const Integration::WheelEvent& event )
+void WheelEventProcessor::ProcessWheelEvent(const Integration::WheelEvent& event)
{
- WheelEventPtr wheelEvent = WheelEvent::New( static_cast< Dali::WheelEvent::Type >( event.type ), event.direction, event.modifiers, event.point, event.delta, event.timeStamp );
- Dali::WheelEvent wheelEventHandle( wheelEvent.Get() );
+ WheelEventPtr wheelEvent = WheelEvent::New(static_cast<Dali::WheelEvent::Type>(event.type), event.direction, event.modifiers, event.point, event.delta, event.timeStamp);
+ Dali::WheelEvent wheelEventHandle(wheelEvent.Get());
- if( wheelEvent->GetType() == Dali::WheelEvent::MOUSE_WHEEL )
+ if(wheelEvent->GetType() == Dali::WheelEvent::MOUSE_WHEEL)
{
Dali::HitTestAlgorithm::Results hitTestResults;
- HitTestAlgorithm::HitTest( mScene.GetSize(), mScene.GetRenderTaskList(), mScene.GetLayerList(), event.point, hitTestResults, IsActorWheelableFunction );
+ HitTestAlgorithm::HitTest(mScene.GetSize(), mScene.GetRenderTaskList(), mScene.GetLayerList(), event.point, hitTestResults, IsActorWheelableFunction);
- DALI_LOG_INFO( gLogFilter, Debug::General, " Screen(%.0f, %.0f), HitActor(%p, %s), Local(%.2f, %.2f)\n",
- event.point.x, event.point.y,
- ( hitTestResults.actor ? reinterpret_cast< void* >( &hitTestResults.actor.GetBaseObject() ) : NULL ),
- ( hitTestResults.actor ? hitTestResults.actor.GetProperty< std::string >( Dali::Actor::Property::NAME ).c_str() : "" ),
- hitTestResults.actorCoordinates.x, hitTestResults.actorCoordinates.y );
+ DALI_LOG_INFO(gLogFilter, Debug::General, " Screen(%.0f, %.0f), HitActor(%p, %s), Local(%.2f, %.2f)\n", event.point.x, event.point.y, (hitTestResults.actor ? reinterpret_cast<void*>(&hitTestResults.actor.GetBaseObject()) : NULL), (hitTestResults.actor ? hitTestResults.actor.GetProperty<std::string>(Dali::Actor::Property::NAME).c_str() : ""), hitTestResults.actorCoordinates.x, hitTestResults.actorCoordinates.y);
// Recursively deliver events to the actor and its parents, until the event is consumed or the stage is reached.
- Dali::Actor consumedActor = EmitWheelSignals( hitTestResults.actor, wheelEventHandle );
+ Dali::Actor consumedActor = EmitWheelSignals(hitTestResults.actor, wheelEventHandle);
- DALI_LOG_INFO( gLogFilter, Debug::Concise, "HitActor: (%p) %s\n", hitTestResults.actor ? reinterpret_cast< void* >( &hitTestResults.actor.GetBaseObject() ) : NULL, hitTestResults.actor ? hitTestResults.actor.GetProperty< std::string >( Dali::Actor::Property::NAME ).c_str() : "" );
- DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? reinterpret_cast< void* >( &consumedActor.GetBaseObject() ) : NULL, consumedActor ? consumedActor.GetProperty< std::string >( Dali::Actor::Property::NAME ).c_str() : "" );
+ DALI_LOG_INFO(gLogFilter, Debug::Concise, "HitActor: (%p) %s\n", hitTestResults.actor ? reinterpret_cast<void*>(&hitTestResults.actor.GetBaseObject()) : NULL, hitTestResults.actor ? hitTestResults.actor.GetProperty<std::string>(Dali::Actor::Property::NAME).c_str() : "");
+ DALI_LOG_INFO(gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? reinterpret_cast<void*>(&consumedActor.GetBaseObject()) : NULL, consumedActor ? consumedActor.GetProperty<std::string>(Dali::Actor::Property::NAME).c_str() : "");
}
else
{
// if CUSTOM_WHEEL, emit the wheel event signal from the scene.
- mScene.EmitWheelEventSignal( wheelEventHandle );
+ mScene.EmitWheelEventSignal(wheelEventHandle);
}
}
#include <dali/devel-api/threading/thread-pool.h>
#include <dali/integration-api/core.h>
#include <dali/integration-api/gl-context-helper-abstraction.h>
+
#include <dali/internal/event/common/scene-impl.h>
+
+#include <dali/internal/update/common/scene-graph-scene.h>
+#include <dali/internal/update/render-tasks/scene-graph-camera.h>
+
#include <dali/internal/render/common/render-algorithms.h>
#include <dali/internal/render/common/render-debug.h>
+#include <dali/internal/render/common/render-instruction.h>
#include <dali/internal/render/common/render-tracker.h>
#include <dali/internal/render/queue/render-queue.h>
+#include <dali/internal/render/renderers/render-frame-buffer.h>
+#include <dali/internal/render/renderers/render-texture.h>
#include <dali/internal/render/shaders/program-controller.h>
namespace Dali
#define DALI_INTERNAL_SCENE_GRAPH_RENDER_DATA_PROVIDER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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/rendering/renderer.h>
#include <dali/internal/render/data-providers/node-data-provider.h>
#include <dali/internal/render/data-providers/uniform-map-data-provider.h>
-#include <dali/internal/render/renderers/render-sampler.h>
-#include <dali/internal/render/renderers/render-texture.h>
#include <dali/internal/update/common/animatable-property.h>
+#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/rendering/renderer.h>
namespace Dali
{
namespace Internal
{
-
struct BlendingOptions;
+namespace Render
+{
+class Texture;
+class Sampler;
+} // namespace Render
+
namespace SceneGraph
{
class Shader;
* The RendererAttachment that creates this object will initialize the members
* directly.
*/
- RenderDataProvider( AnimatableProperty< float >& opacity );
+ RenderDataProvider(AnimatableProperty<float>& opacity);
/**
* Destructor
~RenderDataProvider();
public:
-
/**
* Set the uniform map data provider
* @param[in] uniformMapDataProvider The uniform map data provider
* Set the shader data provider
* @param[in] shader The shader data provider
*/
- void SetShader( Shader& shader );
+ void SetShader(Shader& shader);
/**
* Returns the shader
* Get the opacity
* @return The opacity
*/
- float GetOpacity( BufferIndex bufferIndex );
+ float GetOpacity(BufferIndex bufferIndex);
private:
-
- const UniformMapDataProvider* mUniformMapDataProvider;
- Shader* mShader;
- std::vector<Render::Texture*> mTextures;
- Samplers mSamplers;
- AnimatableProperty< float >& mOpacity;
+ const UniformMapDataProvider* mUniformMapDataProvider;
+ Shader* mShader;
+ std::vector<Render::Texture*> mTextures;
+ Samplers mSamplers;
+ AnimatableProperty<float>& mOpacity;
// Give Renderer access to our private data to reduce copying vectors on construction.
friend class Renderer;
};
-} // SceneGraph
-} // Internal
-} // Dali
+} // namespace SceneGraph
+} // namespace Internal
+} // namespace Dali
#endif // DALI_INTERNAL_SCENE_GRAPH_RENDER_DATA_PROVIDER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
// INTERNAL INCLUDES
#include <dali/internal/common/image-sampler.h>
+#include <dali/internal/render/common/render-instruction.h>
+#include <dali/internal/render/data-providers/node-data-provider.h>
+#include <dali/internal/render/data-providers/uniform-map-data-provider.h>
#include <dali/internal/render/gl-resources/context.h>
#include <dali/internal/render/renderers/render-sampler.h>
-#include <dali/internal/render/shaders/scene-graph-shader.h>
+#include <dali/internal/render/renderers/render-texture.h>
#include <dali/internal/render/shaders/program.h>
-#include <dali/internal/render/data-providers/node-data-provider.h>
-#include <dali/internal/render/data-providers/uniform-map-data-provider.h>
-#include <dali/internal/render/common/render-instruction.h>
+#include <dali/internal/render/shaders/scene-graph-shader.h>
namespace Dali
{
-
namespace Internal
{
-
namespace
{
-
-
/**
* Helper to set view and projection matrices once per program
* @param program to set the matrices to
* @param modelViewMatrix to set
* @param modelViewProjectionMatrix to set
*/
-inline void SetMatrices( Program& program,
- const Matrix& modelMatrix,
- const Matrix& viewMatrix,
- const Matrix& projectionMatrix,
- const Matrix& modelViewMatrix )
-{
- GLint loc = program.GetUniformLocation( Program::UNIFORM_MODEL_MATRIX );
- if( Program::UNIFORM_UNKNOWN != loc )
+inline void SetMatrices(Program& program,
+ const Matrix& modelMatrix,
+ const Matrix& viewMatrix,
+ const Matrix& projectionMatrix,
+ const Matrix& modelViewMatrix)
+{
+ GLint loc = program.GetUniformLocation(Program::UNIFORM_MODEL_MATRIX);
+ if(Program::UNIFORM_UNKNOWN != loc)
{
- program.SetUniformMatrix4fv( loc, 1, modelMatrix.AsFloat() );
+ program.SetUniformMatrix4fv(loc, 1, modelMatrix.AsFloat());
}
- loc = program.GetUniformLocation( Program::UNIFORM_VIEW_MATRIX );
- if( Program::UNIFORM_UNKNOWN != loc )
+ loc = program.GetUniformLocation(Program::UNIFORM_VIEW_MATRIX);
+ if(Program::UNIFORM_UNKNOWN != loc)
{
- if( program.GetViewMatrix() != &viewMatrix )
+ if(program.GetViewMatrix() != &viewMatrix)
{
- program.SetViewMatrix( &viewMatrix );
- program.SetUniformMatrix4fv( loc, 1, viewMatrix.AsFloat() );
+ program.SetViewMatrix(&viewMatrix);
+ program.SetUniformMatrix4fv(loc, 1, viewMatrix.AsFloat());
}
}
// set projection matrix if program has not yet received it this frame or if it is dirty
- loc = program.GetUniformLocation( Program::UNIFORM_PROJECTION_MATRIX );
- if( Program::UNIFORM_UNKNOWN != loc )
+ loc = program.GetUniformLocation(Program::UNIFORM_PROJECTION_MATRIX);
+ if(Program::UNIFORM_UNKNOWN != loc)
{
- if( program.GetProjectionMatrix() != &projectionMatrix )
+ if(program.GetProjectionMatrix() != &projectionMatrix)
{
- program.SetProjectionMatrix( &projectionMatrix );
- program.SetUniformMatrix4fv( loc, 1, projectionMatrix.AsFloat() );
+ program.SetProjectionMatrix(&projectionMatrix);
+ program.SetUniformMatrix4fv(loc, 1, projectionMatrix.AsFloat());
}
}
loc = program.GetUniformLocation(Program::UNIFORM_MODELVIEW_MATRIX);
- if( Program::UNIFORM_UNKNOWN != loc )
+ if(Program::UNIFORM_UNKNOWN != loc)
{
- program.SetUniformMatrix4fv( loc, 1, modelViewMatrix.AsFloat() );
+ program.SetUniformMatrix4fv(loc, 1, modelViewMatrix.AsFloat());
}
- loc = program.GetUniformLocation( Program::UNIFORM_MVP_MATRIX );
- if( Program::UNIFORM_UNKNOWN != loc )
+ loc = program.GetUniformLocation(Program::UNIFORM_MVP_MATRIX);
+ if(Program::UNIFORM_UNKNOWN != loc)
{
Matrix modelViewProjectionMatrix(false);
- Matrix::Multiply( modelViewProjectionMatrix, modelViewMatrix, projectionMatrix );
- program.SetUniformMatrix4fv( loc, 1, modelViewProjectionMatrix.AsFloat() );
+ Matrix::Multiply(modelViewProjectionMatrix, modelViewMatrix, projectionMatrix);
+ program.SetUniformMatrix4fv(loc, 1, modelViewProjectionMatrix.AsFloat());
}
- loc = program.GetUniformLocation( Program::UNIFORM_NORMAL_MATRIX );
- if( Program::UNIFORM_UNKNOWN != loc )
+ loc = program.GetUniformLocation(Program::UNIFORM_NORMAL_MATRIX);
+ if(Program::UNIFORM_UNKNOWN != loc)
{
Matrix3 normalMatrix;
normalMatrix = modelViewMatrix;
normalMatrix.Invert();
normalMatrix.Transpose();
- program.SetUniformMatrix3fv( loc, 1, normalMatrix.AsFloat() );
+ program.SetUniformMatrix3fv(loc, 1, normalMatrix.AsFloat());
}
}
-}
+} // namespace
namespace Render
{
-
-Renderer* Renderer::New( SceneGraph::RenderDataProvider* dataProvider,
- Render::Geometry* geometry,
- uint32_t blendingBitmask,
- const Vector4& blendColor,
- FaceCullingMode::Type faceCullingMode,
- bool preMultipliedAlphaEnabled,
- DepthWriteMode::Type depthWriteMode,
- DepthTestMode::Type depthTestMode,
- DepthFunction::Type depthFunction,
- StencilParameters& stencilParameters )
-{
- return new Renderer( dataProvider, geometry, blendingBitmask, blendColor,
- faceCullingMode, preMultipliedAlphaEnabled, depthWriteMode, depthTestMode,
- depthFunction, stencilParameters );
-}
-
-Renderer::Renderer( SceneGraph::RenderDataProvider* dataProvider,
- Render::Geometry* geometry,
- uint32_t blendingBitmask,
- const Vector4& blendColor,
- FaceCullingMode::Type faceCullingMode,
- bool preMultipliedAlphaEnabled,
- DepthWriteMode::Type depthWriteMode,
- DepthTestMode::Type depthTestMode,
- DepthFunction::Type depthFunction,
- StencilParameters& stencilParameters )
-: mRenderDataProvider( dataProvider ),
- mContext( nullptr),
- mGeometry( geometry ),
+Renderer* Renderer::New(SceneGraph::RenderDataProvider* dataProvider,
+ Render::Geometry* geometry,
+ uint32_t blendingBitmask,
+ const Vector4& blendColor,
+ FaceCullingMode::Type faceCullingMode,
+ bool preMultipliedAlphaEnabled,
+ DepthWriteMode::Type depthWriteMode,
+ DepthTestMode::Type depthTestMode,
+ DepthFunction::Type depthFunction,
+ StencilParameters& stencilParameters)
+{
+ return new Renderer(dataProvider, geometry, blendingBitmask, blendColor, faceCullingMode, preMultipliedAlphaEnabled, depthWriteMode, depthTestMode, depthFunction, stencilParameters);
+}
+
+Renderer::Renderer(SceneGraph::RenderDataProvider* dataProvider,
+ Render::Geometry* geometry,
+ uint32_t blendingBitmask,
+ const Vector4& blendColor,
+ FaceCullingMode::Type faceCullingMode,
+ bool preMultipliedAlphaEnabled,
+ DepthWriteMode::Type depthWriteMode,
+ DepthTestMode::Type depthTestMode,
+ DepthFunction::Type depthFunction,
+ StencilParameters& stencilParameters)
+: mRenderDataProvider(dataProvider),
+ mContext(nullptr),
+ mGeometry(geometry),
mUniformIndexMap(),
mAttributesLocation(),
mUniformsHash(),
- mStencilParameters( stencilParameters ),
+ mStencilParameters(stencilParameters),
mBlendingOptions(),
- mIndexedDrawFirstElement( 0 ),
- mIndexedDrawElementsCount( 0 ),
- mDepthFunction( depthFunction ),
- mFaceCullingMode( faceCullingMode ),
- mDepthWriteMode( depthWriteMode ),
- mDepthTestMode( depthTestMode ),
- mUpdateAttributesLocation( true ),
- mPremultipledAlphaEnabled( preMultipliedAlphaEnabled ),
- mShaderChanged( false ),
- mUpdated( true )
-{
- if( blendingBitmask != 0u )
+ mIndexedDrawFirstElement(0),
+ mIndexedDrawElementsCount(0),
+ mDepthFunction(depthFunction),
+ mFaceCullingMode(faceCullingMode),
+ mDepthWriteMode(depthWriteMode),
+ mDepthTestMode(depthTestMode),
+ mUpdateAttributesLocation(true),
+ mPremultipledAlphaEnabled(preMultipliedAlphaEnabled),
+ mShaderChanged(false),
+ mUpdated(true)
+{
+ if(blendingBitmask != 0u)
{
- mBlendingOptions.SetBitmask( blendingBitmask );
+ mBlendingOptions.SetBitmask(blendingBitmask);
}
- mBlendingOptions.SetBlendColor( blendColor );
+ mBlendingOptions.SetBlendColor(blendColor);
}
-void Renderer::Initialize( Context& context )
+void Renderer::Initialize(Context& context)
{
mContext = &context;
}
Renderer::~Renderer() = default;
-void Renderer::SetGeometry( Render::Geometry* geometry )
+void Renderer::SetGeometry(Render::Geometry* geometry)
{
- mGeometry = geometry;
+ mGeometry = geometry;
mUpdateAttributesLocation = true;
}
-void Renderer::SetDrawCommands( Dali::DevelRenderer::DrawCommand* pDrawCommands, uint32_t size )
+void Renderer::SetDrawCommands(Dali::DevelRenderer::DrawCommand* pDrawCommands, uint32_t size)
{
mDrawCommands.clear();
- mDrawCommands.insert( mDrawCommands.end(), pDrawCommands, pDrawCommands+size );
+ mDrawCommands.insert(mDrawCommands.end(), pDrawCommands, pDrawCommands + size);
}
-void Renderer::SetBlending( Context& context, bool blend )
+void Renderer::SetBlending(Context& context, bool blend)
{
- context.SetBlend( blend );
- if( blend )
+ context.SetBlend(blend);
+ if(blend)
{
// Blend color is optional and rarely used
const Vector4* blendColor = mBlendingOptions.GetBlendColor();
- if( blendColor )
+ if(blendColor)
{
- context.SetCustomBlendColor( *blendColor );
+ context.SetCustomBlendColor(*blendColor);
}
else
{
}
// Set blend source & destination factors
- context.BlendFuncSeparate( mBlendingOptions.GetBlendSrcFactorRgb(),
- mBlendingOptions.GetBlendDestFactorRgb(),
- mBlendingOptions.GetBlendSrcFactorAlpha(),
- mBlendingOptions.GetBlendDestFactorAlpha() );
+ context.BlendFuncSeparate(mBlendingOptions.GetBlendSrcFactorRgb(),
+ mBlendingOptions.GetBlendDestFactorRgb(),
+ mBlendingOptions.GetBlendSrcFactorAlpha(),
+ mBlendingOptions.GetBlendDestFactorAlpha());
// Set blend equations
Dali::DevelBlendEquation::Type rgbEquation = mBlendingOptions.GetBlendEquationRgb();
Dali::DevelBlendEquation::Type alphaEquation = mBlendingOptions.GetBlendEquationAlpha();
- if( mBlendingOptions.IsAdvancedBlendEquationApplied() && mPremultipledAlphaEnabled )
+ if(mBlendingOptions.IsAdvancedBlendEquationApplied() && mPremultipledAlphaEnabled)
{
- if( rgbEquation != alphaEquation )
+ if(rgbEquation != alphaEquation)
{
- DALI_LOG_ERROR( "Advanced Blend Equation have to be appried by using BlendEquation.\n" );
+ DALI_LOG_ERROR("Advanced Blend Equation have to be appried by using BlendEquation.\n");
}
- context.BlendEquation( rgbEquation );
+ context.BlendEquation(rgbEquation);
}
else
{
- context.BlendEquationSeparate( rgbEquation, alphaEquation );
+ context.BlendEquationSeparate(rgbEquation, alphaEquation);
}
}
{
}
-void Renderer::SetUniforms( BufferIndex bufferIndex, const SceneGraph::NodeDataProvider& node, const Vector3& size, Program& program )
+void Renderer::SetUniforms(BufferIndex bufferIndex, const SceneGraph::NodeDataProvider& node, const Vector3& size, Program& program)
{
// Check if the map has changed
- DALI_ASSERT_DEBUG( mRenderDataProvider && "No Uniform map data provider available" );
+ DALI_ASSERT_DEBUG(mRenderDataProvider && "No Uniform map data provider available");
const SceneGraph::UniformMapDataProvider& uniformMapDataProvider = mRenderDataProvider->GetUniformMap();
- if( uniformMapDataProvider.GetUniformMapChanged( bufferIndex ) ||
- node.GetUniformMapChanged(bufferIndex) ||
- mUniformIndexMap.Count() == 0 ||
- mShaderChanged )
+ if(uniformMapDataProvider.GetUniformMapChanged(bufferIndex) ||
+ node.GetUniformMapChanged(bufferIndex) ||
+ mUniformIndexMap.Count() == 0 ||
+ mShaderChanged)
{
// Reset shader pointer
mShaderChanged = false;
- const SceneGraph::CollectedUniformMap& uniformMap = uniformMapDataProvider.GetUniformMap( bufferIndex );
- const SceneGraph::CollectedUniformMap& uniformMapNode = node.GetUniformMap( bufferIndex );
+ const SceneGraph::CollectedUniformMap& uniformMap = uniformMapDataProvider.GetUniformMap(bufferIndex);
+ const SceneGraph::CollectedUniformMap& uniformMapNode = node.GetUniformMap(bufferIndex);
- uint32_t maxMaps = static_cast<uint32_t>( uniformMap.Count() + uniformMapNode.Count() ); // 4,294,967,295 maps should be enough
- mUniformIndexMap.Clear(); // Clear contents, but keep memory if we don't change size
- mUniformIndexMap.Resize( maxMaps );
+ uint32_t maxMaps = static_cast<uint32_t>(uniformMap.Count() + uniformMapNode.Count()); // 4,294,967,295 maps should be enough
+ mUniformIndexMap.Clear(); // Clear contents, but keep memory if we don't change size
+ mUniformIndexMap.Resize(maxMaps);
uint32_t mapIndex = 0;
- for(; mapIndex < uniformMap.Count() ; ++mapIndex )
+ for(; mapIndex < uniformMap.Count(); ++mapIndex)
{
mUniformIndexMap[mapIndex].propertyValue = uniformMap[mapIndex].propertyPtr;
mUniformIndexMap[mapIndex].uniformIndex = program.RegisterUniform(uniformMap[mapIndex].uniformName);
}
- for( uint32_t nodeMapIndex = 0; nodeMapIndex < uniformMapNode.Count() ; ++nodeMapIndex )
+ for(uint32_t nodeMapIndex = 0; nodeMapIndex < uniformMapNode.Count(); ++nodeMapIndex)
{
uint32_t uniformIndex = program.RegisterUniform(uniformMapNode[nodeMapIndex].uniformName);
- bool found(false);
- for( uint32_t i = 0; i<uniformMap.Count(); ++i )
+ bool found(false);
+ for(uint32_t i = 0; i < uniformMap.Count(); ++i)
{
- if( mUniformIndexMap[i].uniformIndex == uniformIndex )
+ if(mUniformIndexMap[i].uniformIndex == uniformIndex)
{
mUniformIndexMap[i].propertyValue = uniformMapNode[nodeMapIndex].propertyPtr;
- found = true;
+ found = true;
break;
}
}
- if( !found )
+ if(!found)
{
mUniformIndexMap[mapIndex].propertyValue = uniformMapNode[nodeMapIndex].propertyPtr;
- mUniformIndexMap[mapIndex].uniformIndex = uniformIndex;
+ mUniformIndexMap[mapIndex].uniformIndex = uniformIndex;
++mapIndex;
}
}
- mUniformIndexMap.Resize( mapIndex );
+ mUniformIndexMap.Resize(mapIndex);
}
// Set uniforms in local map
- for( UniformIndexMappings::Iterator iter = mUniformIndexMap.Begin(),
- end = mUniformIndexMap.End() ;
- iter != end ;
- ++iter )
+ for(UniformIndexMappings::Iterator iter = mUniformIndexMap.Begin(),
+ end = mUniformIndexMap.End();
+ iter != end;
+ ++iter)
{
- SetUniformFromProperty( bufferIndex, program, *iter );
+ SetUniformFromProperty(bufferIndex, program, *iter);
}
- GLint sizeLoc = program.GetUniformLocation( Program::UNIFORM_SIZE );
- if( -1 != sizeLoc )
+ GLint sizeLoc = program.GetUniformLocation(Program::UNIFORM_SIZE);
+ if(-1 != sizeLoc)
{
- program.SetSizeUniform3f( sizeLoc, size.x, size.y, size.z );
+ program.SetSizeUniform3f(sizeLoc, size.x, size.y, size.z);
}
}
-void Renderer::SetUniformFromProperty( BufferIndex bufferIndex, Program& program, UniformIndexMap& map )
+void Renderer::SetUniformFromProperty(BufferIndex bufferIndex, Program& program, UniformIndexMap& map)
{
GLint location = program.GetUniformLocation(map.uniformIndex);
- if( Program::UNIFORM_UNKNOWN != location )
+ if(Program::UNIFORM_UNKNOWN != location)
{
// switch based on property type to use correct GL uniform setter
- switch ( map.propertyValue->GetType() )
+ switch(map.propertyValue->GetType())
{
case Property::INTEGER:
{
- program.SetUniform1i( location, map.propertyValue->GetInteger( bufferIndex ) );
+ program.SetUniform1i(location, map.propertyValue->GetInteger(bufferIndex));
break;
}
case Property::FLOAT:
{
- program.SetUniform1f( location, map.propertyValue->GetFloat( bufferIndex ) );
+ program.SetUniform1f(location, map.propertyValue->GetFloat(bufferIndex));
break;
}
case Property::VECTOR2:
{
- Vector2 value( map.propertyValue->GetVector2( bufferIndex ) );
- program.SetUniform2f( location, value.x, value.y );
+ Vector2 value(map.propertyValue->GetVector2(bufferIndex));
+ program.SetUniform2f(location, value.x, value.y);
break;
}
case Property::VECTOR3:
{
- Vector3 value( map.propertyValue->GetVector3( bufferIndex ) );
- program.SetUniform3f( location, value.x, value.y, value.z );
+ Vector3 value(map.propertyValue->GetVector3(bufferIndex));
+ program.SetUniform3f(location, value.x, value.y, value.z);
break;
}
case Property::VECTOR4:
{
- Vector4 value( map.propertyValue->GetVector4( bufferIndex ) );
- program.SetUniform4f( location, value.x, value.y, value.z, value.w );
+ Vector4 value(map.propertyValue->GetVector4(bufferIndex));
+ program.SetUniform4f(location, value.x, value.y, value.z, value.w);
break;
}
case Property::ROTATION:
{
- Quaternion value( map.propertyValue->GetQuaternion( bufferIndex ) );
- program.SetUniform4f( location, value.mVector.x, value.mVector.y, value.mVector.z, value.mVector.w );
+ Quaternion value(map.propertyValue->GetQuaternion(bufferIndex));
+ program.SetUniform4f(location, value.mVector.x, value.mVector.y, value.mVector.z, value.mVector.w);
break;
}
case Property::MATRIX:
{
const Matrix& value = map.propertyValue->GetMatrix(bufferIndex);
- program.SetUniformMatrix4fv(location, 1, value.AsFloat() );
+ program.SetUniformMatrix4fv(location, 1, value.AsFloat());
break;
}
case Property::MATRIX3:
{
const Matrix3& value = map.propertyValue->GetMatrix3(bufferIndex);
- program.SetUniformMatrix3fv(location, 1, value.AsFloat() );
+ program.SetUniformMatrix3fv(location, 1, value.AsFloat());
break;
}
}
}
-bool Renderer::BindTextures( Context& context, Program& program, Vector<GLuint>& boundTextures )
+bool Renderer::BindTextures(Context& context, Program& program, Vector<GLuint>& boundTextures)
{
uint32_t textureUnit = 0;
- bool result = true;
+ bool result = true;
- GLint uniformLocation(-1);
- std::vector<Render::Sampler*>& samplers( mRenderDataProvider->GetSamplers() );
- std::vector<Render::Texture*>& textures( mRenderDataProvider->GetTextures() );
- for( uint32_t i = 0; i < static_cast<uint32_t>( textures.size() ) && result; ++i ) // not expecting more than uint32_t of textures
+ GLint uniformLocation(-1);
+ std::vector<Render::Sampler*>& samplers(mRenderDataProvider->GetSamplers());
+ std::vector<Render::Texture*>& textures(mRenderDataProvider->GetTextures());
+ for(uint32_t i = 0; i < static_cast<uint32_t>(textures.size()) && result; ++i) // not expecting more than uint32_t of textures
{
- if( textures[i] )
+ if(textures[i])
{
- result = textures[i]->Bind(context, textureUnit, samplers[i] );
- boundTextures.PushBack( textures[i]->GetId() );
- if( result && program.GetSamplerUniformLocation( i, uniformLocation ) )
+ result = textures[i]->Bind(context, textureUnit, samplers[i]);
+ boundTextures.PushBack(textures[i]->GetId());
+ if(result && program.GetSamplerUniformLocation(i, uniformLocation))
{
- program.SetUniform1i( uniformLocation, textureUnit );
+ program.SetUniform1i(uniformLocation, textureUnit);
++textureUnit;
}
}
return result;
}
-void Renderer::SetFaceCullingMode( FaceCullingMode::Type mode )
+void Renderer::SetFaceCullingMode(FaceCullingMode::Type mode)
{
- mFaceCullingMode = mode;
- mUpdated = true;
+ mFaceCullingMode = mode;
+ mUpdated = true;
}
-void Renderer::SetBlendingBitMask( uint32_t bitmask )
+void Renderer::SetBlendingBitMask(uint32_t bitmask)
{
- mBlendingOptions.SetBitmask( bitmask );
+ mBlendingOptions.SetBitmask(bitmask);
mUpdated = true;
}
-void Renderer::SetBlendColor( const Vector4& color )
+void Renderer::SetBlendColor(const Vector4& color)
{
- mBlendingOptions.SetBlendColor( color );
+ mBlendingOptions.SetBlendColor(color);
mUpdated = true;
}
-void Renderer::SetIndexedDrawFirstElement( uint32_t firstElement )
+void Renderer::SetIndexedDrawFirstElement(uint32_t firstElement)
{
mIndexedDrawFirstElement = firstElement;
- mUpdated = true;
+ mUpdated = true;
}
-void Renderer::SetIndexedDrawElementsCount( uint32_t elementsCount )
+void Renderer::SetIndexedDrawElementsCount(uint32_t elementsCount)
{
mIndexedDrawElementsCount = elementsCount;
- mUpdated = true;
+ mUpdated = true;
}
-void Renderer::EnablePreMultipliedAlpha( bool enable )
+void Renderer::EnablePreMultipliedAlpha(bool enable)
{
mPremultipledAlphaEnabled = enable;
- mUpdated = true;
+ mUpdated = true;
}
-void Renderer::SetDepthWriteMode( DepthWriteMode::Type depthWriteMode )
+void Renderer::SetDepthWriteMode(DepthWriteMode::Type depthWriteMode)
{
mDepthWriteMode = depthWriteMode;
- mUpdated = true;
+ mUpdated = true;
}
-void Renderer::SetDepthTestMode( DepthTestMode::Type depthTestMode )
+void Renderer::SetDepthTestMode(DepthTestMode::Type depthTestMode)
{
mDepthTestMode = depthTestMode;
- mUpdated = true;
+ mUpdated = true;
}
DepthWriteMode::Type Renderer::GetDepthWriteMode() const
return mDepthTestMode;
}
-void Renderer::SetDepthFunction( DepthFunction::Type depthFunction )
+void Renderer::SetDepthFunction(DepthFunction::Type depthFunction)
{
mDepthFunction = depthFunction;
- mUpdated = true;
+ mUpdated = true;
}
DepthFunction::Type Renderer::GetDepthFunction() const
return mDepthFunction;
}
-void Renderer::SetRenderMode( RenderMode::Type renderMode )
+void Renderer::SetRenderMode(RenderMode::Type renderMode)
{
mStencilParameters.renderMode = renderMode;
- mUpdated = true;
+ mUpdated = true;
}
RenderMode::Type Renderer::GetRenderMode() const
return mStencilParameters.renderMode;
}
-void Renderer::SetStencilFunction( StencilFunction::Type stencilFunction )
+void Renderer::SetStencilFunction(StencilFunction::Type stencilFunction)
{
mStencilParameters.stencilFunction = stencilFunction;
- mUpdated = true;
+ mUpdated = true;
}
StencilFunction::Type Renderer::GetStencilFunction() const
return mStencilParameters.stencilFunction;
}
-void Renderer::SetStencilFunctionMask( int stencilFunctionMask )
+void Renderer::SetStencilFunctionMask(int stencilFunctionMask)
{
mStencilParameters.stencilFunctionMask = stencilFunctionMask;
- mUpdated = true;
+ mUpdated = true;
}
int Renderer::GetStencilFunctionMask() const
return mStencilParameters.stencilFunctionMask;
}
-void Renderer::SetStencilFunctionReference( int stencilFunctionReference )
+void Renderer::SetStencilFunctionReference(int stencilFunctionReference)
{
mStencilParameters.stencilFunctionReference = stencilFunctionReference;
- mUpdated = true;
+ mUpdated = true;
}
int Renderer::GetStencilFunctionReference() const
return mStencilParameters.stencilFunctionReference;
}
-void Renderer::SetStencilMask( int stencilMask )
+void Renderer::SetStencilMask(int stencilMask)
{
mStencilParameters.stencilMask = stencilMask;
- mUpdated = true;
+ mUpdated = true;
}
int Renderer::GetStencilMask() const
return mStencilParameters.stencilMask;
}
-void Renderer::SetStencilOperationOnFail( StencilOperation::Type stencilOperationOnFail )
+void Renderer::SetStencilOperationOnFail(StencilOperation::Type stencilOperationOnFail)
{
mStencilParameters.stencilOperationOnFail = stencilOperationOnFail;
- mUpdated = true;
+ mUpdated = true;
}
StencilOperation::Type Renderer::GetStencilOperationOnFail() const
return mStencilParameters.stencilOperationOnFail;
}
-void Renderer::SetStencilOperationOnZFail( StencilOperation::Type stencilOperationOnZFail )
+void Renderer::SetStencilOperationOnZFail(StencilOperation::Type stencilOperationOnZFail)
{
mStencilParameters.stencilOperationOnZFail = stencilOperationOnZFail;
- mUpdated = true;
+ mUpdated = true;
}
StencilOperation::Type Renderer::GetStencilOperationOnZFail() const
return mStencilParameters.stencilOperationOnZFail;
}
-void Renderer::SetStencilOperationOnZPass( StencilOperation::Type stencilOperationOnZPass )
+void Renderer::SetStencilOperationOnZPass(StencilOperation::Type stencilOperationOnZPass)
{
mStencilParameters.stencilOperationOnZPass = stencilOperationOnZPass;
- mUpdated = true;
+ mUpdated = true;
}
StencilOperation::Type Renderer::GetStencilOperationOnZPass() const
return mStencilParameters.stencilOperationOnZPass;
}
-void Renderer::Upload( Context& context )
+void Renderer::Upload(Context& context)
{
- mGeometry->Upload( context );
+ mGeometry->Upload(context);
}
-void Renderer::Render( Context& context,
- BufferIndex bufferIndex,
- const SceneGraph::NodeDataProvider& node,
- const Matrix& modelMatrix,
- const Matrix& modelViewMatrix,
- const Matrix& viewMatrix,
- const Matrix& projectionMatrix,
- const Vector3& size,
- bool blend,
- Vector<GLuint>& boundTextures,
- const Dali::Internal::SceneGraph::RenderInstruction& instruction,
- uint32_t queueIndex )
+void Renderer::Render(Context& context,
+ BufferIndex bufferIndex,
+ const SceneGraph::NodeDataProvider& node,
+ const Matrix& modelMatrix,
+ const Matrix& modelViewMatrix,
+ const Matrix& viewMatrix,
+ const Matrix& projectionMatrix,
+ const Vector3& size,
+ bool blend,
+ Vector<GLuint>& boundTextures,
+ const Dali::Internal::SceneGraph::RenderInstruction& instruction,
+ uint32_t queueIndex)
{
// Before doing anything test if the call happens in the right queue
- if( mDrawCommands.empty() && queueIndex > 0 )
+ if(mDrawCommands.empty() && queueIndex > 0)
{
return;
}
// Prepare commands
std::vector<DevelRenderer::DrawCommand*> commands;
- for( auto& cmd : mDrawCommands )
+ for(auto& cmd : mDrawCommands)
{
if(cmd.queue == queueIndex)
{
- commands.emplace_back( &cmd );
+ commands.emplace_back(&cmd);
}
}
// Get the program to use:
Program* program = mRenderDataProvider->GetShader().GetProgram();
- if( !program )
+ if(!program)
{
- DALI_LOG_ERROR( "Failed to get program for shader at address %p.\n", reinterpret_cast< void* >( &mRenderDataProvider->GetShader() ) );
+ DALI_LOG_ERROR("Failed to get program for shader at address %p.\n", reinterpret_cast<void*>(&mRenderDataProvider->GetShader()));
return;
}
//Set cull face mode
const Dali::Internal::SceneGraph::Camera* cam = instruction.GetCamera();
- if (cam->GetReflectionUsed())
+ if(cam->GetReflectionUsed())
{
auto adjFaceCullingMode = mFaceCullingMode;
- switch( mFaceCullingMode )
+ switch(mFaceCullingMode)
{
case FaceCullingMode::Type::FRONT:
{
// nothing to do, leave culling as it is
}
}
- context.CullFace( adjFaceCullingMode );
+ context.CullFace(adjFaceCullingMode);
}
else
{
- context.CullFace( mFaceCullingMode );
+ context.CullFace(mFaceCullingMode);
}
// Take the program into use so we can send uniforms to it
program->Use();
- if( DALI_LIKELY( BindTextures( context, *program, boundTextures ) ) )
+ if(DALI_LIKELY(BindTextures(context, *program, boundTextures)))
{
// Only set up and draw if we have textures and they are all valid
// set projection and view matrix if program has not yet received them yet this frame
- SetMatrices( *program, modelMatrix, viewMatrix, projectionMatrix, modelViewMatrix );
+ SetMatrices(*program, modelMatrix, viewMatrix, projectionMatrix, modelViewMatrix);
// set color uniform
- GLint loc = program->GetUniformLocation( Program::UNIFORM_COLOR );
- if( Program::UNIFORM_UNKNOWN != loc )
+ GLint loc = program->GetUniformLocation(Program::UNIFORM_COLOR);
+ if(Program::UNIFORM_UNKNOWN != loc)
{
- const Vector4& color = node.GetRenderColor( bufferIndex );
- if( mPremultipledAlphaEnabled )
+ const Vector4& color = node.GetRenderColor(bufferIndex);
+ if(mPremultipledAlphaEnabled)
{
- float alpha = color.a * mRenderDataProvider->GetOpacity( bufferIndex );
- program->SetUniform4f( loc, color.r * alpha, color.g * alpha, color.b * alpha, alpha );
+ float alpha = color.a * mRenderDataProvider->GetOpacity(bufferIndex);
+ program->SetUniform4f(loc, color.r * alpha, color.g * alpha, color.b * alpha, alpha);
}
else
{
- program->SetUniform4f( loc, color.r, color.g, color.b, color.a * mRenderDataProvider->GetOpacity( bufferIndex ) );
+ program->SetUniform4f(loc, color.r, color.g, color.b, color.a * mRenderDataProvider->GetOpacity(bufferIndex));
}
}
- SetUniforms( bufferIndex, node, size, *program );
+ SetUniforms(bufferIndex, node, size, *program);
- if( mUpdateAttributesLocation || mGeometry->AttributesChanged() )
+ if(mUpdateAttributesLocation || mGeometry->AttributesChanged())
{
- mGeometry->GetAttributeLocationFromProgram( mAttributesLocation, *program, bufferIndex );
+ mGeometry->GetAttributeLocationFromProgram(mAttributesLocation, *program, bufferIndex);
mUpdateAttributesLocation = false;
}
- if( mBlendingOptions.IsAdvancedBlendEquationApplied() && mPremultipledAlphaEnabled )
+ if(mBlendingOptions.IsAdvancedBlendEquationApplied() && mPremultipledAlphaEnabled)
{
context.BlendBarrier();
}
if(mDrawCommands.empty())
{
- SetBlending( context, blend );
+ SetBlending(context, blend);
- mGeometry->Draw( context,
- bufferIndex,
- mAttributesLocation,
- mIndexedDrawFirstElement,
- mIndexedDrawElementsCount );
+ mGeometry->Draw(context,
+ bufferIndex,
+ mAttributesLocation,
+ mIndexedDrawFirstElement,
+ mIndexedDrawElementsCount);
}
else
{
- for(auto& cmd : commands )
+ for(auto& cmd : commands)
{
- if(cmd->queue == queueIndex )
+ if(cmd->queue == queueIndex)
{
//Set blending mode
SetBlending(context, cmd->queue == DevelRenderer::RENDER_QUEUE_OPAQUE ? false : blend);
- mGeometry->Draw(context, bufferIndex, mAttributesLocation,
- cmd->firstIndex, cmd->elementCount);
+ mGeometry->Draw(context, bufferIndex, mAttributesLocation, cmd->firstIndex, cmd->elementCount);
}
}
}
}
}
-void Renderer::SetSortAttributes( BufferIndex bufferIndex,
- SceneGraph::RenderInstructionProcessor::SortAttributes& sortAttributes ) const
+void Renderer::SetSortAttributes(BufferIndex bufferIndex,
+ SceneGraph::RenderInstructionProcessor::SortAttributes& sortAttributes) const
{
- sortAttributes.shader = &( mRenderDataProvider->GetShader() );
+ sortAttributes.shader = &(mRenderDataProvider->GetShader());
sortAttributes.geometry = mGeometry;
}
-void Renderer::SetShaderChanged( bool value )
+void Renderer::SetShaderChanged(bool value)
{
mShaderChanged = value;
}
bool Renderer::Updated(BufferIndex bufferIndex, const SceneGraph::NodeDataProvider* node)
{
- if (mUpdated)
+ if(mUpdated)
{
mUpdated = false;
return true;
}
- if (mShaderChanged || mUpdateAttributesLocation || mGeometry->AttributesChanged())
+ if(mShaderChanged || mUpdateAttributesLocation || mGeometry->AttributesChanged())
{
return true;
}
- for( const auto& texture : mRenderDataProvider->GetTextures() )
+ for(const auto& texture : mRenderDataProvider->GetTextures())
{
- if (texture && texture->IsNativeImage())
+ if(texture && texture->IsNativeImage())
{
return true;
}
}
- uint64_t hash = 0xc70f6907UL;
- const SceneGraph::CollectedUniformMap& uniformMapNode = node->GetUniformMap( bufferIndex );
+ uint64_t hash = 0xc70f6907UL;
+ const SceneGraph::CollectedUniformMap& uniformMapNode = node->GetUniformMap(bufferIndex);
for(const auto& uniformProperty : uniformMapNode)
{
hash = uniformProperty.propertyPtr->Hash(bufferIndex, hash);
}
const SceneGraph::UniformMapDataProvider& uniformMapDataProvider = mRenderDataProvider->GetUniformMap();
- const SceneGraph::CollectedUniformMap& uniformMap = uniformMapDataProvider.GetUniformMap( bufferIndex );
+ const SceneGraph::CollectedUniformMap& uniformMap = uniformMapDataProvider.GetUniformMap(bufferIndex);
for(const auto& uniformProperty : uniformMap)
{
hash = uniformProperty.propertyPtr->Hash(bufferIndex, hash);
}
- if (mUniformsHash != hash)
+ if(mUniformsHash != hash)
{
mUniformsHash = hash;
return true;
return false;
}
-} // namespace SceneGraph
+} // namespace Render
} // namespace Internal
#define DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
*/
// INTERNAL INCLUDES
-#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/common/vector-wrapper.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/common/type-abstraction-enums.h>
#include <dali/internal/event/common/event-thread-services.h>
+#include <dali/internal/event/rendering/texture-impl.h>
+#include <dali/internal/render/renderers/render-texture.h> // For OwnerPointer<Render::Texture>
+#include <dali/internal/render/renderers/render-vertex-buffer.h>
+#include <dali/internal/render/shaders/scene-graph-shader.h> // for OwnerPointer< Shader >
#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/common/scene-graph-scene.h>
+#include <dali/internal/update/gestures/scene-graph-pan-gesture.h>
+#include <dali/internal/update/manager/scene-graph-frame-callback.h> // for OwnerPointer< FrameCallback >
#include <dali/internal/update/nodes/node.h>
#include <dali/internal/update/nodes/scene-graph-layer.h>
-#include <dali/internal/update/manager/scene-graph-frame-callback.h> // for OwnerPointer< FrameCallback >
-#include <dali/internal/update/rendering/scene-graph-renderer.h> // for OwnerPointer< Renderer >
-#include <dali/internal/update/rendering/scene-graph-texture-set.h> // for OwnerPointer< TextureSet >
-#include <dali/internal/update/gestures/scene-graph-pan-gesture.h>
#include <dali/internal/update/render-tasks/scene-graph-camera.h>
#include <dali/internal/update/render-tasks/scene-graph-render-task-list.h>
-#include <dali/internal/render/shaders/scene-graph-shader.h> // for OwnerPointer< Shader >
-#include <dali/internal/render/renderers/render-vertex-buffer.h>
-#include <dali/internal/event/rendering/texture-impl.h>
+#include <dali/internal/update/rendering/scene-graph-renderer.h> // for OwnerPointer< Renderer >
+#include <dali/internal/update/rendering/scene-graph-texture-set.h> // for OwnerPointer< TextureSet >
namespace Dali
{
-
class FrameCallbackInterface;
namespace Integration
namespace Internal
{
-
class PropertyNotifier;
class NotificationManager;
class CompleteNotificationInterface;
{
struct Sampler;
class FrameBuffer;
-}
+} // namespace Render
// value types used by messages
-template <> struct ParameterType< PropertyNotification::NotifyMode >
-: public BasicType< PropertyNotification::NotifyMode > {};
+template<>
+struct ParameterType<PropertyNotification::NotifyMode>
+: public BasicType<PropertyNotification::NotifyMode>
+{
+};
namespace SceneGraph
{
-
class Animation;
class DiscardQueue;
class RenderManager;
class RenderQueue;
class VertexBuffer;
-struct NodeDepthPair
-{
- SceneGraph::Node* node;
- uint32_t sortedDepth;
- NodeDepthPair( SceneGraph::Node* node, uint32_t sortedDepth )
- : node(node),
- sortedDepth(sortedDepth)
- {
- }
-};
-
-struct NodeDepths
-{
- NodeDepths() = default;
-
- void Add( SceneGraph::Node* node, uint32_t sortedDepth )
- {
- nodeDepths.push_back( NodeDepthPair( node, sortedDepth ) );
- }
-
- std::vector<NodeDepthPair> nodeDepths;
-};
-
-
/**
* UpdateManager maintains a scene graph i.e. a tree of nodes as well as
* other scene graph property owning objects.
class UpdateManager : public ShaderSaver
{
public:
-
/**
* Construct a new UpdateManager.
* @param[in] notificationManager This should be notified when animations have finished.
* @param[in] renderQueue Used to queue messages for the next render.
* @param[in] renderTaskProcessor Handles RenderTasks and RenderInstrucitons.
*/
- UpdateManager( NotificationManager& notificationManager,
- CompleteNotificationInterface& animationPlaylist,
- PropertyNotifier& propertyNotifier,
- DiscardQueue& discardQueue,
- Integration::RenderController& controller,
- RenderManager& renderManager,
- RenderQueue& renderQueue,
- RenderTaskProcessor& renderTaskProcessor );
+ UpdateManager(NotificationManager& notificationManager,
+ CompleteNotificationInterface& animationPlaylist,
+ PropertyNotifier& propertyNotifier,
+ DiscardQueue& discardQueue,
+ Integration::RenderController& controller,
+ RenderManager& renderManager,
+ RenderQueue& renderQueue,
+ RenderTaskProcessor& renderTaskProcessor);
/**
* Destructor.
* @param[in] layer The new root node.
* @post The node is owned by UpdateManager.
*/
- void InstallRoot( OwnerPointer<Layer>& layer );
+ void InstallRoot(OwnerPointer<Layer>& layer);
/**
* Uninstalls the root node.
* @param[in] layer The root node.
* @post The node is owned by UpdateManager.
*/
- void UninstallRoot( Layer* layer );
+ void UninstallRoot(Layer* layer);
/**
* Add a Node; UpdateManager takes ownership.
* @note even though nodes are pool allocated, they also contain other heap allocated data, thus using OwnerPointer when transferring the data
* @param[in] node The node to add.
*/
- void AddNode( OwnerPointer<Node>& node );
+ void AddNode(OwnerPointer<Node>& node);
/**
* Connect a Node to the scene-graph.
* @pre The node does not already have a parent.
* @param[in] parent The new parent node.
*/
- void ConnectNode( Node* parent, Node* node );
+ void ConnectNode(Node* parent, Node* node);
/**
* Disconnect a Node from the scene-graph.
* @pre The node has a parent.
* @param[in] node The node to disconnect.
*/
- void DisconnectNode( Node* node );
+ void DisconnectNode(Node* node);
/**
* Destroy a Node owned by UpdateManager.
* @pre The node has been disconnected from the scene-graph i.e. has no parent or children.
* @param[in] node The node to destroy.
*/
- void DestroyNode( Node* node );
+ void DestroyNode(Node* node);
/**
* Add a camera on scene
* @param[in] camera The camera to add
*/
- void AddCamera( OwnerPointer< Camera >& camera );
+ void AddCamera(OwnerPointer<Camera>& camera);
/**
* Remove a camera from scene
* @param[in] camera to remove
*/
- void RemoveCamera( Camera* camera );
+ void RemoveCamera(Camera* camera);
/**
* Add a newly created object.
* @param[in] object The object to add.
* @post The object is owned by UpdateManager.
*/
- void AddObject( OwnerPointer<PropertyOwner>& object );
+ void AddObject(OwnerPointer<PropertyOwner>& object);
/**
* Remove an object.
* @param[in] object The object to remove.
*/
- void RemoveObject( PropertyOwner* object );
+ void RemoveObject(PropertyOwner* object);
/**
* Add a newly created render task list.
* @param[in] taskList The render task list to add.
* @post The render task list is owned by UpdateManager.
*/
- void AddRenderTaskList( OwnerPointer<RenderTaskList>& taskList );
+ void AddRenderTaskList(OwnerPointer<RenderTaskList>& taskList);
/**
* Remove a render task list.
* @param[in] taskList The render task list to remove.
*/
- void RemoveRenderTaskList( RenderTaskList* taskList );
+ void RemoveRenderTaskList(RenderTaskList* taskList);
/**
* Add a newly created scene.
* @param[in] scene The scene to add.
* @post The scene is owned by UpdateManager.
*/
- void AddScene( OwnerPointer<Scene>& scene );
+ void AddScene(OwnerPointer<Scene>& scene);
/**
* Remove a scene.
* @param[in] scene The scene to remove.
*/
- void RemoveScene( Scene* scene );
+ void RemoveScene(Scene* scene);
// Animations
* @param[in] animation The animation to add.
* @post The animation is owned by UpdateManager.
*/
- void AddAnimation( OwnerPointer< SceneGraph::Animation >& animation );
+ void AddAnimation(OwnerPointer<SceneGraph::Animation>& animation);
/**
* Stop an animation.
* @param[in] animation The animation to stop.
*/
- void StopAnimation( Animation* animation );
+ void StopAnimation(Animation* animation);
/**
* Remove an animation.
* @param[in] animation The animation to remove.
*/
- void RemoveAnimation( Animation* animation );
+ void RemoveAnimation(Animation* animation);
/**
* Query whether any animations are currently running.
* 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 );
+ void AddPropertyResetter(OwnerPointer<PropertyResetterBase>& propertyResetter);
// Property Notification
* @param[in] propertyNotification The notification to add
* @post The propertyNotification is owned by UpdateManager.
*/
- void AddPropertyNotification( OwnerPointer< PropertyNotification >& propertyNotification );
+ void AddPropertyNotification(OwnerPointer<PropertyNotification>& propertyNotification);
/**
* Remove a property notification
* @param[in] propertyNotification The notification to remove
*/
- void RemovePropertyNotification( PropertyNotification* propertyNotification );
+ void RemovePropertyNotification(PropertyNotification* propertyNotification);
/**
* Set Notify state for PropertyNotification
* @param[in] propertyNotification The notification to remove
* @param[in] notifyMode The notification mode.
*/
- void PropertyNotificationSetNotify( PropertyNotification* propertyNotification, PropertyNotification::NotifyMode notifyMode );
+ void PropertyNotificationSetNotify(PropertyNotification* propertyNotification, PropertyNotification::NotifyMode notifyMode);
// Shaders
* @param[in] shader The shader to add.
* @post The shader is owned by the UpdateManager.
*/
- void AddShader( OwnerPointer< Shader >& shader );
+ void AddShader(OwnerPointer<Shader>& shader);
/**
* Remove a shader.
* @param[in] shader The shader to remove.
* @post The shader is destroyed.
*/
- void RemoveShader( Shader* shader );
+ void RemoveShader(Shader* shader);
/**
* Set the shader program for a Shader object
* @param[in] shaderData Source code, hash over source, and optional compiled binary for the shader program
* @param[in] modifiesGeometry True if the vertex shader modifies geometry
*/
- void SetShaderProgram( Shader* shader, Internal::ShaderDataPtr shaderData, bool modifiesGeometry );
+ void SetShaderProgram(Shader* shader, Internal::ShaderDataPtr shaderData, bool modifiesGeometry);
/**
* @brief Accept compiled shaders passed back on render thread for saving.
* @param[in] shaderData Source code, hash over source, and corresponding compiled binary to be saved.
*/
- void SaveBinary( Internal::ShaderDataPtr shaderData ) override;
+ void SaveBinary(Internal::ShaderDataPtr shaderData) override;
/**
* @brief Set the destination for compiled shader binaries to be passed on to.
* The dispatcher passed in will be called from the update thread.
* @param[in] upstream A sink for ShaderDatas to be passed into.
*/
- void SetShaderSaver( ShaderSaver& upstream );
+ void SetShaderSaver(ShaderSaver& upstream);
// Renderers
* Add a new renderer to scene
* @param renderer to add
*/
- void AddRenderer( OwnerPointer< Renderer >& renderer );
+ void AddRenderer(OwnerPointer<Renderer>& renderer);
/**
* Add a renderer from scene
* @param renderer to remove
*/
- void RemoveRenderer( Renderer* renderer );
+ void RemoveRenderer(Renderer* renderer);
// Gestures
* @param[in] gesture The gesture processor.
* @post The gestureProcessor is owned by the UpdateManager.
*/
- void SetPanGestureProcessor( PanGesture* gestureProcessor );
+ void SetPanGestureProcessor(PanGesture* gestureProcessor);
// Textures
* @param[in] textureSet The texture set to add.
* @post The TextureSet is owned by the UpdateManager.
*/
- void AddTextureSet( OwnerPointer< TextureSet >& textureSet );
+ void AddTextureSet(OwnerPointer<TextureSet>& textureSet);
/**
* Remove a TextureSet.
* @param[in] textureSet The TextureSet to remove.
* @post The TextureSet is destroyed.
*/
- void RemoveTextureSet( TextureSet* textureSet );
+ void RemoveTextureSet(TextureSet* textureSet);
// Render tasks
* @param[in] systemLevel True if using the system-level overlay.
* @return The list of render tasks
*/
- RenderTaskList* GetRenderTaskList( bool systemLevel );
+ RenderTaskList* GetRenderTaskList(bool systemLevel);
-// Message queue handling
+ // Message queue handling
/**
* Reserve space for another message in the queue; this must then be initialized by the caller.
* @note the default value of updateScene should match that in EventThreadServices::ReserveMessageSlot.
* @return A pointer to the first char allocated for the message.
*/
- uint32_t* ReserveMessageSlot( uint32_t size, bool updateScene = true );
+ uint32_t* ReserveMessageSlot(uint32_t size, bool updateScene = true);
/**
* @return the current event-buffer index.
* @post Sends a message to RenderManager to add the sampler.
* The sampler will be owned by RenderManager
*/
- void AddSampler( OwnerPointer< Render::Sampler >& sampler );
+ void AddSampler(OwnerPointer<Render::Sampler>& sampler);
/**
* Removes an existing sampler from RenderManager
* @param[in] sampler The sampler to remove
* @post The sampler will be destroyed in the render thread
*/
- void RemoveSampler( Render::Sampler* sampler );
+ void RemoveSampler(Render::Sampler* sampler);
/**
* Sets the filter modes for an existing sampler
* @param[in] minFilterMode The filter to use under minification
* @param[in] magFilterMode The filter to use under magnification
*/
- void SetFilterMode( Render::Sampler* sampler, uint32_t minFilterMode, uint32_t magFilterMode );
+ void SetFilterMode(Render::Sampler* sampler, uint32_t minFilterMode, uint32_t magFilterMode);
/**
* Sets the wrap mode for an existing sampler
* @param[in] sWrapMode Wrapping mode in x direction
* @param[in] tWrapMode Wrapping mode in y direction
*/
- void SetWrapMode( Render::Sampler* sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode );
+ void SetWrapMode(Render::Sampler* sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode);
/**
* Add a new property buffer to RenderManager
* @post Sends a message to RenderManager to add the property buffer.
* The property buffer will be owned by RenderManager
*/
- void AddVertexBuffer( OwnerPointer< Render::VertexBuffer >& propertryBuffer );
+ void AddVertexBuffer(OwnerPointer<Render::VertexBuffer>& propertryBuffer);
/**
* Removes an existing VertexBuffer from RenderManager
* @param[in] propertryBuffer The property buffer to remove
* @post The property buffer will be destroyed in the render thread
*/
- void RemoveVertexBuffer( Render::VertexBuffer* propertryBuffer );
+ void RemoveVertexBuffer(Render::VertexBuffer* propertryBuffer);
/**
* Sets the format of an existing property buffer
* @param[in] format The new format of the buffer
* @post Sends a message to RenderManager to set the new format to the property buffer.
*/
- void SetVertexBufferFormat( Render::VertexBuffer* vertexBuffer, OwnerPointer< Render::VertexBuffer::Format>& format );
+ void SetVertexBufferFormat(Render::VertexBuffer* vertexBuffer, OwnerPointer<Render::VertexBuffer::Format>& format);
/**
* Sets the data of an existing property buffer
* @param[in] size The new size of the buffer
* @post Sends a message to RenderManager to set the new data to the property buffer.
*/
- void SetVertexBufferData( Render::VertexBuffer* vertexBuffer, OwnerPointer< Vector<uint8_t> >& data, uint32_t size );
+ void SetVertexBufferData(Render::VertexBuffer* vertexBuffer, OwnerPointer<Vector<uint8_t> >& data, uint32_t size);
/**
* Adds a geometry to the RenderManager
* @post Sends a message to RenderManager to add the Geometry
* The geometry will be owned by RenderManager
*/
- void AddGeometry( OwnerPointer< Render::Geometry >& geometry );
+ void AddGeometry(OwnerPointer<Render::Geometry>& geometry);
/**
* Removes an existing Geometry from RenderManager
* @param[in] geometry The geometry to remove
* @post The geometry will be destroyed in the render thread
*/
- void RemoveGeometry( Render::Geometry* geometry );
+ void RemoveGeometry(Render::Geometry* geometry);
/**
* Sets the geometry type of an existing Geometry
* @param[in] geometry The geometry
* @param[in] geometryType The type of the geometry
*/
- void SetGeometryType( Render::Geometry* geometry, uint32_t geometryType );
+ void SetGeometryType(Render::Geometry* geometry, uint32_t geometryType);
/**
* Sets the index buffer to be used by a geometry
* @param[in] geometry The geometry
* @param[in] indices A vector containing the indices for the geometry
*/
- void SetIndexBuffer( Render::Geometry* geometry, Dali::Vector<uint16_t>& indices );
+ void SetIndexBuffer(Render::Geometry* geometry, Dali::Vector<uint16_t>& indices);
/**
* Adds a vertex buffer to a geometry
* @param[in] geometry The geometry
* @param[in] vertexBuffer The property buffer
*/
- void AttachVertexBuffer( Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer );
+ void AttachVertexBuffer(Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer);
/**
* Removes a vertex buffer from a geometry
* @param[in] geometry The geometry
* @param[in] vertexBuffer The property buffer
*/
- void RemoveVertexBuffer( Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer );
+ void RemoveVertexBuffer(Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer);
/**
* Adds a texture to the render manager
* @param[in] texture The texture to add
* The texture will be owned by RenderManager
*/
- void AddTexture( OwnerPointer< Render::Texture >& texture );
+ void AddTexture(OwnerPointer<Render::Texture>& texture);
/**
* Removes a texture from the render manager
* @param[in] texture The texture to remove
* @post The texture will be destroyed in the render thread
*/
- void RemoveTexture( Render::Texture* texture );
+ void RemoveTexture(Render::Texture* texture);
/**
* Uploads data to a texture owned by the RenderManager
* @param[in] pixelData The pixel data object
* @param[in] params The parameters for the upload
*/
- void UploadTexture( Render::Texture* texture, PixelDataPtr pixelData, const Texture::UploadParams& params );
+ void UploadTexture(Render::Texture* texture, PixelDataPtr pixelData, const Texture::UploadParams& params);
/**
* Generates mipmaps for a texture owned by the RenderManager
* @param[in] texture The texture
*/
- void GenerateMipmaps( Render::Texture* texture );
+ void GenerateMipmaps(Render::Texture* texture);
/**
* Adds a framebuffer to the render manager
* @param[in] frameBuffer The framebuffer to add
* The framebuffer will be owned by RenderManager
*/
- void AddFrameBuffer( OwnerPointer< Render::FrameBuffer >& frameBuffer );
+ void AddFrameBuffer(OwnerPointer<Render::FrameBuffer>& frameBuffer);
/**
* Removes a FrameBuffer from the render manager
* @param[in] frameBuffer The FrameBuffer to remove
* @post The FrameBuffer will be destroyed in the render thread
*/
- void RemoveFrameBuffer( Render::FrameBuffer* frameBuffer );
+ void RemoveFrameBuffer(Render::FrameBuffer* frameBuffer);
/**
* Attach a texture as color output to an existing FrameBuffer
* @param[in] mipmapLevel The mipmap of the texture to be attached
* @param[in] layer Indicates which layer of a cube map or array texture to attach. Unused for 2D textures
*/
- void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t face );
+ void AttachColorTextureToFrameBuffer(Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t face);
/**
* Attach a texture as depth output to an existing FrameBuffer
* @param[in] texture The texture that will be used as output when rendering
* @param[in] mipmapLevel The mipmap of the texture to be attached
*/
- void AttachDepthTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel );
+ void AttachDepthTextureToFrameBuffer(Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel);
/**
* Attach a texture as depth/stencil output to an existing FrameBuffer
* @param[in] texture The texture that will be used as output when rendering
* @param[in] mipmapLevel The mipmap of the texture to be attached
*/
- void AttachDepthStencilTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel );
+ void AttachDepthStencilTextureToFrameBuffer(Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel);
/**
* This is called when the surface of the scene has been replaced.
* @param[in] scene The scene.
*/
- void SurfaceReplaced( Scene* scene );
+ void SurfaceReplaced(Scene* scene);
public:
-
/**
* Performs an Update traversal on the scene-graph.
* @param[in] elapsedSeconds The elapsed time that should be applied to animations.
* @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.
*/
- uint32_t Update( float elapsedSeconds,
- uint32_t lastVSyncTimeMilliseconds,
- uint32_t nextVSyncTimeMilliseconds,
- bool renderToFboEnabled,
- bool isRenderingToFbo );
+ uint32_t Update(float elapsedSeconds,
+ uint32_t lastVSyncTimeMilliseconds,
+ uint32_t nextVSyncTimeMilliseconds,
+ bool renderToFboEnabled,
+ bool isRenderingToFbo);
/**
* Set the default surface rect.
* @param[in] rect The rect value representing the surface.
*/
- void SetDefaultSurfaceRect( const Rect<int>& rect );
+ void SetDefaultSurfaceRect(const Rect<int>& rect);
/**
* Set the default surface orientation.
/**
* @copydoc Dali::Stage::KeepRendering()
*/
- void KeepRendering( float durationSeconds );
+ void KeepRendering(float durationSeconds);
/**
* @copydoc Dali::DevelStage::SetRenderingBehavior()
*/
- void SetRenderingBehavior( DevelStage::Rendering renderingBehavior );
+ void SetRenderingBehavior(DevelStage::Rendering renderingBehavior);
/**
* Request to render the current frame
* @param layers The layers in depth order.
* @param[in] rootLayer The root layer of the sorted layers.
*/
- void SetLayerDepths( const std::vector< Layer* >& layers, const Layer* rootLayer );
+ void SetLayerDepths(const std::vector<Layer*>& layers, const Layer* rootLayer);
/**
* Set the depth indices of all nodes (in LayerUI's)
* @param[in] nodeDepths A vector of nodes and associated depth indices
*/
- void SetDepthIndices( OwnerPointer< NodeDepths >& nodeDepths );
+ void SetDepthIndices(OwnerPointer<NodeDepths>& nodeDepths);
/**
* Query wheter the default surface rect is changed or not.
* @param[in] frameCallback An OwnerPointer to the SceneGraph FrameCallback object
* @param[in] rootNode A pointer to the root node to apply the FrameCallback to
*/
- void AddFrameCallback( OwnerPointer< FrameCallback >& frameCallback, const Node* rootNode );
+ void AddFrameCallback(OwnerPointer<FrameCallback>& 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 );
+ void RemoveFrameCallback(FrameCallbackInterface* frameCallback);
private:
-
// Undefined
UpdateManager(const UpdateManager&);
* @param[in] elapsedSeconds The time in seconds since the previous update.
* @return True if the update-thread should keep going.
*/
- uint32_t KeepUpdatingCheck( float elapsedSeconds ) const;
+ uint32_t KeepUpdatingCheck(float elapsedSeconds) const;
/**
* Helper to reset all Node properties
* @param[in] bufferIndex to use
*/
- void ResetProperties( BufferIndex bufferIndex );
+ void ResetProperties(BufferIndex bufferIndex);
/**
* Perform gesture updates.
* @param[in] nextVSyncTime The estimated time of the next VSync in milliseconds.
* @return true, if any properties were updated.
*/
- bool ProcessGestures( BufferIndex bufferIndex, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds );
+ bool ProcessGestures(BufferIndex bufferIndex, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds);
/**
* Perform animation updates
* @param[in] elapsedSeconds time since last frame
* @return true if at least one animations is currently active or false otherwise
*/
- bool Animate( BufferIndex bufferIndex, float elapsedSeconds );
+ bool Animate(BufferIndex bufferIndex, float elapsedSeconds);
/**
* Applies constraints to CustomObjects
* @param[in] bufferIndex to use
*/
- void ConstrainCustomObjects( BufferIndex bufferIndex );
+ void ConstrainCustomObjects(BufferIndex bufferIndex);
/**
* Applies constraints to RenderTasks
* @param[in] bufferIndex to use
*/
- void ConstrainRenderTasks( BufferIndex bufferIndex );
+ void ConstrainRenderTasks(BufferIndex bufferIndex);
/**
* Applies constraints to Shaders
* @param[in] bufferIndex to use
*/
- void ConstrainShaders( BufferIndex bufferIndex );
+ void ConstrainShaders(BufferIndex bufferIndex);
/**
* Perform property notification updates
* @param[in] bufferIndex to use
*/
- void ProcessPropertyNotifications( BufferIndex bufferIndex );
+ void ProcessPropertyNotifications(BufferIndex bufferIndex);
/**
* Pass shader binaries queued here on to event thread.
* Update node shaders, opacity, geometry etc.
* @param[in] bufferIndex to use
*/
- void UpdateNodes( BufferIndex bufferIndex );
+ void UpdateNodes(BufferIndex bufferIndex);
/**
* Update Renderers
* @param[in] bufferIndex to use
*/
- void UpdateRenderers( BufferIndex bufferIndex );
+ void UpdateRenderers(BufferIndex bufferIndex);
private:
-
// needs to be direct member so that getter for event buffer can be inlined
SceneGraphBuffers mSceneGraphBuffers;
struct Impl;
Impl* mImpl;
-
};
// Messages for UpdateManager
-inline void InstallRootMessage( UpdateManager& manager, OwnerPointer<Layer>& root )
+inline void InstallRootMessage(UpdateManager& manager, OwnerPointer<Layer>& root)
{
// Message has ownership of Layer while in transit from event -> update
using LocalType = MessageValue1<UpdateManager, OwnerPointer<Layer> >;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::InstallRoot, root );
+ new(slot) LocalType(&manager, &UpdateManager::InstallRoot, root);
}
-inline void UninstallRootMessage( UpdateManager& manager, const Layer* constRoot )
+inline void UninstallRootMessage(UpdateManager& manager, const Layer* constRoot)
{
// Scene graph thread can destroy this object.
- Layer* root = const_cast< Layer* >( constRoot );
+ Layer* root = const_cast<Layer*>(constRoot);
using LocalType = MessageValue1<UpdateManager, Layer*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::UninstallRoot, root );
+ new(slot) LocalType(&manager, &UpdateManager::UninstallRoot, root);
}
-inline void AddNodeMessage( UpdateManager& manager, OwnerPointer<Node>& node )
+inline void AddNodeMessage(UpdateManager& manager, OwnerPointer<Node>& node)
{
// Message has ownership of Node while in transit from event -> update
using LocalType = MessageValue1<UpdateManager, OwnerPointer<Node> >;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::AddNode, node );
+ new(slot) LocalType(&manager, &UpdateManager::AddNode, node);
}
-inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, const Node& constChild )
+inline void ConnectNodeMessage(UpdateManager& manager, const Node& constParent, const Node& constChild)
{
// Update thread can edit the object
- Node& parent = const_cast< Node& >( constParent );
- Node& child = const_cast< Node& >( constChild );
+ Node& parent = const_cast<Node&>(constParent);
+ Node& child = const_cast<Node&>(constChild);
using LocalType = MessageValue2<UpdateManager, Node*, Node*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::ConnectNode, &parent, &child );
+ new(slot) LocalType(&manager, &UpdateManager::ConnectNode, &parent, &child);
}
-inline void DisconnectNodeMessage( UpdateManager& manager, const Node& constNode )
+inline void DisconnectNodeMessage(UpdateManager& manager, const Node& constNode)
{
// Scene graph thread can modify this object.
- Node& node = const_cast< Node& >( constNode );
+ Node& node = const_cast<Node&>(constNode);
using LocalType = MessageValue1<UpdateManager, Node*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::DisconnectNode, &node );
+ new(slot) LocalType(&manager, &UpdateManager::DisconnectNode, &node);
}
-inline void DestroyNodeMessage( UpdateManager& manager, const Node& constNode )
+inline void DestroyNodeMessage(UpdateManager& manager, const Node& constNode)
{
// Scene graph thread can destroy this object.
- Node& node = const_cast< Node& >( constNode );
+ Node& node = const_cast<Node&>(constNode);
using LocalType = MessageValue1<UpdateManager, Node*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::DestroyNode, &node );
+ new(slot) LocalType(&manager, &UpdateManager::DestroyNode, &node);
}
-inline void AddCameraMessage( UpdateManager& manager, OwnerPointer< Camera >& camera )
+inline void AddCameraMessage(UpdateManager& manager, OwnerPointer<Camera>& camera)
{
// Message has ownership of Camera while in transit from event -> update
using LocalType = MessageValue1<UpdateManager, OwnerPointer<Camera> >;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::AddCamera, camera );
+ new(slot) LocalType(&manager, &UpdateManager::AddCamera, camera);
}
-inline void RemoveCameraMessage( UpdateManager& manager, const Camera* camera )
+inline void RemoveCameraMessage(UpdateManager& manager, const Camera* camera)
{
using LocalType = MessageValue1<UpdateManager, Camera*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::RemoveCamera, const_cast<Camera*>( camera ) );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveCamera, const_cast<Camera*>(camera));
}
-inline void AddObjectMessage( UpdateManager& manager, OwnerPointer<PropertyOwner>& object )
+inline void AddObjectMessage(UpdateManager& manager, OwnerPointer<PropertyOwner>& object)
{
// Message has ownership of object while in transit from event -> update
using LocalType = MessageValue1<UpdateManager, OwnerPointer<PropertyOwner> >;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::AddObject, object );
+ new(slot) LocalType(&manager, &UpdateManager::AddObject, object);
}
-inline void RemoveObjectMessage( UpdateManager& manager, const PropertyOwner* object )
+inline void RemoveObjectMessage(UpdateManager& manager, const PropertyOwner* object)
{
using LocalType = MessageValue1<UpdateManager, PropertyOwner*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::RemoveObject, const_cast<PropertyOwner*>( object ) );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveObject, const_cast<PropertyOwner*>(object));
}
-inline void AddAnimationMessage( UpdateManager& manager, OwnerPointer< SceneGraph::Animation >& animation )
+inline void AddAnimationMessage(UpdateManager& manager, OwnerPointer<SceneGraph::Animation>& animation)
{
using LocalType = MessageValue1<UpdateManager, OwnerPointer<SceneGraph::Animation> >;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::AddAnimation, animation );
+ new(slot) LocalType(&manager, &UpdateManager::AddAnimation, animation);
}
-inline void StopAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
+inline void StopAnimationMessage(UpdateManager& manager, const Animation& constAnimation)
{
// The scene-graph thread owns this object so it can safely edit it.
- Animation& animation = const_cast< Animation& >( constAnimation );
+ Animation& animation = const_cast<Animation&>(constAnimation);
using LocalType = MessageValue1<UpdateManager, Animation*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::StopAnimation, &animation );
+ new(slot) LocalType(&manager, &UpdateManager::StopAnimation, &animation);
}
-inline void RemoveAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
+inline void RemoveAnimationMessage(UpdateManager& manager, const Animation& constAnimation)
{
// The scene-graph thread owns this object so it can safely edit it.
- Animation& animation = const_cast< Animation& >( constAnimation );
+ Animation& animation = const_cast<Animation&>(constAnimation);
using LocalType = MessageValue1<UpdateManager, Animation*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::RemoveAnimation, &animation );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveAnimation, &animation);
}
-inline void AddRenderTaskListMessage( UpdateManager& manager, OwnerPointer< SceneGraph::RenderTaskList >& taskList )
+inline void AddRenderTaskListMessage(UpdateManager& manager, OwnerPointer<SceneGraph::RenderTaskList>& taskList)
{
using LocalType = MessageValue1<UpdateManager, OwnerPointer<SceneGraph::RenderTaskList> >;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::AddRenderTaskList, taskList );
+ new(slot) LocalType(&manager, &UpdateManager::AddRenderTaskList, taskList);
}
-inline void RemoveRenderTaskListMessage( UpdateManager& manager, const RenderTaskList& constTaskList )
+inline void RemoveRenderTaskListMessage(UpdateManager& manager, const RenderTaskList& constTaskList)
{
// The scene-graph thread owns this object so it can safely edit it.
- RenderTaskList& taskList = const_cast< RenderTaskList& >( constTaskList );
+ RenderTaskList& taskList = const_cast<RenderTaskList&>(constTaskList);
using LocalType = MessageValue1<UpdateManager, RenderTaskList*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::RemoveRenderTaskList, &taskList );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveRenderTaskList, &taskList);
}
-inline void AddSceneMessage( UpdateManager& manager, OwnerPointer< SceneGraph::Scene >& scene )
+inline void AddSceneMessage(UpdateManager& manager, OwnerPointer<SceneGraph::Scene>& scene)
{
using LocalType = MessageValue1<UpdateManager, OwnerPointer<SceneGraph::Scene> >;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::AddScene, scene );
+ new(slot) LocalType(&manager, &UpdateManager::AddScene, scene);
}
-inline void RemoveSceneMessage( UpdateManager& manager, const SceneGraph::Scene& constScene )
+inline void RemoveSceneMessage(UpdateManager& manager, const SceneGraph::Scene& constScene)
{
// The scene-graph thread owns this object so it can safely edit it.
- Scene& scene = const_cast< Scene& >( constScene );
+ Scene& scene = const_cast<Scene&>(constScene);
using LocalType = MessageValue1<UpdateManager, Scene*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::RemoveScene, &scene );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveScene, &scene);
}
-inline void AddPropertyNotificationMessage( UpdateManager& manager, OwnerPointer< PropertyNotification >& propertyNotification )
+inline void AddPropertyNotificationMessage(UpdateManager& manager, OwnerPointer<PropertyNotification>& propertyNotification)
{
// Message has ownership of PropertyNotification while in transit from event -> update
using LocalType = MessageValue1<UpdateManager, OwnerPointer<PropertyNotification> >;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::AddPropertyNotification, propertyNotification );
+ new(slot) LocalType(&manager, &UpdateManager::AddPropertyNotification, propertyNotification);
}
-inline void RemovePropertyNotificationMessage( UpdateManager& manager, const PropertyNotification& constPropertyNotification )
+inline void RemovePropertyNotificationMessage(UpdateManager& manager, const PropertyNotification& constPropertyNotification)
{
// The scene-graph thread owns this object so it can safely edit it.
- PropertyNotification& propertyNotification = const_cast< PropertyNotification& >( constPropertyNotification );
+ PropertyNotification& propertyNotification = const_cast<PropertyNotification&>(constPropertyNotification);
using LocalType = MessageValue1<UpdateManager, PropertyNotification*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::RemovePropertyNotification, &propertyNotification );
+ new(slot) LocalType(&manager, &UpdateManager::RemovePropertyNotification, &propertyNotification);
}
-inline void PropertyNotificationSetNotifyModeMessage( UpdateManager& manager,
- const PropertyNotification* constPropertyNotification,
- PropertyNotification::NotifyMode notifyMode )
+inline void PropertyNotificationSetNotifyModeMessage(UpdateManager& manager,
+ const PropertyNotification* constPropertyNotification,
+ PropertyNotification::NotifyMode notifyMode)
{
// The scene-graph thread owns this object so it can safely edit it.
- PropertyNotification* propertyNotification = const_cast< PropertyNotification* >( constPropertyNotification );
+ PropertyNotification* propertyNotification = const_cast<PropertyNotification*>(constPropertyNotification);
using LocalType = MessageValue2<UpdateManager, PropertyNotification*, PropertyNotification::NotifyMode>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::PropertyNotificationSetNotify, propertyNotification, notifyMode );
+ new(slot) LocalType(&manager, &UpdateManager::PropertyNotificationSetNotify, propertyNotification, notifyMode);
}
// The render thread can safely change the Shader
-inline void AddShaderMessage( UpdateManager& manager, OwnerPointer< Shader >& shader )
+inline void AddShaderMessage(UpdateManager& manager, OwnerPointer<Shader>& shader)
{
using LocalType = MessageValue1<UpdateManager, OwnerPointer<Shader> >;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::AddShader, shader );
+ new(slot) LocalType(&manager, &UpdateManager::AddShader, shader);
}
// The render thread can safely change the Shader
-inline void RemoveShaderMessage( UpdateManager& manager, const Shader* shader )
+inline void RemoveShaderMessage(UpdateManager& manager, const Shader* shader)
{
using LocalType = MessageValue1<UpdateManager, Shader*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::RemoveShader, const_cast<Shader*>( shader ) );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveShader, const_cast<Shader*>(shader));
}
-inline void SetShaderProgramMessage( UpdateManager& manager,
- const Shader& shader,
- Internal::ShaderDataPtr shaderData,
- bool modifiesGeometry )
+inline void SetShaderProgramMessage(UpdateManager& manager,
+ const Shader& shader,
+ Internal::ShaderDataPtr shaderData,
+ bool modifiesGeometry)
{
using LocalType = MessageValue3<UpdateManager, Shader*, Internal::ShaderDataPtr, bool>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::SetShaderProgram, const_cast<Shader*>( &shader ), shaderData, modifiesGeometry );
+ new(slot) LocalType(&manager, &UpdateManager::SetShaderProgram, const_cast<Shader*>(&shader), shaderData, modifiesGeometry);
}
-inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect<int32_t>& rect )
+inline void SetDefaultSurfaceRectMessage(UpdateManager& manager, const Rect<int32_t>& rect)
{
using LocalType = MessageValue1<UpdateManager, Rect<int32_t> >;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::SetDefaultSurfaceRect, rect );
+ new(slot) LocalType(&manager, &UpdateManager::SetDefaultSurfaceRect, rect);
}
-inline void SurfaceReplacedMessage( UpdateManager& manager, const SceneGraph::Scene& constScene )
+inline void SurfaceReplacedMessage(UpdateManager& manager, const SceneGraph::Scene& constScene)
{
// The scene-graph thread owns this object so it can safely edit it.
- Scene& scene = const_cast< Scene& >( constScene );
+ Scene& scene = const_cast<Scene&>(constScene);
using LocalType = MessageValue1<UpdateManager, Scene*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::SurfaceReplaced, &scene );
+ new(slot) LocalType(&manager, &UpdateManager::SurfaceReplaced, &scene);
}
inline void SetDefaultSurfaceOrientationMessage(UpdateManager& manager, int orientation)
new(slot) LocalType(&manager, &UpdateManager::SetDefaultSurfaceOrientation, orientation);
}
-inline void KeepRenderingMessage( UpdateManager& manager, float durationSeconds )
+inline void KeepRenderingMessage(UpdateManager& manager, float durationSeconds)
{
using LocalType = MessageValue1<UpdateManager, float>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::KeepRendering, durationSeconds );
+ new(slot) LocalType(&manager, &UpdateManager::KeepRendering, durationSeconds);
}
-inline void SetRenderingBehaviorMessage( UpdateManager& manager, DevelStage::Rendering renderingBehavior )
+inline void SetRenderingBehaviorMessage(UpdateManager& manager, DevelStage::Rendering renderingBehavior)
{
using LocalType = MessageValue1<UpdateManager, DevelStage::Rendering>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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 );
+ new(slot) LocalType(&manager, &UpdateManager::SetRenderingBehavior, renderingBehavior);
}
-inline void RequestRenderingMessage( UpdateManager& manager )
+inline void RequestRenderingMessage(UpdateManager& manager)
{
using LocalType = Message<UpdateManager>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::RequestRendering );
+ new(slot) LocalType(&manager, &UpdateManager::RequestRendering);
}
/**
* @param[in] layers list of layers
* @param[in] rootLayer The rool layer
*/
-inline void SetLayerDepthsMessage( UpdateManager& manager, const std::vector< Layer* >& layers, const Layer* rootLayer )
+inline void SetLayerDepthsMessage(UpdateManager& manager, const std::vector<Layer*>& layers, const Layer* rootLayer)
{
using LocalType = MessageValue2<UpdateManager, std::vector<Layer*>, const Layer*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::SetLayerDepths, layers, rootLayer );
+ new(slot) LocalType(&manager, &UpdateManager::SetLayerDepths, layers, rootLayer);
}
-inline void AddRendererMessage( UpdateManager& manager, OwnerPointer< Renderer >& object )
+inline void AddRendererMessage(UpdateManager& manager, OwnerPointer<Renderer>& object)
{
using LocalType = MessageValue1<UpdateManager, OwnerPointer<Renderer> >;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::AddRenderer, object );
+ new(slot) LocalType(&manager, &UpdateManager::AddRenderer, object);
}
-inline void RemoveRendererMessage( UpdateManager& manager, const Renderer& object )
+inline void RemoveRendererMessage(UpdateManager& manager, const Renderer& object)
{
using LocalType = MessageValue1<UpdateManager, Renderer*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::RemoveRenderer, const_cast<Renderer*>( &object ) );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveRenderer, const_cast<Renderer*>(&object));
}
// The render thread can safely change the Shader
-inline void AddTextureSetMessage( UpdateManager& manager, OwnerPointer< TextureSet >& textureSet )
+inline void AddTextureSetMessage(UpdateManager& manager, OwnerPointer<TextureSet>& textureSet)
{
using LocalType = MessageValue1<UpdateManager, OwnerPointer<TextureSet> >;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::AddTextureSet, textureSet );
+ new(slot) LocalType(&manager, &UpdateManager::AddTextureSet, textureSet);
}
// The render thread can safely change the Shader
-inline void RemoveTextureSetMessage( UpdateManager& manager, TextureSet& textureSet )
+inline void RemoveTextureSetMessage(UpdateManager& manager, TextureSet& textureSet)
{
using LocalType = MessageValue1<UpdateManager, TextureSet*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::RemoveTextureSet, &textureSet );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveTextureSet, &textureSet);
}
-inline void AddSamplerMessage( UpdateManager& manager, OwnerPointer< Render::Sampler >& sampler )
+inline void AddSamplerMessage(UpdateManager& manager, OwnerPointer<Render::Sampler>& sampler)
{
// Message has ownership of Sampler while in transit from event -> update
using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::Sampler> >;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::AddSampler, sampler );
+ new(slot) LocalType(&manager, &UpdateManager::AddSampler, sampler);
}
-inline void RemoveSamplerMessage( UpdateManager& manager, Render::Sampler& sampler )
+inline void RemoveSamplerMessage(UpdateManager& manager, Render::Sampler& sampler)
{
using LocalType = MessageValue1<UpdateManager, Render::Sampler*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::RemoveSampler, &sampler );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveSampler, &sampler);
}
-inline void SetFilterModeMessage( UpdateManager& manager, Render::Sampler& sampler, uint32_t minFilterMode, uint32_t magFilterMode )
+inline void SetFilterModeMessage(UpdateManager& manager, Render::Sampler& sampler, uint32_t minFilterMode, uint32_t magFilterMode)
{
using LocalType = MessageValue3<UpdateManager, Render::Sampler*, uint32_t, uint32_t>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::SetFilterMode, &sampler, minFilterMode, magFilterMode );
+ new(slot) LocalType(&manager, &UpdateManager::SetFilterMode, &sampler, minFilterMode, magFilterMode);
}
-inline void SetWrapModeMessage( UpdateManager& manager, Render::Sampler& sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode )
+inline void SetWrapModeMessage(UpdateManager& manager, Render::Sampler& sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode)
{
using LocalType = MessageValue4<UpdateManager, Render::Sampler*, uint32_t, uint32_t, uint32_t>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::SetWrapMode, &sampler, rWrapMode, sWrapMode, tWrapMode );
+ new(slot) LocalType(&manager, &UpdateManager::SetWrapMode, &sampler, rWrapMode, sWrapMode, tWrapMode);
}
-inline void AddVertexBuffer( UpdateManager& manager, OwnerPointer< Render::VertexBuffer >& vertexBuffer )
+inline void AddVertexBuffer(UpdateManager& manager, OwnerPointer<Render::VertexBuffer>& vertexBuffer)
{
// Message has ownership of vertexBuffer while in transit from event -> update
using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::VertexBuffer> >;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::AddVertexBuffer, vertexBuffer );
+ new(slot) LocalType(&manager, &UpdateManager::AddVertexBuffer, vertexBuffer);
}
-inline void RemoveVertexBuffer( UpdateManager& manager, Render::VertexBuffer& vertexBuffer )
+inline void RemoveVertexBuffer(UpdateManager& manager, Render::VertexBuffer& vertexBuffer)
{
using LocalType = MessageValue1<UpdateManager, Render::VertexBuffer*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::RemoveVertexBuffer, &vertexBuffer );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveVertexBuffer, &vertexBuffer);
}
-inline void SetVertexBufferFormat( UpdateManager& manager, Render::VertexBuffer& vertexBuffer, OwnerPointer< Render::VertexBuffer::Format>& format )
+inline void SetVertexBufferFormat(UpdateManager& manager, Render::VertexBuffer& vertexBuffer, OwnerPointer<Render::VertexBuffer::Format>& format)
{
// Message has ownership of VertexBuffer::Format while in transit from event -> update
using LocalType = MessageValue2<UpdateManager, Render::VertexBuffer*, OwnerPointer<Render::VertexBuffer::Format> >;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::SetVertexBufferFormat, &vertexBuffer, format );
+ new(slot) LocalType(&manager, &UpdateManager::SetVertexBufferFormat, &vertexBuffer, format);
}
-inline void SetVertexBufferData( UpdateManager& manager, Render::VertexBuffer& vertexBuffer, OwnerPointer< Vector<uint8_t> >& data, uint32_t size )
+inline void SetVertexBufferData(UpdateManager& manager, Render::VertexBuffer& vertexBuffer, OwnerPointer<Vector<uint8_t> >& data, uint32_t size)
{
// Message has ownership of VertexBuffer data while in transit from event -> update
using LocalType = MessageValue3<UpdateManager, Render::VertexBuffer*, OwnerPointer<Vector<uint8_t> >, uint32_t>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::SetVertexBufferData, &vertexBuffer, data, size );
+ new(slot) LocalType(&manager, &UpdateManager::SetVertexBufferData, &vertexBuffer, data, size);
}
-inline void AddGeometry( UpdateManager& manager, OwnerPointer< Render::Geometry >& geometry )
+inline void AddGeometry(UpdateManager& manager, OwnerPointer<Render::Geometry>& geometry)
{
// Message has ownership of Geometry while in transit from event -> update
using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::Geometry> >;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::AddGeometry, geometry );
+ new(slot) LocalType(&manager, &UpdateManager::AddGeometry, geometry);
}
-inline void RemoveGeometry( UpdateManager& manager, Render::Geometry& geometry )
+inline void RemoveGeometry(UpdateManager& manager, Render::Geometry& geometry)
{
using LocalType = MessageValue1<UpdateManager, Render::Geometry*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::RemoveGeometry, &geometry );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveGeometry, &geometry);
}
-inline void AttachVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::VertexBuffer& vertexBuffer )
+inline void AttachVertexBufferMessage(UpdateManager& manager, Render::Geometry& geometry, const Render::VertexBuffer& vertexBuffer)
{
using LocalType = MessageValue2<UpdateManager, Render::Geometry*, Render::VertexBuffer*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::AttachVertexBuffer, &geometry, const_cast<Render::VertexBuffer*>(&vertexBuffer) );
+ new(slot) LocalType(&manager, &UpdateManager::AttachVertexBuffer, &geometry, const_cast<Render::VertexBuffer*>(&vertexBuffer));
}
-inline void RemoveVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::VertexBuffer& vertexBuffer )
+inline void RemoveVertexBufferMessage(UpdateManager& manager, Render::Geometry& geometry, const Render::VertexBuffer& vertexBuffer)
{
using LocalType = MessageValue2<UpdateManager, Render::Geometry*, Render::VertexBuffer*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::RemoveVertexBuffer, &geometry, const_cast<Render::VertexBuffer*>(&vertexBuffer) );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveVertexBuffer, &geometry, const_cast<Render::VertexBuffer*>(&vertexBuffer));
}
// Custom message type for SetIndexBuffer() used to move data with Vector::Swap()
-template< typename T >
+template<typename T>
class IndexBufferMessage : public MessageBase
{
public:
-
/**
* Constructor which does a Vector::Swap()
*/
- IndexBufferMessage( T* manager, Render::Geometry* geometry, Dali::Vector<uint16_t>& indices )
+ IndexBufferMessage(T* manager, Render::Geometry* geometry, Dali::Vector<uint16_t>& indices)
: MessageBase(),
- mManager( manager ),
- mRenderGeometry( geometry )
+ mManager(manager),
+ mRenderGeometry(geometry)
{
- mIndices.Swap( indices );
+ mIndices.Swap(indices);
}
/**
/**
* @copydoc MessageBase::Process
*/
- void Process( BufferIndex /*bufferIndex*/ ) override
+ void Process(BufferIndex /*bufferIndex*/) override
{
- DALI_ASSERT_DEBUG( mManager && "Message does not have an object" );
- mManager->SetIndexBuffer( mRenderGeometry, mIndices );
+ DALI_ASSERT_DEBUG(mManager && "Message does not have an object");
+ mManager->SetIndexBuffer(mRenderGeometry, mIndices);
}
private:
-
- T* mManager;
- Render::Geometry* mRenderGeometry;
+ T* mManager;
+ Render::Geometry* mRenderGeometry;
Dali::Vector<uint16_t> mIndices;
};
-inline void SetIndexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, Dali::Vector<uint16_t>& indices )
+inline void SetIndexBufferMessage(UpdateManager& manager, Render::Geometry& geometry, Dali::Vector<uint16_t>& indices)
{
using LocalType = IndexBufferMessage<UpdateManager>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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, &geometry, indices );
+ new(slot) LocalType(&manager, &geometry, indices);
}
-inline void SetGeometryTypeMessage( UpdateManager& manager, Render::Geometry& geometry, uint32_t geometryType )
+inline void SetGeometryTypeMessage(UpdateManager& manager, Render::Geometry& geometry, uint32_t geometryType)
{
using LocalType = MessageValue2<UpdateManager, Render::Geometry*, uint32_t>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::SetGeometryType, &geometry, geometryType );
+ new(slot) LocalType(&manager, &UpdateManager::SetGeometryType, &geometry, geometryType);
}
-inline void AddTexture( UpdateManager& manager, OwnerPointer< Render::Texture >& texture )
+inline void AddTexture(UpdateManager& manager, OwnerPointer<Render::Texture>& texture)
{
// Message has ownership of Texture while in transit from event -> update
using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::Texture> >;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::AddTexture, texture );
+ new(slot) LocalType(&manager, &UpdateManager::AddTexture, texture);
}
-inline void RemoveTexture( UpdateManager& manager, Render::Texture& texture )
+inline void RemoveTexture(UpdateManager& manager, Render::Texture& texture)
{
using LocalType = MessageValue1<UpdateManager, Render::Texture*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::RemoveTexture, &texture );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveTexture, &texture);
}
-inline void UploadTextureMessage( UpdateManager& manager, Render::Texture& texture, PixelDataPtr pixelData, const Texture::UploadParams& params )
+inline void UploadTextureMessage(UpdateManager& manager, Render::Texture& texture, PixelDataPtr pixelData, const Texture::UploadParams& params)
{
using LocalType = MessageValue3<UpdateManager, Render::Texture*, PixelDataPtr, Texture::UploadParams>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::UploadTexture, &texture, pixelData, params );
+ new(slot) LocalType(&manager, &UpdateManager::UploadTexture, &texture, pixelData, params);
}
-inline void GenerateMipmapsMessage( UpdateManager& manager, Render::Texture& texture )
+inline void GenerateMipmapsMessage(UpdateManager& manager, Render::Texture& texture)
{
using LocalType = MessageValue1<UpdateManager, Render::Texture*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::GenerateMipmaps, &texture );
+ new(slot) LocalType(&manager, &UpdateManager::GenerateMipmaps, &texture);
}
-
-inline void AddFrameBuffer( UpdateManager& manager, OwnerPointer< Render::FrameBuffer >& frameBuffer )
+inline void AddFrameBuffer(UpdateManager& manager, OwnerPointer<Render::FrameBuffer>& frameBuffer)
{
using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::FrameBuffer> >;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::AddFrameBuffer, frameBuffer );
+ new(slot) LocalType(&manager, &UpdateManager::AddFrameBuffer, frameBuffer);
}
-inline void RemoveFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer )
+inline void RemoveFrameBuffer(UpdateManager& manager, Render::FrameBuffer& frameBuffer)
{
using LocalType = MessageValue1<UpdateManager, Render::FrameBuffer*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::RemoveFrameBuffer, &frameBuffer );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveFrameBuffer, &frameBuffer);
}
-inline void AttachColorTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer )
+inline void AttachColorTextureToFrameBuffer(UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer)
{
using LocalType = MessageValue4<UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t, uint32_t>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::AttachColorTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel, layer );
+ new(slot) LocalType(&manager, &UpdateManager::AttachColorTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel, layer);
}
-inline void AttachDepthTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel )
+inline void AttachDepthTextureToFrameBuffer(UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel)
{
using LocalType = MessageValue3<UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::AttachDepthTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel );
+ new(slot) LocalType(&manager, &UpdateManager::AttachDepthTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel);
}
-inline void AttachDepthStencilTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel )
+inline void AttachDepthStencilTextureToFrameBuffer(UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel)
{
using LocalType = MessageValue3<UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::AttachDepthStencilTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel );
+ new(slot) LocalType(&manager, &UpdateManager::AttachDepthStencilTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel);
}
-inline void SetDepthIndicesMessage( UpdateManager& manager, OwnerPointer< NodeDepths >& nodeDepths )
+inline void SetDepthIndicesMessage(UpdateManager& manager, OwnerPointer<NodeDepths>& nodeDepths)
{
using LocalType = MessageValue1<UpdateManager, OwnerPointer<NodeDepths> >;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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::SetDepthIndices, nodeDepths );
+ new(slot) LocalType(&manager, &UpdateManager::SetDepthIndices, nodeDepths);
}
-inline void AddResetterMessage( UpdateManager& manager, OwnerPointer<PropertyResetterBase> resetter )
+inline void AddResetterMessage(UpdateManager& manager, OwnerPointer<PropertyResetterBase> resetter)
{
using LocalType = MessageValue1<UpdateManager, OwnerPointer<PropertyResetterBase> >;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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 );
+ new(slot) LocalType(&manager, &UpdateManager::AddPropertyResetter, resetter);
}
-inline void AddFrameCallbackMessage( UpdateManager& manager, OwnerPointer< FrameCallback >& frameCallback, const Node& rootNode )
+inline void AddFrameCallbackMessage(UpdateManager& manager, OwnerPointer<FrameCallback>& frameCallback, const Node& rootNode)
{
using LocalType = MessageValue2<UpdateManager, OwnerPointer<FrameCallback>, const Node*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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 );
+ new(slot) LocalType(&manager, &UpdateManager::AddFrameCallback, frameCallback, &rootNode);
}
-inline void RemoveFrameCallbackMessage( UpdateManager& manager, FrameCallbackInterface& frameCallback )
+inline void RemoveFrameCallbackMessage(UpdateManager& manager, FrameCallbackInterface& frameCallback)
{
using LocalType = MessageValue1<UpdateManager, FrameCallbackInterface*>;
// Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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 );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveFrameCallback, &frameCallback);
}
} // namespace SceneGraph
#define DALI_INTERNAL_SCENE_GRAPH_NODE_DECLARATIONS_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
*/
// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-vector.h>
#include <dali/devel-api/common/bitwise-enum.h>
#include <dali/devel-api/common/owner-container.h>
#include <dali/internal/common/owner-pointer.h>
+#include <dali/public-api/common/dali-vector.h>
+#include <dali/public-api/common/vector-wrapper.h>
namespace Dali
{
-
namespace Internal
{
-
namespace SceneGraph
{
-
class Node;
-using NodeContainer = Dali::Vector<Node *>;
+using NodeContainer = Dali::Vector<Node*>;
using NodeIter = NodeContainer::Iterator;
using NodeConstIter = NodeContainer::ConstIterator;
enum class NodePropertyFlags : uint8_t
// 8 bits is enough for 4 flags (compiler will check it)
{
- NOTHING = 0x000,
- TRANSFORM = 0x001,
- VISIBLE = 0x002,
- COLOR = 0x004,
- CHILD_DELETED = 0x008,
- ALL = ( CHILD_DELETED << 1 ) - 1 // all the flags
+ NOTHING = 0x000,
+ TRANSFORM = 0x001,
+ VISIBLE = 0x002,
+ COLOR = 0x004,
+ CHILD_DELETED = 0x008,
+ ALL = (CHILD_DELETED << 1) - 1 // all the flags
+};
+
+struct NodeDepthPair
+{
+ Node* node;
+ uint32_t sortedDepth;
+ NodeDepthPair(Node* node, uint32_t sortedDepth)
+ : node(node),
+ sortedDepth(sortedDepth)
+ {
+ }
+};
+
+struct NodeDepths
+{
+ NodeDepths() = default;
+
+ void Add(Node* node, uint32_t sortedDepth)
+ {
+ nodeDepths.push_back(NodeDepthPair(node, sortedDepth));
+ }
+
+ std::vector<NodeDepthPair> nodeDepths;
};
} // namespace SceneGraph
} // namespace Internal
// specialization has to be done in the same namespace
-template<> struct EnableBitMaskOperators< Internal::SceneGraph::NodePropertyFlags > { static const bool ENABLE = true; };
+template<>
+struct EnableBitMaskOperators<Internal::SceneGraph::NodePropertyFlags>
+{
+ static const bool ENABLE = true;
+};
} // namespace Dali
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
// INTERNAL HEADERS
#include <dali/internal/common/internal-constants.h>
#include <dali/internal/common/memory-pool-object-allocator.h>
+#include <dali/internal/render/renderers/render-texture.h>
#include <dali/internal/update/rendering/scene-graph-renderer.h>
namespace //Unnamed namespace
{
//Memory pool used to allocate new texture sets. Memory used by this pool will be released when shutting down DALi
Dali::Internal::MemoryPoolObjectAllocator<Dali::Internal::SceneGraph::TextureSet> gTextureSetMemoryPool;
-}
+} // namespace
namespace Dali
{
-
namespace Internal
{
-
namespace SceneGraph
{
-
TextureSet* TextureSet::New()
{
- return new ( gTextureSetMemoryPool.AllocateRawThreadSafe() ) TextureSet();
+ return new(gTextureSetMemoryPool.AllocateRawThreadSafe()) TextureSet();
}
TextureSet::TextureSet()
: mSamplers(),
mRenderers(),
- mHasAlpha( false )
+ mHasAlpha(false)
{
}
TextureSet::~TextureSet()
{
- for( auto&& renderer : mRenderers )
+ for(auto&& renderer : mRenderers)
{
renderer->TextureSetDeleted();
}
}
-void TextureSet::operator delete( void* ptr )
+void TextureSet::operator delete(void* ptr)
{
- gTextureSetMemoryPool.FreeThreadSafe( static_cast<TextureSet*>( ptr ) );
+ gTextureSetMemoryPool.FreeThreadSafe(static_cast<TextureSet*>(ptr));
}
-void TextureSet::SetSampler( uint32_t index, Render::Sampler* sampler )
+void TextureSet::SetSampler(uint32_t index, Render::Sampler* sampler)
{
- const uint32_t samplerCount = static_cast<uint32_t>( mSamplers.Size() );
- if( samplerCount < index + 1 )
+ const uint32_t samplerCount = static_cast<uint32_t>(mSamplers.Size());
+ if(samplerCount < index + 1)
{
- mSamplers.Resize( index + 1 );
- for( uint32_t i(samplerCount); i<=index; ++i )
+ mSamplers.Resize(index + 1);
+ for(uint32_t i(samplerCount); i <= index; ++i)
{
mSamplers[i] = nullptr;
}
NotifyChangeToRenderers();
}
-void TextureSet::SetTexture( uint32_t index, Render::Texture* texture )
+void TextureSet::SetTexture(uint32_t index, Render::Texture* texture)
{
- const uint32_t textureCount = static_cast<uint32_t>( mTextures.Size() );
- if( textureCount < index + 1 )
+ const uint32_t textureCount = static_cast<uint32_t>(mTextures.Size());
+ if(textureCount < index + 1)
{
- mTextures.Resize( index + 1 );
+ mTextures.Resize(index + 1);
bool samplerExist = true;
- if( mSamplers.Size() < index + 1 )
+ if(mSamplers.Size() < index + 1)
{
- mSamplers.Resize( index + 1 );
+ mSamplers.Resize(index + 1);
samplerExist = false;
}
- for( uint32_t i(textureCount); i<=index; ++i )
+ for(uint32_t i(textureCount); i <= index; ++i)
{
mTextures[i] = nullptr;
- if( !samplerExist )
+ if(!samplerExist)
{
mSamplers[i] = nullptr;
}
}
mTextures[index] = texture;
- if( texture )
+ if(texture)
{
mHasAlpha |= texture->HasAlphaChannel();
}
return mHasAlpha;
}
-void TextureSet::AddObserver( Renderer* renderer )
+void TextureSet::AddObserver(Renderer* renderer)
{
- for( auto&& element : mRenderers )
+ for(auto&& element : mRenderers)
{
- if( element == renderer )
+ if(element == renderer)
{
//Renderer already in the list
return;
}
}
- mRenderers.PushBack( renderer );
+ mRenderers.PushBack(renderer);
}
-void TextureSet::RemoveObserver( Renderer* renderer )
+void TextureSet::RemoveObserver(Renderer* renderer)
{
- for( auto&& iter = mRenderers.Begin(), end = mRenderers.End(); iter != end; ++iter )
+ for(auto &&iter = mRenderers.Begin(), end = mRenderers.End(); iter != end; ++iter)
{
- if( *iter == renderer )
+ if(*iter == renderer)
{
- mRenderers.Remove( iter );
+ mRenderers.Remove(iter);
return;
}
}
void TextureSet::NotifyChangeToRenderers()
{
- for( auto&& element : mRenderers )
+ for(auto&& element : mRenderers)
{
element->TextureSetChanged();
}