# Type aliases

# RaycastDesc

Ƭ RaycastDesc: Object

raycast函数的参数。

field origin 射线起点。

field unitDir 射线方向(单位向量)。

field distance 射线的最大长度。

field hit 用来接收碰撞信息的容器。

field layerMask 可以用来屏蔽一些物体。

field (未实现)queryTriggerInteraction,是否能与Trigger相交(默认能)。

# Type declaration

Name Type
distance? number
hit? RaycastHit
layerMask? number
origin Vector3
unitDir Vector3

# TCameraBackground

Ƭ TCameraBackground: "default" | "skybox" | "ar"

相机背景渲染模式。

default模式只执行默认清屏。 skybox模式配合Env组件使用。 ar模式配合ARSystem使用。


# TDirection

Ƭ TDirection: "forwards" | "backwards" | "both"

动画播放的方向,如果是both,则会在loop开启时的每次循环中自动反转。


# TEventCallback

Ƭ TEventCallback<TParams>: (params: TParams, sender: Element) => void

# Type parameters

Name
TParams

# Type declaration

▸ (params, sender): void

事件管理器的回调。

# Parameters
Name Type
params TParams
sender Element
# Returns

void


# TTrackMode

Ƭ TTrackMode: "Plane" | "Marker" | "OSD" | "Face" | "Hand" | "Body" | "threeDof"

ARSystemARTracker的跟踪模式。 其中threeDof需要基础库2.30.4以上支持。


# Texture

Ƭ Texture: Kanata.Texture


# UniformBlock

Ƭ UniformBlock: Kanata.UniformBlock


# UniformDescriptor

Ƭ UniformDescriptor: Kanata.UniformDescriptor


# VertexLayout

Ƭ VertexLayout: Kanata.VertexLayout

# Variables

# ARSystemSchema

ARSystemSchema: IComponentSchema

ARSystemschema,详见IARSystemData


# ARTrackSchema

ARTrackSchema: Object

ARTrackerschema,详见IARTrackerData

# Type declaration

Name Type
autoSync { type: string = 'number-array' }
autoSync.type string
image { type: string = 'image' }
image.type string
mode { type: string = 'string' }
mode.type string
src { type: string = 'string' }
src.type string

# ARTrackerDataMapping

ARTrackerDataMapping: { auto-sync: string[] ; hit-id: string[] ; image: string[] ; mode: string[] ; src: string[] } & { layer: string[] ; node-id: string[] ; position: string[] ; rotation: string[] ; scale: string[] ; visible: string[] } & { [key: string]: string[]; }

默认包含XRNode的所有属性映射,以及将ARTracker组件的属性进行映射。


# ARTrackerDefaultComponents

ARTrackerDefaultComponents: IEntityComponents

默认包含XRNode的所有默认组件,以及ARTracker组件。


# AnimatorSchema

AnimatorSchema: Object

Animatorschema定义。

see 解析后的接口详见 IAnimatorData

# Type declaration

Name Type
autoPlay { type: string = 'dict' }
autoPlay.type string
clipMap { type: string = 'dict' }
clipMap.type string
keyframe { type: string = 'keyframe' }
keyframe.type string

# AssetLoadDataMapping

AssetLoadDataMapping: { asset-id: string[] ; defer: string[] ; options: string[] ; src: string[] ; type: string[] } & { [key: string]: string[]; }

AssetLoad组件的属性进行映射。


# AssetLoadSchema

AssetLoadSchema: IComponentSchema

AssetLoadschema,详见{@link IAssetLoadData}。


# AssetMaterialDataMapping

AssetMaterialDataMapping: { asset-id: string[] ; effect: string[] ; env-data: string[] ; marcos: string[] ; render-queue: string[] ; states: string[] ; uniforms: string[] } & { [key: string]: string[]; }

AssetMaterial的属性进行映射。


# AssetMaterialDefaultComponents

AssetMaterialDefaultComponents: IEntityComponents


# AssetMaterialSchema

AssetMaterialSchema: IComponentSchema

AssetMaterialschema,详见IAssetMaterialData


# AssetPostProcessDataMapping

AssetPostProcessDataMapping: { asset-id: string[] ; data: string[] ; is-hdr: string[] ; type: string[] } & { [key: string]: string[]; }

AssetPostProcess的属性进行映射。


