Merge "Performance enhancement, cache glClear state" into tizen
[platform/core/uifw/dali-core.git] / dali / public-api / animation / constraint-functions.h
1 #ifndef __DALI_CONSTRAINT_FUNCTIONS_H__
2 #define __DALI_CONSTRAINT_FUNCTIONS_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <boost/function.hpp>
23
24 namespace Dali
25 {
26
27 struct Vector3;
28 struct Vector4;
29 class Quaternion;
30
31 /**
32  * @brief Constraints can be used to adjust an Actor property, after animations have been applied.
33  *
34  * A local-constraint function is based on local properties of the Actor.
35  */
36 namespace LocalConstraint
37 {
38
39 /**
40  * @brief A function which constrains a Vector3 property, based on the local properties of an Actor.
41  *
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.
48  */
49 typedef boost::function<Vector3 (const Vector3&    size,
50                                  const Vector3&    position,
51                                  const Quaternion& rotation,
52                                  const Vector3&    scale,
53                                  const Vector4&    color)> Vector3Function;
54
55 /**
56  * @brief A function which constrains a Vector4 property, based on the local properties of an Actor.
57  *
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.
64  */
65 typedef boost::function<Vector4 (const Vector3&    size,
66                                  const Vector3&    position,
67                                  const Quaternion& rotation,
68                                  const Vector3&    scale,
69                                  const Vector4&    color)> Vector4Function;
70
71 /**
72  * @brief A function which constrains a Quaternion property, based on the local properties of an Actor.
73  *
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.
80  */
81 typedef boost::function<Quaternion (const Vector3&    size,
82                                     const Vector3&    position,
83                                     const Quaternion& rotation,
84                                     const Vector3&    scale,
85                                     const Vector4&    color)> QuaternionFunction;
86
87 /**
88  * @brief A function which constrains a boolean property, based on the local properties of an Actor.
89  *
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.
96  */
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;
102
103 } // LocalConstraint
104
105 /**
106  * @brief A parent-constraint function is based on properties related to the Actor's parent.
107  */
108 namespace ParentConstraint
109 {
110
111 /**
112  * @brief A function which constrains a Vector3 property, based on properties related to the Actor's parent.
113  *
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.
122  */
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;
130
131 /**
132  * @brief A function which constrains a Vector4 property, based on properties related to the Actor's parent.
133  *
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.
142  */
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;
150
151 /**
152  * @brief A function which constrains a Quaternion property, based on properties related to the Actor's parent.
153  *
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.
161  */
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;
169
170 /**
171  * @brief A function which constrains a boolean property, based on properties related to the Actor's parent.
172  *
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.
181  */
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;
189
190 } // ParentConstraint
191
192 } // namespace Dali
193
194 #endif // __DALI_CONSTRAINT_FUNCTIONS_H__