@galacean/effects-plugin-model 0.0.1-alpha.0 → 0.0.1-alpha.1
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/LICENSE +22 -0
- package/dist/gltf/loader-ext.d.ts +1 -5
- package/dist/gltf/loader-helper.d.ts +3 -3
- package/dist/gltf/loader-impl.d.ts +16 -16
- package/dist/gltf/protocol.d.ts +14 -14
- package/dist/index.d.ts +29 -29
- package/dist/index.js +205 -205
- package/dist/index.min.js +2 -2
- package/dist/index.mjs +203 -203
- package/dist/loader.mjs +134 -134
- package/dist/plugin/model-tree-item.d.ts +2 -2
- package/dist/plugin/model-tree-vfx-item.d.ts +3 -3
- package/dist/plugin/model-vfx-item.d.ts +4 -4
- package/dist/runtime/animation.d.ts +8 -9
- package/dist/runtime/cache.d.ts +3 -3
- package/dist/runtime/camera.d.ts +3 -3
- package/dist/runtime/common.d.ts +3 -3
- package/dist/runtime/light.d.ts +3 -3
- package/dist/runtime/material.d.ts +4 -4
- package/dist/runtime/mesh.d.ts +11 -11
- package/dist/runtime/scene.d.ts +3 -3
- package/dist/runtime/skybox.d.ts +3 -3
- package/dist/utility/hit-test-helper.d.ts +2 -2
- package/dist/utility/plugin-helper.d.ts +25 -25
- package/package.json +4 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT LICENSE
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019-present Ant Group Co., Ltd. https://www.antgroup.com/
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -43,11 +43,7 @@ export declare function loadGLTFScene(options: LoadGLTFSceneOptions): Promise<{
|
|
|
43
43
|
}[];
|
|
44
44
|
gltf: never[];
|
|
45
45
|
images: never[];
|
|
46
|
-
version: string;
|
|
47
46
|
shapes: never[];
|
|
48
47
|
plugins: string[];
|
|
49
|
-
|
|
50
|
-
_imgs: {
|
|
51
|
-
'1': never[];
|
|
52
|
-
};
|
|
48
|
+
version: string;
|
|
53
49
|
}>;
|
|
@@ -3,12 +3,12 @@ import type { BaseTransform as Transform } from '../index';
|
|
|
3
3
|
import { Vector3, Matrix4, Quaternion, Euler } from '../math';
|
|
4
4
|
export declare class LoaderHelper {
|
|
5
5
|
static getTransformFromMat4(mat: Matrix4): Transform;
|
|
6
|
-
static
|
|
6
|
+
static getEffectsTransformFromMat4(mat: Matrix4): Transform;
|
|
7
7
|
static getTransformFromTranslation(t: Vector3): Transform;
|
|
8
8
|
static getTransformFromDirection(d: Vector3): Transform;
|
|
9
|
-
static
|
|
9
|
+
static getEffectsTransformFromDirection(d: Vector3): Transform;
|
|
10
10
|
static getTransformFromTransDir(t: Vector3, d: Vector3): Transform;
|
|
11
|
-
static
|
|
11
|
+
static getEffectsTransformFromTransDir(t: Vector3, d: Vector3): Transform;
|
|
12
12
|
static getEulerFromQuat(q: Quaternion): [number, number, number];
|
|
13
13
|
static getQuatFromEuler(e: Euler): [number, number, number, number];
|
|
14
14
|
static toPlayerColor3(color: spec.vec3): spec.vec3;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Texture, Engine } from '@galacean/effects';
|
|
2
2
|
import { spec, Geometry } from '@galacean/effects';
|
|
3
3
|
import type { Loader, LoaderOptions, SkyboxType, LoadSceneOptions, LoadSceneResult } from './protocol';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ModelAnimationOptions, ModelCameraOptions, ModelMaterialOptions, ModelLightOptions, ModelSkyboxOptions, ModelTreeOptions } from '../index';
|
|
5
5
|
import type { GLTFImage, GLTFMaterial, GLTFTexture, GLTFScene, GLTFPrimitive, GLTFTextureInfo, GLTFLight, GLTFCamera, GLTFAnimation, GLTFImageBasedLight } from '@vvfx/resource-detection';
|
|
6
6
|
import { PSkyboxType } from '../runtime/skybox';
|
|
7
7
|
import type { CubeImage } from '@vvfx/resource-detection/dist/src/gltf-tools/gltf-image-based-light';
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
8
|
+
export declare function getDefaultEffectsGLTFLoader(engine: Engine, options?: LoaderOptions): Loader;
|
|
9
|
+
export declare function setDefaultEffectsGLTFLoader(loader: Loader): void;
|
|
10
10
|
export declare class LoaderImpl implements Loader {
|
|
11
11
|
private _sceneOptions;
|
|
12
12
|
private _loaderOptions;
|
|
@@ -24,19 +24,19 @@ export declare class LoaderImpl implements Loader {
|
|
|
24
24
|
private _skyboxOptions?;
|
|
25
25
|
engine: Engine;
|
|
26
26
|
initial(engine: Engine, options?: LoaderOptions): void;
|
|
27
|
-
processLight(lights: GLTFLight[],
|
|
28
|
-
processCamera(cameras: GLTFCamera[],
|
|
29
|
-
processMaterial(materials: GLTFMaterial[],
|
|
30
|
-
createTreeOptions(scene: GLTFScene):
|
|
31
|
-
createAnimations(animations: GLTFAnimation[]):
|
|
27
|
+
processLight(lights: GLTFLight[], fromGLTF: boolean): void;
|
|
28
|
+
processCamera(cameras: GLTFCamera[], fromGLTF: boolean): void;
|
|
29
|
+
processMaterial(materials: GLTFMaterial[], fromGLTF: boolean): void;
|
|
30
|
+
createTreeOptions(scene: GLTFScene): ModelTreeOptions;
|
|
31
|
+
createAnimations(animations: GLTFAnimation[]): ModelAnimationOptions[];
|
|
32
32
|
createGeometry(primitive: GLTFPrimitive, hasSkinAnim: boolean): Geometry;
|
|
33
|
-
createMaterial(material: GLTFMaterial):
|
|
33
|
+
createMaterial(material: GLTFMaterial): ModelMaterialOptions;
|
|
34
34
|
createTexture2D(image: GLTFImage, texture: GLTFTexture, isBaseColor: boolean): Promise<Texture>;
|
|
35
35
|
createTextureCube(cubeImages: CubeImage[], level0Size?: number): Promise<Texture>;
|
|
36
|
-
createSkybox(ibl: GLTFImageBasedLight): Promise<
|
|
37
|
-
createDefaultSkybox(typeName: SkyboxType): Promise<
|
|
38
|
-
scaleColorVal(val: number,
|
|
39
|
-
scaleColorVec(vec: number[],
|
|
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[];
|
|
40
40
|
loadScene(options: LoadSceneOptions): Promise<LoadSceneResult>;
|
|
41
41
|
private _preprocess;
|
|
42
42
|
tryAddTexture2D(matIndex: number, texInfo: GLTFTextureInfo | undefined, isBaseColor: boolean): Promise<void> | undefined;
|
|
@@ -48,8 +48,8 @@ export declare class LoaderImpl implements Loader {
|
|
|
48
48
|
private _createItemCamera;
|
|
49
49
|
private _createItemSkybox;
|
|
50
50
|
private _computeSceneAABB;
|
|
51
|
-
createLightOptions(light: GLTFLight):
|
|
52
|
-
createCameraOptions(camera: GLTFCamera):
|
|
51
|
+
createLightOptions(light: GLTFLight): ModelLightOptions;
|
|
52
|
+
createCameraOptions(camera: GLTFCamera): ModelCameraOptions | undefined;
|
|
53
53
|
private _clear;
|
|
54
54
|
/**
|
|
55
55
|
* 按照传入的动画播放参数,计算需要播放的动画索引
|
|
@@ -57,7 +57,7 @@ export declare class LoaderImpl implements Loader {
|
|
|
57
57
|
* @param treeOptions 节点树属性,需要初始化animations列表。
|
|
58
58
|
* @returns 返回计算的动画索引,-1表示没有动画需要播放,-88888888表示播放所有动画。
|
|
59
59
|
*/
|
|
60
|
-
getPlayAnimationIndex(treeOptions:
|
|
60
|
+
getPlayAnimationIndex(treeOptions: ModelTreeOptions): number;
|
|
61
61
|
isPlayAnimation(): boolean;
|
|
62
62
|
isPlayAllAnimation(): boolean;
|
|
63
63
|
getRemarkString(): string;
|
package/dist/gltf/protocol.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { GLTFMaterial, GLTFPrimitive, GLTFLight, GLTFScene, GLTFImage, GLTF
|
|
|
2
2
|
import type { CubeImage } from '@vvfx/resource-detection/dist/src/gltf-tools/gltf-image-based-light';
|
|
3
3
|
import type { GLTFResources } from '@vvfx/resource-detection/dist/src/gltf-tools';
|
|
4
4
|
import type { spec, Renderer, Texture, Geometry } from '@galacean/effects';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ModelAnimationOptions, ModelMaterialOptions, ModelSkyboxOptions, ModelTreeOptions, ModelBaseItem } from '../index';
|
|
6
6
|
/**
|
|
7
7
|
* glTF 场景文件加载选项,主要用于 Demo 测试或外部测试调用
|
|
8
8
|
*/
|
|
@@ -37,9 +37,9 @@ export interface LoadSceneOptions {
|
|
|
37
37
|
*/
|
|
38
38
|
ignoreSkybox?: boolean;
|
|
39
39
|
};
|
|
40
|
-
|
|
40
|
+
effects: {
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Renderer
|
|
43
43
|
*/
|
|
44
44
|
renderer?: Renderer;
|
|
45
45
|
/**
|
|
@@ -62,7 +62,7 @@ export interface LoadSceneOptions {
|
|
|
62
62
|
}
|
|
63
63
|
export interface LoadSceneResult {
|
|
64
64
|
source: string;
|
|
65
|
-
items:
|
|
65
|
+
items: ModelBaseItem[];
|
|
66
66
|
sceneAABB: {
|
|
67
67
|
min: spec.vec3;
|
|
68
68
|
max: spec.vec3;
|
|
@@ -74,17 +74,17 @@ export interface LoaderOptions {
|
|
|
74
74
|
export type SkyboxType = 'NFT' | 'FARM';
|
|
75
75
|
export interface Loader {
|
|
76
76
|
loadScene(options: LoadSceneOptions): Promise<LoadSceneResult>;
|
|
77
|
-
processLight(lights: GLTFLight[],
|
|
78
|
-
processCamera(cameras: GLTFCamera[],
|
|
79
|
-
processMaterial(materials: GLTFMaterial[],
|
|
80
|
-
createTreeOptions(scene: GLTFScene):
|
|
81
|
-
createAnimations(animations: GLTFAnimation[]):
|
|
77
|
+
processLight(lights: GLTFLight[], fromGLTF: boolean): void;
|
|
78
|
+
processCamera(cameras: GLTFCamera[], fromGLTF: boolean): void;
|
|
79
|
+
processMaterial(materials: GLTFMaterial[], fromGLTF: boolean): void;
|
|
80
|
+
createTreeOptions(scene: GLTFScene): ModelTreeOptions;
|
|
81
|
+
createAnimations(animations: GLTFAnimation[]): ModelAnimationOptions[];
|
|
82
82
|
createGeometry(primitive: GLTFPrimitive, hasSkinAnim: boolean): Geometry;
|
|
83
|
-
createMaterial(material: GLTFMaterial):
|
|
83
|
+
createMaterial(material: GLTFMaterial): ModelMaterialOptions;
|
|
84
84
|
createTexture2D(images: GLTFImage, textures: GLTFTexture, isBaseColor: boolean): Promise<Texture>;
|
|
85
85
|
createTextureCube(cubeImages: CubeImage[], level0Size?: number): Promise<Texture>;
|
|
86
|
-
createSkybox(ibl: GLTFImageBasedLight): Promise<
|
|
87
|
-
createDefaultSkybox(typeName: SkyboxType): Promise<
|
|
88
|
-
scaleColorVal(val: number,
|
|
89
|
-
scaleColorVec(vec: number[],
|
|
86
|
+
createSkybox(ibl: GLTFImageBasedLight): Promise<ModelSkyboxOptions>;
|
|
87
|
+
createDefaultSkybox(typeName: SkyboxType): Promise<ModelSkyboxOptions>;
|
|
88
|
+
scaleColorVal(val: number, fromGLTF: boolean): number;
|
|
89
|
+
scaleColorVec(vec: number[], fromGLTF: boolean): number[];
|
|
90
90
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import type { spec } from '@galacean/effects';
|
|
2
2
|
export declare const version: string;
|
|
3
3
|
export type BaseTransform = spec.BaseItemTransform;
|
|
4
|
-
export type
|
|
5
|
-
export type
|
|
6
|
-
export type
|
|
7
|
-
export type
|
|
8
|
-
export type
|
|
9
|
-
export type
|
|
10
|
-
export type
|
|
11
|
-
export type
|
|
12
|
-
export type
|
|
13
|
-
export type
|
|
14
|
-
export type
|
|
15
|
-
export type
|
|
16
|
-
export type
|
|
17
|
-
export type
|
|
18
|
-
export type
|
|
19
|
-
export type
|
|
20
|
-
export type
|
|
21
|
-
export type
|
|
22
|
-
export type
|
|
23
|
-
export type
|
|
24
|
-
export type
|
|
25
|
-
export type
|
|
26
|
-
export type
|
|
27
|
-
export type
|
|
28
|
-
export type
|
|
29
|
-
export type
|
|
30
|
-
export type
|
|
31
|
-
export type
|
|
32
|
-
export type
|
|
4
|
+
export type ModelBaseItem = spec.BaseItem;
|
|
5
|
+
export type ModelItemCamera = spec.ModelCameraItem;
|
|
6
|
+
export type ModelItemLight = spec.ModelLightItem;
|
|
7
|
+
export type ModelTextureTransform = spec.ModelTextureTransform;
|
|
8
|
+
export type ModelItemBoundingBox = spec.ModelItemBoundingBox;
|
|
9
|
+
export type ModelItemBoundingSphere = spec.ModelItemBoundingSphere;
|
|
10
|
+
export type ModelItemBounding = spec.ModelItemBounding;
|
|
11
|
+
export type ModelCameraOptions = spec.ModelCameraOptions;
|
|
12
|
+
export type ModelLightBaseOptions = spec.ModelLightBaseOptions;
|
|
13
|
+
export type ModelLightPointOptions = spec.ModelLightPointOptions;
|
|
14
|
+
export type ModelLightSpotOptions = spec.ModelLightSpotOptions;
|
|
15
|
+
export type ModelLightDirOptions = spec.ModelLightDirOptions;
|
|
16
|
+
export type ModelAmbientLightOptions = spec.ModelAmbientLightOptions;
|
|
17
|
+
export type ModelLightOptions = spec.ModelLightOptions;
|
|
18
|
+
export type ModelItemMesh = spec.ModelMeshItem<'studio'>;
|
|
19
|
+
export type ModelItemSkybox = spec.ModelSkyboxItem<'studio'>;
|
|
20
|
+
export type ModelItemTree = spec.ModelTreeItem<'studio'>;
|
|
21
|
+
export type ModelMeshOptions = spec.ModelMeshOptions<'studio'>;
|
|
22
|
+
export type ModelSkinOptions = spec.SkinOptions<'studio'>;
|
|
23
|
+
export type ModelPrimitiveOptions = spec.PrimitiveOptions<'studio'>;
|
|
24
|
+
export type ModelMaterialUnlitOptions = spec.MaterialUnlitOptions<'studio'>;
|
|
25
|
+
export type ModelMaterialPBROptions = spec.MaterialPBROptions<'studio'>;
|
|
26
|
+
export type ModelMaterialHariOptions = spec.MaterialHairOptions<'studio'>;
|
|
27
|
+
export type ModelMaterialOptions = spec.MaterialOptions<'studio'>;
|
|
28
|
+
export type ModelSkyboxOptions = spec.SkyboxOptions<'studio'>;
|
|
29
|
+
export type ModelTreeOptions = spec.ModelTreeOptions<'studio'>;
|
|
30
|
+
export type ModelTreeContent = spec.ModelTreeContent<'studio'>;
|
|
31
|
+
export type ModelAnimTrackOptions = spec.ModelAnimTrackOptions<'studio'>;
|
|
32
|
+
export type ModelAnimationOptions = spec.ModelAnimationOptions<'studio'>;
|
|
33
33
|
export * from './gesture';
|
|
34
34
|
export * from './gltf';
|
|
35
35
|
export * from './math';
|