新增3D控件

Signed-off-by: huxiaoming5@huawei.com <huxiaoming5@huawei.com>
Change-Id: I84b648b7c89affa88a5de36b397c56568579eb0c
Signed-off-by: huxiaoming5@huawei.com <huxiaoming5@huawei.com>
This commit is contained in:
huxiaoming5@huawei.com 2023-12-14 23:53:14 +08:00
parent 228285d99d
commit de6d99d2be
5 changed files with 209 additions and 2 deletions

View File

@ -0,0 +1,198 @@
/*
* Copyright (c) 2023-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* The enum of model type
* @enum { number }
* @syscap SystemCapability.ArkUi.Graphics3D
* @systemapi
* @since 11
*/
declare enum ModelType {
/**
* Render to texture, gpu would compose this texture to screen.
*
* @syscap SystemCapability.ArkUi.Graphics3D
* @systemapi
* @since 11
*/
TEXTURE = 0,
/**
* Render to surface, special hardware would compose this surface to screen.
*
* @syscap SystemCapability.ArkUi.Graphics3D
* @systemapi
* @since 11
*/
SURFACE = 1,
}
/**
* Scene options used by 3D scene control
*
* @interface SceneOptions
* @syscap SystemCapability.ArkUi.Graphics3D
* @systemapi
* @since 11
*/
declare interface SceneOptions {
/**
* Scene resource when 3D rendering
*
* @type { ?Resource }
* @syscap SystemCapability.ArkUi.Graphics3D
* @systemapi
* @since 11
*/
scene?: Resource;
/**
* Scene type when 3D rendering
*
* @type { ?ModelType }
* @default ModelType.SURFACE
* @syscap SystemCapability.ArkUi.Graphics3D
* @systemapi
* @since 11
*/
modelType?: ModelType;
}
/**
* Defines Component3D.
*
* @interface Component3DInterface
* @syscap SystemCapability.ArkUi.Graphics3D
* @systemapi
* @since 11
*/
interface Component3DInterface {
/**
* SceneOptions used by constructor
*
* @param { SceneOptions } sceneOptions - The 3D scene controller
* @returns { Component3DAttribute }
* @syscap SystemCapability.ArkUi.Graphics3D
* @systemapi
* @since 11
*/
(sceneOptions?: SceneOptions): Component3DAttribute;
}
/**
* @extends CommonMethod<Component3DAttribute>
* @syscap SystemCapability.ArkUi.Graphics3D
* @systemapi
* @since 11
*/
declare class Component3DAttribute extends CommonMethod<Component3DAttribute> {
/**
* Load 3D model environment resource.
*
* @param { Resource } uri - The path of 3D environment resource
* @returns { Component3DAttribute } The attribute of the component3D
* @syscap SystemCapability.ArkUi.Graphics3D
* @systemapi
* @since 11
*/
environment(uri: Resource): Component3DAttribute;
/**
* Set render pipeline of 3D scene render.
*
* @param { Resource } uri - The path of Render pipeline config file
* @param { boolean } selfRenderUpdate - Trigger rendering every frame
* @returns { Component3DAttribute } The attribute of the component3D
* @syscap SystemCapability.ArkUi.Graphics3D
* @systemapi
* @since 11
*/
customRender(uri: Resource, selfRenderUpdate: boolean): Component3DAttribute;
/**
* Load shader uri.
*
* @param { Resource } uri - The path of custom shader
* @returns { Component3DAttribute } The attribute of the component3D
* @syscap SystemCapability.ArkUi.Graphics3D
* @systemapi
* @since 11
*/
shader(uri: Resource): Component3DAttribute;
/**
* Load shader texture uri.
*
* @param { Resource } uri - The path of texture used by shader
* @returns { Component3DAttribute } The attribute of the component3D
* @syscap SystemCapability.ArkUi.Graphics3D
* @systemapi
* @since 11
*/
shaderImageTexture(uri: Resource): Component3DAttribute;
/**
* Buffer input for shader animation
*
* @param { Array<number> } buffer - The uniform buffer of shader input
* @returns { Component3DAttribute } The attribute of the component3D
* @syscap SystemCapability.ArkUi.Graphics3D
* @systemapi
* @since 11
*/
shaderInputBuffer(buffer: Array<number>): Component3DAttribute;
/**
* Set render width resolution.
*
* @param { Dimension } value - Width of gpu render target, target would upscale or downscale to view's width.
* @returns { Component3DAttribute } The attribute of the component3D
* @syscap SystemCapability.ArkUi.Graphics3D
* @systemapi
* @since 11
*/
renderWidth(value: Dimension): Component3DAttribute;
/**
* Set render height resolution.
*
* @param { Dimension } value - Height of gpu render target, target would upscale or downscale to view's height.
* @returns { Component3DAttribute } The attribute of the component3D
* @syscap SystemCapability.ArkUi.Graphics3D
* @systemapi
* @since 11
*/
renderHeight(value: Dimension): Component3DAttribute;
}
/**
* Defines Component3D component.
*
* @syscap SystemCapability.ArkUi.Graphics3D
* @systemapi
* @since 11
*/
declare const Component3D: Component3DInterface;
/**
* Defines Component3D instance.
*
* @syscap SystemCapability.ArkUi.Graphics3D
* @systemapi
* @since 11
*/
declare const Component3DInstance: Component3DAttribute;

View File

@ -128,3 +128,4 @@
/// <reference path="./image_span.d.ts" />
/// <reference path="./effect_component.d.ts" />
/// <reference path="./ui_extension_component.d.ts" />
/// <reference path="./component3d.d.ts" />

View File

@ -221,6 +221,7 @@
"SystemCapability.Multimedia.Media.AVScreenCapture",
"SystemCapability.AI.IntelligentVoice.Core",
"SystemCapability.Multimedia.Media.SoundPool",
"SystemCapability.Multimedia.Audio.Spatialization"
"SystemCapability.Multimedia.Audio.Spatialization",
"SystemCapability.ArkUi.Graphics3D"
]
}

View File

@ -343,7 +343,8 @@
"SystemCapability.AI.IntelligentVoice.Core",
"SystemCapability.Msdp.DeviceStatus.Drag",
"SystemCapability.DistributedDataManager.CommonType",
"SystemCapability.Multimedia.Audio.Spatialization"
"SystemCapability.Multimedia.Audio.Spatialization",
"SystemCapability.ArkUi.Graphics3D"
]
},
"administrators": [

View File

@ -24,6 +24,7 @@
"ColorPickerDialog",
"Column",
"ColumnSplit",
"Component3D",
"Counter",
"DataPanel",
"DatePicker",
@ -190,6 +191,11 @@
"type": "ColumnSplitAttribute",
"instance": "ColumnSplitInstance"
},
{
"name": "Component3D",
"type": "Component3DAttribute",
"instance": "Component3DInstance"
},
{
"name": "Counter",
"type": "CounterAttribute",