[NUI.Scene3D] Make API to apply ModelMotion
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Scene3D / src / public / ModelMotion / MotionTransformIndex.cs
1 using System.Numerics;
2 /*
3  * Copyright(c) 2023 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18
19 using System;
20 using System.ComponentModel;
21 using System.Collections.Generic;
22 using Tizen.NUI;
23
24 namespace Tizen.NUI.Scene3D
25 {
26     /// <summary>
27     /// Index of Transform feature.
28     /// Each TransformTypes has their own matched MotionValue type.
29     /// </summary>
30     [EditorBrowsable(EditorBrowsableState.Never)]
31     public class MotionTransformIndex : MotionIndex
32     {
33         /// <summary>
34         /// The list of component types what this MotionIndex can control.
35         /// </summary>
36         [EditorBrowsable(EditorBrowsableState.Never)]
37         [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names")]
38         public enum TransformTypes
39         {
40             /// <summary>
41             /// The position of ModelNode. MotionValue should be Vector3.
42             /// </summary>
43             [EditorBrowsable(EditorBrowsableState.Never)]
44             Position,
45
46             /// <summary>
47             /// The x position of ModelNode. MotionValue should be float.
48             /// </summary>
49             [EditorBrowsable(EditorBrowsableState.Never)]
50             PositionX,
51
52             /// <summary>
53             /// The y position of ModelNode. MotionValue should be float.
54             /// </summary>
55             [EditorBrowsable(EditorBrowsableState.Never)]
56             PositionY,
57
58             /// <summary>
59             /// The z position of ModelNode. MotionValue should be float.
60             /// </summary>
61             [EditorBrowsable(EditorBrowsableState.Never)]
62             PositionZ,
63
64             /// <summary>
65             /// The orientation of ModelNode. MotionValue should be Rotation.
66             /// </summary>
67             [EditorBrowsable(EditorBrowsableState.Never)]
68             Orientation,
69
70             /// <summary>
71             /// The scale of ModelNode. MotionValue should be Vector3.
72             /// </summary>
73             [EditorBrowsable(EditorBrowsableState.Never)]
74             Scale,
75
76             /// <summary>
77             /// The x scale of ModelNode. MotionValue should be float.
78             /// </summary>
79             [EditorBrowsable(EditorBrowsableState.Never)]
80             ScaleX,
81
82             /// <summary>
83             /// The y scale of ModelNode. MotionValue should be float.
84             /// </summary>
85             [EditorBrowsable(EditorBrowsableState.Never)]
86             ScaleY,
87
88             /// <summary>
89             /// The z scale of ModelNode. MotionValue should be float.
90             /// </summary>
91             [EditorBrowsable(EditorBrowsableState.Never)]
92             ScaleZ,
93         }
94
95         /// <summary>
96         /// Create an initialized motion index.
97         /// </summary>
98         [EditorBrowsable(EditorBrowsableState.Never)]
99         public MotionTransformIndex()
100         {
101         }
102
103         /// <summary>
104         /// The component type what this MotionIndex want to control.
105         /// </summary>
106         [EditorBrowsable(EditorBrowsableState.Never)]
107         public TransformTypes TransformType { get; set; } = TransformTypes.Position;
108
109         /// <summary>
110         /// Get uniform name of TransformType.
111         /// </summary>
112         [EditorBrowsable(EditorBrowsableState.Never)]
113         internal override string GetPropertyName(ModelNode node)
114         {
115             switch (TransformType)
116             {
117                 case TransformTypes.Position:
118                 {
119                     return "Position";
120                 }
121                 case TransformTypes.PositionX:
122                 {
123                     return "PositionX";
124                 }
125                 case TransformTypes.PositionY:
126                 {
127                     return "PositionY";
128                 }
129                 case TransformTypes.PositionZ:
130                 {
131                     return "PositionZ";
132                 }
133                 case TransformTypes.Orientation:
134                 {
135                     return "Orientation";
136                 }
137                 case TransformTypes.Scale:
138                 {
139                     return "Scale";
140                 }
141                 case TransformTypes.ScaleX:
142                 {
143                     return "ScaleX";
144                 }
145                 case TransformTypes.ScaleY:
146                 {
147                     return "ScaleY";
148                 }
149                 case TransformTypes.ScaleZ:
150                 {
151                     return "ScaleZ";
152                 }
153             }
154             return null;
155         }
156     }
157 }