# AssetPostProcessDefaultComponents

AssetPostProcessDefaultComponents: IEntityComponents


# AssetRenderTextureDataMapping

AssetRenderTextureDataMapping: { asset-id: string[] ; height: string[] ; is-hdr: string[] ; width: string[] } & { [key: string]: string[]; }

AssetRenderTexture的属性进行映射。


# AssetRenderTextureDefaultComponents

AssetRenderTextureDefaultComponents: IEntityComponents


# AssetRenderTextureSchema

AssetRenderTextureSchema: IComponentSchema

AssetRenderTextureschema,详见IAssetRenderTextureData


# AssetsDefaultComponents

AssetsDefaultComponents: IEntityComponents

默认包含Assets组件。


# AssetsSchema

AssetsSchema: IComponentSchema = {}


# BasicDataMapping

BasicDataMapping: Object

空的默认组件映射。

# Index signature

▪ [key: string]: string[]


# BasicDefaultComponents

BasicDefaultComponents: IEntityComponents = {}

空的默认组件集。


# CameraDataMapping

CameraDataMapping: { allow-features: string[] ; background: string[] ; clear-color: string[] ; clear-depth: string[] ; clear-stencil: string[] ; cull-mask: string[] ; depth: string[] ; far: string[] ; fov: string[] ; is-ar-camera: string[] ; is-clear-color: string[] ; is-clear-depth: string[] ; is-clear-stencil: string[] ; is-perspective: string[] ; near: string[] ; orth-size: string[] ; post-process: string[] ; render-target: string[] ; target: string[] } & { layer: string[] ; node-id: string[] ; position: string[] ; rotation: string[] ; scale: string[] ; visible: string[] } & { [key: string]: string[]; }

默认包含XRNode的所有属性映射,以及将Camera组件的属性进行映射。


# CameraDefaultComponents

CameraDefaultComponents: IEntityComponents

默认包含XRNode的所有默认组件,以及Camera组件。


# CameraOrbitControlSchema

CameraOrbitControlSchema: IComponentSchema

CameraOrbitControlschema,详见ICameraOrbitControlData


# CameraSchema

CameraSchema: IComponentSchema

Cameraschema,详见ICameraData


# CapsuleShapeSchema

CapsuleShapeSchema: IComponentSchema


# CubeShapeSchema

CubeShapeSchema: IComponentSchema


# EnvDataMapping

EnvDataMapping: { diffuse-exp: string[] ; env-data: string[] ; is-sky2d: string[] ; rotation: string[] ; sky-map: string[] ; specular-exp: string[] } & { [key: string]: string[]; }

默认将Env组件的属性进行映射。


# EnvDefaultComponents

EnvDefaultComponents: IEntityComponents

默认包含Env组件。


# EnvSchema

EnvSchema: IComponentSchema

Envschema,详见IEnvData


# GLTFDataMapping

GLTFDataMapping: { cast-shadow: string[] ; model: string[] ; never-cull: string[] ; receive-shadow: string[] ; states: string[] } & { layer: string[] ; node-id: string[] ; position: string[] ; rotation: string[] ; scale: string[] ; visible: string[] } & { [key: string]: string[]; }

默认包含XRNode的所有属性映射,以及将GLTF组件的属性进行映射。

  • model → {@link IGLTFComponentData.model}
  • cast-shadow → {@link IGLTFComponentData.castShadow}
  • receive-shadow → {@link IGLTFComponentData.receiveShadow}

# GLTFDefaultComponents

GLTFDefaultComponents: IEntityComponents

默认包含XRNode的所有默认组件,以及GLTF组件。


# GLTFSchema

GLTFSchema: IComponentSchema


# LightDataMapping

LightDataMapping: { cast-shadow: string[] ; color: string[] ; inner-cone-angle: string[] ; intensity: string[] ; outer-cone-angle: string[] ; range: string[] ; shadow-bias: string[] ; shadow-distance: string[] ; shadow-strength: string[] ; type: string[] } & { layer: string[] ; node-id: string[] ; position: string[] ; rotation: string[] ; scale: string[] ; visible: string[] } & { [key: string]: string[]; }

默认包含XRNode的所有属性映射,以及将Light组件的属性进行映射。


# LightDefaultComponents

LightDefaultComponents: IEntityComponents

