• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024-2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file Defines 3D basic types
18 * @kit ArkGraphics3D
19 */
20
21/**
22 * Defines Vec2.
23 *
24 * @typedef Vec2
25 * @syscap SystemCapability.ArkUi.Graphics3D
26 * @since 12
27 */
28export interface Vec2 {
29  /**
30   * X component of the vec2.
31   *
32   * @type { number }
33   * @syscap SystemCapability.ArkUi.Graphics3D
34   * @since 12
35   */
36  x: number;
37
38  /**
39   * Y component of the vec2.
40   *
41   * @type { number }
42   * @syscap SystemCapability.ArkUi.Graphics3D
43   * @since 12
44   */
45  y: number;
46}
47
48/**
49 * Defines Vec3.
50 *
51 * @typedef Vec3
52 * @syscap SystemCapability.ArkUi.Graphics3D
53 * @since 12
54 */
55export interface Vec3 {
56  /**
57   * X component of the vec3.
58   *
59   * @type { number }
60   * @syscap SystemCapability.ArkUi.Graphics3D
61   * @since 12
62   */
63  x: number;
64
65  /**
66   * Y component of the vec3.
67   *
68   * @type { number }
69   * @syscap SystemCapability.ArkUi.Graphics3D
70   * @since 12
71   */
72  y: number;
73
74  /**
75   * Z component of the vec3.
76   *
77   * @type { number }
78   * @syscap SystemCapability.ArkUi.Graphics3D
79   * @since 12
80   */
81  z: number;
82}
83
84/**
85 * Defines Vec4.
86 *
87 * @typedef Vec4
88 * @syscap SystemCapability.ArkUi.Graphics3D
89 * @since 12
90 */
91export interface Vec4 {
92  /**
93   * X component of the vec4.
94   *
95   * @type { number }
96   * @syscap SystemCapability.ArkUi.Graphics3D
97   * @since 12
98   */
99  x: number;
100
101  /**
102   * Y component of the vec4.
103   *
104   * @type { number }
105   * @syscap SystemCapability.ArkUi.Graphics3D
106   * @since 12
107   */
108  y: number;
109
110  /**
111   * Z component of the vec4.
112   *
113   * @type { number }
114   * @syscap SystemCapability.ArkUi.Graphics3D
115   * @since 12
116   */
117  z: number;
118
119  /**
120   * W component of the vec4.
121   *
122   * @type { number }
123   * @syscap SystemCapability.ArkUi.Graphics3D
124   * @since 12
125   */
126  w: number;
127}
128
129/**
130 * Quaternion representing a rotation.
131 *
132 * @typedef Quaternion
133 * @syscap SystemCapability.ArkUi.Graphics3D
134 * @since 12
135 */
136export interface Quaternion {
137  /**
138   * X component of the quaternion.
139   *
140   * @type { number }
141   * @syscap SystemCapability.ArkUi.Graphics3D
142   * @since 12
143   */
144  x: number;
145
146  /**
147   * Y component of the quaternion.
148   *
149   * @type { number }
150   * @syscap SystemCapability.ArkUi.Graphics3D
151   * @since 12
152   */
153  y: number;
154
155  /**
156   * Z component of the quaternion.
157   *
158   * @type { number }
159   * @syscap SystemCapability.ArkUi.Graphics3D
160   * @since 12
161   */
162  z: number;
163
164  /**
165   * W component of the quaternion.
166   *
167   * @type { number }
168   * @syscap SystemCapability.ArkUi.Graphics3D
169   * @since 12
170   */
171  w: number;
172}
173
174/**
175 * Axis aligned bounding box.
176 *
177 * @typedef Aabb
178 * @syscap SystemCapability.ArkUi.Graphics3D
179 * @since 12
180 */
181export interface Aabb {
182  /**
183   * Coordinates of the AABB minimum corner.
184   *
185   * @type { Vec3 }
186   * @syscap SystemCapability.ArkUi.Graphics3D
187   * @since 12
188   */
189  aabbMin: Vec3;
190
191  /**
192   * Coordinates of the AABB maximum corner.
193   *
194   * @type { Vec3 }
195   * @syscap SystemCapability.ArkUi.Graphics3D
196   * @since 12
197   */
198  aabbMax: Vec3;
199}
200
201/**
202 * Defines Color.
203 *
204 * @typedef Color
205 * @syscap SystemCapability.ArkUi.Graphics3D
206 * @since 12
207 */
208export interface Color {
209  /**
210   * R component of the color.
211   *
212   * @type { number }
213   * @syscap SystemCapability.ArkUi.Graphics3D
214   * @since 12
215   */
216  r: number;
217
218  /**
219   * G component of the color.
220   *
221   * @type { number }
222   * @syscap SystemCapability.ArkUi.Graphics3D
223   * @since 12
224   */
225  g: number;
226
227  /**
228   * B component of the color.
229   *
230   * @type { number }
231   * @syscap SystemCapability.ArkUi.Graphics3D
232   * @since 12
233   */
234  b: number;
235
236  /**
237   * A component of the color.
238   *
239   * @type { number }
240   * @syscap SystemCapability.ArkUi.Graphics3D
241   * @since 12
242   */
243  a: number;
244}
245
246/**
247 * Defines rectangle.
248 *
249 * @typedef Rect
250 * @syscap SystemCapability.ArkUi.Graphics3D
251 * @since 12
252 */
253export interface Rect {
254  /**
255   * Left up x coordinate.
256   *
257   * @type { number }
258   * @syscap SystemCapability.ArkUi.Graphics3D
259   * @since 12
260   */
261  x: number;
262
263  /**
264   * Left up y coordinate.
265   *
266   * @type { number }
267   * @syscap SystemCapability.ArkUi.Graphics3D
268   * @since 12
269   */
270  y: number;
271
272  /**
273   * The width of the rectangle.
274   *
275   * @type { number }
276   * @syscap SystemCapability.ArkUi.Graphics3D
277   * @since 12
278   */
279  width: number;
280
281  /**
282   * The height of the rectangle.
283   *
284   * @type { number }
285   * @syscap SystemCapability.ArkUi.Graphics3D
286   * @since 12
287   */
288  height: number;
289}
290
291/**
292 * 3D position information.
293 *
294 * @typedef { Vec3 }
295 * @syscap SystemCapability.ArkUi.Graphics3D
296 * @since 12
297 */
298export type Position3 = Vec3;
299
300/**
301 * 3D rotation info as euler angles.
302 *
303 * @typedef { Vec3 }
304 * @syscap SystemCapability.ArkUi.Graphics3D
305 * @since 12
306 */
307export type Rotation3 = Vec3;
308
309/**
310 * 3D scale information.
311 *
312 * @typedef { Vec3 }
313 * @syscap SystemCapability.ArkUi.Graphics3D
314 * @since 12
315 */
316export type Scale3 = Vec3;
317