void ActiveConstraintBase::ProxyDestroyed( ProxyObject& proxy )
{
// Remove proxy pointer from observation set
- ProxyObjectIter iter = mObservedProxies.find( &proxy );
- DALI_ASSERT_DEBUG( mObservedProxies.end() != iter );
- mObservedProxies.erase( iter );
+ ProxyObjectIter iter = std::find( mObservedProxies.Begin(), mObservedProxies.End(), &proxy );
+ DALI_ASSERT_DEBUG( mObservedProxies.End() != iter );
+ mObservedProxies.Erase( iter );
// Stop observing the remaining proxies
StopObservation();
void ActiveConstraintBase::ObserveProxy( ProxyObject& proxy )
{
- if ( mObservedProxies.end() == mObservedProxies.find(&proxy) )
+ ProxyObjectIter iter = std::find( mObservedProxies.Begin(), mObservedProxies.End(), &proxy );
+ if ( mObservedProxies.End() == iter )
{
proxy.AddObserver( *this );
- mObservedProxies.insert( &proxy );
+ mObservedProxies.PushBack( &proxy );
}
}
void ActiveConstraintBase::StopObservation()
{
- for( ProxyObjectIter iter = mObservedProxies.begin(); mObservedProxies.end() != iter; ++iter )
+ const ProxyObjectIter end = mObservedProxies.End();
+ for( ProxyObjectIter iter = mObservedProxies.Begin(); iter != end; ++iter )
{
(*iter)->RemoveObserver( *this );
}
- mObservedProxies.clear();
+ mObservedProxies.Clear();
}
void ActiveConstraintBase::FirstApplyFinished( Object* object )
{
- ActiveConstraintBase& self = dynamic_cast<ActiveConstraintBase&>( *object );
+ // trust the object is correct as its set in FirstApply (in this same file)
+ ActiveConstraintBase* self = static_cast<ActiveConstraintBase*>( object );
// This is necessary when the constraint was not added to scene-graph during the animation
- self.SetWeight( Dali::ActiveConstraint::FINAL_WEIGHT );
+ self->SetWeight( Dali::ActiveConstraint::FINAL_WEIGHT );
// The animation is no longer needed
- GetImplementation(self.mApplyAnimation).SetFinishedCallback( NULL, NULL );
- self.mApplyAnimation.Reset();
+ GetImplementation(self->mApplyAnimation).SetFinishedCallback( NULL, NULL );
+ self->mApplyAnimation.Reset();
// Chain "Finish" to "Applied" signal
- if ( !self.mAppliedSignal.Empty() )
+ if ( !self->mAppliedSignal.Empty() )
{
- Dali::ActiveConstraint handle( &self );
-
- self.mAppliedSignal.Emit( handle );
+ Dali::ActiveConstraint handle( self );
+ self->mAppliedSignal.Emit( handle );
}
// WARNING - this constraint may now have been deleted; don't do anything else here
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/time-period.h>
#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/common/set-wrapper.h>
#include <dali/internal/event/animation/constraint-source-impl.h>
namespace Dali
{
class EventToUpdate;
-typedef std::set<ProxyObject*> ProxyObjectContainer;
-typedef ProxyObjectContainer::iterator ProxyObjectIter;
+typedef Dali::Vector<ProxyObject*> ProxyObjectContainer;
+typedef ProxyObjectContainer::Iterator ProxyObjectIter;
namespace SceneGraph
{
#include <boost/function.hpp>
// INTERNAL INCLUDES
-#include <dali/public-api/common/set-wrapper.h>
#include <dali/internal/common/event-to-update.h>
#include <dali/internal/common/message.h>
#include <dali/internal/event/common/proxy-object.h>
{
/**
+ * Helper to add only unique entries to the propertyOwner container
+ * @param propertyOwners to add the entries to
+ * @param object to add
+ */
+inline void AddUnique( SceneGraph::PropertyOwnerContainer& propertyOwners, SceneGraph::PropertyOwner* object )
+{
+ const SceneGraph::PropertyOwnerIter iter = std::find( propertyOwners.Begin(), propertyOwners.End(), object );
+ if( iter == propertyOwners.End() )
+ {
+ // each owner should only be added once
+ propertyOwners.PushBack( object );
+ }
+}
+
+/**
* Connects a constraint which takes another property as an input.
*/
template < typename PropertyType >
return;
}
- // Build a set of property-owners, providing the scene-graph properties
- SceneGraph::PropertyOwnerSet propertyOwners;
- propertyOwners.insert( targetObject );
+ // Build a container of property-owners, providing the scene-graph properties
+ SceneGraph::PropertyOwnerContainer propertyOwners;
+ propertyOwners.PushBack( targetObject );
// Build the constraint function; this requires a scene-graph property from each source
ConstraintFunctionPtr func( ConnectConstraintFunction( propertyOwners ) );
/**
* Helper for ConnectConstraint. Creates a connected constraint-function.
- * Also populates the property-owner set, for each input connected to the constraint-function.
- * @param[out] propertyOwners The set of property-owners providing the scene-graph properties.
+ * Also populates the property-owner container, for each input connected to the constraint-function.
+ * @param[out] propertyOwners The container of property-owners providing the scene-graph properties.
* @return A connected constraint-function, or NULL if the scene-graph properties are not available.
*/
- PropertyConstraintBase<PropertyType>* ConnectConstraintFunction( SceneGraph::PropertyOwnerSet& propertyOwners )
+ PropertyConstraintBase<PropertyType>* ConnectConstraintFunction( SceneGraph::PropertyOwnerContainer& propertyOwners )
{
PropertyConstraintBase<PropertyType>* func = mUserFunction->Clone();
bool usingComponentFunc( false );
// The property owner will not exist, if the target proxy-object is off-stage
if( NULL != owner )
{
- propertyOwners.insert( owner );
+ AddUnique( propertyOwners, owner );
inputProperty = const_cast< PropertyInputImpl* >( source.object->GetSceneObjectInputProperty( source.propertyIndex ) );
componentIndex = source.object->GetPropertyComponentIndex( source.propertyIndex );
// The property owner will not exist, if the parent proxy-object is off-stage
if ( NULL != owner )
{
- propertyOwners.insert( owner );
+ AddUnique( propertyOwners, owner );
inputProperty = const_cast< PropertyInputImpl* >( proxyParent->GetSceneObjectInputProperty( source.propertyIndex ) );
componentIndex = proxyParent->GetPropertyComponentIndex( source.propertyIndex );
return;
}
- // Build a set of property-owners, providing the scene-graph properties
- SceneGraph::PropertyOwnerSet propertyOwners;
- propertyOwners.insert( targetObject );
+ // Build a container of property-owners, providing the scene-graph properties
+ SceneGraph::PropertyOwnerContainer propertyOwners;
+ propertyOwners.PushBack( targetObject );
// Build the constraint function; this requires a scene-graph property from each source
ConstraintFunctionPtr func( ConnectConstraintFunction( propertyOwners ) );
/**
* Helper for ConnectConstraint. Creates a connected constraint-function.
- * Also populates the property-owner set, for each input connected to the constraint-function.
- * @param[out] propertyOwners The set of property-owners providing the scene-graph properties.
+ * Also populates the property-owner container, for each input connected to the constraint-function.
+ * @param[out] propertyOwners The container of property-owners providing the scene-graph properties.
* @return A connected constraint-function, or NULL if the scene-graph properties are not available.
*/
- PropertyConstraintBase<float>* ConnectConstraintFunction( SceneGraph::PropertyOwnerSet& propertyOwners )
+ PropertyConstraintBase<float>* ConnectConstraintFunction( SceneGraph::PropertyOwnerContainer& propertyOwners )
{
PropertyConstraintBase<float>* func = mUserFunction->Clone();
bool usingComponentFunc( false );
// The property owner will not exist, if the target proxy-object is off-stage
if( NULL != owner )
{
- propertyOwners.insert( owner );
+ AddUnique( propertyOwners, owner );
inputProperty = const_cast< PropertyInputImpl* >( source.object->GetSceneObjectInputProperty( source.propertyIndex ) );
componentIndex = source.object->GetPropertyComponentIndex( source.propertyIndex );
// The property owner will not exist, if the parent proxy-object is off-stage
if ( NULL != owner )
{
- propertyOwners.insert( owner );
+ AddUnique( propertyOwners, owner );
inputProperty = const_cast< PropertyInputImpl* >( proxyParent->GetSceneObjectInputProperty( source.propertyIndex ) );
componentIndex = proxyParent->GetPropertyComponentIndex( source.propertyIndex );
mBlendEquationSeparateModeRGB( GL_FUNC_ADD ),
mBlendEquationSeparateModeAlpha( GL_FUNC_ADD ),
mMaxTextureSize(0),
- mMaxTextureUnits(0),
mClearColor(Color::WHITE), // initial color, never used until it's been set by the user
mCullFaceMode(CullNone),
mViewPort( 0, 0, 0, 0 ),
mGlAbstraction.FrontFace(GL_CCW);
mGlAbstraction.CullFace(GL_BACK);
- // get max texture units
- mGlAbstraction.GetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &mMaxTextureUnits);
- DALI_ASSERT_DEBUG(mMaxTextureUnits > 7); // according to GLES 2.0 specification
- mBound2dTextureId.reserve(mMaxTextureUnits);
// rebind texture units
- for( int i=0; i < mMaxTextureUnits; ++i )
+ for( unsigned int i=0; i < MAX_TEXTURE_UNITS; ++i )
{
mBound2dTextureId[ i ] = 0;
// set active texture
mGlAbstraction.GetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS_OES, &numProgramBinaryFormats);
if( GL_NO_ERROR == mGlAbstraction.GetError() && 0 != numProgramBinaryFormats )
{
- mProgramBinaryFormats.resize(numProgramBinaryFormats);
+ mProgramBinaryFormats.Resize(numProgramBinaryFormats);
mGlAbstraction.GetIntegerv(GL_PROGRAM_BINARY_FORMATS_OES, &mProgramBinaryFormats[0]);
}
// INTERNAL INCLUDES
#include <dali/integration-api/gl-defines.h>
#include <dali/public-api/common/map-wrapper.h>
-#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/actors/renderable-actor.h>
#include <dali/integration-api/debug.h>
#include <dali/integration-api/gl-abstraction.h>
*/
static const unsigned int MAX_ATTRIBUTE_CACHE_SIZE = 8;
+ static const unsigned int MAX_TEXTURE_UNITS = 8; // for GLES 2.0 its 8, which is more than DALi uses anyways
+
/**
* Creates the Dali Context object.
* This method does not create an OpenGL context i.e. that is done from outside dali-core.
// reset the cached texture id's incase the driver re-uses them
// when creating new textures
- for( int i=0; i < mMaxTextureUnits; ++i )
+ for( unsigned int i=0; i < MAX_TEXTURE_UNITS; ++i )
{
mBound2dTextureId[ i ] = 0;
}
*/
GLint CachedNumberOfProgramBinaryFormats() const
{
- return mProgramBinaryFormats.size();
+ return mProgramBinaryFormats.Count();
}
/**
*/
GLint CachedProgramBinaryFormat( const unsigned int formatIndex = 0 ) const
{
- DALI_ASSERT_ALWAYS( formatIndex < mProgramBinaryFormats.size() && "formatIndex out of bounds");
+ DALI_ASSERT_ALWAYS( formatIndex < mProgramBinaryFormats.Count() && "formatIndex out of bounds");
return mProgramBinaryFormats[ formatIndex ];
}
// glBindTexture() state
unsigned int mActiveTextureUnit;
- std::vector<GLuint> mBound2dTextureId; ///< The ID passed to glBindTexture(GL_TEXTURE_2D)
+ GLuint mBound2dTextureId[ MAX_TEXTURE_UNITS ]; ///< The ID passed to glBindTexture(GL_TEXTURE_2D)
// glBlendColor() state
bool mUsingDefaultBlendColor;
GLenum mBlendEquationSeparateModeAlpha; ///< Controls Alpha blend mode
GLint mMaxTextureSize; ///< return value from GetIntegerv(GL_MAX_TEXTURE_SIZE)
- GLint mMaxTextureUnits; ///< return value from GetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS)
Vector4 mClearColor; ///< clear color
- std::vector<GLint> mProgramBinaryFormats; ///< array of supported program binary formats
+ Dali::Vector<GLint> mProgramBinaryFormats; ///< array of supported program binary formats
// Face culling mode
CullFaceMode mCullFaceMode;
unsigned int ConstraintBase::mTotalInstanceCount = 0;
#endif
-ConstraintBase::ConstraintBase( PropertyOwnerSet& ownerSet )
+ConstraintBase::ConstraintBase( PropertyOwnerContainer& ownerSet )
: mWeight( Dali::ActiveConstraint::DEFAULT_WEIGHT ),
mRemoveAction( Dali::Constraint::DEFAULT_REMOVE_ACTION ),
mFirstApply( true ),
namespace SceneGraph
{
+typedef Dali::Vector<PropertyOwner*> PropertyOwnerContainer;
+typedef PropertyOwnerContainer::Iterator PropertyOwnerIter;
+
/**
* An abstract base class for Constraints.
* This can be used to constrain a property of a scene-object, after animations have been applied.
/**
* Constructor
*/
- ConstraintBase( PropertyOwnerSet& ownerSet );
+ ConstraintBase( PropertyOwnerContainer& ownerContainer );
/**
* Virtual destructor.
*/
void StartObservation()
{
- for( PropertyOwnerIter iter = mObservedOwners.begin(); mObservedOwners.end() != iter; ++iter )
+ const PropertyOwnerIter end = mObservedOwners.End();
+ for( PropertyOwnerIter iter = mObservedOwners.Begin(); end != iter; ++iter )
{
(*iter)->AddObserver( *this );
}
*/
void StopObservation()
{
- for( PropertyOwnerIter iter = mObservedOwners.begin(); mObservedOwners.end() != iter; ++iter )
+ const PropertyOwnerIter end = mObservedOwners.End();
+ for( PropertyOwnerIter iter = mObservedOwners.Begin(); end != iter; ++iter )
{
(*iter)->RemoveObserver( *this );
}
- mObservedOwners.clear();
+ mObservedOwners.Clear();
}
/**
if ( !mDisconnected )
{
// Discard pointer to disconnected property owner
- PropertyOwnerIter iter = mObservedOwners.find( &owner );
- if( mObservedOwners.end() != iter )
+ PropertyOwnerIter iter = std::find( mObservedOwners.Begin(), mObservedOwners.End(), &owner );
+ if( mObservedOwners.End() != iter )
{
- mObservedOwners.erase( iter );
+ mObservedOwners.Erase( iter );
// Stop observing the remaining property owners
StopObservation();
private:
- PropertyOwnerSet mObservedOwners; ///< A set of pointers to each observed object. Not owned.
+ PropertyOwnerContainer mObservedOwners; ///< A set of pointers to each observed object. Not owned.
#ifdef DEBUG_ENABLED
static unsigned int mCurrentInstanceCount; ///< The current number of Constraint instances in existence.
* @return A smart-pointer to a newly allocated constraint.
*/
static ConstraintBase* New( const PropertyBase& targetProperty,
- PropertyOwnerSet& ownerSet,
+ PropertyOwnerContainer& ownerContainer,
ConstraintFunctionPtr func,
InterpolatorFunc interpolator,
const AnimatableProperty<float>* customWeight )
PropertyBase& property = const_cast< PropertyBase& >( targetProperty );
return new Constraint< PropertyType, PropertyAccessorType >( property,
- ownerSet,
+ ownerContainer,
func,
interpolator,
customWeight );
* @copydoc Dali::Internal::SceneGraph::Constraint::New()
*/
Constraint( PropertyBase& targetProperty,
- PropertyOwnerSet& ownerSet,
+ PropertyOwnerContainer& ownerContainer,
ConstraintFunctionPtr func,
InterpolatorFunc interpolator,
const AnimatableProperty<float>* customWeight )
- : ConstraintBase( ownerSet ),
+ : ConstraintBase( ownerContainer ),
mTargetProperty( &targetProperty ),
mFunc( func ),
mInterpolator( interpolator ),
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-vector.h>
-#include <dali/public-api/common/set-wrapper.h>
#include <dali/internal/common/message.h>
#include <dali/internal/common/owner-container.h>
#include <dali/internal/update/common/property-base.h>
class PropertyOwner;
-typedef std::set<PropertyOwner*> PropertyOwnerSet;
-typedef PropertyOwnerSet::iterator PropertyOwnerIter;
-
typedef OwnerContainer< PropertyBase* > OwnedPropertyContainer;
typedef OwnedPropertyContainer::Iterator OwnedPropertyIter;
// INTERNAL INCLUDES
#include <dali/public-api/actors/actor-enumerations.h>
#include <dali/public-api/actors/draw-mode.h>
+#include <dali/public-api/common/set-wrapper.h>
#include <dali/public-api/math/quaternion.h>
#include <dali/public-api/math/math-utils.h>
#include <dali/public-api/math/vector3.h>