1 #ifndef DALI_INTERNAL_SCENE_GRAPH_ANIMATABLE_PROPERTY_H
2 #define DALI_INTERNAL_SCENE_GRAPH_ANIMATABLE_PROPERTY_H
5 * Copyright (c) 2023 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/internal/common/matrix-utils.h>
27 #include <dali/internal/update/common/double-buffered.h>
28 #include <dali/internal/update/common/property-base.h>
29 #include <dali/public-api/common/dali-common.h>
30 #include <dali/public-api/object/property-input.h>
31 #include <dali/public-api/object/property-types.h>
32 #include <dali/public-api/object/property.h>
41 * Dirty flags record whether an animatable property has changed.
42 * In the frame following a change, the property is reset to a base value.
44 * If the property was "Baked", then the base value matches the (double-buffered) value from the previous frame.
45 * Therefore when reset, the property is flagged as "clean".
47 * However if the property was only "Set" (and not "Baked"), then typically the base value and previous value will not match.
48 * In this case the reset operation is equivalent to a "Bake", and the value is considered "dirty" for an additional frame.
50 static const uint32_t CLEAN_FLAG = 0x00; ///< Indicates that the value did not change in this, or the previous frame
51 static const uint32_t BAKED_FLAG = 0x01; ///< Indicates that the value was Baked during the previous frame
52 static const uint32_t SET_FLAG = 0x02; ///< Indicates that the value was Set during the previous frame
53 static const uint32_t RESET_FLAG = 0x02; ///< Indicates that the value should be reset to the base value in the next two frames
56 class AnimatableProperty;
59 * Base class to reduce code size from the templates.
61 class AnimatablePropertyBase : public PropertyBase
65 * Constructor, initialize the dirty flag
67 AnimatablePropertyBase()
69 mDirtyFlags(BAKED_FLAG)
76 ~AnimatablePropertyBase() override = default;
78 protected: // for derived classes
80 * Flag that the property has been Set during the current frame.
84 mDirtyFlags = SET_FLAG;
88 * Flag that the property has been Baked during the current frame.
92 mDirtyFlags = BAKED_FLAG;
97 * Mark the property as dirty so that it will be reset to the base value in the next two frames.
101 mDirtyFlags = RESET_FLAG;
104 public: // From PropertyBase
106 * @copydoc Dali::Internal::SceneGraph::PropertyBase::IsClean()
108 bool IsClean() const override
110 return (CLEAN_FLAG == mDirtyFlags);
114 * @copydoc Dali::Internal::PropertyInputImpl::InputInitialized()
116 bool InputInitialized() const override
118 return true; // Animatable properties are always valid
121 protected: // so that ResetToBaseValue can set it directly
122 uint32_t mDirtyFlags; ///< Flag whether value changed during previous 2 frames
126 * An boolean animatable property of a scene-graph object.
129 class AnimatableProperty<bool> : public AnimatablePropertyBase
133 * Create an animatable property.
134 * @param [in] initialValue The initial value of the property.
136 AnimatableProperty(bool initialValue)
137 : mValue(initialValue),
138 mBaseValue(initialValue)
143 * Virtual destructor.
145 ~AnimatableProperty() override = default;
148 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
150 Dali::Property::Type GetType() const override
152 return Dali::PropertyTypes::Get<bool>();
156 * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
158 void ResetToBaseValue(BufferIndex updateBufferIndex) override
160 if(CLEAN_FLAG != mDirtyFlags)
162 mValue[updateBufferIndex] = mBaseValue;
164 mDirtyFlags = (mDirtyFlags >> 1);
169 * @copydoc Dali::Internal::PropertyInputImpl::GetBoolean()
171 const bool& GetBoolean(BufferIndex bufferIndex) const override
173 return mValue[bufferIndex];
177 * @copydoc Dali::Internal::PropertyInputImpl::GetValueAddress()
179 const void* GetValueAddress(BufferIndex bufferIndex) const override
181 return &mValue[bufferIndex];
185 * @copydoc Dali::Internal::PropertyInputImpl::GetValueSize()
187 size_t GetValueSize() const override
193 * Set the property value. This will only persist for the current frame; the property
194 * will be reset with the base value, at the beginning of the next frame.
195 * @param[in] bufferIndex The buffer to write.
196 * @param[in] value The new property value.
198 void Set(BufferIndex bufferIndex, bool value)
200 // check if the value actually changed to avoid dirtying nodes unnecessarily
201 if(mValue[bufferIndex] != value)
203 mValue[bufferIndex] = value;
210 * Change the property value by a relative amount.
211 * @param[in] bufferIndex The buffer to write.
212 * @param[in] delta The property will change by this amount.
214 void SetRelative(BufferIndex bufferIndex, bool delta)
216 // check if the value actually changed to avoid dirtying nodes unnecessarily
217 // false + false does not change value, true + false does not either
218 if(delta && !mValue[bufferIndex])
220 mValue[bufferIndex] = delta;
227 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
229 bool& Get(BufferIndex bufferIndex)
231 return mValue[bufferIndex];
235 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
237 const bool& Get(BufferIndex bufferIndex) const
239 return mValue[bufferIndex];
243 * Retrieve the property value.
244 * @param[in] bufferIndex The buffer to read.
245 * @return The property value.
247 bool& operator[](BufferIndex bufferIndex)
249 return mValue[bufferIndex];
253 * Retrieve the property value.
254 * @param[in] bufferIndex The buffer to read.
255 * @return The property value.
257 const bool& operator[](BufferIndex bufferIndex) const
259 return mValue[bufferIndex];
263 * Set both the property value & base value.
264 * @param[in] bufferIndex The buffer to write for the property value.
265 * @param[in] value The new property value.
267 void Bake(BufferIndex bufferIndex, bool value)
269 // bake has to check the base value as current buffer value can be correct by constraint or something else
270 if(mBaseValue != value)
273 // It's ok to bake both buffers as render is performed in same thread as update. Reading from event side
274 // has never been atomically safe.
275 mValue[bufferIndex] = value;
276 mValue[1 - bufferIndex] = value;
283 * Change the property value & base value by a relative amount.
284 * @param[in] bufferIndex The buffer to write for the local property value.
285 * @param[in] delta The property will change by this amount.
287 void BakeRelative(BufferIndex bufferIndex, bool delta)
289 mValue[bufferIndex] = mValue[bufferIndex] || delta;
290 mBaseValue = mValue[bufferIndex];
297 AnimatableProperty(const AnimatableProperty& property);
300 AnimatableProperty& operator=(const AnimatableProperty& rhs);
303 DoubleBuffered<bool> mValue; ///< The double-buffered property value
304 bool mBaseValue; ///< Reset to this base value at the beginning of each frame
308 * An integer animatable property of a scene-graph object.
311 class AnimatableProperty<int> : public AnimatablePropertyBase
315 * Create an animatable property.
316 * @param [in] initialValue The initial value of the property.
318 AnimatableProperty(int initialValue)
319 : mValue(initialValue),
320 mBaseValue(initialValue)
325 * Virtual destructor.
327 ~AnimatableProperty() override = default;
330 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
332 Dali::Property::Type GetType() const override
334 return Dali::PropertyTypes::Get<int>();
338 * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
340 void ResetToBaseValue(BufferIndex updateBufferIndex) override
342 if(CLEAN_FLAG != mDirtyFlags)
344 mValue[updateBufferIndex] = mBaseValue;
346 mDirtyFlags = (mDirtyFlags >> 1);
351 * @copydoc Dali::Internal::PropertyInputImpl::GetInteger()
353 const int& GetInteger(BufferIndex bufferIndex) const override
355 return mValue[bufferIndex];
359 * @copydoc Dali::Internal::PropertyInputImpl::GetValueAddress()
361 const void* GetValueAddress(BufferIndex bufferIndex) const override
363 return &mValue[bufferIndex];
367 * @copydoc Dali::Internal::PropertyInputImpl::GetValueSize()
369 size_t GetValueSize() const override
375 * Set the property value. This will only persist for the current frame; the property
376 * will be reset with the base value, at the beginning of the next frame.
377 * @param[in] bufferIndex The buffer to write.
378 * @param[in] value The new property value.
380 void Set(BufferIndex bufferIndex, int value)
382 mValue[bufferIndex] = value;
388 * Change the property value by a relative amount.
389 * @param[in] bufferIndex The buffer to write.
390 * @param[in] delta The property will change by this amount.
392 void SetRelative(BufferIndex bufferIndex, int delta)
394 mValue[bufferIndex] = mValue[bufferIndex] + delta;
400 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
402 int& Get(BufferIndex bufferIndex)
404 return mValue[bufferIndex];
408 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
410 const int& Get(BufferIndex bufferIndex) const
412 return mValue[bufferIndex];
416 * Retrieve the property value.
417 * @param[in] bufferIndex The buffer to read.
418 * @return The property value.
420 int& operator[](BufferIndex bufferIndex)
422 return mValue[bufferIndex];
426 * Retrieve the property value.
427 * @param[in] bufferIndex The buffer to read.
428 * @return The property value.
430 const int& operator[](BufferIndex bufferIndex) const
432 return mValue[bufferIndex];
436 * Set both the property value & base value.
437 * @param[in] bufferIndex The buffer to write for the property value.
438 * @param[in] value The new property value.
440 void Bake(BufferIndex bufferIndex, int value)
442 mValue[bufferIndex] = value;
443 mValue[1 - bufferIndex] = value;
444 mBaseValue = mValue[bufferIndex];
450 * Change the property value & base value by a relative amount.
451 * @param[in] bufferIndex The buffer to write for the local property value.
452 * @param[in] delta The property will change by this amount.
454 void BakeRelative(BufferIndex bufferIndex, int delta)
456 mValue[bufferIndex] = mValue[bufferIndex] + delta;
457 mBaseValue = mValue[bufferIndex];
463 * Sets both double-buffered values & the base value.
464 * This should only be used when the owning object has not been connected to the scene-graph.
465 * @param[in] value The new property value.
467 void SetInitial(const int& value)
470 mValue[1] = mValue[0];
471 mBaseValue = mValue[0];
475 * Change both double-buffered values & the base value by a relative amount.
476 * This should only be used when the owning object has not been connected to the scene-graph.
477 * @param[in] delta The property will change by this amount.
479 void SetInitialRelative(const int& delta)
481 mValue[0] = mValue[0] + delta;
482 mValue[1] = mValue[0];
483 mBaseValue = mValue[0];
488 AnimatableProperty(const AnimatableProperty& property);
491 AnimatableProperty& operator=(const AnimatableProperty& rhs);
494 DoubleBuffered<int> mValue; ///< The double-buffered property value
495 int mBaseValue; ///< Reset to this base value at the beginning of each frame
499 * An float animatable property of a scene-graph object.
502 class AnimatableProperty<float> : public AnimatablePropertyBase
506 * Create an animatable property.
507 * @param [in] initialValue The initial value of the property.
509 AnimatableProperty(float initialValue)
510 : mValue(initialValue),
511 mBaseValue(initialValue)
516 * Virtual destructor.
518 ~AnimatableProperty() override = default;
521 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
523 Dali::Property::Type GetType() const override
525 return Dali::PropertyTypes::Get<float>();
529 * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
531 void ResetToBaseValue(BufferIndex updateBufferIndex) override
533 if(CLEAN_FLAG != mDirtyFlags)
535 mValue[updateBufferIndex] = mBaseValue;
537 mDirtyFlags = (mDirtyFlags >> 1);
542 * @copydoc Dali::Internal::PropertyInputImpl::GetFloat()
544 const float& GetFloat(BufferIndex bufferIndex) const override
546 return mValue[bufferIndex];
550 * @copydoc Dali::Internal::PropertyInputImpl::GetValueAddress()
552 const void* GetValueAddress(BufferIndex bufferIndex) const override
554 return &mValue[bufferIndex];
558 * @copydoc Dali::Internal::PropertyInputImpl::GetValueSize()
560 size_t GetValueSize() const override
562 return sizeof(float);
566 * Set the property value. This will only persist for the current frame; the property
567 * will be reset with the base value, at the beginning of the next frame.
568 * @param[in] bufferIndex The buffer to write.
569 * @param[in] value The new property value.
571 void Set(BufferIndex bufferIndex, float value)
573 mValue[bufferIndex] = value;
579 * Change the property value by a relative amount.
580 * @param[in] bufferIndex The buffer to write.
581 * @param[in] delta The property will change by this amount.
583 void SetRelative(BufferIndex bufferIndex, float delta)
585 mValue[bufferIndex] = mValue[bufferIndex] + delta;
591 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
593 float& Get(BufferIndex bufferIndex)
595 return mValue[bufferIndex];
599 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
601 const float& Get(BufferIndex bufferIndex) const
603 return mValue[bufferIndex];
607 * Retrieve the property value.
608 * @param[in] bufferIndex The buffer to read.
609 * @return The property value.
611 float& operator[](BufferIndex bufferIndex)
613 return mValue[bufferIndex];
617 * Retrieve the property value.
618 * @param[in] bufferIndex The buffer to read.
619 * @return The property value.
621 const float& operator[](BufferIndex bufferIndex) const
623 return mValue[bufferIndex];
627 * Set both the property value & base value.
628 * @param[in] bufferIndex The buffer to write for the property value.
629 * @param[in] value The new property value.
631 void Bake(BufferIndex bufferIndex, float value)
633 // It's ok to bake both buffers as render is performed in same thread as update. Reading from event side
634 // has never been atomically safe.
635 mValue[bufferIndex] = value;
636 mValue[1 - bufferIndex] = value;
637 mBaseValue = mValue[bufferIndex];
643 * Change the property value & base value by a relative amount.
644 * @param[in] bufferIndex The buffer to write for the local property value.
645 * @param[in] delta The property will change by this amount.
647 void BakeRelative(BufferIndex bufferIndex, float delta)
649 mValue[bufferIndex] = mValue[bufferIndex] + delta;
650 mBaseValue = mValue[bufferIndex];
656 * Sets both double-buffered values & the base value.
657 * This should only be used when the owning object has not been connected to the scene-graph.
658 * @param[in] value The new property value.
660 void SetInitial(const float& value)
663 mValue[1] = mValue[0];
664 mBaseValue = mValue[0];
668 * Change both double-buffered values & the base value by a relative amount.
669 * This should only be used when the owning object has not been connected to the scene-graph.
670 * @param[in] delta The property will change by this amount.
672 void SetInitialRelative(const float& delta)
674 mValue[0] = mValue[0] + delta;
675 mValue[1] = mValue[0];
676 mBaseValue = mValue[0];
681 AnimatableProperty(const AnimatableProperty& property);
684 AnimatableProperty& operator=(const AnimatableProperty& rhs);
687 DoubleBuffered<float> mValue; ///< The double-buffered property value
688 float mBaseValue; ///< Reset to this base value at the beginning of each frame
692 * An Vector2 animatable property of a scene-graph object.
695 class AnimatableProperty<Vector2> : public AnimatablePropertyBase
699 * Create an animatable property.
700 * @param [in] initialValue The initial value of the property.
702 AnimatableProperty(const Vector2& initialValue)
703 : mValue(initialValue),
704 mBaseValue(initialValue)
709 * Virtual destructor.
711 ~AnimatableProperty() override = default;
714 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
716 Dali::Property::Type GetType() const override
718 return Dali::PropertyTypes::Get<Vector2>();
722 * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
724 void ResetToBaseValue(BufferIndex updateBufferIndex) override
726 if(CLEAN_FLAG != mDirtyFlags)
728 mValue[updateBufferIndex] = mBaseValue;
730 mDirtyFlags = (mDirtyFlags >> 1);
735 * @copydoc Dali::PropertyInput::GetVector2()
737 const Vector2& GetVector2(BufferIndex bufferIndex) const override
739 return mValue[bufferIndex];
743 * @copydoc Dali::Internal::PropertyInputImpl::GetValueAddress()
745 const void* GetValueAddress(BufferIndex bufferIndex) const override
747 return &mValue[bufferIndex];
751 * @copydoc Dali::Internal::PropertyInputImpl::GetValueSize()
753 size_t GetValueSize() const override
755 return sizeof(Vector2);
759 * Set the property value. This will only persist for the current frame; the property
760 * will be reset with the base value, at the beginning of the next frame.
761 * @param[in] bufferIndex The buffer to write.
762 * @param[in] value The new property value.
764 void Set(BufferIndex bufferIndex, const Vector2& value)
766 mValue[bufferIndex] = value;
772 * Set the property value. This will only persist for the current frame; the property
773 * will be reset with the base value, at the beginning of the next frame.
774 * @param[in] bufferIndex The buffer to write.
775 * @param[in] value The new X value.
777 void SetX(BufferIndex bufferIndex, float value)
779 mValue[bufferIndex].x = value;
785 * Set the property value. This will only persist for the current frame; the property
786 * will be reset with the base value, at the beginning of the next frame.
787 * @param[in] bufferIndex The buffer to write.
788 * @param[in] value The new Y value.
790 void SetY(BufferIndex bufferIndex, float value)
792 mValue[bufferIndex].y = value;
798 * Change the property value by a relative amount.
799 * @param[in] bufferIndex The buffer to write.
800 * @param[in] delta The property will change by this amount.
802 void SetRelative(BufferIndex bufferIndex, const Vector2& delta)
804 mValue[bufferIndex] += delta;
810 * Change the X value by a relative amount.
811 * @param[in] bufferIndex The buffer to write.
812 * @param[in] delta The X value will change by this amount.
814 void SetXRelative(BufferIndex bufferIndex, float delta)
816 mValue[bufferIndex].x += delta;
822 * Change the Y value by a relative amount.
823 * @param[in] bufferIndex The buffer to write.
824 * @param[in] delta The Y value will change by this amount.
826 void SetYRelative(BufferIndex bufferIndex, float delta)
828 mValue[bufferIndex].y += delta;
834 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
836 Vector2& Get(BufferIndex bufferIndex)
838 return mValue[bufferIndex];
842 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
844 const Vector2& Get(BufferIndex bufferIndex) const
846 return mValue[bufferIndex];
850 * Retrieve the property value.
851 * @param[in] bufferIndex The buffer to read.
852 * @return The property value.
854 Vector2& operator[](BufferIndex bufferIndex)
856 return mValue[bufferIndex];
860 * Retrieve the property value.
861 * @param[in] bufferIndex The buffer to read.
862 * @return The property value.
864 const Vector2& operator[](BufferIndex bufferIndex) const
866 return mValue[bufferIndex];
870 * Set both the property value & base value.
871 * @param[in] bufferIndex The buffer to write for the property value.
872 * @param[in] value The new property value.
874 void Bake(BufferIndex bufferIndex, const Vector2& value)
876 // It's ok to bake both buffers as render is performed in same thread as update. Reading from event side
877 // has never been atomically safe.
878 mValue[bufferIndex] = value;
879 mValue[1 - bufferIndex] = value;
886 * Set both the X value & base X value.
887 * @param[in] bufferIndex The buffer to write for the property value.
888 * @param[in] value The new property value.
890 void BakeX(BufferIndex bufferIndex, float value)
892 mValue[bufferIndex].x = value;
893 mValue[1 - bufferIndex].x = value;
894 mBaseValue.x = value;
900 * Set both the Y value & base Y value.
901 * @param[in] bufferIndex The buffer to write for the property value.
902 * @param[in] value The new property value.
904 void BakeY(BufferIndex bufferIndex, float value)
906 mValue[bufferIndex].y = value;
907 mValue[1 - bufferIndex].y = value;
908 mBaseValue.y = value;
914 * Change the property value & base value by a relative amount.
915 * @param[in] bufferIndex The buffer to write for the local property value.
916 * @param[in] delta The property will change by this amount.
918 void BakeRelative(BufferIndex bufferIndex, const Vector2& delta)
920 mValue[bufferIndex] += delta;
921 mBaseValue = mValue[bufferIndex];
927 * Change the X value & base X value by a relative amount.
928 * @param[in] bufferIndex The buffer to write for the local property value.
929 * @param[in] delta The X value will change by this amount.
931 void BakeXRelative(BufferIndex bufferIndex, float delta)
933 mValue[bufferIndex].x += delta;
934 mBaseValue.x = mValue[bufferIndex].x;
940 * Change the Y value & base Y value by a relative amount.
941 * @param[in] bufferIndex The buffer to write for the local property value.
942 * @param[in] delta The Y value will change by this amount.
944 void BakeYRelative(BufferIndex bufferIndex, float delta)
946 mValue[bufferIndex].y += delta;
947 mBaseValue.y = mValue[bufferIndex].y;
954 AnimatableProperty(const AnimatableProperty& property);
957 AnimatableProperty& operator=(const AnimatableProperty& rhs);
960 DoubleBuffered<Vector2> mValue; ///< The double-buffered property value
961 Vector2 mBaseValue; ///< Reset to this base value at the beginning of each frame
965 * A Vector3 animatable property of a scene-graph object.
968 class AnimatableProperty<Vector3> : public AnimatablePropertyBase
972 * Create an animatable property.
981 * Create an animatable property.
982 * @param [in] initialValue The initial value of the property.
984 AnimatableProperty(const Vector3& initialValue)
985 : mValue(initialValue),
986 mBaseValue(initialValue)
991 * Virtual destructor.
993 ~AnimatableProperty() override = default;
996 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
998 Dali::Property::Type GetType() const override
1000 return Dali::PropertyTypes::Get<Vector3>();
1004 * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
1006 void ResetToBaseValue(BufferIndex updateBufferIndex) override
1008 if(CLEAN_FLAG != mDirtyFlags)
1010 mValue[updateBufferIndex] = mBaseValue;
1012 mDirtyFlags = (mDirtyFlags >> 1);
1017 * @copydoc Dali::PropertyInput::GetVector3()
1019 const Vector3& GetVector3(BufferIndex bufferIndex) const override
1021 return mValue[bufferIndex];
1025 * @copydoc Dali::Internal::PropertyInputImpl::GetValueAddress()
1027 const void* GetValueAddress(BufferIndex bufferIndex) const override
1029 return &mValue[bufferIndex];
1033 * @copydoc Dali::Internal::PropertyInputImpl::GetValueSize()
1035 size_t GetValueSize() const override
1037 return sizeof(Vector3);
1041 * Set the property value. This will only persist for the current frame; the property
1042 * will be reset with the base value, at the beginning of the next frame.
1043 * @param[in] bufferIndex The buffer to write.
1044 * @param[in] value The new property value.
1046 void Set(BufferIndex bufferIndex, const Vector3& value)
1048 mValue[bufferIndex] = value;
1054 * Set the property value. This will only persist for the current frame; the property
1055 * will be reset with the base value, at the beginning of the next frame.
1056 * @param[in] bufferIndex The buffer to write.
1057 * @param[in] value The new X value.
1059 void SetX(BufferIndex bufferIndex, float value)
1061 mValue[bufferIndex].x = value;
1067 * Set the property value. This will only persist for the current frame; the property
1068 * will be reset with the base value, at the beginning of the next frame.
1069 * @param[in] bufferIndex The buffer to write.
1070 * @param[in] value The new Y value.
1072 void SetY(BufferIndex bufferIndex, float value)
1074 mValue[bufferIndex].y = value;
1080 * Set the property value. This will only persist for the current frame; the property
1081 * will be reset with the base value, at the beginning of the next frame.
1082 * @param[in] bufferIndex The buffer to write.
1083 * @param[in] value The new Z value.
1085 void SetZ(BufferIndex bufferIndex, float value)
1087 mValue[bufferIndex].z = value;
1093 * Change the property value by a relative amount.
1094 * @param[in] bufferIndex The buffer to write.
1095 * @param[in] delta The property will change by this amount.
1097 void SetRelative(BufferIndex bufferIndex, const Vector3& delta)
1099 mValue[bufferIndex] += delta;
1105 * Change the X value by a relative amount.
1106 * @param[in] bufferIndex The buffer to write.
1107 * @param[in] delta The X value will change by this amount.
1109 void SetXRelative(BufferIndex bufferIndex, float delta)
1111 mValue[bufferIndex].x += delta;
1117 * Change the Y value by a relative amount.
1118 * @param[in] bufferIndex The buffer to write.
1119 * @param[in] delta The Y value will change by this amount.
1121 void SetYRelative(BufferIndex bufferIndex, float delta)
1123 mValue[bufferIndex].y += delta;
1129 * Change the Z value by a relative amount.
1130 * @param[in] bufferIndex The buffer to write.
1131 * @param[in] delta The Z value will change by this amount.
1133 void SetZRelative(BufferIndex bufferIndex, float delta)
1135 mValue[bufferIndex].z += delta;
1141 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
1143 Vector3& Get(BufferIndex bufferIndex)
1145 return mValue[bufferIndex];
1149 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
1151 const Vector3& Get(BufferIndex bufferIndex) const
1153 return mValue[bufferIndex];
1157 * Retrieve the property value.
1158 * @param[in] bufferIndex The buffer to read.
1159 * @return The property value.
1161 Vector3& operator[](BufferIndex bufferIndex)
1163 return mValue[bufferIndex];
1167 * Retrieve the property value.
1168 * @param[in] bufferIndex The buffer to read.
1169 * @return The property value.
1171 const Vector3& operator[](BufferIndex bufferIndex) const
1173 return mValue[bufferIndex];
1177 * Set both the property value & base value.
1178 * @param[in] bufferIndex The buffer to write for the property value.
1179 * @param[in] value The new property value.
1181 void Bake(BufferIndex bufferIndex, const Vector3& value)
1183 mValue[bufferIndex] = value;
1184 mValue[1 - bufferIndex] = value;
1191 * Set both the X value & base X value.
1192 * @param[in] bufferIndex The buffer to write for the property value.
1193 * @param[in] value The new property value.
1195 void BakeX(BufferIndex bufferIndex, float value)
1197 mValue[bufferIndex].x = value;
1198 mValue[1 - bufferIndex].x = value;
1199 mBaseValue.x = value;
1205 * Set both the Y value & base Y value.
1206 * @param[in] bufferIndex The buffer to write for the property value.
1207 * @param[in] value The new property value.
1209 void BakeY(BufferIndex bufferIndex, float value)
1211 mValue[bufferIndex].y = value;
1212 mValue[1 - bufferIndex].y = value;
1213 mBaseValue.y = value;
1219 * Set both the Z value & base Z value.
1220 * @param[in] bufferIndex The buffer to write for the property value.
1221 * @param[in] value The new property value.
1223 void BakeZ(BufferIndex bufferIndex, float value)
1225 mValue[bufferIndex].z = value;
1226 mValue[1 - bufferIndex].z = value;
1227 mBaseValue.z = value;
1233 * Change the property value & base value by a relative amount.
1234 * @param[in] bufferIndex The buffer to write for the local property value.
1235 * @param[in] delta The property will change by this amount.
1237 void BakeRelative(BufferIndex bufferIndex, const Vector3& delta)
1239 mValue[bufferIndex] += delta;
1240 mBaseValue = mValue[bufferIndex];
1246 * Change the property value & base value by a relative amount.
1247 * @param[in] bufferIndex The buffer to write for the local property value.
1248 * @param[in] delta The property will change by this amount.
1250 void BakeRelativeMultiply(BufferIndex bufferIndex, const Vector3& delta)
1252 mValue[bufferIndex] *= delta;
1253 mBaseValue = mValue[bufferIndex];
1259 * Change the X value & base X value by a relative amount.
1260 * @param[in] bufferIndex The buffer to write for the local property value.
1261 * @param[in] delta The X value will change by this amount.
1263 void BakeXRelative(BufferIndex bufferIndex, float delta)
1265 mValue[bufferIndex].x += delta;
1266 mBaseValue.x = mValue[bufferIndex].x;
1272 * Change the Y value & base Y value by a relative amount.
1273 * @param[in] bufferIndex The buffer to write for the local property value.
1274 * @param[in] delta The Y value will change by this amount.
1276 void BakeYRelative(BufferIndex bufferIndex, float delta)
1278 mValue[bufferIndex].y += delta;
1279 mBaseValue.y = mValue[bufferIndex].y;
1285 * Change the Z value & base Z value by a relative amount.
1286 * @param[in] bufferIndex The buffer to write for the local property value.
1287 * @param[in] delta The Z value will change by this amount.
1289 void BakeZRelative(BufferIndex bufferIndex, float delta)
1291 mValue[bufferIndex].z += delta;
1292 mBaseValue.z = mValue[bufferIndex].z;
1299 AnimatableProperty(const AnimatableProperty& property);
1302 AnimatableProperty& operator=(const AnimatableProperty& rhs);
1305 DoubleBuffered<Vector3> mValue; ///< The double-buffered property value
1306 Vector3 mBaseValue; ///< Reset to this base value at the beginning of each frame
1310 * A Vector4 animatable property of a scene-graph object.
1313 class AnimatableProperty<Vector4> : public AnimatablePropertyBase
1317 * Create an animatable property.
1318 * @param [in] initialValue The initial value of the property.
1320 AnimatableProperty(const Vector4& initialValue)
1321 : mValue(initialValue),
1322 mBaseValue(initialValue)
1327 * Virtual destructor.
1329 ~AnimatableProperty() override = default;
1332 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
1334 Dali::Property::Type GetType() const override
1336 return Dali::PropertyTypes::Get<Vector4>();
1340 * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
1342 void ResetToBaseValue(BufferIndex updateBufferIndex) override
1344 if(CLEAN_FLAG != mDirtyFlags)
1346 mValue[updateBufferIndex] = mBaseValue;
1348 mDirtyFlags = (mDirtyFlags >> 1);
1353 * @copydoc Dali::PropertyInput::GetVector4()
1355 const Vector4& GetVector4(BufferIndex bufferIndex) const override
1357 return mValue[bufferIndex];
1361 * @copydoc Dali::Internal::PropertyInputImpl::GetValueAddress()
1363 const void* GetValueAddress(BufferIndex bufferIndex) const override
1365 return &mValue[bufferIndex];
1369 * @copydoc Dali::Internal::PropertyInputImpl::GetValueSize()
1371 size_t GetValueSize() const override
1373 return sizeof(Vector4);
1377 * Set the property value. This will only persist for the current frame; the property
1378 * will be reset with the base value, at the beginning of the next frame.
1379 * @param[in] bufferIndex The buffer to write.
1380 * @param[in] value The new property value.
1382 void Set(BufferIndex bufferIndex, const Vector4& value)
1384 mValue[bufferIndex] = value;
1390 * Set the X value. This will only persist for the current frame; the property
1391 * will be reset with the base value, at the beginning of the next frame.
1392 * @param[in] bufferIndex The buffer to write.
1393 * @param[in] value The new X value.
1395 void SetX(BufferIndex bufferIndex, float value)
1397 mValue[bufferIndex].x = value;
1403 * Set the Y value. This will only persist for the current frame; the property
1404 * will be reset with the base value, at the beginning of the next frame.
1405 * @param[in] bufferIndex The buffer to write.
1406 * @param[in] value The new Y value.
1408 void SetY(BufferIndex bufferIndex, float value)
1410 mValue[bufferIndex].y = value;
1416 * Set the Z value. This will only persist for the current frame; the property
1417 * will be reset with the base value, at the beginning of the next frame.
1418 * @param[in] bufferIndex The buffer to write.
1419 * @param[in] value The new Z value.
1421 void SetZ(BufferIndex bufferIndex, float value)
1423 mValue[bufferIndex].z = value;
1429 * Set the W value. This will only persist for the current frame; the property
1430 * will be reset with the base value, at the beginning of the next frame.
1431 * @param[in] bufferIndex The buffer to write.
1432 * @param[in] value The new W value.
1434 void SetW(BufferIndex bufferIndex, float value)
1436 mValue[bufferIndex].w = value;
1442 * Change the property value by a relative amount.
1443 * @param[in] bufferIndex The buffer to write.
1444 * @param[in] delta The property will change by this amount.
1446 void SetRelative(BufferIndex bufferIndex, const Vector4& delta)
1448 mValue[bufferIndex] = mValue[bufferIndex] + delta;
1454 * Change the X value by a relative amount.
1455 * @param[in] bufferIndex The buffer to write.
1456 * @param[in] delta The X value will change by this amount.
1458 void SetXRelative(BufferIndex bufferIndex, float delta)
1460 mValue[bufferIndex].x = mValue[bufferIndex].x + delta;
1466 * Change the Y value by a relative amount.
1467 * @param[in] bufferIndex The buffer to write.
1468 * @param[in] delta The Y value will change by this amount.
1470 void SetYRelative(BufferIndex bufferIndex, float delta)
1472 mValue[bufferIndex].y = mValue[bufferIndex].y + delta;
1478 * Change the Z value by a relative amount.
1479 * @param[in] bufferIndex The buffer to write.
1480 * @param[in] delta The Z value will change by this amount.
1482 void SetZRelative(BufferIndex bufferIndex, float delta)
1484 mValue[bufferIndex].z = mValue[bufferIndex].z + delta;
1490 * Change the W value by a relative amount.
1491 * @param[in] bufferIndex The buffer to write.
1492 * @param[in] delta The W value will change by this amount.
1494 void SetWRelative(BufferIndex bufferIndex, float delta)
1496 mValue[bufferIndex].w = mValue[bufferIndex].w + delta;
1502 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
1504 Vector4& Get(BufferIndex bufferIndex)
1506 return mValue[bufferIndex];
1510 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
1512 const Vector4& Get(BufferIndex bufferIndex) const
1514 return mValue[bufferIndex];
1518 * Retrieve the property value.
1519 * @param[in] bufferIndex The buffer to read.
1520 * @return The property value.
1522 Vector4& operator[](BufferIndex bufferIndex)
1524 return mValue[bufferIndex];
1528 * Retrieve the property value.
1529 * @param[in] bufferIndex The buffer to read.
1530 * @return The property value.
1532 const Vector4& operator[](BufferIndex bufferIndex) const
1534 return mValue[bufferIndex];
1538 * Set both the property value & base value.
1539 * @param[in] bufferIndex The buffer to write for the property value.
1540 * @param[in] value The new property value.
1542 void Bake(BufferIndex bufferIndex, const Vector4& value)
1544 mValue[bufferIndex] = value;
1545 mValue[1 - bufferIndex] = value;
1546 mBaseValue = mValue[bufferIndex];
1552 * Set both the X value & base X value.
1553 * @param[in] bufferIndex The buffer to write for the property value.
1554 * @param[in] value The new property value.
1556 void BakeX(BufferIndex bufferIndex, float value)
1558 mValue[bufferIndex].x = value;
1559 mValue[1 - bufferIndex].x = value;
1560 mBaseValue.x = mValue[bufferIndex].x;
1566 * Set both the Y value & base Y value.
1567 * @param[in] bufferIndex The buffer to write for the property value.
1568 * @param[in] value The new property value.
1570 void BakeY(BufferIndex bufferIndex, float value)
1572 mValue[bufferIndex].y = value;
1573 mValue[1 - bufferIndex].y = value;
1574 mBaseValue.y = mValue[bufferIndex].y;
1580 * Set both the Z value & base Z value.
1581 * @param[in] bufferIndex The buffer to write for the property value.
1582 * @param[in] value The new property value.
1584 void BakeZ(BufferIndex bufferIndex, float value)
1586 mValue[bufferIndex].z = value;
1587 mValue[1 - bufferIndex].z = value;
1588 mBaseValue.z = mValue[bufferIndex].z;
1594 * Set both the W value & base W value.
1595 * @param[in] bufferIndex The buffer to write for the property value.
1596 * @param[in] value The new property value.
1598 void BakeW(BufferIndex bufferIndex, float value)
1600 mValue[bufferIndex].w = value;
1601 mValue[1 - bufferIndex].w = value;
1602 mBaseValue.w = mValue[bufferIndex].w;
1608 * Change the property value & base value by a relative amount.
1609 * @param[in] bufferIndex The buffer to write for the local property value.
1610 * @param[in] delta The property will change by this amount.
1612 void BakeRelative(BufferIndex bufferIndex, const Vector4& delta)
1614 mValue[bufferIndex] = mValue[bufferIndex] + delta;
1615 mBaseValue = mValue[bufferIndex];
1621 * Change the X value & base X value by a relative amount.
1622 * @param[in] bufferIndex The buffer to write for the local property value.
1623 * @param[in] delta The X value will change by this amount.
1625 void BakeXRelative(BufferIndex bufferIndex, float delta)
1627 mValue[bufferIndex].x = mValue[bufferIndex].x + delta;
1628 mBaseValue.x = mValue[bufferIndex].x;
1634 * Change the Y value & base Y value by a relative amount.
1635 * @param[in] bufferIndex The buffer to write for the local property value.
1636 * @param[in] delta The Y value will change by this amount.
1638 void BakeYRelative(BufferIndex bufferIndex, float delta)
1640 mValue[bufferIndex].y = mValue[bufferIndex].y + delta;
1641 mBaseValue.y = mValue[bufferIndex].y;
1647 * Change the Z value & base Z value by a relative amount.
1648 * @param[in] bufferIndex The buffer to write for the local property value.
1649 * @param[in] delta The Z value will change by this amount.
1651 void BakeZRelative(BufferIndex bufferIndex, float delta)
1653 mValue[bufferIndex].z = mValue[bufferIndex].z + delta;
1654 mBaseValue.z = mValue[bufferIndex].z;
1660 * Change the W value & base W value by a relative amount.
1661 * @param[in] bufferIndex The buffer to write for the local property value.
1662 * @param[in] delta The W value will change by this amount.
1664 void BakeWRelative(BufferIndex bufferIndex, float delta)
1666 mValue[bufferIndex].w = mValue[bufferIndex].w + delta;
1667 mBaseValue.w = mValue[bufferIndex].w;
1673 * Sets both double-buffered W values & the base W value.
1674 * This should only be used when the owning object has not been connected to the scene-graph.
1675 * @param[in] value The new W value.
1677 void SetWInitial(float value)
1679 mValue[0].w = value;
1680 mValue[1].w = mValue[0].w;
1681 mBaseValue.w = mValue[0].w;
1686 AnimatableProperty(const AnimatableProperty& property);
1689 AnimatableProperty& operator=(const AnimatableProperty& rhs);
1692 DoubleBuffered<Vector4> mValue; ///< The double-buffered property value
1693 Vector4 mBaseValue; ///< Reset to this base value at the beginning of each frame
1696 * An Quaternion animatable property of a scene-graph object.
1699 class AnimatableProperty<Quaternion> : public AnimatablePropertyBase
1703 * Create an animatable property.
1705 AnimatableProperty()
1712 * Create an animatable property.
1713 * @param [in] initialValue The initial value of the property.
1715 AnimatableProperty(const Quaternion& initialValue)
1716 : mValue(initialValue),
1717 mBaseValue(initialValue)
1722 * Virtual destructor.
1724 ~AnimatableProperty() override = default;
1727 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
1729 Dali::Property::Type GetType() const override
1731 return Dali::PropertyTypes::Get<Quaternion>();
1735 * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
1737 void ResetToBaseValue(BufferIndex updateBufferIndex) override
1739 if(CLEAN_FLAG != mDirtyFlags)
1741 mValue[updateBufferIndex] = mBaseValue;
1743 mDirtyFlags = (mDirtyFlags >> 1);
1748 * @copydoc Dali::PropertyInput::GetQuaternion()
1750 const Quaternion& GetQuaternion(BufferIndex bufferIndex) const override
1752 return mValue[bufferIndex];
1756 * Set the property value. This will only persist for the current frame; the property
1757 * will be reset with the base value, at the beginning of the next frame.
1758 * @param[in] bufferIndex The buffer to write.
1759 * @param[in] value The new property value.
1761 void Set(BufferIndex bufferIndex, const Quaternion& value)
1763 mValue[bufferIndex] = value;
1769 * @copydoc Dali::Internal::PropertyInputImpl::GetValueAddress()
1771 const void* GetValueAddress(BufferIndex bufferIndex) const override
1773 return &mValue[bufferIndex];
1777 * @copydoc Dali::Internal::PropertyInputImpl::GetValueSize()
1779 size_t GetValueSize() const override
1781 return sizeof(Vector4);
1785 * Change the property value by a relative amount.
1786 * @param[in] bufferIndex The buffer to write.
1787 * @param[in] delta The property will change by this amount.
1789 void SetRelative(BufferIndex bufferIndex, const Quaternion& delta)
1791 mValue[bufferIndex] *= delta;
1797 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
1799 Quaternion& Get(BufferIndex bufferIndex)
1801 return mValue[bufferIndex];
1805 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
1807 const Quaternion& Get(BufferIndex bufferIndex) const
1809 return mValue[bufferIndex];
1813 * Retrieve the property value.
1814 * @param[in] bufferIndex The buffer to read.
1815 * @return The property value.
1817 Quaternion& operator[](BufferIndex bufferIndex)
1819 return mValue[bufferIndex];
1823 * Retrieve the property value.
1824 * @param[in] bufferIndex The buffer to read.
1825 * @return The property value.
1827 const Quaternion& operator[](BufferIndex bufferIndex) const
1829 return mValue[bufferIndex];
1833 * Set both the property value & base value.
1834 * @param[in] bufferIndex The buffer to write for the property value.
1835 * @param[in] value The new property value.
1837 void Bake(BufferIndex bufferIndex, const Quaternion& value)
1839 // It's ok to bake both buffers as render is performed in same thread as update. Reading from event side
1840 // has never been atomically safe.
1841 mValue[bufferIndex] = value;
1842 mValue[1 - bufferIndex] = value;
1849 * Change the property value & base value by a relative amount.
1850 * @param[in] bufferIndex The buffer to write for the local property value.
1851 * @param[in] delta The property will change by this amount.
1853 void BakeRelative(BufferIndex bufferIndex, const Quaternion& delta)
1855 mValue[bufferIndex] *= delta;
1856 mBaseValue = mValue[bufferIndex];
1863 AnimatableProperty(const AnimatableProperty& property);
1866 AnimatableProperty& operator=(const AnimatableProperty& rhs);
1869 DoubleBuffered<Quaternion> mValue; ///< The double-buffered property value
1870 Quaternion mBaseValue; ///< Reset to this base value at the beginning of each frame
1874 * A Matrix animatable property of a scene-graph object.
1877 class AnimatableProperty<Matrix> : public AnimatablePropertyBase
1881 * Create an animatable property.
1882 * @param [in] initialValue The initial value of the property.
1884 AnimatableProperty(const Matrix& initialValue)
1885 : mValue(initialValue),
1886 mBaseValue(initialValue)
1891 * Virtual destructor.
1893 ~AnimatableProperty() override = default;
1896 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
1898 Dali::Property::Type GetType() const override
1900 return Dali::PropertyTypes::Get<Matrix>();
1904 * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
1906 void ResetToBaseValue(BufferIndex updateBufferIndex) override
1908 if(CLEAN_FLAG != mDirtyFlags)
1910 mValue[updateBufferIndex] = mBaseValue;
1912 mDirtyFlags = (mDirtyFlags >> 1);
1917 * @copydoc Dali::Internal::PropertyInputImpl::GetMatrix()
1919 const Matrix& GetMatrix(BufferIndex bufferIndex) const override
1921 return mValue[bufferIndex];
1925 * @copydoc Dali::Internal::PropertyInputImpl::GetValueAddress()
1927 const void* GetValueAddress(BufferIndex bufferIndex) const override
1929 return &mValue[bufferIndex];
1933 * @copydoc Dali::Internal::PropertyInputImpl::GetValueSize()
1935 size_t GetValueSize() const override
1937 return sizeof(Matrix);
1941 * Set the property value. This will only persist for the current frame; the property
1942 * will be reset with the base value, at the beginning of the next frame.
1943 * @param[in] bufferIndex The buffer to write.
1944 * @param[in] value The new property value.
1946 void Set(BufferIndex bufferIndex, const Matrix& value)
1948 mValue[bufferIndex] = value;
1953 * Change the property value by a relative amount.
1954 * @param[in] bufferIndex The buffer to write.
1955 * @param[in] delta The property will change by this amount.
1957 void SetRelative(BufferIndex bufferIndex, const Matrix& delta)
1960 MatrixUtils::Multiply(temp, mValue[bufferIndex], delta);
1961 mValue[bufferIndex] = temp;
1967 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
1969 Matrix& Get(BufferIndex bufferIndex)
1971 return mValue[bufferIndex];
1975 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
1977 const Matrix& Get(BufferIndex bufferIndex) const
1979 return mValue[bufferIndex];
1983 * Retrieve the property value.
1984 * @param[in] bufferIndex The buffer to read.
1985 * @return The property value.
1987 Matrix& operator[](BufferIndex bufferIndex)
1989 return mValue[bufferIndex];
1993 * Retrieve the property value.
1994 * @param[in] bufferIndex The buffer to read.
1995 * @return The property value.
1997 const Matrix& operator[](BufferIndex bufferIndex) const
1999 return mValue[bufferIndex];
2003 * Set both the property value & base value.
2004 * @param[in] bufferIndex The buffer to write for the property value.
2005 * @param[in] value The new property value.
2007 void Bake(BufferIndex bufferIndex, const Matrix& value)
2009 // It's ok to bake both buffers as render is performed in same thread as update. Reading from event side
2010 // has never been atomically safe.
2011 mValue[bufferIndex] = value;
2012 mValue[1 - bufferIndex] = value;
2013 mBaseValue = mValue[bufferIndex];
2019 * Change the property value & base value by a relative amount.
2020 * @param[in] bufferIndex The buffer to write for the local property value.
2021 * @param[in] delta The property will change by this amount.
2023 void BakeRelative(BufferIndex bufferIndex, const Matrix& delta)
2026 MatrixUtils::Multiply(temp, mValue[bufferIndex], delta);
2027 mValue[bufferIndex] = temp;
2035 AnimatableProperty(const AnimatableProperty& property);
2038 AnimatableProperty& operator=(const AnimatableProperty& rhs);
2041 DoubleBuffered<Matrix> mValue; ///< The double-buffered property value
2042 Matrix mBaseValue; ///< Reset to this base value at the beginning of each frame
2046 * A Matrix3 animatable property of a scene-graph object.
2049 class AnimatableProperty<Matrix3> : public AnimatablePropertyBase
2053 * Create an animatable property.
2054 * @param [in] initialValue The initial value of the property.
2056 AnimatableProperty(const Matrix3& initialValue)
2057 : mValue(initialValue),
2058 mBaseValue(initialValue)
2063 * Virtual destructor.
2065 ~AnimatableProperty() override = default;
2068 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
2070 Dali::Property::Type GetType() const override
2072 return Dali::PropertyTypes::Get<Matrix3>();
2076 * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
2078 void ResetToBaseValue(BufferIndex updateBufferIndex) override
2080 if(CLEAN_FLAG != mDirtyFlags)
2082 mValue[updateBufferIndex] = mBaseValue;
2084 mDirtyFlags = (mDirtyFlags >> 1);
2089 * @copydoc Dali::Internal::PropertyInputImpl::GetMatrix3()
2091 const Matrix3& GetMatrix3(BufferIndex bufferIndex) const override
2093 return mValue[bufferIndex];
2097 * @copydoc Dali::Internal::PropertyInputImpl::GetValueAddress()
2099 const void* GetValueAddress(BufferIndex bufferIndex) const override
2101 return &mValue[bufferIndex];
2105 * @copydoc Dali::Internal::PropertyInputImpl::GetValueSize()
2107 size_t GetValueSize() const override
2109 return sizeof(Matrix3);
2113 * Set the property value. This will only persist for the current frame; the property
2114 * will be reset with the base value, at the beginning of the next frame.
2115 * @param[in] bufferIndex The buffer to write.
2116 * @param[in] value The new property value.
2118 void Set(BufferIndex bufferIndex, const Matrix3& value)
2120 mValue[bufferIndex] = value;
2125 * Change the property value by a relative amount.
2126 * @param[in] bufferIndex The buffer to write.
2127 * @param[in] delta The property will change by this amount.
2129 void SetRelative(BufferIndex bufferIndex, const Matrix3& delta)
2132 MatrixUtils::Multiply(temp, mValue[bufferIndex], delta);
2133 mValue[bufferIndex] = temp;
2138 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
2140 Matrix3& Get(BufferIndex bufferIndex)
2142 return mValue[bufferIndex];
2146 * @copydoc Dali::SceneGraph::AnimatableProperty::Get()
2148 const Matrix3& Get(BufferIndex bufferIndex) const
2150 return mValue[bufferIndex];
2154 * Retrieve the property value.
2155 * @param[in] bufferIndex The buffer to read.
2156 * @return The property value.
2158 Matrix3& operator[](BufferIndex bufferIndex)
2160 return mValue[bufferIndex];
2164 * Retrieve the property value.
2165 * @param[in] bufferIndex The buffer to read.
2166 * @return The property value.
2168 const Matrix3& operator[](BufferIndex bufferIndex) const
2170 return mValue[bufferIndex];
2174 * Set both the property value & base value.
2175 * @param[in] bufferIndex The buffer to write for the property value.
2176 * @param[in] value The new property value.
2178 void Bake(BufferIndex bufferIndex, const Matrix3& value)
2180 // It's ok to bake both buffers as render is performed in same thread as update. Reading from event side
2181 // has never been atomically safe.
2182 mValue[bufferIndex] = value;
2183 mValue[1 - bufferIndex] = value;
2184 mBaseValue = mValue[bufferIndex];
2190 * Change the property value & base value by a relative amount.
2191 * @param[in] bufferIndex The buffer to write for the local property value.
2192 * @param[in] delta The property will change by this amount.
2194 void BakeRelative(BufferIndex bufferIndex, const Matrix3& delta)
2197 MatrixUtils::Multiply(temp, mValue[bufferIndex], delta);
2198 mValue[bufferIndex] = temp;
2206 AnimatableProperty(const AnimatableProperty& property);
2209 AnimatableProperty& operator=(const AnimatableProperty& rhs);
2212 DoubleBuffered<Matrix3> mValue; ///< The double-buffered property value
2213 Matrix3 mBaseValue; ///< Reset to this base value at the beginning of each frame
2216 } // namespace SceneGraph
2218 } // namespace Internal
2222 #endif // DALI_INTERNAL_SCENE_GRAPH_ANIMATABLE_PROPERTY_H