161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
461847f8eSopenharmony_ci * you may not use this file except in compliance with the License.
561847f8eSopenharmony_ci * You may obtain a copy of the License at
661847f8eSopenharmony_ci *
761847f8eSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
861847f8eSopenharmony_ci *
961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and
1361847f8eSopenharmony_ci * limitations under the License.
1461847f8eSopenharmony_ci */
1561847f8eSopenharmony_ci
1661847f8eSopenharmony_ci/**
1761847f8eSopenharmony_ci * @file Defines 3D component
1861847f8eSopenharmony_ci * @kit ArkUI
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ci/**
2261847f8eSopenharmony_ci * Provides methods for controlling the 3d scene 
2361847f8eSopenharmony_ci *
2461847f8eSopenharmony_ci * @typedef { import('../api/@ohos.graphics.scene').Scene }
2561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUi.Graphics3D
2661847f8eSopenharmony_ci * @atomicservice 
2761847f8eSopenharmony_ci * @since 12 
2861847f8eSopenharmony_ci */
2961847f8eSopenharmony_cideclare type Scene = import('../api/@ohos.graphics.scene').Scene;
3061847f8eSopenharmony_ci
3161847f8eSopenharmony_ci/**
3261847f8eSopenharmony_ci * The enum of model type
3361847f8eSopenharmony_ci * @enum { number }
3461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUi.Graphics3D
3561847f8eSopenharmony_ci * @atomicservice
3661847f8eSopenharmony_ci * @since 12
3761847f8eSopenharmony_ci */
3861847f8eSopenharmony_cideclare enum ModelType {
3961847f8eSopenharmony_ci  /**
4061847f8eSopenharmony_ci   * Render to texture, gpu would compose this texture to screen.
4161847f8eSopenharmony_ci   *
4261847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUi.Graphics3D
4361847f8eSopenharmony_ci   * @atomicservice
4461847f8eSopenharmony_ci   * @since 12
4561847f8eSopenharmony_ci   */
4661847f8eSopenharmony_ci  TEXTURE = 0,
4761847f8eSopenharmony_ci
4861847f8eSopenharmony_ci  /**
4961847f8eSopenharmony_ci   * Render to surface, special hardware would compose this surface to screen.
5061847f8eSopenharmony_ci   *
5161847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUi.Graphics3D
5261847f8eSopenharmony_ci   * @atomicservice
5361847f8eSopenharmony_ci   * @since 12
5461847f8eSopenharmony_ci   */
5561847f8eSopenharmony_ci  SURFACE = 1,
5661847f8eSopenharmony_ci}
5761847f8eSopenharmony_ci
5861847f8eSopenharmony_ci/**
5961847f8eSopenharmony_ci * Scene options used by 3D scene control 
6061847f8eSopenharmony_ci *
6161847f8eSopenharmony_ci * @interface SceneOptions
6261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUi.Graphics3D
6361847f8eSopenharmony_ci * @atomicservice
6461847f8eSopenharmony_ci * @since 12
6561847f8eSopenharmony_ci */
6661847f8eSopenharmony_cideclare interface SceneOptions {
6761847f8eSopenharmony_ci  /**
6861847f8eSopenharmony_ci   * ResourceStr type for 3D rendering, Scene type for 3d scene controlling
6961847f8eSopenharmony_ci   *
7061847f8eSopenharmony_ci   * @type { ?(ResourceStr | Scene) }
7161847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUi.Graphics3D
7261847f8eSopenharmony_ci   * @atomicservice
7361847f8eSopenharmony_ci   * @since 12
7461847f8eSopenharmony_ci   */
7561847f8eSopenharmony_ci  scene?: ResourceStr | Scene;
7661847f8eSopenharmony_ci
7761847f8eSopenharmony_ci  /**
7861847f8eSopenharmony_ci   * Scene type when 3D rendering
7961847f8eSopenharmony_ci   *
8061847f8eSopenharmony_ci   * @type { ?ModelType }
8161847f8eSopenharmony_ci   * @default ModelType.SURFACE 
8261847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUi.Graphics3D
8361847f8eSopenharmony_ci   * @atomicservice
8461847f8eSopenharmony_ci   * @since 12
8561847f8eSopenharmony_ci   */
8661847f8eSopenharmony_ci  modelType?: ModelType; 
8761847f8eSopenharmony_ci}
8861847f8eSopenharmony_ci
8961847f8eSopenharmony_ci/**
9061847f8eSopenharmony_ci * Defines Component3D. 
9161847f8eSopenharmony_ci *
9261847f8eSopenharmony_ci * @interface Component3DInterface
9361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUi.Graphics3D
9461847f8eSopenharmony_ci * @atomicservice
9561847f8eSopenharmony_ci * @since 12
9661847f8eSopenharmony_ci */
9761847f8eSopenharmony_ciinterface Component3DInterface {
9861847f8eSopenharmony_ci  /**
9961847f8eSopenharmony_ci   * SceneOptions used by constructor 
10061847f8eSopenharmony_ci   *
10161847f8eSopenharmony_ci   * @param { SceneOptions } sceneOptions - The 3D scene controller
10261847f8eSopenharmony_ci   * @returns { Component3DAttribute }
10361847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUi.Graphics3D
10461847f8eSopenharmony_ci   * @atomicservice
10561847f8eSopenharmony_ci   * @since 12
10661847f8eSopenharmony_ci   */
10761847f8eSopenharmony_ci  (sceneOptions?: SceneOptions): Component3DAttribute;
10861847f8eSopenharmony_ci}
10961847f8eSopenharmony_ci
11061847f8eSopenharmony_ci/**
11161847f8eSopenharmony_ci * @extends CommonMethod<Component3DAttribute>
11261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUi.Graphics3D
11361847f8eSopenharmony_ci * @atomicservice
11461847f8eSopenharmony_ci * @since 12
11561847f8eSopenharmony_ci */
11661847f8eSopenharmony_cideclare class Component3DAttribute extends CommonMethod<Component3DAttribute> {
11761847f8eSopenharmony_ci  /**
11861847f8eSopenharmony_ci   * Load 3D model environment resource.
11961847f8eSopenharmony_ci   *
12061847f8eSopenharmony_ci   * @param { ResourceStr } uri - The path of 3D environment resource
12161847f8eSopenharmony_ci   * @returns { Component3DAttribute } The attribute of the component3D
12261847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUi.Graphics3D
12361847f8eSopenharmony_ci   * @atomicservice
12461847f8eSopenharmony_ci   * @since 12
12561847f8eSopenharmony_ci   */
12661847f8eSopenharmony_ci  environment(uri: ResourceStr): Component3DAttribute;
12761847f8eSopenharmony_ci
12861847f8eSopenharmony_ci  /**
12961847f8eSopenharmony_ci   * Set render pipeline of 3D scene render.
13061847f8eSopenharmony_ci   *
13161847f8eSopenharmony_ci   * @param { ResourceStr } uri - The path of Render pipeline config file
13261847f8eSopenharmony_ci   * @param { boolean } selfRenderUpdate - Trigger rendering every frame
13361847f8eSopenharmony_ci   * @returns { Component3DAttribute } The attribute of the component3D
13461847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUi.Graphics3D
13561847f8eSopenharmony_ci   * @atomicservice
13661847f8eSopenharmony_ci   * @since 12
13761847f8eSopenharmony_ci   */
13861847f8eSopenharmony_ci  customRender(uri: ResourceStr, selfRenderUpdate: boolean): Component3DAttribute;
13961847f8eSopenharmony_ci
14061847f8eSopenharmony_ci  /**
14161847f8eSopenharmony_ci   * Load shader uri. 
14261847f8eSopenharmony_ci   *
14361847f8eSopenharmony_ci   * @param { ResourceStr } uri - The path of custom shader
14461847f8eSopenharmony_ci   * @returns { Component3DAttribute } The attribute of the component3D
14561847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUi.Graphics3D
14661847f8eSopenharmony_ci   * @atomicservice
14761847f8eSopenharmony_ci   * @since 12
14861847f8eSopenharmony_ci   */
14961847f8eSopenharmony_ci  shader(uri: ResourceStr): Component3DAttribute;
15061847f8eSopenharmony_ci
15161847f8eSopenharmony_ci  /**
15261847f8eSopenharmony_ci   * Load shader texture uri. 
15361847f8eSopenharmony_ci   *
15461847f8eSopenharmony_ci   * @param { ResourceStr } uri - The path of texture used by shader
15561847f8eSopenharmony_ci   * @returns { Component3DAttribute } The attribute of the component3D
15661847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUi.Graphics3D
15761847f8eSopenharmony_ci   * @atomicservice
15861847f8eSopenharmony_ci   * @since 12
15961847f8eSopenharmony_ci   */
16061847f8eSopenharmony_ci  shaderImageTexture(uri: ResourceStr): Component3DAttribute;
16161847f8eSopenharmony_ci  
16261847f8eSopenharmony_ci  /**
16361847f8eSopenharmony_ci   * Buffer input for shader animation 
16461847f8eSopenharmony_ci   *
16561847f8eSopenharmony_ci   * @param { Array<number> } buffer - The uniform buffer of shader input
16661847f8eSopenharmony_ci   * @returns { Component3DAttribute } The attribute of the component3D
16761847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUi.Graphics3D
16861847f8eSopenharmony_ci   * @atomicservice
16961847f8eSopenharmony_ci   * @since 12
17061847f8eSopenharmony_ci   */
17161847f8eSopenharmony_ci  shaderInputBuffer(buffer: Array<number>): Component3DAttribute;
17261847f8eSopenharmony_ci
17361847f8eSopenharmony_ci  /**
17461847f8eSopenharmony_ci   * Set render width resolution. 
17561847f8eSopenharmony_ci   *
17661847f8eSopenharmony_ci   * @param { Dimension } value - Width of gpu render target, target would upscale or downscale to view's width.
17761847f8eSopenharmony_ci   * @returns { Component3DAttribute } The attribute of the component3D
17861847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUi.Graphics3D
17961847f8eSopenharmony_ci   * @atomicservice
18061847f8eSopenharmony_ci   * @since 12
18161847f8eSopenharmony_ci   */
18261847f8eSopenharmony_ci  renderWidth(value: Dimension): Component3DAttribute;
18361847f8eSopenharmony_ci
18461847f8eSopenharmony_ci  /**
18561847f8eSopenharmony_ci   * Set render height resolution. 
18661847f8eSopenharmony_ci   *
18761847f8eSopenharmony_ci   * @param { Dimension } value - Height of gpu render target, target would upscale or downscale to view's height.
18861847f8eSopenharmony_ci   * @returns { Component3DAttribute } The attribute of the component3D
18961847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUi.Graphics3D
19061847f8eSopenharmony_ci   * @atomicservice
19161847f8eSopenharmony_ci   * @since 12
19261847f8eSopenharmony_ci   */
19361847f8eSopenharmony_ci  renderHeight(value: Dimension): Component3DAttribute;
19461847f8eSopenharmony_ci}
19561847f8eSopenharmony_ci
19661847f8eSopenharmony_ci/**
19761847f8eSopenharmony_ci * Defines Component3D component. 
19861847f8eSopenharmony_ci *
19961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUi.Graphics3D
20061847f8eSopenharmony_ci * @atomicservice
20161847f8eSopenharmony_ci * @since 12
20261847f8eSopenharmony_ci */
20361847f8eSopenharmony_cideclare const Component3D: Component3DInterface;
20461847f8eSopenharmony_ci
20561847f8eSopenharmony_ci/**
20661847f8eSopenharmony_ci * Defines Component3D instance.
20761847f8eSopenharmony_ci *
20861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUi.Graphics3D
20961847f8eSopenharmony_ci * @atomicservice
21061847f8eSopenharmony_ci * @since 12
21161847f8eSopenharmony_ci */
21261847f8eSopenharmony_cideclare const Component3DInstance: Component3DAttribute;
213