@galacean/effects-plugin-model 2.0.0-alpha.6 → 2.0.0-alpha.7
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/gltf/loader-ecs-ext.d.ts +24 -0
- package/dist/gltf/loader-ecs.d.ts +86 -0
- package/dist/gltf/protocol.d.ts +9 -1
- package/dist/helper/index.d.ts +1 -0
- package/dist/index.js +171 -202
- 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 +172 -203
- package/dist/index.mjs.map +1 -1
- package/dist/loader.mjs +167 -198
- package/dist/loader.mjs.map +1 -1
- package/dist/runtime/material.d.ts +1 -2
- package/dist/runtime/mesh.d.ts +2 -2
- package/package.json +5 -5
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { GLTFResources } from '@vvfx/resource-detection';
|
|
2
|
+
import type { Player, spec } from '@galacean/effects';
|
|
3
|
+
import type { LoadSceneOptions, LoadSceneECSResult } from './protocol';
|
|
4
|
+
import { LoaderECS } from './loader-ecs';
|
|
5
|
+
export declare class LoaderECSEx extends LoaderECS {
|
|
6
|
+
loadScene(options: LoadSceneOptions): Promise<LoadSceneECSResult>;
|
|
7
|
+
/**
|
|
8
|
+
* 检查序列化和反序列逻辑,排查渲染场景中渲染正常和编辑器中渲染错误的问题。
|
|
9
|
+
* 针对Image、Texture、Material、Mesh、Scene、Animation和IBL的检查。
|
|
10
|
+
*
|
|
11
|
+
* @param res 加载的GLTF场景资源
|
|
12
|
+
*/
|
|
13
|
+
checkSerializer(res: GLTFResources): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export interface LoadGLTFSceneECSOptions {
|
|
16
|
+
url: string;
|
|
17
|
+
player: Player;
|
|
18
|
+
playAnimation?: number | string;
|
|
19
|
+
camera?: {
|
|
20
|
+
position?: spec.vec3;
|
|
21
|
+
rotation?: spec.vec3;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export declare function loadGLTFSceneECS(options: LoadGLTFSceneECSOptions): Promise<spec.JSONScene>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { Texture, Engine } from '@galacean/effects';
|
|
2
|
+
import { spec } from '@galacean/effects';
|
|
3
|
+
import type { LoaderOptions, SkyboxType, LoadSceneOptions, LoadSceneECSResult } from './protocol';
|
|
4
|
+
import type { ModelAnimationOptions, ModelCameraOptions, ModelLightOptions, ModelSkyboxOptions, ModelTreeOptions } from '../index';
|
|
5
|
+
import type { GLTFImage, GLTFMaterial, GLTFTexture, GLTFScene, GLTFLight, GLTFCamera, GLTFAnimation } from '@vvfx/resource-detection';
|
|
6
|
+
import { PSkyboxType } from '../runtime/skybox';
|
|
7
|
+
export declare class LoaderECS {
|
|
8
|
+
private sceneOptions;
|
|
9
|
+
private loaderOptions;
|
|
10
|
+
private gltfScene;
|
|
11
|
+
private gltfSkins;
|
|
12
|
+
private gltfMeshs;
|
|
13
|
+
private gltfLights;
|
|
14
|
+
private gltfCameras;
|
|
15
|
+
private gltfImages;
|
|
16
|
+
private gltfTextures;
|
|
17
|
+
private gltfMaterials;
|
|
18
|
+
private gltfAnimations;
|
|
19
|
+
composition: spec.Composition;
|
|
20
|
+
images: spec.Image[];
|
|
21
|
+
textures: spec.TextureDefine[];
|
|
22
|
+
items: spec.VFXItemData[];
|
|
23
|
+
components: spec.ComponentData[];
|
|
24
|
+
materials: spec.MaterialData[];
|
|
25
|
+
shaders: spec.ShaderData[];
|
|
26
|
+
geometries: spec.GeometryData[];
|
|
27
|
+
engine: Engine;
|
|
28
|
+
constructor(composition?: spec.Composition);
|
|
29
|
+
initial(engine: Engine, options?: LoaderOptions): void;
|
|
30
|
+
loadScene(options: LoadSceneOptions): Promise<LoadSceneECSResult>;
|
|
31
|
+
getLoadResult(): LoadSceneECSResult;
|
|
32
|
+
addLight(data: ModelLight): void;
|
|
33
|
+
addCamera(camera: ModelCamera): void;
|
|
34
|
+
processMaterial(materials: GLTFMaterial[], fromGLTF: boolean): void;
|
|
35
|
+
createTreeOptions(scene: GLTFScene): ModelTreeOptions;
|
|
36
|
+
createAnimations(animations: GLTFAnimation[]): ModelAnimationOptions[];
|
|
37
|
+
createTexture2D(image: GLTFImage, texture: GLTFTexture, isBaseColor: boolean): Promise<Texture>;
|
|
38
|
+
createDefaultSkybox(typeName: SkyboxType): Promise<ModelSkyboxOptions>;
|
|
39
|
+
scaleColorVal(val: number, fromGLTF: boolean): number;
|
|
40
|
+
scaleColorVec(vec: number[], fromGLTF: boolean): number[];
|
|
41
|
+
createLightOptions(light: GLTFLight): ModelLightOptions;
|
|
42
|
+
createCameraOptions(camera: GLTFCamera): ModelCameraOptions | undefined;
|
|
43
|
+
private clear;
|
|
44
|
+
/**
|
|
45
|
+
* 按照传入的动画播放参数,计算需要播放的动画索引
|
|
46
|
+
*
|
|
47
|
+
* @param treeOptions 节点树属性,需要初始化animations列表。
|
|
48
|
+
* @returns 返回计算的动画索引,-1表示没有动画需要播放,-88888888表示播放所有动画。
|
|
49
|
+
*/
|
|
50
|
+
getPlayAnimationIndex(treeOptions: ModelTreeOptions): number;
|
|
51
|
+
isPlayAnimation(): boolean;
|
|
52
|
+
isPlayAllAnimation(): boolean;
|
|
53
|
+
getRemarkString(): string;
|
|
54
|
+
isTiny3dMode(): boolean;
|
|
55
|
+
getItemDuration(): number;
|
|
56
|
+
getItemEndBehavior(): spec.ItemEndBehavior;
|
|
57
|
+
getSkyboxType(): PSkyboxType | undefined;
|
|
58
|
+
isSkyboxVis(): boolean;
|
|
59
|
+
ignoreSkybox(): boolean;
|
|
60
|
+
isEnvironmentTest(): boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface ModelCamera {
|
|
63
|
+
fov: number;
|
|
64
|
+
near: number;
|
|
65
|
+
far: number;
|
|
66
|
+
clipMode: spec.CameraClipMode;
|
|
67
|
+
name: string;
|
|
68
|
+
position: spec.vec3;
|
|
69
|
+
rotation: spec.vec3;
|
|
70
|
+
duration: number;
|
|
71
|
+
endBehavior: spec.ItemEndBehavior;
|
|
72
|
+
}
|
|
73
|
+
export interface ModelLight {
|
|
74
|
+
lightType: spec.LightType;
|
|
75
|
+
color: spec.ColorData;
|
|
76
|
+
intensity: number;
|
|
77
|
+
range?: number;
|
|
78
|
+
innerConeAngle?: number;
|
|
79
|
+
outerConeAngle?: number;
|
|
80
|
+
name: string;
|
|
81
|
+
position: spec.vec3;
|
|
82
|
+
rotation: spec.vec3;
|
|
83
|
+
scale: spec.vec3;
|
|
84
|
+
duration: number;
|
|
85
|
+
endBehavior: spec.ItemEndBehavior;
|
|
86
|
+
}
|
package/dist/gltf/protocol.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GLTFMaterial, GLTFPrimitive, GLTFLight, GLTFScene, GLTFImage, GLTFTexture, GLTFCamera, GLTFAnimation, GLTFImageBasedLight } from '@vvfx/resource-detection';
|
|
2
2
|
import type { CubeImage } from '@vvfx/resource-detection/dist/src/gltf-tools/gltf-image-based-light';
|
|
3
|
-
import type { GLTFResources } from '@vvfx/resource-detection
|
|
3
|
+
import type { GLTFResources } from '@vvfx/resource-detection';
|
|
4
4
|
import type { spec, Renderer, Texture, Geometry } from '@galacean/effects';
|
|
5
5
|
import type { ModelAnimationOptions, ModelMaterialOptions, ModelSkyboxOptions, ModelTreeOptions, ModelBaseItem } from '../index';
|
|
6
6
|
/**
|
|
@@ -68,6 +68,14 @@ export interface LoadSceneResult {
|
|
|
68
68
|
max: spec.vec3;
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
+
export interface LoadSceneECSResult {
|
|
72
|
+
source: string;
|
|
73
|
+
jsonScene: spec.JSONScene;
|
|
74
|
+
sceneAABB: {
|
|
75
|
+
min: spec.vec3;
|
|
76
|
+
max: spec.vec3;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
71
79
|
export interface LoaderOptions {
|
|
72
80
|
compatibleMode?: 'gltf' | 'tiny3d' | 'oasis';
|
|
73
81
|
}
|
package/dist/helper/index.d.ts
CHANGED