1 #ifndef __DALI_CONSTRAINT_FUNCTIONS_H__
2 #define __DALI_CONSTRAINT_FUNCTIONS_H__
5 * Copyright (c) 2014 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.
22 #include <boost/function.hpp>
32 * @brief Constraints can be used to adjust an Actor property, after animations have been applied.
34 * A local-constraint function is based on local properties of the Actor.
36 namespace LocalConstraint
40 * @brief A function which constrains a Vector3 property, based on the local properties of an Actor.
42 * @param[in] size The actor's current size.
43 * @param[in] position The actor's current position.
44 * @param[in] scale The actor's current rotation.
45 * @param[in] rotation The actor's current scale.
46 * @param[in] color The actor's current color.
47 * @return The constrained property value.
49 typedef boost::function<Vector3 (const Vector3& size,
50 const Vector3& position,
51 const Quaternion& rotation,
53 const Vector4& color)> Vector3Function;
56 * @brief A function which constrains a Vector4 property, based on the local properties of an Actor.
58 * @param[in] size The actor's current size.
59 * @param[in] position The actor's current position.
60 * @param[in] scale The actor's current rotation.
61 * @param[in] rotation The actor's current scale.
62 * @param[in] color The actor's current color.
63 * @return The constrained property value.
65 typedef boost::function<Vector4 (const Vector3& size,
66 const Vector3& position,
67 const Quaternion& rotation,
69 const Vector4& color)> Vector4Function;
72 * @brief A function which constrains a Quaternion property, based on the local properties of an Actor.
74 * @param[in] size The actor's current size.
75 * @param[in] position The actor's current position.
76 * @param[in] scale The actor's current rotation.
77 * @param[in] rotation The actor's current scale.
78 * @param[in] color The actor's current color.
79 * @return The constrained property value.
81 typedef boost::function<Quaternion (const Vector3& size,
82 const Vector3& position,
83 const Quaternion& rotation,
85 const Vector4& color)> QuaternionFunction;
88 * @brief A function which constrains a boolean property, based on the local properties of an Actor.
90 * @param[in] size The actor's current size.
91 * @param[in] position The actor's current position.
92 * @param[in] scale The actor's current rotation.
93 * @param[in] rotation The actor's current scale.
94 * @param[in] color The actor's current color.
95 * @return The constrained property value.
97 typedef boost::function<bool (const Vector3& size,
98 const Vector3& position,
99 const Quaternion& rotation,
100 const Vector3& scale,
101 const Vector4& color)> BoolFunction;
106 * @brief A parent-constraint function is based on properties related to the Actor's parent.
108 namespace ParentConstraint
112 * @brief A function which constrains a Vector3 property, based on properties related to the Actor's parent.
114 * @param[in] current The current value of the property to be constrained.
115 * @param[in] parentOrigin The actor's current parent-origin.
116 * @param[in] anchorPoint The actor's current anchor-point.
117 * @param[in] parentSize The parent's current size.
118 * @param[in] parentPosition The parent's current position.
119 * @param[in] parentRotation The parent's current rotation.
120 * @param[in] parentScale The parent's current scale.
121 * @return The constrained property value.
123 typedef boost::function<Vector3 (const Vector3& current,
124 const Vector3& parentOrigin,
125 const Vector3& anchorPoint,
126 const Vector3& parentSize,
127 const Vector3& parentPosition,
128 const Quaternion& parentRotation,
129 const Vector3& parentScale)> Vector3Function;
132 * @brief A function which constrains a Vector4 property, based on properties related to the Actor's parent.
134 * @param[in] current The current value of the property to be constrained.
135 * @param[in] parentOrigin The actor's current parent-origin.
136 * @param[in] anchorPoint The actor's current anchor-point.
137 * @param[in] parentSize The parent's current size.
138 * @param[in] parentPosition The parent's current position.
139 * @param[in] parentRotation The parent's current rotation.
140 * @param[in] parentScale The parent's current scale.
141 * @return The constrained property value.
143 typedef boost::function<Vector4 (const Vector4& current,
144 const Vector3& parentOrigin,
145 const Vector3& anchorPoint,
146 const Vector3& parentSize,
147 const Vector3& parentPosition,
148 const Quaternion& parentRotation,
149 const Vector3& parentScale)> Vector4Function;
152 * @brief A function which constrains a Quaternion property, based on properties related to the Actor's parent.
154 * @param[in] parentOrigin The actor's current parent-origin.
155 * @param[in] anchorPoint The actor's current anchor-point.
156 * @param[in] parentSize The parent's current size.
157 * @param[in] parentPosition The parent's current position.
158 * @param[in] parentRotation The parent's current rotation.
159 * @param[in] parentScale The parent's current scale.
160 * @return The constrained property value.
162 typedef boost::function<Quaternion (const Quaternion& current,
163 const Vector3& parentOrigin,
164 const Vector3& anchorPoint,
165 const Vector3& parentSize,
166 const Vector3& parentPosition,
167 const Quaternion& parentRotation,
168 const Vector3& parentScale)> QuaternionFunction;
171 * @brief A function which constrains a boolean property, based on properties related to the Actor's parent.
173 * @param[in] progress A progress value in the range 0->1, where 1 means that the constraint is fully applied.
174 * @param[in] parentOrigin The actor's current parent-origin.
175 * @param[in] anchorPoint The actor's current anchor-point.
176 * @param[in] parentSize The parent's current size.
177 * @param[in] parentPosition The parent's current position.
178 * @param[in] parentRotation The parent's current rotation.
179 * @param[in] parentScale The parent's current scale.
180 * @return The constrained property value.
182 typedef boost::function<bool (const bool& current,
183 const Vector3& parentOrigin,
184 const Vector3& anchorPoint,
185 const Vector3& parentSize,
186 const Vector3& parentPosition,
187 const Quaternion& parentRotation,
188 const Vector3& parentScale)> BoolFunction;
190 } // ParentConstraint
194 #endif // __DALI_CONSTRAINT_FUNCTIONS_H__