1 #ifndef __DALI_INTERNAL_SCENE_GRAPH_DOUBLE_BUFFERED_PROPERTY_H__
2 #define __DALI_INTERNAL_SCENE_GRAPH_DOUBLE_BUFFERED_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/scene-graph-buffers.h>
44 namespace DoubleBufferedPropertyFlags
47 * Dirty flags record whether a doubleBuffered property has changed.
48 * In the frame following a change, the property is copied from the most recent
49 * buffer to the old buffer.
51 static const unsigned int CLEAN_FLAG = 0x00; ///< Indicates that the value did not change in this, or the previous frame
52 static const unsigned int COPIED_FLAG = 0x01; ///< Indicates that the value was copied during the previous frame
53 static const unsigned int SET_FLAG = 0x02; ///< Indicates that the value was Set during the previous frame
57 class DoubleBufferedProperty;
60 * Base class to reduce code size from the templates.
62 class DoubleBufferedPropertyBase : public PropertyInputImpl
67 * Constructor, initialize the dirty flag
69 DoubleBufferedPropertyBase()
70 : PropertyInputImpl(),
71 mDirtyFlags( DoubleBufferedPropertyFlags::COPIED_FLAG )
77 virtual ~DoubleBufferedPropertyBase()
81 * Auto-age the property: if it was set the previous frame,
82 * then copy the value into the current frame's buffer.
84 virtual void CopyPrevious( BufferIndex updateBufferIndex ) = 0;
87 protected: // for derived classes
89 * Flag that the property has been Set during the current frame.
93 mDirtyFlags = DoubleBufferedPropertyFlags::SET_FLAG;
96 public: // From PropertyBase
99 * @copydoc Dali::Internal::PropertyInputImpl::InputChanged()
101 virtual bool InputChanged() const
103 return ( DoubleBufferedPropertyFlags::CLEAN_FLAG != mDirtyFlags );
107 * @copydoc Dali::Internal::PropertyInputImpl::InputInitialized()
109 virtual bool InputInitialized() const
111 return true; // DoubleBuffered properties are always valid
114 protected: // so that ResetToBaseValue can set it directly
116 unsigned int mDirtyFlags; ///< Flag whether value changed during previous 2 frames
122 * A boolean doubleBuffered property of a scene-graph object.
125 class DoubleBufferedProperty<bool> : public DoubleBufferedPropertyBase
130 * Create an doubleBuffered property.
131 * @param [in] initialValue The initial value of the property.
133 DoubleBufferedProperty( bool initialValue )
134 : mValue( initialValue )
139 * Virtual destructor.
141 virtual ~DoubleBufferedProperty()
146 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
148 virtual Dali::Property::Type GetType() const
150 return Dali::PropertyTypes::Get<bool>();
154 * @copydoc Dali::Internal::SceneGraph::DoubleBufferedPropertyBase::CopyPrevious()
156 virtual void CopyPrevious( BufferIndex updateBufferIndex )
158 if( DoubleBufferedPropertyFlags::SET_FLAG == mDirtyFlags)
160 mValue[ updateBufferIndex ] = mValue[ 1-updateBufferIndex ];
161 mDirtyFlags = ( mDirtyFlags >> 1 );
166 * @copydoc Dali::Internal::PropertyInputImpl::GetBoolean()
168 virtual const bool& GetBoolean( BufferIndex bufferIndex ) const
170 return mValue[ bufferIndex ];
174 * Set the property value. This will persist for the current frame, and will
175 * be copied to the other buffer next frame (unless it is set again)
176 * @param[in] bufferIndex The buffer to write.
177 * @param[in] value The new property value.
179 void Set(BufferIndex bufferIndex, bool value)
181 // check if the value actually changed to avoid dirtying nodes unnecessarily
182 if( mValue[bufferIndex] != value )
184 mValue[bufferIndex] = value;
191 * @copydoc Dali::SceneGraph::DoubleBufferedProperty::Get()
193 bool& Get(size_t bufferIndex)
195 return mValue[bufferIndex];
199 * @copydoc Dali::SceneGraph::DoubleBufferedProperty::Get()
201 const bool& Get(size_t bufferIndex) const
203 return mValue[bufferIndex];
207 * Retrieve the property value.
208 * @param[in] bufferIndex The buffer to read.
209 * @return The property value.
211 bool& operator[](size_t bufferIndex)
213 return mValue[bufferIndex];
217 * Retrieve the property value.
218 * @param[in] bufferIndex The buffer to read.
219 * @return The property value.
221 const bool& operator[](size_t bufferIndex) const
223 return mValue[bufferIndex];
228 DoubleBufferedProperty(const DoubleBufferedProperty& property);
231 DoubleBufferedProperty& operator=(const DoubleBufferedProperty& rhs);
234 DoubleBuffered<bool> mValue; ///< The double-buffered property value
239 * A double buffered integer property of a scene-graph object.
242 class DoubleBufferedProperty<int> : public DoubleBufferedPropertyBase
247 * Create a double buffered property.
248 * @param [in] initialValue The initial value of the property.
250 DoubleBufferedProperty( int initialValue )
251 : mValue( initialValue )
256 * Virtual destructor.
258 virtual ~DoubleBufferedProperty()
263 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
265 virtual Dali::Property::Type GetType() const
267 return Dali::PropertyTypes::Get<int>();
271 * @copydoc Dali::Internal::SceneGraph::DoubleBufferedPropertyBase::CopyPrevious()
273 virtual void CopyPrevious( BufferIndex updateBufferIndex )
275 if( DoubleBufferedPropertyFlags::SET_FLAG == mDirtyFlags)
277 mValue[ updateBufferIndex ] = mValue[ 1-updateBufferIndex ];
278 mDirtyFlags = ( mDirtyFlags >> 1 );
283 * @copydoc Dali::Internal::PropertyInputImpl::GetInteger()
285 virtual const int& GetInteger( BufferIndex bufferIndex ) const
287 return mValue[ bufferIndex ];
291 * Set the property value. This will persist for the current frame, and will
292 * be copied to the other buffer next frame (unless it is set again)
293 * @param[in] bufferIndex The buffer to write.
294 * @param[in] value The new property value.
296 void Set(BufferIndex bufferIndex, int value)
298 // check if the value actually changed to avoid dirtying nodes unnecessarily
299 if( mValue[bufferIndex] != value )
301 mValue[bufferIndex] = value;
308 * @copydoc Dali::SceneGraph::DoubleBufferedProperty::Get()
310 int& Get(size_t bufferIndex)
312 return mValue[bufferIndex];
316 * @copydoc Dali::SceneGraph::DoubleBufferedProperty::Get()
318 const int& Get(size_t bufferIndex) const
320 return mValue[bufferIndex];
324 * Retrieve the property value.
325 * @param[in] bufferIndex The buffer to read.
326 * @return The property value.
328 int& operator[](size_t bufferIndex)
330 return mValue[bufferIndex];
334 * Retrieve the property value.
335 * @param[in] bufferIndex The buffer to read.
336 * @return The property value.
338 const int& operator[](size_t bufferIndex) const
340 return mValue[bufferIndex];
345 DoubleBufferedProperty(const DoubleBufferedProperty& property);
348 DoubleBufferedProperty& operator=(const DoubleBufferedProperty& rhs);
351 DoubleBuffered<int> mValue; ///< The double-buffered property value
356 * A double buffered unsigned integer property of a scene-graph object.
359 class DoubleBufferedProperty<unsigned int> : public DoubleBufferedPropertyBase
362 typedef unsigned int OwnType;
365 * Create a double buffered property.
366 * @param [in] initialValue The initial value of the property.
368 DoubleBufferedProperty( OwnType initialValue )
369 : mValue( initialValue )
374 * Virtual destructor.
376 virtual ~DoubleBufferedProperty()
381 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
383 virtual Dali::Property::Type GetType() const
385 return Dali::PropertyTypes::Get<OwnType>();
389 * @copydoc Dali::Internal::SceneGraph::DoubleBufferedPropertyBase::CopyPrevious()
391 virtual void CopyPrevious( BufferIndex updateBufferIndex )
393 if( DoubleBufferedPropertyFlags::SET_FLAG == mDirtyFlags)
395 mValue[ updateBufferIndex ] = mValue[ 1-updateBufferIndex ];
396 mDirtyFlags = ( mDirtyFlags >> 1 );
401 * @copydoc Dali::Internal::PropertyInputImpl::GetInteger()
403 virtual const OwnType& GetUnsignedInteger( BufferIndex bufferIndex ) const
405 return mValue[ bufferIndex ];
409 * Set the property value. This will persist for the current frame, and will
410 * be copied to the other buffer next frame (unless it is set again)
411 * @param[in] bufferIndex The buffer to write.
412 * @param[in] value The new property value.
414 void Set(BufferIndex bufferIndex, OwnType value)
416 // check if the value actually changed to avoid dirtying nodes unnecessarily
417 if( mValue[bufferIndex] != value )
419 mValue[bufferIndex] = value;
426 * @copydoc Dali::SceneGraph::DoubleBufferedProperty::Get()
428 OwnType& Get(size_t bufferIndex)
430 return mValue[bufferIndex];
434 * @copydoc Dali::SceneGraph::DoubleBufferedProperty::Get()
436 const OwnType& Get(size_t bufferIndex) const
438 return mValue[bufferIndex];
442 * Retrieve the property value.
443 * @param[in] bufferIndex The buffer to read.
444 * @return The property value.
446 OwnType& operator[](size_t bufferIndex)
448 return mValue[bufferIndex];
452 * Retrieve the property value.
453 * @param[in] bufferIndex The buffer to read.
454 * @return The property value.
456 const OwnType& operator[](size_t bufferIndex) const
458 return mValue[bufferIndex];
463 DoubleBufferedProperty(const DoubleBufferedProperty& property);
466 DoubleBufferedProperty& operator=(const DoubleBufferedProperty& rhs);
469 DoubleBuffered<OwnType> mValue; ///< The double-buffered property value
474 * A float doubleBuffered property of a scene-graph object.
477 class DoubleBufferedProperty<float> : public DoubleBufferedPropertyBase
482 * Create a doubleBuffered property.
483 * @param[in] initialValue The initial value of the property.
485 DoubleBufferedProperty( float initialValue )
486 : mValue( initialValue )
491 * Virtual destructor.
493 virtual ~DoubleBufferedProperty()
498 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
500 virtual Dali::Property::Type GetType() const
502 return Dali::PropertyTypes::Get<float>();
506 * @copydoc Dali::Internal::SceneGraph::DoubleBufferedPropertyBase::CopyPrevious()
508 virtual void CopyPrevious( BufferIndex updateBufferIndex )
510 if( DoubleBufferedPropertyFlags::SET_FLAG == mDirtyFlags)
512 mValue[ updateBufferIndex ] = mValue[ 1-updateBufferIndex ];
513 mDirtyFlags = ( mDirtyFlags >> 1 );
518 * @copydoc Dali::Internal::PropertyInputImpl::GetFloat()
520 virtual const float& GetFloat( BufferIndex bufferIndex ) const
522 return mValue[ bufferIndex ];
526 * Set the property value. This will persist for the current frame, and will
527 * be copied to the other buffer next frame (unless it is set again)
528 * @param[in] bufferIndex The buffer to write.
529 * @param[in] value The new property value.
531 void Set(BufferIndex bufferIndex, float value)
533 mValue[bufferIndex] = value;
538 * @copydoc Dali::SceneGraph::DoubleBufferedProperty::Get()
540 float& Get(size_t bufferIndex)
542 return mValue[bufferIndex];
546 * @copydoc Dali::SceneGraph::DoubleBufferedProperty::Get()
548 const float& Get(size_t bufferIndex) const
550 return mValue[bufferIndex];
554 * Retrieve the property value.
555 * @param[in] bufferIndex The buffer to read.
556 * @return The property value.
558 float& operator[](size_t bufferIndex)
560 return mValue[bufferIndex];
564 * Retrieve the property value.
565 * @param[in] bufferIndex The buffer to read.
566 * @return The property value.
568 const float& operator[](size_t bufferIndex) const
570 return mValue[bufferIndex];
575 DoubleBufferedProperty(const DoubleBufferedProperty& property);
578 DoubleBufferedProperty& operator=(const DoubleBufferedProperty& rhs);
581 DoubleBuffered<float> mValue; ///< The double-buffered property value
585 * A double buffered Vector2 property of a scene-graph object.
588 class DoubleBufferedProperty<Vector2> : public DoubleBufferedPropertyBase
593 * Create a double buffered property.
594 * @param [in] initialValue The initial value of the property.
596 DoubleBufferedProperty( Vector2 initialValue )
597 : mValue( initialValue )
602 * Virtual destructor.
604 virtual ~DoubleBufferedProperty()
609 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
611 virtual Dali::Property::Type GetType() const
613 return Dali::PropertyTypes::Get<Vector2>();
617 * @copydoc Dali::Internal::SceneGraph::DoubleBufferedPropertyBase::CopyPrevious()
619 virtual void CopyPrevious( BufferIndex updateBufferIndex )
621 if( DoubleBufferedPropertyFlags::SET_FLAG == mDirtyFlags)
623 mValue[ updateBufferIndex ] = mValue[ 1-updateBufferIndex ];
624 mDirtyFlags = ( mDirtyFlags >> 1 );
629 * @copydoc Dali::Internal::PropertyInputImpl::GetVector2()
631 virtual const Vector2& GetVector2( BufferIndex bufferIndex ) const
633 return mValue[ bufferIndex ];
637 * Set the property value. This will persist for the current frame, and will
638 * be copied to the other buffer next frame (unless it is set again)
639 * @param[in] bufferIndex The buffer to write.
640 * @param[in] value The new property value.
642 void Set(BufferIndex bufferIndex, Vector2 value)
644 mValue[bufferIndex] = value;
649 * @copydoc Dali::SceneGraph::DoubleBufferedProperty::Get()
651 Vector2& Get(size_t bufferIndex)
653 return mValue[bufferIndex];
657 * @copydoc Dali::SceneGraph::DoubleBufferedProperty::Get()
659 const Vector2& Get(size_t bufferIndex) const
661 return mValue[bufferIndex];
665 * Retrieve the property value.
666 * @param[in] bufferIndex The buffer to read.
667 * @return The property value.
669 Vector2& operator[](size_t bufferIndex)
671 return mValue[bufferIndex];
675 * Retrieve the property value.
676 * @param[in] bufferIndex The buffer to read.
677 * @return The property value.
679 const Vector2& operator[](size_t bufferIndex) const
681 return mValue[bufferIndex];
686 DoubleBufferedProperty(const DoubleBufferedProperty& property);
689 DoubleBufferedProperty& operator=(const DoubleBufferedProperty& rhs);
692 DoubleBuffered<Vector2> mValue; ///< The double-buffered property value
696 * A double buffered Vector3 property of a scene-graph object.
699 class DoubleBufferedProperty<Vector3> : public DoubleBufferedPropertyBase
704 * Create a double buffered property.
705 * @param [in] initialValue The initial value of the property.
707 DoubleBufferedProperty( Vector3 initialValue )
708 : mValue( initialValue )
713 * Virtual destructor.
715 virtual ~DoubleBufferedProperty()
720 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
722 virtual Dali::Property::Type GetType() const
724 return Dali::PropertyTypes::Get<Vector3>();
728 * @copydoc Dali::Internal::SceneGraph::DoubleBufferedPropertyBase::CopyPrevious()
730 virtual void CopyPrevious( BufferIndex updateBufferIndex )
732 if( DoubleBufferedPropertyFlags::SET_FLAG == mDirtyFlags)
734 mValue[ updateBufferIndex ] = mValue[ 1-updateBufferIndex ];
735 mDirtyFlags = ( mDirtyFlags >> 1 );
740 * @copydoc Dali::Internal::PropertyInputImpl::GetVector3()
742 virtual const Vector3& GetVector3( BufferIndex bufferIndex ) const
744 return mValue[ bufferIndex ];
748 * Set the property value. This will persist for the current frame, and will
749 * be copied to the other buffer next frame (unless it is set again)
750 * @param[in] bufferIndex The buffer to write.
751 * @param[in] value The new property value.
753 void Set(BufferIndex bufferIndex, Vector3 value)
755 mValue[bufferIndex] = value;
760 * @copydoc Dali::SceneGraph::DoubleBufferedProperty::Get()
762 Vector3& Get(size_t bufferIndex)
764 return mValue[bufferIndex];
768 * @copydoc Dali::SceneGraph::DoubleBufferedProperty::Get()
770 const Vector3& Get(size_t bufferIndex) const
772 return mValue[bufferIndex];
776 * Retrieve the property value.
777 * @param[in] bufferIndex The buffer to read.
778 * @return The property value.
780 Vector3& operator[](size_t bufferIndex)
782 return mValue[bufferIndex];
786 * Retrieve the property value.
787 * @param[in] bufferIndex The buffer to read.
788 * @return The property value.
790 const Vector3& operator[](size_t bufferIndex) const
792 return mValue[bufferIndex];
797 DoubleBufferedProperty(const DoubleBufferedProperty& property);
800 DoubleBufferedProperty& operator=(const DoubleBufferedProperty& rhs);
803 DoubleBuffered<Vector3> mValue; ///< The double-buffered property value
807 * A double buffered Vector4 property of a scene-graph object.
810 class DoubleBufferedProperty<Vector4> : public DoubleBufferedPropertyBase
815 * Create a double buffered property.
816 * @param [in] initialValue The initial value of the property.
818 DoubleBufferedProperty( Vector4 initialValue )
819 : mValue( initialValue )
824 * Virtual destructor.
826 virtual ~DoubleBufferedProperty()
831 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
833 virtual Dali::Property::Type GetType() const
835 return Dali::PropertyTypes::Get<Vector4>();
839 * @copydoc Dali::Internal::SceneGraph::DoubleBufferedPropertyBase::CopyPrevious()
841 virtual void CopyPrevious( BufferIndex updateBufferIndex )
843 if( DoubleBufferedPropertyFlags::SET_FLAG == mDirtyFlags)
845 mValue[ updateBufferIndex ] = mValue[ 1-updateBufferIndex ];
846 mDirtyFlags = ( mDirtyFlags >> 1 );
851 * @copydoc Dali::Internal::PropertyInputImpl::GetVector4()
853 virtual const Vector4& GetVector4( BufferIndex bufferIndex ) const
855 return mValue[ bufferIndex ];
859 * Set the property value. This will persist for the current frame, and will
860 * be copied to the other buffer next frame (unless it is set again)
861 * @param[in] bufferIndex The buffer to write.
862 * @param[in] value The new property value.
864 void Set(BufferIndex bufferIndex, Vector4 value)
866 mValue[bufferIndex] = value;
871 * @copydoc Dali::SceneGraph::DoubleBufferedProperty::Get()
873 Vector4& Get(size_t bufferIndex)
875 return mValue[bufferIndex];
879 * @copydoc Dali::SceneGraph::DoubleBufferedProperty::Get()
881 const Vector4& Get(size_t bufferIndex) const
883 return mValue[bufferIndex];
887 * Retrieve the property value.
888 * @param[in] bufferIndex The buffer to read.
889 * @return The property value.
891 Vector4& operator[](size_t bufferIndex)
893 return mValue[bufferIndex];
897 * Retrieve the property value.
898 * @param[in] bufferIndex The buffer to read.
899 * @return The property value.
901 const Vector4& operator[](size_t bufferIndex) const
903 return mValue[bufferIndex];
908 DoubleBufferedProperty(const DoubleBufferedProperty& property);
911 DoubleBufferedProperty& operator=(const DoubleBufferedProperty& rhs);
914 DoubleBuffered<Vector4> mValue; ///< The double-buffered property value
919 * A double buffered Quaternion property of a scene-graph object.
922 class DoubleBufferedProperty<Quaternion> : public DoubleBufferedPropertyBase
927 * Create a double buffered property.
928 * @param [in] initialValue The initial value of the property.
930 DoubleBufferedProperty( Quaternion initialValue )
931 : mValue( initialValue )
936 * Virtual destructor.
938 virtual ~DoubleBufferedProperty()
943 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
945 virtual Dali::Property::Type GetType() const
947 return Dali::PropertyTypes::Get<Quaternion>();
951 * @copydoc Dali::Internal::SceneGraph::DoubleBufferedPropertyBase::CopyPrevious()
953 virtual void CopyPrevious( BufferIndex updateBufferIndex )
955 if( DoubleBufferedPropertyFlags::SET_FLAG == mDirtyFlags)
957 mValue[ updateBufferIndex ] = mValue[ 1-updateBufferIndex ];
958 mDirtyFlags = ( mDirtyFlags >> 1 );
963 * @copydoc Dali::Internal::PropertyInputImpl::GetQuaternion()
965 virtual const Quaternion& GetQuaternion( BufferIndex bufferIndex ) const
967 return mValue[ bufferIndex ];
971 * Set the property value. This will persist for the current frame, and will
972 * be copied to the other buffer next frame (unless it is set again)
973 * @param[in] bufferIndex The buffer to write.
974 * @param[in] value The new property value.
976 void Set(BufferIndex bufferIndex, Quaternion value)
978 mValue[bufferIndex] = value;
983 * @copydoc Dali::SceneGraph::DoubleBufferedProperty::Get()
985 Quaternion& Get(size_t bufferIndex)
987 return mValue[bufferIndex];
991 * @copydoc Dali::SceneGraph::DoubleBufferedProperty::Get()
993 const Quaternion& Get(size_t bufferIndex) const
995 return mValue[bufferIndex];
999 * Retrieve the property value.
1000 * @param[in] bufferIndex The buffer to read.
1001 * @return The property value.
1003 Quaternion& operator[](size_t bufferIndex)
1005 return mValue[bufferIndex];
1009 * Retrieve the property value.
1010 * @param[in] bufferIndex The buffer to read.
1011 * @return The property value.
1013 const Quaternion& operator[](size_t bufferIndex) const
1015 return mValue[bufferIndex];
1020 DoubleBufferedProperty(const DoubleBufferedProperty& property);
1023 DoubleBufferedProperty& operator=(const DoubleBufferedProperty& rhs);
1026 DoubleBuffered<Quaternion> mValue; ///< The double-buffered property value
1030 * A double buffered Matrix property of a scene-graph object.
1033 class DoubleBufferedProperty<Matrix> : public DoubleBufferedPropertyBase
1038 * Create a double buffered property.
1039 * @param [in] initialValue The initial value of the property.
1041 DoubleBufferedProperty( Matrix initialValue )
1042 : mValue( initialValue )
1047 * Virtual destructor.
1049 virtual ~DoubleBufferedProperty()
1054 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
1056 virtual Dali::Property::Type GetType() const
1058 return Dali::PropertyTypes::Get<Matrix>();
1062 * @copydoc Dali::Internal::SceneGraph::DoubleBufferedPropertyBase::CopyPrevious()
1064 virtual void CopyPrevious( BufferIndex updateBufferIndex )
1066 if( DoubleBufferedPropertyFlags::SET_FLAG == mDirtyFlags)
1068 mValue[ updateBufferIndex ] = mValue[ 1-updateBufferIndex ];
1069 mDirtyFlags = ( mDirtyFlags >> 1 );
1074 * @copydoc Dali::Internal::PropertyInputImpl::GetMatrix()
1076 virtual const Matrix& GetMatrix( BufferIndex bufferIndex ) const
1078 return mValue[ bufferIndex ];
1082 * Set the property value. This will persist for the current frame, and will
1083 * be copied to the other buffer next frame (unless it is set again)
1084 * @param[in] bufferIndex The buffer to write.
1085 * @param[in] value The new property value.
1087 void Set(BufferIndex bufferIndex, Matrix value)
1089 mValue[bufferIndex] = value;
1094 * @copydoc Dali::SceneGraph::DoubleBufferedProperty::Get()
1096 Matrix& Get(size_t bufferIndex)
1098 return mValue[bufferIndex];
1102 * @copydoc Dali::SceneGraph::DoubleBufferedProperty::Get()
1104 const Matrix& Get(size_t bufferIndex) const
1106 return mValue[bufferIndex];
1110 * Retrieve the property value.
1111 * @param[in] bufferIndex The buffer to read.
1112 * @return The property value.
1114 Matrix& operator[](size_t bufferIndex)
1116 return mValue[bufferIndex];
1120 * Retrieve the property value.
1121 * @param[in] bufferIndex The buffer to read.
1122 * @return The property value.
1124 const Matrix& operator[](size_t bufferIndex) const
1126 return mValue[bufferIndex];
1131 DoubleBufferedProperty(const DoubleBufferedProperty& property);
1134 DoubleBufferedProperty& operator=(const DoubleBufferedProperty& rhs);
1137 DoubleBuffered<Matrix> mValue; ///< The double-buffered property value
1142 * A double buffered Matrix3 property of a scene-graph object.
1145 class DoubleBufferedProperty<Matrix3> : public DoubleBufferedPropertyBase
1150 * Create a double buffered property.
1151 * @param [in] initialValue The initial value of the property.
1153 DoubleBufferedProperty( Matrix3 initialValue )
1154 : mValue( initialValue )
1159 * Virtual destructor.
1161 virtual ~DoubleBufferedProperty()
1166 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
1168 virtual Dali::Property::Type GetType() const
1170 return Dali::PropertyTypes::Get<Matrix3>();
1174 * @copydoc Dali::Internal::SceneGraph::DoubleBufferedPropertyBase::CopyPrevious()
1176 virtual void CopyPrevious( BufferIndex updateBufferIndex )
1178 if( DoubleBufferedPropertyFlags::SET_FLAG == mDirtyFlags)
1180 mValue[ updateBufferIndex ] = mValue[ 1-updateBufferIndex ];
1181 mDirtyFlags = ( mDirtyFlags >> 1 );
1186 * @copydoc Dali::Internal::PropertyInputImpl::GetMatrix3()
1188 virtual const Matrix3& GetMatrix3( BufferIndex bufferIndex ) const
1190 return mValue[ bufferIndex ];
1194 * Set the property value. This will persist for the current frame, and will
1195 * be copied to the other buffer next frame (unless it is set again)
1196 * @param[in] bufferIndex The buffer to write.
1197 * @param[in] value The new property value.
1199 void Set(BufferIndex bufferIndex, Matrix3 value)
1201 mValue[bufferIndex] = value;
1206 * @copydoc Dali::SceneGraph::DoubleBufferedProperty::Get()
1208 Matrix3& Get(size_t bufferIndex)
1210 return mValue[bufferIndex];
1214 * @copydoc Dali::SceneGraph::DoubleBufferedProperty::Get()
1216 const Matrix3& Get(size_t bufferIndex) const
1218 return mValue[bufferIndex];
1222 * Retrieve the property value.
1223 * @param[in] bufferIndex The buffer to read.
1224 * @return The property value.
1226 Matrix3& operator[](size_t bufferIndex)
1228 return mValue[bufferIndex];
1232 * Retrieve the property value.
1233 * @param[in] bufferIndex The buffer to read.
1234 * @return The property value.
1236 const Matrix3& operator[](size_t bufferIndex) const
1238 return mValue[bufferIndex];
1243 DoubleBufferedProperty(const DoubleBufferedProperty& property);
1246 DoubleBufferedProperty& operator=(const DoubleBufferedProperty& rhs);
1249 DoubleBuffered<Matrix3> mValue; ///< The double-buffered property value
1252 } // namespace SceneGraph
1254 // Messages for DoubleBufferedProperty<T>
1257 void SetMessage( EventThreadServices& eventThreadServices,
1258 const SceneGraph::DoubleBufferedProperty<T>& property,
1259 typename ParameterType< T >::PassingType newValue )
1261 typedef MessageDoubleBuffered1< SceneGraph::DoubleBufferedProperty<T>, T > LocalType;
1263 // Reserve some memory inside the message queue
1264 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1266 // Construct message in the message queue memory; note that delete should not be called on the return value
1267 new (slot) LocalType( &property,
1268 &SceneGraph::DoubleBufferedProperty<T>::Set,
1272 } // namespace Internal
1276 #endif // __DALI_INTERNAL_SCENE_GRAPH_DOUBLE_BUFFERED_PROPERTY_H__