[NUI] remove "_" and refactoring naming to pascal case.
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Matrix.cs
1 /*
2  * Copyright(c) 2019 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 namespace Tizen.NUI
19 {
20     internal class Matrix : Disposable
21     {
22
23         internal Matrix(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
24         {
25         }
26
27         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Matrix obj)
28         {
29             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
30         }
31
32         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
33         {
34             Interop.Matrix.DeleteMatrix(swigCPtr);
35         }
36
37
38         public static Vector4 operator *(Matrix arg1, Vector4 arg2)
39         {
40             return arg1.Multiply(arg2);
41         }
42
43         public Matrix() : this(Interop.Matrix.NewMatrix(), true)
44         {
45             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
46         }
47
48         public Matrix(bool initialize) : this(Interop.Matrix.NewMatrix(initialize), true)
49         {
50             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
51         }
52
53         public Matrix(float[] array) : this(Interop.Matrix.NewMatrix(array), true)
54         {
55             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
56         }
57
58         public Matrix(Rotation rotation) : this(Interop.Matrix.NewMatrixQuaternion(Rotation.getCPtr(rotation)), true)
59         {
60             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
61         }
62
63         public Matrix(Matrix matrix) : this(Interop.Matrix.NewMatrix(Matrix.getCPtr(matrix)), true)
64         {
65             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
66         }
67
68         public Matrix Assign(Matrix matrix)
69         {
70             Matrix ret = new Matrix(Interop.Matrix.Assign(swigCPtr, Matrix.getCPtr(matrix)), false);
71             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
72             return ret;
73         }
74
75         public static Matrix IDENTITY
76         {
77             get
78             {
79                 global::System.IntPtr cPtr = Interop.Matrix.IdentityGet();
80                 Matrix ret = (cPtr == global::System.IntPtr.Zero) ? null : new Matrix(cPtr, false);
81                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
82                 return ret;
83             }
84         }
85
86         public void SetIdentity()
87         {
88             Interop.Matrix.SetIdentity(swigCPtr);
89             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
90         }
91
92         public void SetIdentityAndScale(Vector3 scale)
93         {
94             Interop.Matrix.SetIdentityAndScale(swigCPtr, Vector3.getCPtr(scale));
95             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
96         }
97
98         public void InvertTransform(Matrix result)
99         {
100             Interop.Matrix.InvertTransform(swigCPtr, Matrix.getCPtr(result));
101             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
102         }
103
104         public bool Invert()
105         {
106             bool ret = Interop.Matrix.Invert(swigCPtr);
107             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
108             return ret;
109         }
110
111         public void Transpose()
112         {
113             Interop.Matrix.Transpose(swigCPtr);
114             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
115         }
116
117         public Vector3 GetXAxis()
118         {
119             Vector3 ret = new Vector3(Interop.Matrix.GetXAxis(swigCPtr), true);
120             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121             return ret;
122         }
123
124         public Vector3 GetYAxis()
125         {
126             Vector3 ret = new Vector3(Interop.Matrix.GetYAxis(swigCPtr), true);
127             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
128             return ret;
129         }
130
131         public Vector3 GetZAxis()
132         {
133             Vector3 ret = new Vector3(Interop.Matrix.GetZAxis(swigCPtr), true);
134             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
135             return ret;
136         }
137
138         public void SetXAxis(Vector3 axis)
139         {
140             Interop.Matrix.SetXAxis(swigCPtr, Vector3.getCPtr(axis));
141             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
142         }
143
144         public void SetYAxis(Vector3 axis)
145         {
146             Interop.Matrix.SetYAxis(swigCPtr, Vector3.getCPtr(axis));
147             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
148         }
149
150         public void SetZAxis(Vector3 axis)
151         {
152             Interop.Matrix.SetZAxis(swigCPtr, Vector3.getCPtr(axis));
153             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154         }
155
156         public Vector4 GetTranslation()
157         {
158             Vector4 ret = new Vector4(Interop.Matrix.GetTranslation(swigCPtr), false);
159             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
160             return ret;
161         }
162
163         public Vector3 GetTranslation3()
164         {
165             Vector3 ret = new Vector3(Interop.Matrix.GetTranslation3(swigCPtr), false);
166             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167             return ret;
168         }
169
170         public void SetTranslation(Vector4 translation)
171         {
172             Interop.Matrix.SetTranslationVector4(swigCPtr, Vector4.getCPtr(translation));
173             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
174         }
175
176         public void SetTranslation(Vector3 translation)
177         {
178             Interop.Matrix.SetTranslationVector3(swigCPtr, Vector3.getCPtr(translation));
179             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
180         }
181
182         public void OrthoNormalize()
183         {
184             Interop.Matrix.OrthoNormalize(swigCPtr);
185             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
186         }
187
188         public SWIGTYPE_p_float AsFloat()
189         {
190             global::System.IntPtr cPtr = Interop.Matrix.AsFloat(swigCPtr);
191             SWIGTYPE_p_float ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_float(cPtr);
192             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
193             return ret;
194         }
195
196         public static void Multiply(Matrix result, Matrix lhs, Matrix rhs)
197         {
198             Interop.Matrix.Multiply(Matrix.getCPtr(result), Matrix.getCPtr(lhs), Matrix.getCPtr(rhs));
199             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
200         }
201
202         public static void Multiply(Matrix result, Matrix lhs, Rotation rhs)
203         {
204             Interop.Matrix.MultiplyQuaternion(Matrix.getCPtr(result), Matrix.getCPtr(lhs), Rotation.getCPtr(rhs));
205             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
206         }
207
208         public Vector4 Multiply(Vector4 rhs)
209         {
210             Vector4 ret = new Vector4(Interop.Matrix.Multiply(swigCPtr, Vector4.getCPtr(rhs)), true);
211             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
212             return ret;
213         }
214
215         public bool EqualTo(Matrix rhs)
216         {
217             bool ret = Interop.Matrix.EqualTo(swigCPtr, Matrix.getCPtr(rhs));
218             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
219             return ret;
220         }
221
222         public bool NotEqualTo(Matrix rhs)
223         {
224             bool ret = Interop.Matrix.NotEqualTo(swigCPtr, Matrix.getCPtr(rhs));
225             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
226             return ret;
227         }
228
229         public void SetTransformComponents(Vector3 scale, Rotation rotation, Vector3 translation)
230         {
231             Interop.Matrix.SetTransformComponents(swigCPtr, Vector3.getCPtr(scale), Rotation.getCPtr(rotation), Vector3.getCPtr(translation));
232             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
233         }
234
235         public void SetInverseTransformComponents(Vector3 scale, Rotation rotation, Vector3 translation)
236         {
237             Interop.Matrix.SetInverseTransformComponents(swigCPtr, Vector3.getCPtr(scale), Rotation.getCPtr(rotation), Vector3.getCPtr(translation));
238             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
239         }
240
241         public void SetInverseTransformComponents(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis, Vector3 translation)
242         {
243             Interop.Matrix.SetInverseTransformComponents(swigCPtr, Vector3.getCPtr(xAxis), Vector3.getCPtr(yAxis), Vector3.getCPtr(zAxis), Vector3.getCPtr(translation));
244             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
245         }
246
247         public void GetTransformComponents(Vector3 position, Rotation rotation, Vector3 scale)
248         {
249             Interop.Matrix.GetTransformComponents(swigCPtr, Vector3.getCPtr(position), Rotation.getCPtr(rotation), Vector3.getCPtr(scale));
250             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
251         }
252     }
253 }