@galacean/effects-threejs 2.10.0-alpha.1 → 2.10.0-alpha.2
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/index.js +2192 -1127
- 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 +2185 -1128
- package/dist/index.mjs.map +1 -1
- package/dist/three-data-buffer.d.ts +11 -0
- package/dist/three-engine.d.ts +13 -2
- package/dist/three-geometry.d.ts +3 -155
- package/package.json +2 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DataBuffer } from '@galacean/effects-core';
|
|
2
|
+
import type * as THREE from 'three';
|
|
3
|
+
export type ThreeBufferResource = THREE.InterleavedBuffer | THREE.BufferAttribute;
|
|
4
|
+
/**
|
|
5
|
+
* 保存渲染后端中的缓冲区资源。
|
|
6
|
+
*/
|
|
7
|
+
export declare class ThreeDataBuffer extends DataBuffer {
|
|
8
|
+
resource?: ThreeBufferResource | undefined;
|
|
9
|
+
constructor(resource?: ThreeBufferResource | undefined);
|
|
10
|
+
get underlyingResource(): ThreeBufferResource | undefined;
|
|
11
|
+
}
|
package/dist/three-engine.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import type { Composition, EngineOptions } from '@galacean/effects-core';
|
|
1
|
+
import type { Composition, DataBuffer, DataBufferOptions, EngineOptions, Geometry, IndicesArray } from '@galacean/effects-core';
|
|
2
2
|
import { Engine } from '@galacean/effects-core';
|
|
3
|
-
import
|
|
3
|
+
import * as THREE from 'three';
|
|
4
|
+
import { ThreeDataBuffer } from './three-data-buffer';
|
|
4
5
|
export interface ThreeEngineOptions {
|
|
5
6
|
threeCamera?: THREE.Camera;
|
|
6
7
|
composition: Composition;
|
|
7
8
|
threeGroup: THREE.Group;
|
|
8
9
|
}
|
|
10
|
+
type BufferData = number[] | ArrayBuffer | ArrayBufferView;
|
|
9
11
|
/**
|
|
10
12
|
* 挂载着合成需要的全局对象等
|
|
11
13
|
*/
|
|
@@ -15,4 +17,13 @@ export declare class ThreeEngine extends Engine {
|
|
|
15
17
|
composition: Composition;
|
|
16
18
|
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, options?: EngineOptions);
|
|
17
19
|
setOptions(threeEngineOptions: ThreeEngineOptions): void;
|
|
20
|
+
createVertexBuffer(data: BufferData | number, options: DataBufferOptions): ThreeDataBuffer;
|
|
21
|
+
createDynamicVertexBuffer(data: BufferData | number, options: DataBufferOptions): ThreeDataBuffer;
|
|
22
|
+
createIndexBuffer(indices: IndicesArray): ThreeDataBuffer;
|
|
23
|
+
updateDynamicVertexBuffer(vertexBuffer: DataBuffer, data: BufferData, byteOffset?: number, byteLength?: number): void;
|
|
24
|
+
updateDynamicIndexBuffer(indexBuffer: DataBuffer, indices: IndicesArray, byteOffset?: number): void;
|
|
25
|
+
/** @hide */
|
|
26
|
+
releaseBuffer(buffer: DataBuffer): boolean;
|
|
27
|
+
removeGeometry(geometry: Geometry): void;
|
|
18
28
|
}
|
|
29
|
+
export {};
|
package/dist/three-geometry.d.ts
CHANGED
|
@@ -1,156 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { Geometry } from '@galacean/effects-core';
|
|
1
|
+
import type { Geometry } from '@galacean/effects-core';
|
|
3
2
|
import * as THREE from 'three';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
interface ThreeAttributeWithType {
|
|
8
|
-
/**
|
|
9
|
-
* THREE 中 attribute 对象
|
|
10
|
-
*/
|
|
11
|
-
attribute: THREE.InterleavedBufferAttribute;
|
|
12
|
-
/**
|
|
13
|
-
* attribute 类型
|
|
14
|
-
*/
|
|
15
|
-
type: number;
|
|
16
|
-
/**
|
|
17
|
-
* 共享或单独的 buffer
|
|
18
|
-
*/
|
|
19
|
-
buffer: THREE.InterleavedBuffer;
|
|
20
|
-
/**
|
|
21
|
-
* 数据长度
|
|
22
|
-
*/
|
|
23
|
-
dataLength: number;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* THREE 中的 geometry 的抽象实现类
|
|
27
|
-
*/
|
|
28
|
-
export declare class ThreeGeometry extends Geometry {
|
|
29
|
-
/**
|
|
30
|
-
* geometry 对象
|
|
31
|
-
*/
|
|
32
|
-
geometry: THREE.BufferGeometry;
|
|
33
|
-
/**
|
|
34
|
-
* 记录顶点属性信息用于缓存
|
|
35
|
-
*/
|
|
36
|
-
attributes: Record<string, ThreeAttributeWithType>;
|
|
37
|
-
/**
|
|
38
|
-
* geometry 绘制模式
|
|
39
|
-
*/
|
|
40
|
-
readonly mode: GLenum;
|
|
41
|
-
private destroyed;
|
|
42
|
-
private attributesName;
|
|
43
|
-
/**
|
|
44
|
-
* 构造函数
|
|
45
|
-
* @param props - geometry 创建参数
|
|
46
|
-
*/
|
|
47
|
-
constructor(engine: Engine, props?: GeometryProps);
|
|
48
|
-
/**
|
|
49
|
-
* 获取绘制数量
|
|
50
|
-
*/
|
|
51
|
-
get drawCount(): number;
|
|
52
|
-
/**
|
|
53
|
-
* 设置绘制数量
|
|
54
|
-
*/
|
|
55
|
-
set drawCount(val: number);
|
|
56
|
-
/**
|
|
57
|
-
* 获取绘制起点
|
|
58
|
-
*/
|
|
59
|
-
get drawStart(): number;
|
|
60
|
-
/**
|
|
61
|
-
* 设置绘制起点
|
|
62
|
-
*/
|
|
63
|
-
set drawStart(val: number);
|
|
64
|
-
/**
|
|
65
|
-
* 获取 attribute 数据
|
|
66
|
-
*
|
|
67
|
-
* @param name - attribute 名称
|
|
68
|
-
* @returns 返回 attribute 数据,如果为空返回 undefined
|
|
69
|
-
*/
|
|
70
|
-
getAttributeData(name: string): spec.TypedArray | undefined;
|
|
71
|
-
/**
|
|
72
|
-
* 设置 attribute 数据
|
|
73
|
-
*
|
|
74
|
-
* @param name - attribute 名称
|
|
75
|
-
* @param data - attribute 数据
|
|
76
|
-
* @returns
|
|
77
|
-
*/
|
|
78
|
-
setAttributeData(name: string, data: spec.TypedArray): void;
|
|
79
|
-
/**
|
|
80
|
-
* 设置可变的 attribute 数据
|
|
81
|
-
*
|
|
82
|
-
* @param name - attribute 名称
|
|
83
|
-
* @param dataOffset - 数据偏移
|
|
84
|
-
* @param data - 数据内容
|
|
85
|
-
* @returns
|
|
86
|
-
*/
|
|
87
|
-
setAttributeSubData(name: string, dataOffset: number, data: spec.TypedArray): void;
|
|
88
|
-
/**
|
|
89
|
-
* 获取 attribute 数据步长
|
|
90
|
-
*
|
|
91
|
-
* @param name - attribute名称
|
|
92
|
-
* @returns 返回步长值
|
|
93
|
-
*/
|
|
94
|
-
getAttributeStride(name: string): number;
|
|
95
|
-
/**
|
|
96
|
-
* 获取用到的所有 attribute 名称
|
|
97
|
-
* @returns 返回名称数组
|
|
98
|
-
*/
|
|
99
|
-
getAttributeNames(): string[];
|
|
100
|
-
/**
|
|
101
|
-
* 获取 index attribute 数据
|
|
102
|
-
* @returns 返回数据,如果为空返回 undefined
|
|
103
|
-
*/
|
|
104
|
-
getIndexData(): spec.TypedArray | undefined;
|
|
105
|
-
/**
|
|
106
|
-
* 设置 index attribute 数据
|
|
107
|
-
*
|
|
108
|
-
* @param data - index 数据
|
|
109
|
-
*/
|
|
110
|
-
setIndexData(data?: spec.TypedArray): void;
|
|
111
|
-
/**
|
|
112
|
-
* 设置偏移 index 数据
|
|
113
|
-
*
|
|
114
|
-
* @param offset - 数据偏移量
|
|
115
|
-
* @param data - 数据内容
|
|
116
|
-
*/
|
|
117
|
-
setIndexSubData(offset: number, data: spec.TypedArray): void;
|
|
118
|
-
/**
|
|
119
|
-
* 设置绘制偏移
|
|
120
|
-
*
|
|
121
|
-
* @param start - 绘制偏移
|
|
122
|
-
*/
|
|
123
|
-
setDrawStart(start: number): void;
|
|
124
|
-
/**
|
|
125
|
-
* 获取绘制偏移
|
|
126
|
-
*
|
|
127
|
-
* @returns 返回绘制移
|
|
128
|
-
*/
|
|
129
|
-
getDrawStart(): number;
|
|
130
|
-
/**
|
|
131
|
-
* 设置绘制数量
|
|
132
|
-
*
|
|
133
|
-
* @param count - 绘制数量
|
|
134
|
-
*/
|
|
135
|
-
setDrawCount(count: number): void;
|
|
136
|
-
/**
|
|
137
|
-
* 获取绘制数量
|
|
138
|
-
*
|
|
139
|
-
* @returns 返回绘制数量
|
|
140
|
-
*/
|
|
141
|
-
getDrawCount(): number;
|
|
142
|
-
/**
|
|
143
|
-
* 获取蒙皮数据
|
|
144
|
-
*
|
|
145
|
-
* @returns 返回蒙皮数据
|
|
146
|
-
*/
|
|
147
|
-
getSkinProps(): SkinProps;
|
|
148
|
-
/**
|
|
149
|
-
* 销毁方法
|
|
150
|
-
*
|
|
151
|
-
* @returns
|
|
152
|
-
*/
|
|
153
|
-
dispose(): void;
|
|
154
|
-
private setAttributeType;
|
|
155
|
-
}
|
|
156
|
-
export {};
|
|
3
|
+
export declare function getThreeGeometry(source: Geometry): THREE.BufferGeometry;
|
|
4
|
+
export declare function disposeThreeGeometry(source: Geometry): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/effects-threejs",
|
|
3
|
-
"version": "2.10.0-alpha.
|
|
3
|
+
"version": "2.10.0-alpha.2",
|
|
4
4
|
"description": "Galacean Effects runtime threejs plugin for the web",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"registry": "https://registry.npmjs.org"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@galacean/effects-core": "2.10.0-alpha.
|
|
46
|
+
"@galacean/effects-core": "2.10.0-alpha.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"three": "^0.149.0",
|