graphic3d新增读取系统资源路径接口

Signed-off-by: donglongping <donglongping@huawei.com>
This commit is contained in:
donglongping 2024-08-13 10:43:25 +08:00
parent 42cf0adc04
commit fed98b41e1
3 changed files with 22 additions and 24 deletions

View File

@ -26,7 +26,7 @@
* @atomicservice
* @since 12
*/
declare type Scene = import('../api/@ohos.graphics.scene').Scene
declare type Scene = import('../api/@ohos.graphics.scene').Scene;
/**
* The enum of model type
@ -65,14 +65,14 @@ declare enum ModelType {
*/
declare interface SceneOptions {
/**
* Resource type for 3D rendering, Scene type for 3d scene controlling
* ResourceStr type for 3D rendering, Scene type for 3d scene controlling
*
* @type { ?(Resource | Scene) }
* @type { ?(ResourceStr | Scene) }
* @syscap SystemCapability.ArkUi.Graphics3D
* @atomicservice
* @since 12
*/
scene?: Resource | Scene;
scene?: ResourceStr | Scene;
/**
* Scene type when 3D rendering
@ -117,47 +117,47 @@ declare class Component3DAttribute extends CommonMethod<Component3DAttribute> {
/**
* Load 3D model environment resource.
*
* @param { Resource } uri - The path of 3D environment resource
* @param { ResourceStr } uri - The path of 3D environment resource
* @returns { Component3DAttribute } The attribute of the component3D
* @syscap SystemCapability.ArkUi.Graphics3D
* @atomicservice
* @since 12
*/
environment(uri: Resource): Component3DAttribute;
environment(uri: ResourceStr): Component3DAttribute;
/**
* Set render pipeline of 3D scene render.
*
* @param { Resource } uri - The path of Render pipeline config file
* @param { ResourceStr } 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
* @atomicservice
* @since 12
*/
customRender(uri: Resource, selfRenderUpdate: boolean): Component3DAttribute;
customRender(uri: ResourceStr, selfRenderUpdate: boolean): Component3DAttribute;
/**
* Load shader uri.
*
* @param { Resource } uri - The path of custom shader
* @param { ResourceStr } uri - The path of custom shader
* @returns { Component3DAttribute } The attribute of the component3D
* @syscap SystemCapability.ArkUi.Graphics3D
* @atomicservice
* @since 12
*/
shader(uri: Resource): Component3DAttribute;
shader(uri: ResourceStr): Component3DAttribute;
/**
* Load shader texture uri.
*
* @param { Resource } uri - The path of texture used by shader
* @param { ResourceStr } uri - The path of texture used by shader
* @returns { Component3DAttribute } The attribute of the component3D
* @syscap SystemCapability.ArkUi.Graphics3D
* @atomicservice
* @since 12
*/
shaderImageTexture(uri: Resource): Component3DAttribute;
shaderImageTexture(uri: ResourceStr): Component3DAttribute;
/**
* Buffer input for shader animation

View File

@ -18,9 +18,8 @@
* @kit ArkGraphics3D
*/
import { Shader, MaterialType, Material, Animation, Environment, Image } from './SceneResources'
import { Camera, LightType, Light, Node, NodeType } from './SceneNodes'
import { Resource } from 'GlobalResource';
import { Shader, MaterialType, Material, Animation, Environment, Image } from './SceneResources';
import { Camera, LightType, Light, Node, NodeType } from './SceneNodes';
/**
* The scene resource parameters type.
@ -42,11 +41,11 @@ export interface SceneResourceParameters {
/**
* The resource uri of the scene resource parameters.
*
* @type { ?Resource }
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUi.Graphics3D
* @since 12
*/
uri?: Resource;
uri?: ResourceStr;
}
/**
@ -165,15 +164,15 @@ export interface SceneResourceFactory {
*/
export class Scene {
/**
* Create a new scene from a Resource.
* Create a new scene from a ResourceStr.
*
* @param { Resource } uri - the resource of creating a scene
* @param { ResourceStr } uri - the resource of creating a scene
* @returns { Promise<Scene> } promise a scene
* @static
* @syscap SystemCapability.ArkUi.Graphics3D
* @since 12
*/
static load(uri? : Resource): Promise<Scene>;
static load(uri? : ResourceStr): Promise<Scene>;
/**
* The environment of the scene.

View File

@ -19,8 +19,7 @@
*/
import { Vec2, Vec3, Vec4, Aabb } from './SceneTypes';
import { Resource } from 'GlobalResource';
import { Callback } from '../@ohos.base'
import { Callback } from '../@ohos.base';
/**
* The enum of SceneResource type.
@ -125,12 +124,12 @@ export interface SceneResource {
/**
* Scene resource uri.
*
* @type { ?Resource }
* @type { ?ResourceStr }
* @readonly
* @syscap SystemCapability.ArkUi.Graphics3D
* @since 12
*/
readonly uri?: Resource;
readonly uri?: ResourceStr;
/**