默认包含XRNode的所有默认组件,以及Light组件。


# LightSchema

LightSchema: IComponentSchema

Lightschema,详见ILightData


# MeshDataMapping

MeshDataMapping: { cast-shadow: string[] ; env-data: string[] ; geometry: string[] ; material: string[] ; never-cull: string[] ; receive-shadow: string[] ; states: string[] ; uniforms: string[] } & { layer: string[] ; node-id: string[] ; position: string[] ; rotation: string[] ; scale: string[] ; visible: string[] } & { [key: string]: string[]; }

默认包含XRNode的所有属性映射,以及将Mesh组件的属性进行映射。


# MeshDefaultComponents

MeshDefaultComponents: IEntityComponents

默认包含XRNode的所有默认组件,以及Mesh组件。


# MeshSchema

MeshSchema: IComponentSchema

Meshschema,详见IMeshData


# MeshShapeSchema

MeshShapeSchema: IComponentSchema


# NodeDataMapping

NodeDataMapping: { layer: string[] ; node-id: string[] ; position: string[] ; rotation: string[] ; scale: string[] ; visible: string[] } & { [key: string]: string[]; }

默认将Transform组件的属性进行映射。


# NodeDefaultComponents

NodeDefaultComponents: IEntityComponents

默认包含Transform组件。


# ParticleDataMapping

ParticleDataMapping: Object

# Index signature

▪ [key: string]: string[]


# ParticleDefaultComponents

ParticleDefaultComponents: IEntityComponents


# ParticleSchema

ParticleSchema: IComponentSchema

Particleschema定义。

see 解析后的接口详见 IParticleData


# RenderSystemSchema

RenderSystemSchema: IComponentSchema

RenderSystemschema,详见IRenderSystemData


# RigidbodySchema

RigidbodySchema: Object

# Type declaration

Name Type
constraintsMask { type: string = 'number' }
constraintsMask.type string
disabled { type: string = 'boolean' }
disabled.type string
kinematic { type: string = 'boolean' }
kinematic.type string
mass { type: string = 'number' }
mass.type string
useGravity { type: string = 'boolean' }
useGravity.type string

# SceneDataMapping

SceneDataMapping: Object = {}

场景的默认映射。

# Index signature

▪ [key: string]: string[]


# SceneDefaultComponents

SceneDefaultComponents: IEntityComponents

场景的默认组件,均为系统。


# ShadowDataMapping

ShadowDataMapping: { layer: string[] ; node-id: string[] ; position: string[] ; rotation: string[] ; scale: string[] ; visible: string[] } & { [key: string]: string[]; }

默认包含XRNode的所有属性映射。


# ShadowDefaultComponents

ShadowDefaultComponents: IEntityComponents

默认包含XRNode的所有默认组件。


# ShapeInteractSchema

ShapeInteractSchema: Object

# Type declaration

Name Type
bounciness { type: string = 'number' }
bounciness.type string
collide { type: string = 'boolean' }
collide.type string
disabled { type: string = 'boolean' }
disabled.type string
dynamicFriction { type: string = 'number' }
dynamicFriction.type string
staticFriction { type: string = 'number' }
staticFriction.type string

# SphereShapeSchema

SphereShapeSchema: IComponentSchema


# TextDataMapping

TextDataMapping: Object

# Index signature

▪ [key: string]: string[]


# TextDefaultComponents

TextDefaultComponents: IEntityComponents


# TextSchema

TextSchema: IComponentSchema


# TransformSchema

TransformSchema: IComponentSchema

Transformschema,详见ITransformData


# noneParamsEaseFuncs

noneParamsEaseFuncs: Object

不需要自定义参数的一些内置插值曲线。

# Type declaration

