1 #ifndef __DALI_INTERNAL_SCENE_GRAPH_ANIMATABLE_PROPERTY_H__
2 #define __DALI_INTERNAL_SCENE_GRAPH_ANIMATABLE_PROPERTY_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
25 #include <dali/public-api/common/dali-common.h>
26 #include <dali/public-api/object/property.h>
27 #include <dali/public-api/object/property-input.h>
28 #include <dali/public-api/object/property-types.h>
29 #include <dali/internal/common/message.h>
30 #include <dali/internal/event/common/event-thread-services.h>
31 #include <dali/internal/event/common/property-input-impl.h>
32 #include <dali/internal/update/common/double-buffered.h>
33 #include <dali/internal/update/common/property-base.h>
34 #include <dali/internal/update/common/scene-graph-buffers.h>
46 * Dirty flags record whether an animatable property has changed.
47 * In the frame following a change, the property is reset to a base value.
49 * If the property was "Baked", then the base value matches the (double-buffered) value from the previous frame.
50 * Therefore when reset, the property is flagged as "clean".
52 * However if the property was only "Set" (and not "Baked"), then typically the base value and previous value will not match.
53 * In this case the reset operation is equivalent to a "Bake", and the value is considered "dirty" for an additional frame.
55 static const unsigned int CLEAN_FLAG = 0x00; ///< Indicates that the value did not change in this, or the previous frame
56 static const unsigned int BAKED_FLAG = 0x01; ///< Indicates that the value was Baked during the previous frame
57 static const unsigned int SET_FLAG = 0x02; ///< Indicates that the value was Set during the previous frame
60 class AnimatableProperty;
63 * Base class to reduce code size from the templates.
65 class AnimatablePropertyBase : public PropertyBase
70 * Constructor, initialize the dirty flag
72 AnimatablePropertyBase()
74 mDirtyFlags( BAKED_FLAG )
80 virtual ~AnimatablePropertyBase()
83 protected: // for derived classes
86 * Flag that the property has been Set during the current frame.
90 mDirtyFlags = SET_FLAG;
94 * Flag that the property has been Baked during the current frame.
98 mDirtyFlags = BAKED_FLAG;
101 public: // From PropertyBase
104 * @copydoc Dali::Internal::SceneGraph::PropertyBase::IsClean()
106 virtual bool IsClean() const
108 return ( CLEAN_FLAG == mDirtyFlags );
112 * @copydoc Dali::Internal::PropertyInputImpl::InputInitialized()
114 virtual bool InputInitialized() const
116 return true; // Animatable properties are always valid
119 protected: // so that ResetToBaseValue can set it directly
121 unsigned int mDirtyFlags; ///< Flag whether value changed during previous 2 frames
127 * An boolean animatable property of a scene-graph object.
130 class AnimatableProperty<bool> : public AnimatablePropertyBase
135 * Create an animatable property.
136 * @param [in] initialValue The initial value of the property.
138 AnimatableProperty( bool initialValue )
139 : mValue( initialValue ),
140 mBaseValue( initialValue )
145 * Virtual destructor.
147 virtual ~AnimatableProperty()
152 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
154 virtual Dali::Property::Type GetType() const
156 return Dali::PropertyTypes::Get<bool>();
160 * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
162 virtual void ResetToBaseValue(BufferIndex updateBufferIndex)
164 if (CLEAN_FLAG != mDirtyFlags)
166 mValue[updateBufferIndex] = mBaseValue;
168 mDirtyFlags = ( mDirtyFlags >> 1 );
173 * @copydoc Dali::Internal::PropertyInputImpl::GetBoolean()
175 virtual const bool& GetBoolean( BufferIndex bufferIndex ) const
177 return mValue[ bufferIndex ];
181 * Set the property value. This will only persist for the current frame; the property
182 * will be reset with the base value, at the beginning of the next frame.
183 * @param[in] bufferIndex The buffer to write.
184 * @param[in] value The new property value.
186 void Set(BufferIndex bufferIndex, bool value)
188 // check if the value actually changed to avoid dirtying nodes unnecessarily
189 if( mValue[bufferIndex] != value )
191 mValue[bufferIndex] = value;
198 * Change the property value by a relative amount.
199 * @param[in] bufferIndex The buffer to write.
200 * @param[in] delta The property will change by this amount.
202 void SetRelative(BufferIndex bufferIndex, bool delta)
204 // check if the value actually changed to avoid dirtying nodes unnecessarily
205 // false + false does not change value, true + false does not either
206 if( delta && !mValue[bufferIndex] )
208 mValue[bufferIndex] += delta;
215 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
217 bool& Get(size_t bufferIndex)
219 return mValue[bufferIndex];
223 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
225 const bool& Get(size_t bufferIndex) const
227 return mValue[bufferIndex];
231 * Retrieve the property value.
232 * @param[in] bufferIndex The buffer to read.
233 * @return The property value.
235 bool& operator[](size_t bufferIndex)
237 return mValue[bufferIndex];
241 * Retrieve the property value.
242 * @param[in] bufferIndex The buffer to read.
243 * @return The property value.
245 const bool& operator[](size_t bufferIndex) const
247 return mValue[bufferIndex];
251 * Set both the property value & base value.
252 * @param[in] bufferIndex The buffer to write for the property value.
253 * @param[in] value The new property value.
255 void Bake(BufferIndex bufferIndex, bool value)
257 // bake has to check the base value as current buffer value can be correct by constraint or something else
258 if( mBaseValue != value )
261 mValue[bufferIndex] = value;
268 * Change the property value & base value by a relative amount.
269 * @param[in] bufferIndex The buffer to write for the local property value.
270 * @param[in] delta The property will change by this amount.
272 void BakeRelative(BufferIndex bufferIndex, bool delta)
274 mValue[bufferIndex] += delta;
275 mBaseValue = mValue[bufferIndex];
283 AnimatableProperty(const AnimatableProperty& property);
286 AnimatableProperty& operator=(const AnimatableProperty& rhs);
290 DoubleBuffered<bool> mValue; ///< The double-buffered property value
291 bool mBaseValue; ///< Reset to this base value at the beginning of each frame
297 * An integer animatable property of a scene-graph object.
300 class AnimatableProperty<int> : public AnimatablePropertyBase
305 * Create an animatable property.
306 * @param [in] initialValue The initial value of the property.
308 AnimatableProperty( int initialValue )
309 : mValue( initialValue ),
310 mBaseValue( initialValue )
315 * Virtual destructor.
317 virtual ~AnimatableProperty()
322 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
324 virtual Dali::Property::Type GetType() const
326 return Dali::PropertyTypes::Get<int>();
330 * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
332 virtual void ResetToBaseValue(BufferIndex updateBufferIndex)
334 if (CLEAN_FLAG != mDirtyFlags)
336 mValue[updateBufferIndex] = mBaseValue;
338 mDirtyFlags = ( mDirtyFlags >> 1 );
343 * @copydoc Dali::Internal::PropertyInputImpl::GetInteger()
345 virtual const int& GetInteger( BufferIndex bufferIndex ) const
347 return mValue[ bufferIndex ];
351 * Set the property value. This will only persist for the current frame; the property
352 * will be reset with the base value, at the beginning of the next frame.
353 * @param[in] bufferIndex The buffer to write.
354 * @param[in] value The new property value.
356 void Set(BufferIndex bufferIndex, int value)
358 mValue[bufferIndex] = value;
364 * Change the property value by a relative amount.
365 * @param[in] bufferIndex The buffer to write.
366 * @param[in] delta The property will change by this amount.
368 void SetRelative(BufferIndex bufferIndex, int delta)
370 mValue[bufferIndex] = mValue[bufferIndex] + delta;
376 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
378 int& Get(size_t bufferIndex)
380 return mValue[bufferIndex];
384 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
386 const int& Get(size_t bufferIndex) const
388 return mValue[bufferIndex];
392 * Retrieve the property value.
393 * @param[in] bufferIndex The buffer to read.
394 * @return The property value.
396 int& operator[](size_t bufferIndex)
398 return mValue[bufferIndex];
402 * Retrieve the property value.
403 * @param[in] bufferIndex The buffer to read.
404 * @return The property value.
406 const int& operator[](size_t bufferIndex) const
408 return mValue[bufferIndex];
412 * Set both the property value & base value.
413 * @param[in] bufferIndex The buffer to write for the property value.
414 * @param[in] value The new property value.
416 void Bake(BufferIndex bufferIndex, int value)
418 mValue[bufferIndex] = value;
419 mBaseValue = mValue[bufferIndex];
425 * Change the property value & base value by a relative amount.
426 * @param[in] bufferIndex The buffer to write for the local property value.
427 * @param[in] delta The property will change by this amount.
429 void BakeRelative(BufferIndex bufferIndex, int delta)
431 mValue[bufferIndex] = mValue[bufferIndex] + delta;
432 mBaseValue = mValue[bufferIndex];
438 * Sets both double-buffered values & the base value.
439 * This should only be used when the owning object has not been connected to the scene-graph.
440 * @param[in] value The new property value.
442 void SetInitial(const int& value)
445 mValue[1] = mValue[0];
446 mBaseValue = mValue[0];
450 * Change both double-buffered values & the base value by a relative amount.
451 * This should only be used when the owning object has not been connected to the scene-graph.
452 * @param[in] delta The property will change by this amount.
454 void SetInitialRelative(const int& delta)
456 mValue[0] = mValue[0] + delta;
457 mValue[1] = mValue[0];
458 mBaseValue = mValue[0];
464 AnimatableProperty(const AnimatableProperty& property);
467 AnimatableProperty& operator=(const AnimatableProperty& rhs);
471 DoubleBuffered<int> mValue; ///< The double-buffered property value
472 int mBaseValue; ///< Reset to this base value at the beginning of each frame
477 * An unsigned integer animatable property of a scene-graph object.
480 class AnimatableProperty<unsigned int> : public AnimatablePropertyBase
485 * Create an animatable property.
486 * @param [in] initialValue The initial value of the property.
488 AnimatableProperty( unsigned int initialValue )
489 : mValue( initialValue ),
490 mBaseValue( initialValue )
495 * Virtual destructor.
497 virtual ~AnimatableProperty()
502 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
504 virtual Dali::Property::Type GetType() const
506 return Dali::PropertyTypes::Get<unsigned int>();
510 * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
512 virtual void ResetToBaseValue(BufferIndex updateBufferIndex)
514 if (CLEAN_FLAG != mDirtyFlags)
516 mValue[updateBufferIndex] = mBaseValue;
518 mDirtyFlags = ( mDirtyFlags >> 1 );
523 * @copydoc Dali::Internal::PropertyInputImpl::GetUnsignedInteger()
525 virtual const unsigned int& GetUnsignedInteger( BufferIndex bufferIndex ) const
527 return mValue[ bufferIndex ];
531 * Set the property value. This will only persist for the current frame; the property
532 * will be reset with the base value, at the beginning of the next frame.
533 * @param[in] bufferIndex The buffer to write.
534 * @param[in] value The new property value.
536 void Set(BufferIndex bufferIndex, unsigned int value)
538 mValue[bufferIndex] = value;
544 * Change the property value by a relative amount.
545 * @param[in] bufferIndex The buffer to write.
546 * @param[in] delta The property will change by this amount.
548 void SetRelative(BufferIndex bufferIndex, unsigned int delta)
550 mValue[bufferIndex] = mValue[bufferIndex] + delta;
556 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
558 unsigned int& Get(size_t bufferIndex)
560 return mValue[bufferIndex];
564 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
566 const unsigned int& Get(size_t bufferIndex) const
568 return mValue[bufferIndex];
572 * Retrieve the property value.
573 * @param[in] bufferIndex The buffer to read.
574 * @return The property value.
576 unsigned int& operator[](size_t bufferIndex)
578 return mValue[bufferIndex];
582 * Retrieve the property value.
583 * @param[in] bufferIndex The buffer to read.
584 * @return The property value.
586 const unsigned int& operator[](size_t bufferIndex) const
588 return mValue[bufferIndex];
592 * Set both the property value & base value.
593 * @param[in] bufferIndex The buffer to write for the property value.
594 * @param[in] value The new property value.
596 void Bake(BufferIndex bufferIndex, unsigned int value)
598 mValue[bufferIndex] = value;
599 mBaseValue = mValue[bufferIndex];
605 * Change the property value & base value by a relative amount.
606 * @param[in] bufferIndex The buffer to write for the local property value.
607 * @param[in] delta The property will change by this amount.
609 void BakeRelative(BufferIndex bufferIndex, unsigned int delta)
611 mValue[bufferIndex] = mValue[bufferIndex] + delta;
612 mBaseValue = mValue[bufferIndex];
618 * Sets both double-buffered values & the base value.
619 * This should only be used when the owning object has not been connected to the scene-graph.
620 * @param[in] value The new property value.
622 void SetInitial(const unsigned int& value)
625 mValue[1] = mValue[0];
626 mBaseValue = mValue[0];
630 * Change both double-buffered values & the base value by a relative amount.
631 * This should only be used when the owning object has not been connected to the scene-graph.
632 * @param[in] delta The property will change by this amount.
634 void SetInitialRelative(const unsigned int& delta)
636 mValue[0] = mValue[0] + delta;
637 mValue[1] = mValue[0];
638 mBaseValue = mValue[0];
644 AnimatableProperty(const AnimatableProperty& property);
647 AnimatableProperty& operator=(const AnimatableProperty& rhs);
650 DoubleBuffered<unsigned int> mValue; ///< The double-buffered property value
651 unsigned int mBaseValue; ///< Reset to this base value at the beginning of each frame
656 * An float animatable property of a scene-graph object.
659 class AnimatableProperty<float> : public AnimatablePropertyBase
664 * Create an animatable property.
665 * @param [in] initialValue The initial value of the property.
667 AnimatableProperty( float initialValue )
668 : mValue( initialValue ),
669 mBaseValue( initialValue )
674 * Virtual destructor.
676 virtual ~AnimatableProperty()
681 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
683 virtual Dali::Property::Type GetType() const
685 return Dali::PropertyTypes::Get<float>();
689 * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
691 virtual void ResetToBaseValue(BufferIndex updateBufferIndex)
693 if (CLEAN_FLAG != mDirtyFlags)
695 mValue[updateBufferIndex] = mBaseValue;
697 mDirtyFlags = ( mDirtyFlags >> 1 );
702 * @copydoc Dali::Internal::PropertyInputImpl::GetFloat()
704 virtual const float& GetFloat( BufferIndex bufferIndex ) const
706 return mValue[ bufferIndex ];
710 * Set the property value. This will only persist for the current frame; the property
711 * will be reset with the base value, at the beginning of the next frame.
712 * @param[in] bufferIndex The buffer to write.
713 * @param[in] value The new property value.
715 void Set(BufferIndex bufferIndex, float value)
717 mValue[bufferIndex] = value;
723 * Change the property value by a relative amount.
724 * @param[in] bufferIndex The buffer to write.
725 * @param[in] delta The property will change by this amount.
727 void SetRelative(BufferIndex bufferIndex, float delta)
729 mValue[bufferIndex] = mValue[bufferIndex] + delta;
735 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
737 float& Get(size_t bufferIndex)
739 return mValue[bufferIndex];
743 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
745 const float& Get(size_t bufferIndex) const
747 return mValue[bufferIndex];
751 * Retrieve the property value.
752 * @param[in] bufferIndex The buffer to read.
753 * @return The property value.
755 float& operator[](size_t bufferIndex)
757 return mValue[bufferIndex];
761 * Retrieve the property value.
762 * @param[in] bufferIndex The buffer to read.
763 * @return The property value.
765 const float& operator[](size_t bufferIndex) const
767 return mValue[bufferIndex];
771 * Set both the property value & base value.
772 * @param[in] bufferIndex The buffer to write for the property value.
773 * @param[in] value The new property value.
775 void Bake(BufferIndex bufferIndex, float value)
777 mValue[bufferIndex] = value;
778 mBaseValue = mValue[bufferIndex];
784 * Change the property value & base value by a relative amount.
785 * @param[in] bufferIndex The buffer to write for the local property value.
786 * @param[in] delta The property will change by this amount.
788 void BakeRelative(BufferIndex bufferIndex, float delta)
790 mValue[bufferIndex] = mValue[bufferIndex] + delta;
791 mBaseValue = mValue[bufferIndex];
797 * Sets both double-buffered values & the base value.
798 * This should only be used when the owning object has not been connected to the scene-graph.
799 * @param[in] value The new property value.
801 void SetInitial(const float& value)
804 mValue[1] = mValue[0];
805 mBaseValue = mValue[0];
809 * Change both double-buffered values & the base value by a relative amount.
810 * This should only be used when the owning object has not been connected to the scene-graph.
811 * @param[in] delta The property will change by this amount.
813 void SetInitialRelative(const float& delta)
815 mValue[0] = mValue[0] + delta;
816 mValue[1] = mValue[0];
817 mBaseValue = mValue[0];
823 AnimatableProperty(const AnimatableProperty& property);
826 AnimatableProperty& operator=(const AnimatableProperty& rhs);
830 DoubleBuffered<float> mValue; ///< The double-buffered property value
831 float mBaseValue; ///< Reset to this base value at the beginning of each frame
835 * An Vector2 animatable property of a scene-graph object.
838 class AnimatableProperty<Vector2> : public AnimatablePropertyBase
843 * Create an animatable property.
844 * @param [in] initialValue The initial value of the property.
846 AnimatableProperty( const Vector2& initialValue )
847 : mValue( initialValue ),
848 mBaseValue( initialValue )
853 * Virtual destructor.
855 virtual ~AnimatableProperty()
860 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
862 virtual Dali::Property::Type GetType() const
864 return Dali::PropertyTypes::Get<Vector2>();
868 * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
870 virtual void ResetToBaseValue(BufferIndex updateBufferIndex)
872 if (CLEAN_FLAG != mDirtyFlags)
874 mValue[updateBufferIndex] = mBaseValue;
876 mDirtyFlags = ( mDirtyFlags >> 1 );
881 * @copydoc Dali::PropertyInput::GetVector2()
883 virtual const Vector2& GetVector2( BufferIndex bufferIndex ) const
885 return mValue[ bufferIndex ];
889 * Set the property value. This will only persist for the current frame; the property
890 * will be reset with the base value, at the beginning of the next frame.
891 * @param[in] bufferIndex The buffer to write.
892 * @param[in] value The new property value.
894 void Set(BufferIndex bufferIndex, const Vector2& value)
896 mValue[bufferIndex] = value;
902 * Set the property value. This will only persist for the current frame; the property
903 * will be reset with the base value, at the beginning of the next frame.
904 * @param[in] bufferIndex The buffer to write.
905 * @param[in] value The new X value.
907 void SetX(BufferIndex bufferIndex, float value)
909 mValue[bufferIndex].x = value;
915 * Set the property value. This will only persist for the current frame; the property
916 * will be reset with the base value, at the beginning of the next frame.
917 * @param[in] bufferIndex The buffer to write.
918 * @param[in] value The new Y value.
920 void SetY(BufferIndex bufferIndex, float value)
922 mValue[bufferIndex].y = value;
928 * Change the property value by a relative amount.
929 * @param[in] bufferIndex The buffer to write.
930 * @param[in] delta The property will change by this amount.
932 void SetRelative(BufferIndex bufferIndex, const Vector2& delta)
934 mValue[bufferIndex] += delta;
940 * Change the X value by a relative amount.
941 * @param[in] bufferIndex The buffer to write.
942 * @param[in] delta The X value will change by this amount.
944 void SetXRelative(BufferIndex bufferIndex, float delta)
946 mValue[bufferIndex].x += delta;
952 * Change the Y value by a relative amount.
953 * @param[in] bufferIndex The buffer to write.
954 * @param[in] delta The Y value will change by this amount.
956 void SetYRelative(BufferIndex bufferIndex, float delta)
958 mValue[bufferIndex].y += delta;
964 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
966 Vector2& Get(size_t bufferIndex)
968 return mValue[bufferIndex];
972 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
974 const Vector2& Get(size_t bufferIndex) const
976 return mValue[bufferIndex];
980 * Retrieve the property value.
981 * @param[in] bufferIndex The buffer to read.
982 * @return The property value.
984 Vector2& operator[](size_t bufferIndex)
986 return mValue[bufferIndex];
990 * Retrieve the property value.
991 * @param[in] bufferIndex The buffer to read.
992 * @return The property value.
994 const Vector2& operator[](size_t bufferIndex) const
996 return mValue[bufferIndex];
1000 * Set both the property value & base value.
1001 * @param[in] bufferIndex The buffer to write for the property value.
1002 * @param[in] value The new property value.
1004 void Bake(BufferIndex bufferIndex, const Vector2& value)
1006 mValue[bufferIndex] = value;
1013 * Set both the X value & base X value.
1014 * @param[in] bufferIndex The buffer to write for the property value.
1015 * @param[in] value The new property value.
1017 void BakeX(BufferIndex bufferIndex, float value)
1019 mValue[bufferIndex].x = value;
1020 mBaseValue.x = value;
1026 * Set both the Y value & base Y value.
1027 * @param[in] bufferIndex The buffer to write for the property value.
1028 * @param[in] value The new property value.
1030 void BakeY(BufferIndex bufferIndex, float value)
1032 mValue[bufferIndex].y = value;
1033 mBaseValue.y = value;
1039 * Change the property value & base value by a relative amount.
1040 * @param[in] bufferIndex The buffer to write for the local property value.
1041 * @param[in] delta The property will change by this amount.
1043 void BakeRelative(BufferIndex bufferIndex, const Vector2& delta)
1045 mValue[bufferIndex] += delta;
1046 mBaseValue = mValue[bufferIndex];
1052 * Change the X value & base X value by a relative amount.
1053 * @param[in] bufferIndex The buffer to write for the local property value.
1054 * @param[in] delta The X value will change by this amount.
1056 void BakeXRelative(BufferIndex bufferIndex, float delta)
1058 mValue[bufferIndex].x += delta;
1059 mBaseValue.x = mValue[bufferIndex].x;
1065 * Change the Y value & base Y value by a relative amount.
1066 * @param[in] bufferIndex The buffer to write for the local property value.
1067 * @param[in] delta The Y value will change by this amount.
1069 void BakeYRelative(BufferIndex bufferIndex, float delta)
1071 mValue[bufferIndex].y += delta;
1072 mBaseValue.y = mValue[bufferIndex].y;
1080 AnimatableProperty(const AnimatableProperty& property);
1083 AnimatableProperty& operator=(const AnimatableProperty& rhs);
1087 DoubleBuffered<Vector2> mValue; ///< The double-buffered property value
1088 Vector2 mBaseValue; ///< Reset to this base value at the beginning of each frame
1093 * A Vector3 animatable property of a scene-graph object.
1096 class AnimatableProperty<Vector3> : public AnimatablePropertyBase
1101 * Create an animatable property.
1103 AnimatableProperty()
1110 * Create an animatable property.
1111 * @param [in] initialValue The initial value of the property.
1113 AnimatableProperty( const Vector3& initialValue )
1114 : mValue( initialValue ),
1115 mBaseValue( initialValue )
1120 * Virtual destructor.
1122 virtual ~AnimatableProperty()
1127 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
1129 virtual Dali::Property::Type GetType() const
1131 return Dali::PropertyTypes::Get<Vector3>();
1135 * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
1137 virtual void ResetToBaseValue(BufferIndex updateBufferIndex)
1139 if (CLEAN_FLAG != mDirtyFlags)
1141 mValue[updateBufferIndex] = mBaseValue;
1143 mDirtyFlags = ( mDirtyFlags >> 1 );
1148 * @copydoc Dali::PropertyInput::GetVector3()
1150 virtual const Vector3& GetVector3( BufferIndex bufferIndex ) const
1152 return mValue[ bufferIndex ];
1156 * Set the property value. This will only persist for the current frame; the property
1157 * will be reset with the base value, at the beginning of the next frame.
1158 * @param[in] bufferIndex The buffer to write.
1159 * @param[in] value The new property value.
1161 void Set(BufferIndex bufferIndex, const Vector3& value)
1163 mValue[bufferIndex] = value;
1169 * Set the property value. This will only persist for the current frame; the property
1170 * will be reset with the base value, at the beginning of the next frame.
1171 * @param[in] bufferIndex The buffer to write.
1172 * @param[in] value The new X value.
1174 void SetX(BufferIndex bufferIndex, float value)
1176 mValue[bufferIndex].x = value;
1182 * Set the property value. This will only persist for the current frame; the property
1183 * will be reset with the base value, at the beginning of the next frame.
1184 * @param[in] bufferIndex The buffer to write.
1185 * @param[in] value The new Y value.
1187 void SetY(BufferIndex bufferIndex, float value)
1189 mValue[bufferIndex].y = value;
1195 * Set the property value. This will only persist for the current frame; the property
1196 * will be reset with the base value, at the beginning of the next frame.
1197 * @param[in] bufferIndex The buffer to write.
1198 * @param[in] value The new Z value.
1200 void SetZ(BufferIndex bufferIndex, float value)
1202 mValue[bufferIndex].z = value;
1208 * Change the property value by a relative amount.
1209 * @param[in] bufferIndex The buffer to write.
1210 * @param[in] delta The property will change by this amount.
1212 void SetRelative(BufferIndex bufferIndex, const Vector3& delta)
1214 mValue[bufferIndex] += delta;
1220 * Change the X value by a relative amount.
1221 * @param[in] bufferIndex The buffer to write.
1222 * @param[in] delta The X value will change by this amount.
1224 void SetXRelative(BufferIndex bufferIndex, float delta)
1226 mValue[bufferIndex].x += delta;
1232 * Change the Y value by a relative amount.
1233 * @param[in] bufferIndex The buffer to write.
1234 * @param[in] delta The Y value will change by this amount.
1236 void SetYRelative(BufferIndex bufferIndex, float delta)
1238 mValue[bufferIndex].y += delta;
1244 * Change the Z value by a relative amount.
1245 * @param[in] bufferIndex The buffer to write.
1246 * @param[in] delta The Z value will change by this amount.
1248 void SetZRelative(BufferIndex bufferIndex, float delta)
1250 mValue[bufferIndex].z += delta;
1256 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
1258 Vector3& Get(size_t bufferIndex)
1260 return mValue[bufferIndex];
1264 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
1266 const Vector3& Get(size_t bufferIndex) const
1268 return mValue[bufferIndex];
1272 * Retrieve the property value.
1273 * @param[in] bufferIndex The buffer to read.
1274 * @return The property value.
1276 Vector3& operator[](size_t bufferIndex)
1278 return mValue[bufferIndex];
1282 * Retrieve the property value.
1283 * @param[in] bufferIndex The buffer to read.
1284 * @return The property value.
1286 const Vector3& operator[](size_t bufferIndex) const
1288 return mValue[bufferIndex];
1292 * Set both the property value & base value.
1293 * @param[in] bufferIndex The buffer to write for the property value.
1294 * @param[in] value The new property value.
1296 void Bake(BufferIndex bufferIndex, const Vector3& value)
1298 mValue[bufferIndex] = value;
1305 * Set both the X value & base X value.
1306 * @param[in] bufferIndex The buffer to write for the property value.
1307 * @param[in] value The new property value.
1309 void BakeX(BufferIndex bufferIndex, float value)
1311 mValue[bufferIndex].x = value;
1312 mBaseValue.x = value;
1318 * Set both the Y value & base Y value.
1319 * @param[in] bufferIndex The buffer to write for the property value.
1320 * @param[in] value The new property value.
1322 void BakeY(BufferIndex bufferIndex, float value)
1324 mValue[bufferIndex].y = value;
1325 mBaseValue.y = value;
1331 * Set both the Z value & base Z value.
1332 * @param[in] bufferIndex The buffer to write for the property value.
1333 * @param[in] value The new property value.
1335 void BakeZ(BufferIndex bufferIndex, float value)
1337 mValue[bufferIndex].z = value;
1338 mBaseValue.z = value;
1344 * Change the property value & base value by a relative amount.
1345 * @param[in] bufferIndex The buffer to write for the local property value.
1346 * @param[in] delta The property will change by this amount.
1348 void BakeRelative(BufferIndex bufferIndex, const Vector3& delta)
1350 mValue[bufferIndex] += delta;
1351 mBaseValue = mValue[bufferIndex];
1357 * Change the property value & base value by a relative amount.
1358 * @param[in] bufferIndex The buffer to write for the local property value.
1359 * @param[in] delta The property will change by this amount.
1361 void BakeRelativeMultiply(BufferIndex bufferIndex, const Vector3& delta)
1363 mValue[bufferIndex] *= delta;
1364 mBaseValue = mValue[bufferIndex];
1370 * Change the X value & base X value by a relative amount.
1371 * @param[in] bufferIndex The buffer to write for the local property value.
1372 * @param[in] delta The X value will change by this amount.
1374 void BakeXRelative(BufferIndex bufferIndex, float delta)
1376 mValue[bufferIndex].x += delta;
1377 mBaseValue.x = mValue[bufferIndex].x;
1383 * Change the Y value & base Y value by a relative amount.
1384 * @param[in] bufferIndex The buffer to write for the local property value.
1385 * @param[in] delta The Y value will change by this amount.
1387 void BakeYRelative(BufferIndex bufferIndex, float delta)
1389 mValue[bufferIndex].y += delta;
1390 mBaseValue.y = mValue[bufferIndex].y;
1396 * Change the Z value & base Z value by a relative amount.
1397 * @param[in] bufferIndex The buffer to write for the local property value.
1398 * @param[in] delta The Z value will change by this amount.
1400 void BakeZRelative(BufferIndex bufferIndex, float delta)
1402 mValue[bufferIndex].z += delta;
1403 mBaseValue.z = mValue[bufferIndex].z;
1411 AnimatableProperty(const AnimatableProperty& property);
1414 AnimatableProperty& operator=(const AnimatableProperty& rhs);
1418 DoubleBuffered<Vector3> mValue; ///< The double-buffered property value
1419 Vector3 mBaseValue; ///< Reset to this base value at the beginning of each frame
1424 * A Vector4 animatable property of a scene-graph object.
1427 class AnimatableProperty<Vector4> : public AnimatablePropertyBase
1432 * Create an animatable property.
1433 * @param [in] initialValue The initial value of the property.
1435 AnimatableProperty( const Vector4& initialValue )
1436 : mValue( initialValue ),
1437 mBaseValue( initialValue )
1442 * Virtual destructor.
1444 virtual ~AnimatableProperty()
1449 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
1451 virtual Dali::Property::Type GetType() const
1453 return Dali::PropertyTypes::Get<Vector4>();
1457 * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
1459 virtual void ResetToBaseValue(BufferIndex updateBufferIndex)
1461 if (CLEAN_FLAG != mDirtyFlags)
1463 mValue[updateBufferIndex] = mBaseValue;
1465 mDirtyFlags = ( mDirtyFlags >> 1 );
1470 * @copydoc Dali::PropertyInput::GetVector4()
1472 virtual const Vector4& GetVector4( BufferIndex bufferIndex ) const
1474 return mValue[ bufferIndex ];
1478 * Set the property value. This will only persist for the current frame; the property
1479 * will be reset with the base value, at the beginning of the next frame.
1480 * @param[in] bufferIndex The buffer to write.
1481 * @param[in] value The new property value.
1483 void Set(BufferIndex bufferIndex, const Vector4& value)
1485 mValue[bufferIndex] = value;
1491 * Set the X value. This will only persist for the current frame; the property
1492 * will be reset with the base value, at the beginning of the next frame.
1493 * @param[in] bufferIndex The buffer to write.
1494 * @param[in] value The new X value.
1496 void SetX(BufferIndex bufferIndex, float value)
1498 mValue[bufferIndex].x = value;
1504 * Set the Y value. This will only persist for the current frame; the property
1505 * will be reset with the base value, at the beginning of the next frame.
1506 * @param[in] bufferIndex The buffer to write.
1507 * @param[in] value The new Y value.
1509 void SetY(BufferIndex bufferIndex, float value)
1511 mValue[bufferIndex].y = value;
1517 * Set the Z value. This will only persist for the current frame; the property
1518 * will be reset with the base value, at the beginning of the next frame.
1519 * @param[in] bufferIndex The buffer to write.
1520 * @param[in] value The new Z value.
1522 void SetZ(BufferIndex bufferIndex, float value)
1524 mValue[bufferIndex].z = value;
1530 * Set the W value. This will only persist for the current frame; the property
1531 * will be reset with the base value, at the beginning of the next frame.
1532 * @param[in] bufferIndex The buffer to write.
1533 * @param[in] value The new W value.
1535 void SetW(BufferIndex bufferIndex, float value)
1537 mValue[bufferIndex].w = value;
1543 * Change the property value by a relative amount.
1544 * @param[in] bufferIndex The buffer to write.
1545 * @param[in] delta The property will change by this amount.
1547 void SetRelative(BufferIndex bufferIndex, const Vector4& delta)
1549 mValue[bufferIndex] = mValue[bufferIndex] + delta;
1555 * Change the X value by a relative amount.
1556 * @param[in] bufferIndex The buffer to write.
1557 * @param[in] delta The X value will change by this amount.
1559 void SetXRelative(BufferIndex bufferIndex, float delta)
1561 mValue[bufferIndex].x = mValue[bufferIndex].x + delta;
1567 * Change the Y value by a relative amount.
1568 * @param[in] bufferIndex The buffer to write.
1569 * @param[in] delta The Y value will change by this amount.
1571 void SetYRelative(BufferIndex bufferIndex, float delta)
1573 mValue[bufferIndex].y = mValue[bufferIndex].y + delta;
1579 * Change the Z value by a relative amount.
1580 * @param[in] bufferIndex The buffer to write.
1581 * @param[in] delta The Z value will change by this amount.
1583 void SetZRelative(BufferIndex bufferIndex, float delta)
1585 mValue[bufferIndex].z = mValue[bufferIndex].z + delta;
1591 * Change the W value by a relative amount.
1592 * @param[in] bufferIndex The buffer to write.
1593 * @param[in] delta The W value will change by this amount.
1595 void SetWRelative(BufferIndex bufferIndex, float delta)
1597 mValue[bufferIndex].w = mValue[bufferIndex].w + delta;
1603 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
1605 Vector4& Get(size_t bufferIndex)
1607 return mValue[bufferIndex];
1611 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
1613 const Vector4& Get(size_t bufferIndex) const
1615 return mValue[bufferIndex];
1619 * Retrieve the property value.
1620 * @param[in] bufferIndex The buffer to read.
1621 * @return The property value.
1623 Vector4& operator[](size_t bufferIndex)
1625 return mValue[bufferIndex];
1629 * Retrieve the property value.
1630 * @param[in] bufferIndex The buffer to read.
1631 * @return The property value.
1633 const Vector4& operator[](size_t bufferIndex) const
1635 return mValue[bufferIndex];
1639 * Set both the property value & base value.
1640 * @param[in] bufferIndex The buffer to write for the property value.
1641 * @param[in] value The new property value.
1643 void Bake(BufferIndex bufferIndex, const Vector4& value)
1645 mValue[bufferIndex] = value;
1646 mBaseValue = mValue[bufferIndex];
1652 * Set both the X value & base X value.
1653 * @param[in] bufferIndex The buffer to write for the property value.
1654 * @param[in] value The new property value.
1656 void BakeX(BufferIndex bufferIndex, float value)
1658 mValue[bufferIndex].x = value;
1659 mBaseValue.x = mValue[bufferIndex].x;
1665 * Set both the Y value & base Y value.
1666 * @param[in] bufferIndex The buffer to write for the property value.
1667 * @param[in] value The new property value.
1669 void BakeY(BufferIndex bufferIndex, float value)
1671 mValue[bufferIndex].y = value;
1672 mBaseValue.y = mValue[bufferIndex].y;
1678 * Set both the Z value & base Z value.
1679 * @param[in] bufferIndex The buffer to write for the property value.
1680 * @param[in] value The new property value.
1682 void BakeZ(BufferIndex bufferIndex, float value)
1684 mValue[bufferIndex].z = value;
1685 mBaseValue.z = mValue[bufferIndex].z;
1691 * Set both the W value & base W value.
1692 * @param[in] bufferIndex The buffer to write for the property value.
1693 * @param[in] value The new property value.
1695 void BakeW(BufferIndex bufferIndex, float value)
1697 mValue[bufferIndex].w = value;
1698 mBaseValue.w = mValue[bufferIndex].w;
1704 * Change the property value & base value by a relative amount.
1705 * @param[in] bufferIndex The buffer to write for the local property value.
1706 * @param[in] delta The property will change by this amount.
1708 void BakeRelative(BufferIndex bufferIndex, const Vector4& delta)
1710 mValue[bufferIndex] = mValue[bufferIndex] + delta;
1711 mBaseValue = mValue[bufferIndex];
1717 * Change the X value & base X value by a relative amount.
1718 * @param[in] bufferIndex The buffer to write for the local property value.
1719 * @param[in] delta The X value will change by this amount.
1721 void BakeXRelative(BufferIndex bufferIndex, float delta)
1723 mValue[bufferIndex].x = mValue[bufferIndex].x + delta;
1724 mBaseValue.x = mValue[bufferIndex].x;
1730 * Change the Y value & base Y value by a relative amount.
1731 * @param[in] bufferIndex The buffer to write for the local property value.
1732 * @param[in] delta The Y value will change by this amount.
1734 void BakeYRelative(BufferIndex bufferIndex, float delta)
1736 mValue[bufferIndex].y = mValue[bufferIndex].y + delta;
1737 mBaseValue.y = mValue[bufferIndex].y;
1743 * Change the Z value & base Z value by a relative amount.
1744 * @param[in] bufferIndex The buffer to write for the local property value.
1745 * @param[in] delta The Z value will change by this amount.
1747 void BakeZRelative(BufferIndex bufferIndex, float delta)
1749 mValue[bufferIndex].z = mValue[bufferIndex].z + delta;
1750 mBaseValue.z = mValue[bufferIndex].z;
1756 * Change the W value & base W value by a relative amount.
1757 * @param[in] bufferIndex The buffer to write for the local property value.
1758 * @param[in] delta The W value will change by this amount.
1760 void BakeWRelative(BufferIndex bufferIndex, float delta)
1762 mValue[bufferIndex].w = mValue[bufferIndex].w + delta;
1763 mBaseValue.w = mValue[bufferIndex].w;
1769 * Sets both double-buffered W values & the base W value.
1770 * This should only be used when the owning object has not been connected to the scene-graph.
1771 * @param[in] value The new W value.
1773 void SetWInitial(float value)
1775 mValue[0].w = value;
1776 mValue[1].w = mValue[0].w;
1777 mBaseValue.w = mValue[0].w;
1783 AnimatableProperty(const AnimatableProperty& property);
1786 AnimatableProperty& operator=(const AnimatableProperty& rhs);
1790 DoubleBuffered<Vector4> mValue; ///< The double-buffered property value
1791 Vector4 mBaseValue; ///< Reset to this base value at the beginning of each frame
1795 * An Quaternion animatable property of a scene-graph object.
1798 class AnimatableProperty<Quaternion> : public AnimatablePropertyBase
1803 * Create an animatable property.
1805 AnimatableProperty()
1812 * Create an animatable property.
1813 * @param [in] initialValue The initial value of the property.
1815 AnimatableProperty( const Quaternion& initialValue )
1816 : mValue( initialValue ),
1817 mBaseValue( initialValue )
1822 * Virtual destructor.
1824 virtual ~AnimatableProperty()
1829 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
1831 virtual Dali::Property::Type GetType() const
1833 return Dali::PropertyTypes::Get<Quaternion>();
1837 * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
1839 virtual void ResetToBaseValue(BufferIndex updateBufferIndex)
1841 if (CLEAN_FLAG != mDirtyFlags)
1843 mValue[updateBufferIndex] = mBaseValue;
1845 mDirtyFlags = ( mDirtyFlags >> 1 );
1850 * @copydoc Dali::PropertyInput::GetQuaternion()
1852 virtual const Quaternion& GetQuaternion( BufferIndex bufferIndex ) const
1854 return mValue[ bufferIndex ];
1858 * Set the property value. This will only persist for the current frame; the property
1859 * will be reset with the base value, at the beginning of the next frame.
1860 * @param[in] bufferIndex The buffer to write.
1861 * @param[in] value The new property value.
1863 void Set(BufferIndex bufferIndex, const Quaternion& value)
1865 mValue[bufferIndex] = value;
1871 * Change the property value by a relative amount.
1872 * @param[in] bufferIndex The buffer to write.
1873 * @param[in] delta The property will change by this amount.
1875 void SetRelative(BufferIndex bufferIndex, const Quaternion& delta)
1877 mValue[bufferIndex] *= delta;
1883 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
1885 Quaternion& Get(size_t bufferIndex)
1887 return mValue[bufferIndex];
1891 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
1893 const Quaternion& Get(size_t bufferIndex) const
1895 return mValue[bufferIndex];
1899 * Retrieve the property value.
1900 * @param[in] bufferIndex The buffer to read.
1901 * @return The property value.
1903 Quaternion& operator[](size_t bufferIndex)
1905 return mValue[bufferIndex];
1909 * Retrieve the property value.
1910 * @param[in] bufferIndex The buffer to read.
1911 * @return The property value.
1913 const Quaternion& operator[](size_t bufferIndex) const
1915 return mValue[bufferIndex];
1919 * Set both the property value & base value.
1920 * @param[in] bufferIndex The buffer to write for the property value.
1921 * @param[in] value The new property value.
1923 void Bake(BufferIndex bufferIndex, const Quaternion& value)
1925 mValue[bufferIndex] = value;
1932 * Change the property value & base value by a relative amount.
1933 * @param[in] bufferIndex The buffer to write for the local property value.
1934 * @param[in] delta The property will change by this amount.
1936 void BakeRelative(BufferIndex bufferIndex, const Quaternion& delta)
1938 mValue[bufferIndex] *= delta;
1939 mBaseValue = mValue[bufferIndex];
1947 AnimatableProperty(const AnimatableProperty& property);
1950 AnimatableProperty& operator=(const AnimatableProperty& rhs);
1954 DoubleBuffered<Quaternion> mValue; ///< The double-buffered property value
1955 Quaternion mBaseValue; ///< Reset to this base value at the beginning of each frame
1960 * A Matrix animatable property of a scene-graph object.
1963 class AnimatableProperty<Matrix> : public AnimatablePropertyBase
1968 * Create an animatable property.
1969 * @param [in] initialValue The initial value of the property.
1971 AnimatableProperty( const Matrix& initialValue )
1972 : mValue( initialValue ),
1973 mBaseValue( initialValue )
1978 * Virtual destructor.
1980 virtual ~AnimatableProperty()
1985 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
1987 virtual Dali::Property::Type GetType() const
1989 return Dali::PropertyTypes::Get<Matrix>();
1993 * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
1995 virtual void ResetToBaseValue(BufferIndex updateBufferIndex)
1997 if (CLEAN_FLAG != mDirtyFlags)
1999 mValue[updateBufferIndex] = mBaseValue;
2001 mDirtyFlags = ( mDirtyFlags >> 1 );
2006 * @copydoc Dali::Internal::PropertyInputImpl::GetMatrix()
2008 virtual const Matrix& GetMatrix( BufferIndex bufferIndex ) const
2010 return mValue[ bufferIndex ];
2014 * Set the property value. This will only persist for the current frame; the property
2015 * will be reset with the base value, at the beginning of the next frame.
2016 * @param[in] bufferIndex The buffer to write.
2017 * @param[in] value The new property value.
2019 void Set(BufferIndex bufferIndex, const Matrix& value)
2021 mValue[bufferIndex] = value;
2027 * Change the property value by a relative amount.
2028 * @param[in] bufferIndex The buffer to write.
2029 * @param[in] delta The property will change by this amount.
2031 void SetRelative(BufferIndex bufferIndex, const Matrix& delta)
2034 Matrix::Multiply(temp, mValue[bufferIndex], delta);
2035 mValue[bufferIndex] = temp;
2041 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
2043 Matrix& Get(size_t bufferIndex)
2045 return mValue[bufferIndex];
2049 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
2051 const Matrix& Get(size_t bufferIndex) const
2053 return mValue[bufferIndex];
2057 * Retrieve the property value.
2058 * @param[in] bufferIndex The buffer to read.
2059 * @return The property value.
2061 Matrix& operator[](size_t bufferIndex)
2063 return mValue[bufferIndex];
2067 * Retrieve the property value.
2068 * @param[in] bufferIndex The buffer to read.
2069 * @return The property value.
2071 const Matrix& operator[](size_t bufferIndex) const
2073 return mValue[bufferIndex];
2077 * Set both the property value & base value.
2078 * @param[in] bufferIndex The buffer to write for the property value.
2079 * @param[in] value The new property value.
2081 void Bake(BufferIndex bufferIndex, const Matrix& value)
2083 mValue[bufferIndex] = value;
2084 mBaseValue = mValue[bufferIndex];
2090 * Change the property value & base value by a relative amount.
2091 * @param[in] bufferIndex The buffer to write for the local property value.
2092 * @param[in] delta The property will change by this amount.
2094 void BakeRelative(BufferIndex bufferIndex, const Matrix& delta)
2097 Matrix::Multiply(temp, mValue[bufferIndex], delta);
2098 mValue[bufferIndex] = temp;
2107 AnimatableProperty(const AnimatableProperty& property);
2110 AnimatableProperty& operator=(const AnimatableProperty& rhs);
2114 DoubleBuffered<Matrix> mValue; ///< The double-buffered property value
2115 Matrix mBaseValue; ///< Reset to this base value at the beginning of each frame
2120 * A Matrix3 animatable property of a scene-graph object.
2123 class AnimatableProperty<Matrix3> : public AnimatablePropertyBase
2128 * Create an animatable property.
2129 * @param [in] initialValue The initial value of the property.
2131 AnimatableProperty( const Matrix3& initialValue )
2132 : mValue( initialValue ),
2133 mBaseValue( initialValue )
2138 * Virtual destructor.
2140 virtual ~AnimatableProperty()
2145 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
2147 virtual Dali::Property::Type GetType() const
2149 return Dali::PropertyTypes::Get<Matrix3>();
2153 * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
2155 virtual void ResetToBaseValue(BufferIndex updateBufferIndex)
2157 if (CLEAN_FLAG != mDirtyFlags)
2159 mValue[updateBufferIndex] = mBaseValue;
2161 mDirtyFlags = ( mDirtyFlags >> 1 );
2166 * @copydoc Dali::Internal::PropertyInputImpl::GetMatrix3()
2168 virtual const Matrix3& GetMatrix3( BufferIndex bufferIndex ) const
2170 return mValue[ bufferIndex ];
2174 * Set the property value. This will only persist for the current frame; the property
2175 * will be reset with the base value, at the beginning of the next frame.
2176 * @param[in] bufferIndex The buffer to write.
2177 * @param[in] value The new property value.
2179 void Set(BufferIndex bufferIndex, const Matrix3& value)
2181 mValue[bufferIndex] = value;
2186 * Change the property value by a relative amount.
2187 * @param[in] bufferIndex The buffer to write.
2188 * @param[in] delta The property will change by this amount.
2190 void SetRelative(BufferIndex bufferIndex, const Matrix3& delta)
2193 Matrix3::Multiply(temp, mValue[bufferIndex], delta);
2194 mValue[bufferIndex] = temp;
2199 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
2201 Matrix3& Get(size_t bufferIndex)
2203 return mValue[bufferIndex];
2207 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
2209 const Matrix3& Get(size_t bufferIndex) const
2211 return mValue[bufferIndex];
2215 * Retrieve the property value.
2216 * @param[in] bufferIndex The buffer to read.
2217 * @return The property value.
2219 Matrix3& operator[](size_t bufferIndex)
2221 return mValue[bufferIndex];
2225 * Retrieve the property value.
2226 * @param[in] bufferIndex The buffer to read.
2227 * @return The property value.
2229 const Matrix3& operator[](size_t bufferIndex) const
2231 return mValue[bufferIndex];
2235 * Set both the property value & base value.
2236 * @param[in] bufferIndex The buffer to write for the property value.
2237 * @param[in] value The new property value.
2239 void Bake(BufferIndex bufferIndex, const Matrix3& value)
2241 mValue[bufferIndex] = value;
2242 mBaseValue = mValue[bufferIndex];
2248 * Change the property value & base value by a relative amount.
2249 * @param[in] bufferIndex The buffer to write for the local property value.
2250 * @param[in] delta The property will change by this amount.
2252 void BakeRelative(BufferIndex bufferIndex, const Matrix3& delta)
2255 Matrix3::Multiply(temp, mValue[bufferIndex], delta);
2256 mValue[bufferIndex] = temp;
2265 AnimatableProperty(const AnimatableProperty& property);
2268 AnimatableProperty& operator=(const AnimatableProperty& rhs);
2272 DoubleBuffered<Matrix3> mValue; ///< The double-buffered property value
2273 Matrix3 mBaseValue; ///< Reset to this base value at the beginning of each frame
2277 } // namespace SceneGraph
2279 // Messages for AnimatableProperty<T>
2282 void BakeMessage( EventThreadServices& eventThreadServices,
2283 const SceneGraph::AnimatableProperty<T>& property,
2284 typename ParameterType< T >::PassingType newValue )
2286 typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty<T>, T > LocalType;
2288 // Reserve some memory inside the message queue
2289 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
2291 // Construct message in the message queue memory; note that delete should not be called on the return value
2292 new (slot) LocalType( &property,
2293 &SceneGraph::AnimatableProperty<T>::Bake,
2298 void BakeRelativeMessage( EventThreadServices& eventThreadServices,
2299 const SceneGraph::AnimatableProperty<T>& property,
2302 typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty<T>, const T& > LocalType;
2304 // Reserve some memory inside the message queue
2305 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
2307 // Construct message in the message queue memory; note that delete should not be called on the return value
2308 new (slot) LocalType( &property,
2309 &SceneGraph::AnimatableProperty<T>::BakeRelative,
2314 void SetXComponentMessage( EventThreadServices& eventThreadServices,
2315 const SceneGraph::AnimatableProperty<T>& property,
2316 typename ParameterType< float >::PassingType newValue )
2318 typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty<T>, float > LocalType;
2320 // Reserve some memory inside the message queue
2321 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
2323 // Construct message in the message queue memory; note that delete should not be called on the return value
2324 new (slot) LocalType( &property,
2325 &SceneGraph::AnimatableProperty<T>::BakeX,
2330 void SetYComponentMessage( EventThreadServices& eventThreadServices,
2331 const SceneGraph::AnimatableProperty<T>& property,
2332 typename ParameterType< float >::PassingType newValue )
2334 typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty<T>, float > LocalType;
2336 // Reserve some memory inside the message queue
2337 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
2339 // Construct message in the message queue memory; note that delete should not be called on the return value
2340 new (slot) LocalType( &property,
2341 &SceneGraph::AnimatableProperty<T>::BakeY,
2346 void SetZComponentMessage( EventThreadServices& eventThreadServices,
2347 const SceneGraph::AnimatableProperty<T>& property,
2348 typename ParameterType< float >::PassingType newValue )
2350 typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty<T>, float > LocalType;
2352 // Reserve some memory inside the message queue
2353 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
2355 // Construct message in the message queue memory; note that delete should not be called on the return value
2356 new (slot) LocalType( &property,
2357 &SceneGraph::AnimatableProperty<T>::BakeZ,
2362 void SetWComponentMessage( EventThreadServices& eventThreadServices,
2363 const SceneGraph::AnimatableProperty<T>& property,
2364 typename ParameterType< float >::PassingType newValue )
2366 typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty<T>, float > LocalType;
2368 // Reserve some memory inside the message queue
2369 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
2371 // Construct message in the message queue memory; note that delete should not be called on the return value
2372 new (slot) LocalType( &property,
2373 &SceneGraph::AnimatableProperty<T>::BakeW,
2377 } // namespace Internal
2381 #endif // __DALI_INTERNAL_SCENE_GRAPH_ANIMATABLE_PROPERTY_H__