@galacean/effects-plugin-model 2.0.0-alpha.20 → 2.0.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alipay.js +195 -1658
- package/dist/alipay.js.map +1 -1
- package/dist/alipay.mjs +196 -1656
- package/dist/alipay.mjs.map +1 -1
- package/dist/gltf/index.d.ts +1 -2
- package/dist/gltf/loader-ext.d.ts +5 -36
- package/dist/gltf/loader-impl.d.ts +61 -63
- package/dist/gltf/protocol.d.ts +42 -38
- package/dist/helper/index.d.ts +0 -1
- package/dist/index.js +196 -1659
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +197 -1657
- package/dist/index.mjs.map +1 -1
- package/dist/loader.mjs +9032 -10492
- package/dist/loader.mjs.map +1 -1
- package/dist/runtime/skybox.d.ts +3 -3
- package/package.json +4 -4
- package/dist/gltf/loader-ecs-ext.d.ts +0 -18
- package/dist/gltf/loader-ecs.d.ts +0 -121
package/dist/gltf/index.d.ts
CHANGED
|
@@ -1,49 +1,18 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Player, spec } from '@galacean/effects';
|
|
1
|
+
import type { Player } from '@galacean/effects';
|
|
3
2
|
import type { LoadSceneOptions, LoadSceneResult } from './protocol';
|
|
3
|
+
import { spec } from '@galacean/effects';
|
|
4
4
|
import { LoaderImpl } from './loader-impl';
|
|
5
5
|
export declare class LoaderImplEx extends LoaderImpl {
|
|
6
6
|
loadScene(options: LoadSceneOptions): Promise<LoadSceneResult>;
|
|
7
|
-
/**
|
|
8
|
-
* 检查序列化和反序列逻辑,排查渲染场景中渲染正常和编辑器中渲染错误的问题。
|
|
9
|
-
* 针对Image、Texture、Material、Mesh、Scene、Animation和IBL的检查。
|
|
10
|
-
*
|
|
11
|
-
* @param res 加载的GLTF场景资源
|
|
12
|
-
*/
|
|
13
|
-
checkSerializer(res: GLTFResources): Promise<void>;
|
|
14
7
|
}
|
|
15
|
-
export interface
|
|
8
|
+
export interface LoadGLTFOptions {
|
|
16
9
|
url: string;
|
|
17
10
|
player: Player;
|
|
18
11
|
playAnimation?: number;
|
|
12
|
+
playAllAnimation?: boolean;
|
|
19
13
|
camera?: {
|
|
20
14
|
position?: spec.vec3;
|
|
21
15
|
rotation?: spec.vec3;
|
|
22
16
|
};
|
|
23
17
|
}
|
|
24
|
-
export declare function
|
|
25
|
-
compositionId: number;
|
|
26
|
-
requires: never[];
|
|
27
|
-
compositions: {
|
|
28
|
-
name: string;
|
|
29
|
-
id: number;
|
|
30
|
-
duration: number;
|
|
31
|
-
endBehavior: number;
|
|
32
|
-
camera: {
|
|
33
|
-
fov: number;
|
|
34
|
-
far: number;
|
|
35
|
-
near: number;
|
|
36
|
-
position: number[];
|
|
37
|
-
clipMode: number;
|
|
38
|
-
};
|
|
39
|
-
items: spec.BaseItem[];
|
|
40
|
-
meta: {
|
|
41
|
-
previewSize: number[];
|
|
42
|
-
};
|
|
43
|
-
}[];
|
|
44
|
-
gltf: never[];
|
|
45
|
-
images: never[];
|
|
46
|
-
shapes: never[];
|
|
47
|
-
plugins: string[];
|
|
48
|
-
version: string;
|
|
49
|
-
}>;
|
|
18
|
+
export declare function loadGLTF(options: LoadGLTFOptions): Promise<spec.JSONScene>;
|
|
@@ -1,56 +1,62 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import type { Loader,
|
|
4
|
-
import type {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { spec } from '@galacean/effects';
|
|
2
|
+
import type { TextureSourceOptions, math } from '@galacean/effects';
|
|
3
|
+
import type { SkyboxType, LoadSceneOptions, LoadSceneResult, Loader, ModelCamera, ModelLight, ModelSkybox, ModelImageLike } from './protocol';
|
|
4
|
+
import type { ModelMeshComponentData, ModelSkyboxComponentData, ModelTreeOptions, ModelLightComponentData, ModelCameraComponentData } from '../index';
|
|
5
|
+
import { PSkyboxType } from '../runtime';
|
|
6
|
+
import type { GLTFResources } from '@vvfx/resource-detection';
|
|
7
|
+
export interface LoaderOptions {
|
|
8
|
+
compatibleMode?: 'gltf' | 'tiny3d';
|
|
9
|
+
}
|
|
10
|
+
export declare function getDefaultEffectsGLTFLoader(options?: LoaderOptions): Loader;
|
|
9
11
|
export declare function setDefaultEffectsGLTFLoader(loader: Loader): void;
|
|
10
12
|
export declare class LoaderImpl implements Loader {
|
|
11
|
-
private
|
|
12
|
-
private
|
|
13
|
-
private
|
|
14
|
-
private
|
|
15
|
-
private
|
|
16
|
-
private
|
|
17
|
-
private
|
|
18
|
-
private
|
|
19
|
-
private
|
|
20
|
-
private
|
|
21
|
-
private
|
|
22
|
-
private
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
createSkybox(ibl: GLTFImageBasedLight): Promise<ModelSkyboxOptions>;
|
|
37
|
-
createDefaultSkybox(typeName: SkyboxType): Promise<ModelSkyboxOptions>;
|
|
38
|
-
scaleColorVal(val: number, fromGLTF: boolean): number;
|
|
39
|
-
scaleColorVec(vec: number[], fromGLTF: boolean): number[];
|
|
13
|
+
private sceneOptions;
|
|
14
|
+
private loaderOptions;
|
|
15
|
+
private gltfScene;
|
|
16
|
+
private gltfSkins;
|
|
17
|
+
private gltfMeshs;
|
|
18
|
+
private gltfLights;
|
|
19
|
+
private gltfCameras;
|
|
20
|
+
private gltfImages;
|
|
21
|
+
private gltfTextures;
|
|
22
|
+
private gltfMaterials;
|
|
23
|
+
private gltfAnimations;
|
|
24
|
+
private gltfImageBasedLights;
|
|
25
|
+
composition: spec.CompositionData;
|
|
26
|
+
timelineAssetId: string;
|
|
27
|
+
images: spec.Image[];
|
|
28
|
+
imageElements: ModelImageLike[];
|
|
29
|
+
textures: spec.TextureDefine[];
|
|
30
|
+
items: spec.VFXItemData[];
|
|
31
|
+
components: spec.ComponentData[];
|
|
32
|
+
materials: spec.MaterialData[];
|
|
33
|
+
shaders: spec.ShaderData[];
|
|
34
|
+
geometries: spec.GeometryData[];
|
|
35
|
+
animations: spec.AnimationClipData[];
|
|
36
|
+
sceneAABB: math.Box3;
|
|
37
|
+
constructor(composition?: spec.CompositionData);
|
|
40
38
|
loadScene(options: LoadSceneOptions): Promise<LoadSceneResult>;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
39
|
+
processGLTFResource(resource: GLTFResources, imageElements: ModelImageLike[]): void;
|
|
40
|
+
processComponentData(components: spec.EffectComponentData[]): void;
|
|
41
|
+
processLightComponentData(light: ModelLightComponentData): void;
|
|
42
|
+
processCameraComponentData(camera: ModelCameraComponentData): void;
|
|
43
|
+
processSkyboxComponentData(skybox: ModelSkyboxComponentData): void;
|
|
44
|
+
processMaterialData(material: spec.MaterialData): void;
|
|
45
|
+
processTextureOptions(options: TextureSourceOptions, isBaseColor: boolean, image?: ModelImageLike): void;
|
|
46
|
+
initial(options?: LoaderOptions): void;
|
|
47
|
+
checkMeshComponentData(mesh: ModelMeshComponentData, resource: GLTFResources): void;
|
|
48
|
+
processMaterialTexture(material: spec.MaterialData, textureName: string, isBaseColor: boolean, textureDataMap: Record<string, TextureSourceOptions>, imageElements: ModelImageLike[]): void;
|
|
49
|
+
getLoadResult(): LoadSceneResult;
|
|
50
|
+
addLight(data: ModelLight): void;
|
|
51
|
+
addCamera(camera: ModelCamera): void;
|
|
52
|
+
tryAddSkybox(skybox: ModelSkybox): Promise<void>;
|
|
53
|
+
createSkyboxComponentData(typeName: SkyboxType): {
|
|
54
|
+
imageList: spec.Image[];
|
|
55
|
+
textureOptionsList: TextureSourceOptions[];
|
|
56
|
+
component: spec.SkyboxComponentData;
|
|
57
|
+
};
|
|
58
|
+
private clear;
|
|
59
|
+
private computeSceneAABB;
|
|
54
60
|
/**
|
|
55
61
|
* 按照传入的动画播放参数,计算需要播放的动画索引
|
|
56
62
|
*
|
|
@@ -61,8 +67,8 @@ export declare class LoaderImpl implements Loader {
|
|
|
61
67
|
isPlayAnimation(): boolean;
|
|
62
68
|
isPlayAllAnimation(): boolean;
|
|
63
69
|
getRemarkString(): string;
|
|
70
|
+
getCompositionDuration(): number;
|
|
64
71
|
isTiny3dMode(): boolean;
|
|
65
|
-
getTextureManager(): TextureManager;
|
|
66
72
|
getItemDuration(): number;
|
|
67
73
|
getItemEndBehavior(): spec.ItemEndBehavior;
|
|
68
74
|
getSkyboxType(): PSkyboxType | undefined;
|
|
@@ -70,15 +76,7 @@ export declare class LoaderImpl implements Loader {
|
|
|
70
76
|
ignoreSkybox(): boolean;
|
|
71
77
|
isEnvironmentTest(): boolean;
|
|
72
78
|
}
|
|
73
|
-
declare
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
private _textureMap;
|
|
78
|
-
constructor(owner: LoaderImpl);
|
|
79
|
-
initial(gltfImages: GLTFImage[], gltfTextures: GLTFTexture[]): void;
|
|
80
|
-
dispose(): void;
|
|
81
|
-
addTexture(matIndex: number, texIndex: number, tex: Texture, isBaseColor: boolean): void;
|
|
82
|
-
getTexture(matIndex: number, texIndex: number, isBaseColor: boolean): Texture | undefined;
|
|
83
|
-
}
|
|
84
|
-
export {};
|
|
79
|
+
export declare function getPBRShaderProperties(): string;
|
|
80
|
+
export declare function getUnlitShaderProperties(): string;
|
|
81
|
+
export declare function getDefaultPBRMaterialData(): spec.MaterialData;
|
|
82
|
+
export declare function getDefaultUnlitMaterialData(): spec.MaterialData;
|
package/dist/gltf/protocol.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type { ModelAnimationOptions, ModelMaterialOptions, ModelSkyboxOptions, ModelTreeOptions, ModelBaseItem, ModelLightComponentData, ModelCameraComponentData, ModelMeshComponentData, ModelSkyboxComponentData } from '../index';
|
|
1
|
+
import type { GLTFResources } from '@vvfx/resource-detection';
|
|
2
|
+
import type { spec, TextureSourceOptions, EffectComponentData } from '@galacean/effects';
|
|
3
|
+
import type { ModelLightComponentData, ModelCameraComponentData, ModelSkyboxComponentData } from '../index';
|
|
5
4
|
/**
|
|
6
5
|
* glTF 场景文件加载选项,主要用于 Demo 测试或外部测试调用
|
|
7
6
|
*/
|
|
@@ -37,10 +36,6 @@ export interface LoadSceneOptions {
|
|
|
37
36
|
ignoreSkybox?: boolean;
|
|
38
37
|
};
|
|
39
38
|
effects: {
|
|
40
|
-
/**
|
|
41
|
-
* Renderer
|
|
42
|
-
*/
|
|
43
|
-
renderer?: Renderer;
|
|
44
39
|
/**
|
|
45
40
|
* 播放时间,单位秒
|
|
46
41
|
*/
|
|
@@ -60,14 +55,6 @@ export interface LoadSceneOptions {
|
|
|
60
55
|
};
|
|
61
56
|
}
|
|
62
57
|
export interface LoadSceneResult {
|
|
63
|
-
source: string;
|
|
64
|
-
items: ModelBaseItem[];
|
|
65
|
-
sceneAABB: {
|
|
66
|
-
min: spec.vec3;
|
|
67
|
-
max: spec.vec3;
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
export interface LoadSceneECSResult {
|
|
71
58
|
source: string;
|
|
72
59
|
jsonScene: spec.JSONScene;
|
|
73
60
|
sceneAABB: {
|
|
@@ -75,34 +62,51 @@ export interface LoadSceneECSResult {
|
|
|
75
62
|
max: spec.vec3;
|
|
76
63
|
};
|
|
77
64
|
}
|
|
78
|
-
export interface LoaderOptions {
|
|
79
|
-
compatibleMode?: 'gltf' | 'tiny3d';
|
|
80
|
-
}
|
|
81
65
|
export type SkyboxType = 'NFT' | 'FARM';
|
|
66
|
+
export interface ModelCamera {
|
|
67
|
+
fov: number;
|
|
68
|
+
near: number;
|
|
69
|
+
far: number;
|
|
70
|
+
clipMode: spec.CameraClipMode;
|
|
71
|
+
name: string;
|
|
72
|
+
position: spec.vec3;
|
|
73
|
+
rotation: spec.vec3;
|
|
74
|
+
duration: number;
|
|
75
|
+
endBehavior: spec.ItemEndBehavior;
|
|
76
|
+
}
|
|
77
|
+
export interface ModelLight {
|
|
78
|
+
lightType: spec.LightType;
|
|
79
|
+
color: spec.ColorData;
|
|
80
|
+
intensity: number;
|
|
81
|
+
range?: number;
|
|
82
|
+
innerConeAngle?: number;
|
|
83
|
+
outerConeAngle?: number;
|
|
84
|
+
name: string;
|
|
85
|
+
position: spec.vec3;
|
|
86
|
+
rotation: spec.vec3;
|
|
87
|
+
scale: spec.vec3;
|
|
88
|
+
duration: number;
|
|
89
|
+
endBehavior: spec.ItemEndBehavior;
|
|
90
|
+
}
|
|
91
|
+
export interface ModelSkybox {
|
|
92
|
+
skyboxType?: string;
|
|
93
|
+
renderable?: boolean;
|
|
94
|
+
intensity?: number;
|
|
95
|
+
reflectionsIntensity?: number;
|
|
96
|
+
duration?: number;
|
|
97
|
+
}
|
|
98
|
+
export interface ModelImageLike {
|
|
99
|
+
name?: string;
|
|
100
|
+
width: number;
|
|
101
|
+
height: number;
|
|
102
|
+
}
|
|
82
103
|
export interface Loader {
|
|
83
104
|
loadScene(options: LoadSceneOptions): Promise<LoadSceneResult>;
|
|
84
|
-
|
|
85
|
-
processCamera(cameras: GLTFCamera[], fromGLTF: boolean): void;
|
|
86
|
-
processMaterial(materials: GLTFMaterial[], fromGLTF: boolean): void;
|
|
87
|
-
createTreeOptions(scene: GLTFScene): ModelTreeOptions;
|
|
88
|
-
createAnimations(animations: GLTFAnimation[]): ModelAnimationOptions[];
|
|
89
|
-
createGeometry(primitive: GLTFPrimitive, hasSkinAnim: boolean): Geometry;
|
|
90
|
-
createMaterial(material: GLTFMaterial): ModelMaterialOptions;
|
|
91
|
-
createTexture2D(images: GLTFImage, textures: GLTFTexture, isBaseColor: boolean): Promise<Texture>;
|
|
92
|
-
createTextureCube(cubeImages: CubeImage[], level0Size?: number): Promise<Texture>;
|
|
93
|
-
createSkybox(ibl: GLTFImageBasedLight): Promise<ModelSkyboxOptions>;
|
|
94
|
-
createDefaultSkybox(typeName: SkyboxType): Promise<ModelSkyboxOptions>;
|
|
95
|
-
scaleColorVal(val: number, fromGLTF: boolean): number;
|
|
96
|
-
scaleColorVec(vec: number[], fromGLTF: boolean): number[];
|
|
97
|
-
}
|
|
98
|
-
export interface LoaderECS {
|
|
99
|
-
loadScene(options: LoadSceneOptions): Promise<LoadSceneECSResult>;
|
|
100
|
-
processGLTFResource(resource: GLTFResources): void;
|
|
105
|
+
processGLTFResource(resource: GLTFResources, imageElements: ModelImageLike[]): void;
|
|
101
106
|
processComponentData(components: EffectComponentData[]): void;
|
|
102
107
|
processLightComponentData(light: ModelLightComponentData): void;
|
|
103
108
|
processCameraComponentData(camera: ModelCameraComponentData): void;
|
|
104
|
-
processMeshComponentData(mesh: ModelMeshComponentData): void;
|
|
105
109
|
processSkyboxComponentData(skybox: ModelSkyboxComponentData): void;
|
|
106
110
|
processMaterialData(material: spec.MaterialData): void;
|
|
107
|
-
processTextureOptions(options: TextureSourceOptions, isBaseColor: boolean): void;
|
|
111
|
+
processTextureOptions(options: TextureSourceOptions, isBaseColor: boolean, image?: ModelImageLike): void;
|
|
108
112
|
}
|
package/dist/helper/index.d.ts
CHANGED