Name Type
ease-in (x: number) => number
ease-in-back (x: any) => number
ease-in-bounce (x: any) => number
ease-in-circ (x: any) => number
ease-in-cubic (x: any) => number
ease-in-elastic (x: any) => number
ease-in-expo (x: any) => number
ease-in-out (x: number) => number
ease-in-out-back (x: any) => number
ease-in-out-bounce (x: any) => number
ease-in-out-circ (x: any) => number
ease-in-out-cubic (x: any) => number
ease-in-out-elastic (x: any) => number
ease-in-out-expo (x: any) => number
ease-in-out-quad (x: any) => number
ease-in-out-quart (x: any) => number
ease-in-out-quint (x: any) => number
ease-in-out-sine (x: any) => number
ease-in-quad (x: any) => number
ease-in-quart (x: any) => number
ease-in-quint (x: any) => number
ease-in-sine (x: any) => number
ease-out (x: number) => number
ease-out-back (x: any) => number
ease-out-bounce TEaseFunction
ease-out-circ (x: any) => number
ease-out-cubic (x: any) => number
ease-out-elastic (x: any) => number
ease-out-expo (x: any) => number
ease-out-quad (x: any) => number
ease-out-quart (x: any) => number
ease-out-quint (x: any) => number
ease-out-sine (x: any) => number
linear (x: any) => any

# useParamsEaseFuncs

useParamsEaseFuncs: Object

可以自定义参数的插值函数。

# Type declaration

Name Type
cubic-bezier (times: number[], params: number[]) => (x: number) => number
steps (times: number[], params: number[]) => (x: number) => number

# Functions

# genLspMeta

genLspMeta(scene): IXRFrameMeta

# Parameters

Name Type
scene Scene

# Returns

IXRFrameMeta


# isTextureWrapper

isTextureWrapper(value): value is ITextureWrapper

# Parameters

Name Type
value any

# Returns

value is ITextureWrapper


# registerAssetLoader

registerAssetLoader(type, clz): void

注册一个资源加载器。注意注册后该type会被自动注册到DataValue中:registerDataValue。 在基础库版本v2.29.2以上导出。

# Parameters

Name Type Description
type string 类型,也是写在AssetLoad上的那个type
clz (scene: Scene, type: string) => AssetLoader<any, any> 继承自AssetLoader的自定义资源加载器类。

# Returns

void


# registerComponent

registerComponent(type, clz): void

向系统中注册一个组件,然后可以在xml中使用。

# Parameters

Name Type
type string
clz () => Component<any>

# Returns

void


# registerDataValue

registerDataValue<TDataValue>(type, handler): void

为组件在xml中写的属性值按类型注册解析器,由于xml传入的值全部都是字符串,所以需要解析,比如:

registerDataValue('number', {create: (value: string, defaultValue: any, scene: Scene) => {
  return value === undefined ? defaultValue : parseFloat(value));
}});

就是注册了number类型,后续在组件的schema中写的number类型数据,就会走这个解析器。 注意最后一个参数scene可以用于获取资源等,比如scene.assets.getAssetWithState(type, value, defaultValue) 如果是被资源加载器加载的资源,则会在资源加载器注册时自动注册数据类型,详见AssetLoader

已经注册的类型可见组件数据解析

# Type parameters

Name
TDataValue

# Parameters

Name Type
type string
handler IDataValueHandler<TDataValue>

# Returns

void


# registerEffect

Const registerEffect(id, factory): void

注册Effect资源。

# Parameters

Name Type
id string
factory (scene: Scene) => Effect

# Returns

void


# registerElement

registerElement(type, clz): void

注册一个自定义元素。 注意注册的typexml中使用时需要加上xr-前缀,比如注册custom类型的元素,使用时需要时xr-custom

# Parameters

Name Type
type string
clz typeof Element

# Returns

void


# registerGeometry

Const registerGeometry(id, factory): void

注册Geometry资源。

# Parameters

Name Type
id string
factory (scene: Scene) => Geometry

# Returns

void


# registerMaterial

Const registerMaterial(id, factory): void

注册Material资源。

# Parameters

Name Type
id string
factory (scene: Scene) => Material

# Returns

void


# registerTexture

Const registerTexture(id, factory): void

注册Texture资源。

# Parameters

Name Type
id string
factory (scene: Scene) => default

# Returns

void


# registerUniformDesc

Const registerUniformDesc(id, factory): void

注册UniformDescriptor资源。

# Parameters

Name Type
id string
factory (scene: Scene) => default

# Returns

void


# registerVertexDataDesc

Const registerVertexDataDesc(id, factory): void

注册VertexDataDescriptor资源。

# Parameters

Name Type
id string
factory (scene: Scene) => default

# Returns

void


# registerVertexLayout

Const registerVertexLayout(id, factory): void

注册VertexLayout资源。

# Parameters

Name Type
id string
factory (scene: Scene) => default

# Returns

void