gl-draw 0.9.0-beta.21 → 0.9.0-beta.210
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/README.md +0 -18
- package/dist/BaseObject.js +1 -1
- package/dist/BaseObject.module.js +100 -51
- package/dist/colorCorrection.js +1 -0
- package/dist/colorCorrection.module.js +25 -0
- package/dist/core/BaseObject.d.ts +21 -7
- package/dist/core/Camera.d.ts +1 -0
- package/dist/core/Composer.d.ts +33 -2
- package/dist/core/Controls.d.ts +56 -0
- package/dist/core/Pencil.d.ts +36 -9
- package/dist/core/Renderer.d.ts +5 -13
- package/dist/core/TransformControls.d.ts +18 -0
- package/dist/core/pass/CrossFadePass.d.ts +11 -0
- package/dist/events.js +1 -0
- package/dist/events.module.js +234 -0
- package/dist/getProjection.js +1 -0
- package/dist/getProjection.module.js +12 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +18 -1
- package/dist/index.module.js +525 -527
- package/dist/objects/conicPolygon/createGeometry.d.ts +8 -0
- package/dist/objects/conicPolygon/geometry/index.d.ts +18 -18
- package/dist/objects/conicPolygon/index.d.ts +9 -12
- package/dist/objects/extrudePolygon/ExtrudeGeometry.d.ts +4 -1
- package/dist/objects/extrudePolygon/index.d.ts +2 -3
- package/dist/objects/image/index.d.ts +6 -3
- package/dist/objects/index.d.ts +2 -3
- package/dist/objects/index.js +120 -125
- package/dist/objects/index.module.js +1108 -1172
- package/dist/objects/line/createGeometry.d.ts +5 -5
- package/dist/objects/line/index.d.ts +9 -26
- package/dist/objects/line/meshLine/MeshLineGeometry.d.ts +40 -0
- package/dist/objects/line/meshLine/MeshLineMaterial.d.ts +48 -0
- package/dist/objects/line/meshLine/index.d.ts +3 -89
- package/dist/objects/line/meshLine/raycast.d.ts +3 -0
- package/dist/objects/node/index.d.ts +7 -9
- package/dist/objects/video/index.d.ts +2 -2
- package/dist/plugins/Data.d.ts +1 -0
- package/dist/plugins/Draw.d.ts +14 -2
- package/dist/plugins/Loader/CacheLoader.d.ts +19 -0
- package/dist/plugins/Loader/TextureLoader.d.ts +6 -0
- package/dist/plugins/Loader/VideoTextureLoader.d.ts +6 -0
- package/dist/plugins/Loader/index.d.ts +93 -0
- package/dist/plugins/Worker/chunk.d.ts +1 -0
- package/dist/plugins/Worker/createGeometry.d.ts +3 -0
- package/dist/plugins/Worker/getAttributes/conicLine.d.ts +20 -0
- package/dist/plugins/Worker/getAttributes/conicPolygon.d.ts +23 -0
- package/dist/plugins/Worker/getAttributes/coords2Vector.d.ts +3 -0
- package/dist/plugins/Worker/getAttributes/extrudePolygon.d.ts +26 -0
- package/dist/plugins/Worker/getAttributes/getMessage.d.ts +13 -0
- package/dist/plugins/Worker/getAttributes/line.d.ts +20 -0
- package/dist/plugins/Worker/index.d.ts +44 -0
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.module.js +646 -214
- package/dist/utils/colorCorrection.d.ts +13 -1
- package/dist/utils/getProjection.d.ts +10 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.module.js +84 -86
- package/dist/uvGenerator.js +1 -1
- package/dist/uvGenerator.module.js +40 -39
- package/package.json +14 -14
- package/dist/core/Control.d.ts +0 -33
- package/dist/geojson/china.json +0 -103310
- package/dist/geojson/countries.json +0 -27483
- package/dist/objects/extrudePolygon/coords2Vector.d.ts +0 -7
- package/dist/objects/extrudePolygon/getWorkerGeometry.d.ts +0 -20
- package/dist/objects/line/coords2Vector.d.ts +0 -7
- package/dist/objects/line/getWorkerGeometry.d.ts +0 -16
- package/dist/objects/line/line.w.d.ts +0 -1
- package/dist/objects/line/meshLine/shader/fragment.d.ts +0 -2
- package/dist/objects/line/meshLine/shader/vertex.d.ts +0 -2
- package/dist/plugins/Worker.d.ts +0 -31
- package/dist/worker/extrudePolygon.w.js +0 -3142
- package/dist/worker/line.w.js +0 -5
- /package/dist/{objects/extrudePolygon/extrudePolygon.w.d.ts → plugins/Worker/getAttributes/geo.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -239,21 +239,3 @@ interface Options {
|
|
|
239
239
|
(method) BaseObject.dispose(): void
|
|
240
240
|
```
|
|
241
241
|
|
|
242
|
-
## 提示
|
|
243
|
-
### @tweenjs/tween.js 使用需要注册
|
|
244
|
-
```js
|
|
245
|
-
const pencil = new Pencil({
|
|
246
|
-
...
|
|
247
|
-
})
|
|
248
|
-
pencil.use({
|
|
249
|
-
install: () => {},
|
|
250
|
-
update: () => {
|
|
251
|
-
TWEEN.update();
|
|
252
|
-
},
|
|
253
|
-
dispose: () => {
|
|
254
|
-
TWEEN.removeAll();
|
|
255
|
-
},
|
|
256
|
-
})
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
|
package/dist/BaseObject.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const b=require("three"),l=require("esus-lite"),u=require("three/examples/jsm/renderers/CSS2DRenderer"),o=require("three/examples/jsm/renderers/CSS3DRenderer"),h=require("./disposeMesh.js");require("idb-keyval");require("d3-geo");function j(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const s=j(b),c=new WeakMap,a=r=>c.get(r),d=r=>{r&&(h.disposeMesh(r),r.children.forEach(e=>{c.has(e)||d(e)}))};class p{constructor(){this.objectType="BaseObject",this.userData={},this.pm=l.makePromiseCreator(),this.materialList={},this.useMaterialType="origin"}get parent(){const e=this.object3d.parent;return a(e)||this.pencil.scene}get children(){return this.object3d.children.map(e=>a(e)).filter(e=>!!e)}get position(){var e;return(e=this.object3d)==null?void 0:e.position}get rotation(){var e;return(e=this.object3d)==null?void 0:e.rotation}get scale(){var e;return(e=this.object3d)==null?void 0:e.scale}get add(){var e;return(e=this.object3d)==null?void 0:e.add.bind(this.object3d)}get remove(){var e;return(e=this.object3d)==null?void 0:e.remove.bind(this.object3d)}get visible(){return this.object3d?this.object3d.visible:!1}create(){}render(){}update(e,t){}resize(e,t){}show(){return this.object3d&&(this.object3d.visible=!0),this}hide(){return this.object3d&&(this.object3d.visible=!1),this}createMesh(...e){return this.object3d=new s.Mesh(...e),this}createGroup(){return this.object3d=new s.Group,this}createPoints(...e){return this.object3d=new s.Points(...e),this}createCSS2DObject(e){return this.object3d=new u.CSS2DObject(e),this}createCSS3DObject(e){return this.object3d=new o.CSS3DObject(e),this}createCSS3DSprite(e){return this.object3d=new o.CSS3DSprite(e),this}createSprite(e){return this.object3d=new s.Sprite(e),this}attach(...e){return[...e].forEach(t=>{this.object3d.attach(t.object3d)}),this}getSize(){const e=new s.Box3().setFromObject(this.object3d);return{min:e.min,max:e.max,size:e.getSize(new s.Vector3)}}traverse(e){e(this),this.children.forEach(t=>{t.traverse(e)})}clone(){return this.drawController.clone(this)}instantiate(e){return this.drawController.instantiate(this,e)}erase(){this.drawController.erase(this)}cloneMaterial(){const e=this.object3d;if(!e||!e.material)return;const t=e.material;return Array.isArray(t)?t.map(i=>i.clone()):t.clone()}setMaterialList(e,t){const i=this.object3d;if(!i||!i.material)return;this.materialList.origin||(this.materialList.origin=i.material);const n=t==="clone"?this.cloneMaterial():t;return this.materialList[e]=n,n}useMaterial(e){const t=this.object3d;!t||!t.material||this.useMaterialType===e||(this.useMaterialType=e,t.material=this.materialList[e])}dispose(){d(this.object3d),Object.keys(this.materialList).forEach(e=>{e!=="origin"&&h.disposeMesh({material:this.materialList[e]})})}}exports.BaseObject=p;exports.baseObjectByObject3D=a;exports.objMap=c;
|
|
@@ -1,91 +1,140 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { makePromiseCreator as
|
|
3
|
-
import { CSS2DObject as
|
|
4
|
-
import { CSS3DObject as
|
|
5
|
-
import { d as
|
|
1
|
+
import * as r from "three";
|
|
2
|
+
import { makePromiseCreator as d } from "esus-lite";
|
|
3
|
+
import { CSS2DObject as b } from "three/examples/jsm/renderers/CSS2DRenderer";
|
|
4
|
+
import { CSS3DObject as l, CSS3DSprite as j } from "three/examples/jsm/renderers/CSS3DRenderer";
|
|
5
|
+
import { d as c } from "./disposeMesh.module.js";
|
|
6
6
|
import "idb-keyval";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import "d3-geo";
|
|
8
|
+
const n = /* @__PURE__ */ new WeakMap(), o = (i) => n.get(i), h = (i) => {
|
|
9
|
+
i && (c(i), i.children.forEach((t) => {
|
|
10
|
+
n.has(t) || h(t);
|
|
10
11
|
}));
|
|
11
12
|
};
|
|
12
|
-
class
|
|
13
|
+
class w {
|
|
13
14
|
constructor() {
|
|
14
|
-
this.
|
|
15
|
+
this.objectType = "BaseObject", this.userData = {}, this.pm = d(), this.materialList = {}, this.useMaterialType = "origin";
|
|
15
16
|
}
|
|
16
17
|
get parent() {
|
|
17
|
-
const
|
|
18
|
-
return (
|
|
18
|
+
const t = this.object3d.parent;
|
|
19
|
+
return o(t) || this.pencil.scene;
|
|
19
20
|
}
|
|
20
21
|
get children() {
|
|
21
|
-
return this.object3d.children.map((
|
|
22
|
+
return this.object3d.children.map((t) => o(t)).filter((t) => !!t);
|
|
22
23
|
}
|
|
23
|
-
|
|
24
|
+
get position() {
|
|
25
|
+
var t;
|
|
26
|
+
return (t = this.object3d) == null ? void 0 : t.position;
|
|
27
|
+
}
|
|
28
|
+
get rotation() {
|
|
29
|
+
var t;
|
|
30
|
+
return (t = this.object3d) == null ? void 0 : t.rotation;
|
|
31
|
+
}
|
|
32
|
+
get scale() {
|
|
33
|
+
var t;
|
|
34
|
+
return (t = this.object3d) == null ? void 0 : t.scale;
|
|
35
|
+
}
|
|
36
|
+
get add() {
|
|
37
|
+
var t;
|
|
38
|
+
return (t = this.object3d) == null ? void 0 : t.add.bind(this.object3d);
|
|
39
|
+
}
|
|
40
|
+
get remove() {
|
|
41
|
+
var t;
|
|
42
|
+
return (t = this.object3d) == null ? void 0 : t.remove.bind(this.object3d);
|
|
43
|
+
}
|
|
44
|
+
get visible() {
|
|
45
|
+
return this.object3d ? this.object3d.visible : !1;
|
|
24
46
|
}
|
|
25
47
|
create() {
|
|
26
48
|
}
|
|
27
49
|
render() {
|
|
28
50
|
}
|
|
29
|
-
update(
|
|
51
|
+
update(t, e) {
|
|
30
52
|
}
|
|
31
|
-
resize(
|
|
53
|
+
resize(t, e) {
|
|
32
54
|
}
|
|
33
55
|
show() {
|
|
34
|
-
return this.object3d && (this.object3d.visible = !0), this
|
|
56
|
+
return this.object3d && (this.object3d.visible = !0), this;
|
|
35
57
|
}
|
|
36
58
|
hide() {
|
|
37
|
-
return this.object3d && (this.object3d.visible = !1), this
|
|
38
|
-
}
|
|
39
|
-
isVisible() {
|
|
40
|
-
return this.visible;
|
|
59
|
+
return this.object3d && (this.object3d.visible = !1), this;
|
|
41
60
|
}
|
|
42
|
-
createMesh(...
|
|
43
|
-
return this.object3d = new
|
|
61
|
+
createMesh(...t) {
|
|
62
|
+
return this.object3d = new r.Mesh(...t), this;
|
|
44
63
|
}
|
|
45
64
|
createGroup() {
|
|
46
|
-
return this.object3d = new
|
|
47
|
-
}
|
|
48
|
-
createPoints(...e) {
|
|
49
|
-
return this.object3d = new t.Points(...e), this;
|
|
50
|
-
}
|
|
51
|
-
createCSS2DObject(e) {
|
|
52
|
-
return this.object3d = new c(e), this;
|
|
65
|
+
return this.object3d = new r.Group(), this;
|
|
53
66
|
}
|
|
54
|
-
|
|
55
|
-
return this.object3d = new
|
|
67
|
+
createPoints(...t) {
|
|
68
|
+
return this.object3d = new r.Points(...t), this;
|
|
56
69
|
}
|
|
57
|
-
|
|
58
|
-
return this.object3d = new
|
|
70
|
+
createCSS2DObject(t) {
|
|
71
|
+
return this.object3d = new b(t), this;
|
|
59
72
|
}
|
|
60
|
-
|
|
61
|
-
return this.object3d = new t
|
|
73
|
+
createCSS3DObject(t) {
|
|
74
|
+
return this.object3d = new l(t), this;
|
|
62
75
|
}
|
|
63
|
-
|
|
64
|
-
return this.object3d
|
|
76
|
+
createCSS3DSprite(t) {
|
|
77
|
+
return this.object3d = new j(t), this;
|
|
65
78
|
}
|
|
66
|
-
|
|
67
|
-
return this.object3d.
|
|
79
|
+
createSprite(t) {
|
|
80
|
+
return this.object3d = new r.Sprite(t), this;
|
|
68
81
|
}
|
|
69
|
-
attach(
|
|
70
|
-
return
|
|
82
|
+
attach(...t) {
|
|
83
|
+
return [...t].forEach((e) => {
|
|
84
|
+
this.object3d.attach(e.object3d);
|
|
85
|
+
}), this;
|
|
71
86
|
}
|
|
72
87
|
getSize() {
|
|
73
|
-
const
|
|
88
|
+
const t = new r.Box3().setFromObject(this.object3d);
|
|
74
89
|
return {
|
|
75
|
-
min:
|
|
76
|
-
max:
|
|
77
|
-
size:
|
|
90
|
+
min: t.min,
|
|
91
|
+
max: t.max,
|
|
92
|
+
size: t.getSize(new r.Vector3())
|
|
78
93
|
};
|
|
79
94
|
}
|
|
80
|
-
traverse(
|
|
81
|
-
|
|
82
|
-
|
|
95
|
+
traverse(t) {
|
|
96
|
+
t(this), this.children.forEach((e) => {
|
|
97
|
+
e.traverse(t);
|
|
83
98
|
});
|
|
84
99
|
}
|
|
100
|
+
clone() {
|
|
101
|
+
return this.drawController.clone(this);
|
|
102
|
+
}
|
|
103
|
+
instantiate(t) {
|
|
104
|
+
return this.drawController.instantiate(this, t);
|
|
105
|
+
}
|
|
106
|
+
erase() {
|
|
107
|
+
this.drawController.erase(this);
|
|
108
|
+
}
|
|
109
|
+
cloneMaterial() {
|
|
110
|
+
const t = this.object3d;
|
|
111
|
+
if (!t || !t.material)
|
|
112
|
+
return;
|
|
113
|
+
const e = t.material;
|
|
114
|
+
return Array.isArray(e) ? e.map((s) => s.clone()) : e.clone();
|
|
115
|
+
}
|
|
116
|
+
setMaterialList(t, e) {
|
|
117
|
+
const s = this.object3d;
|
|
118
|
+
if (!s || !s.material)
|
|
119
|
+
return;
|
|
120
|
+
this.materialList.origin || (this.materialList.origin = s.material);
|
|
121
|
+
const a = e === "clone" ? this.cloneMaterial() : e;
|
|
122
|
+
return this.materialList[t] = a, a;
|
|
123
|
+
}
|
|
124
|
+
useMaterial(t) {
|
|
125
|
+
const e = this.object3d;
|
|
126
|
+
!e || !e.material || this.useMaterialType === t || (this.useMaterialType = t, e.material = this.materialList[t]);
|
|
127
|
+
}
|
|
85
128
|
dispose() {
|
|
86
|
-
|
|
129
|
+
h(this.object3d), Object.keys(this.materialList).forEach((t) => {
|
|
130
|
+
t !== "origin" && c({
|
|
131
|
+
material: this.materialList[t]
|
|
132
|
+
});
|
|
133
|
+
});
|
|
87
134
|
}
|
|
88
135
|
}
|
|
89
136
|
export {
|
|
90
|
-
|
|
137
|
+
w as B,
|
|
138
|
+
o as b,
|
|
139
|
+
n as o
|
|
91
140
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const p=require("three");function f(o){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const i in o)if(i!=="default"){const e=Object.getOwnPropertyDescriptor(o,i);Object.defineProperty(c,i,e.get?e:{enumerable:!0,get:()=>o[i]})}}return c.default=o,Object.freeze(c)}const m=f(p),t={linearSRGB:"srgb-linear",sRGB:"srgb"},n={Linear:3e3,sRGB:3001};function u({node:o,material:c,texture:i}){let e=i?{map:i}:c||(o==null?void 0:o.material);e&&!Array.isArray(e)&&(e=[e]),e==null||e.forEach(l=>{var s,a;const r=l;+m.REVISION<152?((s=r.color)==null||s.convertSRGBToLinear(),(a=r.emissive)==null||a.convertSRGBToLinear(),r.map&&(r.map.encoding=n.sRGB),r.emissiveMap&&(r.emissiveMap.encoding=n.sRGB)):(r.map&&(r.map.colorSpace=t.sRGB),r.emissiveMap&&(r.emissiveMap.colorSpace=t.sRGB))})}exports.ColorSpace=t;exports.TextureEncoding=n;exports.colorCorrection=u;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as R from "three";
|
|
2
|
+
const n = {
|
|
3
|
+
linearSRGB: "srgb-linear",
|
|
4
|
+
sRGB: "srgb"
|
|
5
|
+
}, p = {
|
|
6
|
+
Linear: 3e3,
|
|
7
|
+
sRGB: 3001
|
|
8
|
+
};
|
|
9
|
+
function l({
|
|
10
|
+
node: e,
|
|
11
|
+
material: a,
|
|
12
|
+
texture: o
|
|
13
|
+
}) {
|
|
14
|
+
let s = o ? { map: o } : a || (e == null ? void 0 : e.material);
|
|
15
|
+
s && !Array.isArray(s) && (s = [s]), s == null || s.forEach((m) => {
|
|
16
|
+
var r, c;
|
|
17
|
+
const i = m;
|
|
18
|
+
+R.REVISION < 152 ? ((r = i.color) == null || r.convertSRGBToLinear(), (c = i.emissive) == null || c.convertSRGBToLinear(), i.map && (i.map.encoding = p.sRGB), i.emissiveMap && (i.emissiveMap.encoding = p.sRGB)) : (i.map && (i.map.colorSpace = n.sRGB), i.emissiveMap && (i.emissiveMap.colorSpace = n.sRGB));
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
n as C,
|
|
23
|
+
p as T,
|
|
24
|
+
l as c
|
|
25
|
+
};
|
|
@@ -1,29 +1,37 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import type Pencil from "./Pencil";
|
|
3
|
+
import type Draw from "../plugins/Draw";
|
|
4
|
+
export declare const objMap: WeakMap<THREE.Object3D<THREE.Event>, IBaseObject>;
|
|
5
|
+
export declare const baseObjectByObject3D: (obj: THREE.Object3D) => IBaseObject | undefined;
|
|
3
6
|
export { CSS3DObject, CSS3DSprite, } from 'three/examples/jsm/renderers/CSS3DRenderer';
|
|
4
7
|
export { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer';
|
|
5
8
|
export default class BaseObject {
|
|
6
|
-
|
|
9
|
+
objectType: string;
|
|
10
|
+
objectOptions?: Record<string, any>;
|
|
7
11
|
key: string;
|
|
8
12
|
pencil: Pencil;
|
|
13
|
+
drawController: Draw<any>;
|
|
9
14
|
object3d: THREE.Object3D;
|
|
10
15
|
userData: Record<string, any>;
|
|
11
16
|
get parent(): IBaseObject | THREE.Scene;
|
|
12
17
|
get children(): IBaseObject[];
|
|
18
|
+
get position(): THREE.Vector3;
|
|
19
|
+
get rotation(): THREE.Euler;
|
|
20
|
+
get scale(): THREE.Vector3;
|
|
21
|
+
get add(): (...object: THREE.Object3D<THREE.Event>[]) => THREE.Object3D<THREE.Event>;
|
|
22
|
+
get remove(): (...object: THREE.Object3D<THREE.Event>[]) => THREE.Object3D<THREE.Event>;
|
|
23
|
+
get visible(): boolean;
|
|
13
24
|
pm: {
|
|
14
25
|
promise: Promise<any>;
|
|
15
26
|
resolve: (value?: any) => void;
|
|
16
27
|
reject: (value?: any) => void;
|
|
17
28
|
};
|
|
18
|
-
visible: boolean;
|
|
19
|
-
init(): void;
|
|
20
29
|
create(): void;
|
|
21
30
|
render(): void;
|
|
22
31
|
update(delta: number, elapsed: number): void;
|
|
23
32
|
resize(width: number, height: number): void;
|
|
24
33
|
show(): this;
|
|
25
34
|
hide(): this;
|
|
26
|
-
isVisible(): boolean;
|
|
27
35
|
createMesh(...args: ConstructorParameters<typeof THREE.Mesh>): this;
|
|
28
36
|
createGroup(): this;
|
|
29
37
|
createPoints(...args: ConstructorParameters<typeof THREE.Points>): this;
|
|
@@ -31,15 +39,21 @@ export default class BaseObject {
|
|
|
31
39
|
createCSS3DObject(dom: HTMLElement): this;
|
|
32
40
|
createCSS3DSprite(dom: HTMLElement): this;
|
|
33
41
|
createSprite(material: THREE.SpriteMaterial): this;
|
|
34
|
-
|
|
35
|
-
remove(...args: Parameters<THREE.Object3D['remove']>): this;
|
|
36
|
-
attach(o: IBaseObject): this;
|
|
42
|
+
attach(...args: IBaseObject[]): this;
|
|
37
43
|
getSize(): {
|
|
38
44
|
min: THREE.Vector3;
|
|
39
45
|
max: THREE.Vector3;
|
|
40
46
|
size: THREE.Vector3;
|
|
41
47
|
};
|
|
42
48
|
traverse(fn: (o: IBaseObject) => void): void;
|
|
49
|
+
clone(): Promise<any>;
|
|
50
|
+
instantiate(extendsOptions?: any): Promise<any>;
|
|
51
|
+
erase(): void;
|
|
52
|
+
cloneMaterial(): THREE.Material | THREE.Material[] | undefined;
|
|
53
|
+
materialList: Record<string, THREE.Material | THREE.Material[]>;
|
|
54
|
+
setMaterialList(name: string, material: THREE.Material | THREE.Material[] | 'clone'): THREE.Material | THREE.Material[] | undefined;
|
|
55
|
+
useMaterialType: string;
|
|
56
|
+
useMaterial(name: string): void;
|
|
43
57
|
dispose(): void;
|
|
44
58
|
}
|
|
45
59
|
export interface IBaseObject extends BaseObject {
|
package/dist/core/Camera.d.ts
CHANGED
package/dist/core/Composer.d.ts
CHANGED
|
@@ -1,21 +1,46 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import GUI from 'lil-gui';
|
|
3
|
-
import { EffectComposer, CopyPass, EffectPass, SelectiveBloomEffect } from 'postprocessing';
|
|
3
|
+
import { EffectComposer, CopyPass, EffectPass, BlendFunction, SelectiveBloomEffect, ToneMappingEffect, ToneMappingMode } from 'postprocessing';
|
|
4
|
+
import CrossFadePass from './pass/CrossFadePass';
|
|
4
5
|
export interface BloomParams {
|
|
6
|
+
luminancePass: boolean;
|
|
5
7
|
luminanceThreshold: number;
|
|
6
8
|
luminanceSmoothing: number;
|
|
7
9
|
mipmapBlur: boolean;
|
|
8
10
|
intensity: number;
|
|
11
|
+
blendFunction: BlendFunction;
|
|
12
|
+
ignoreBackground: boolean;
|
|
9
13
|
}
|
|
10
14
|
export declare const defaultBloomParams: {
|
|
15
|
+
luminancePass: boolean;
|
|
11
16
|
luminanceThreshold: number;
|
|
12
17
|
luminanceSmoothing: number;
|
|
13
18
|
mipmapBlur: boolean;
|
|
14
19
|
intensity: number;
|
|
20
|
+
blendFunction: BlendFunction;
|
|
21
|
+
ignoreBackground: boolean;
|
|
22
|
+
};
|
|
23
|
+
export interface ToneMappingParams {
|
|
24
|
+
mode: ToneMappingMode;
|
|
25
|
+
resolution: number;
|
|
26
|
+
whitePoint: number;
|
|
27
|
+
middleGrey: number;
|
|
28
|
+
minLuminance: number;
|
|
29
|
+
averageLuminance: number;
|
|
30
|
+
adaptationRate: number;
|
|
31
|
+
}
|
|
32
|
+
export declare const defaultToneMappingParams: {
|
|
33
|
+
mode: ToneMappingMode;
|
|
34
|
+
resolution: number;
|
|
35
|
+
whitePoint: number;
|
|
36
|
+
middleGrey: number;
|
|
37
|
+
minLuminance: number;
|
|
38
|
+
averageLuminance: number;
|
|
39
|
+
adaptationRate: number;
|
|
15
40
|
};
|
|
16
41
|
export interface ComposerParams {
|
|
17
42
|
multisampling: number;
|
|
18
|
-
|
|
43
|
+
frameBufferType: THREE.TextureDataType;
|
|
19
44
|
encoding: THREE.TextureEncoding;
|
|
20
45
|
}
|
|
21
46
|
interface Options {
|
|
@@ -33,11 +58,17 @@ export default class {
|
|
|
33
58
|
fxaaPass?: EffectPass;
|
|
34
59
|
bloomPass?: EffectPass;
|
|
35
60
|
bloomEffect?: SelectiveBloomEffect;
|
|
61
|
+
crossFadePass?: CrossFadePass;
|
|
62
|
+
toneMappingPass?: EffectPass;
|
|
63
|
+
toneMappingEffect?: ToneMappingEffect;
|
|
36
64
|
options: Options;
|
|
37
65
|
active: boolean;
|
|
38
66
|
constructor(options: Options);
|
|
39
67
|
addCopyPass(): void;
|
|
68
|
+
addCrossFadePass(): void;
|
|
40
69
|
addFXAAPass(): void;
|
|
70
|
+
addToneMappingPass(params: ToneMappingParams): void;
|
|
71
|
+
addToneMappingGui(gui: GUI): void;
|
|
41
72
|
addBloomPass(params: BloomParams): void;
|
|
42
73
|
addBloomGui(gui: GUI): void;
|
|
43
74
|
toggleBloomSelection(obj?: THREE.Object3D<THREE.Event>, state?: boolean): void;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import CameraControls from 'camera-controls';
|
|
3
|
+
export interface ControlsParams {
|
|
4
|
+
domElement: HTMLElement;
|
|
5
|
+
}
|
|
6
|
+
export declare const defaultControlParams: {};
|
|
7
|
+
interface Options {
|
|
8
|
+
camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
9
|
+
controlsParams: ControlsParams;
|
|
10
|
+
customControl?: any;
|
|
11
|
+
}
|
|
12
|
+
export default class {
|
|
13
|
+
options: Options;
|
|
14
|
+
controls?: any;
|
|
15
|
+
cameraControls?: CameraControls;
|
|
16
|
+
cameraControlsAction: Readonly<{
|
|
17
|
+
readonly NONE: 0;
|
|
18
|
+
readonly ROTATE: 1;
|
|
19
|
+
readonly TRUCK: 2;
|
|
20
|
+
readonly OFFSET: 4;
|
|
21
|
+
readonly DOLLY: 8;
|
|
22
|
+
readonly ZOOM: 16;
|
|
23
|
+
readonly TOUCH_ROTATE: 32;
|
|
24
|
+
readonly TOUCH_TRUCK: 64;
|
|
25
|
+
readonly TOUCH_OFFSET: 128;
|
|
26
|
+
readonly TOUCH_DOLLY: 256;
|
|
27
|
+
readonly TOUCH_ZOOM: 512;
|
|
28
|
+
readonly TOUCH_DOLLY_TRUCK: 1024;
|
|
29
|
+
readonly TOUCH_DOLLY_OFFSET: 2048;
|
|
30
|
+
readonly TOUCH_DOLLY_ROTATE: 4096;
|
|
31
|
+
readonly TOUCH_ZOOM_TRUCK: 8192;
|
|
32
|
+
readonly TOUCH_ZOOM_OFFSET: 16384;
|
|
33
|
+
readonly TOUCH_ZOOM_ROTATE: 32768;
|
|
34
|
+
}>;
|
|
35
|
+
private limitPanV?;
|
|
36
|
+
constructor(options: Options);
|
|
37
|
+
limitPan({ maxX, minX, maxZ, minZ, maxY, minY, }: {
|
|
38
|
+
maxX?: number | undefined;
|
|
39
|
+
minX?: number | undefined;
|
|
40
|
+
maxZ?: number | undefined;
|
|
41
|
+
minZ?: number | undefined;
|
|
42
|
+
maxY?: number | undefined;
|
|
43
|
+
minY?: number | undefined;
|
|
44
|
+
}): void;
|
|
45
|
+
changeRotation({ vertical, horizontal, distance, }: {
|
|
46
|
+
vertical?: number;
|
|
47
|
+
horizontal?: number;
|
|
48
|
+
distance?: number;
|
|
49
|
+
}): void;
|
|
50
|
+
enable(): void;
|
|
51
|
+
disable(): void;
|
|
52
|
+
autoRotateSpeed: number;
|
|
53
|
+
update(delta: number): void;
|
|
54
|
+
dispose(): void;
|
|
55
|
+
}
|
|
56
|
+
export {};
|
package/dist/core/Pencil.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="postprocessing" />
|
|
1
2
|
import * as THREE from 'three';
|
|
2
3
|
import { EventEmitter } from 'events';
|
|
3
4
|
import Stats from 'three/examples/jsm/libs/stats.module';
|
|
@@ -5,9 +6,10 @@ import GUI from 'lil-gui';
|
|
|
5
6
|
import { RendererParams } from "./Renderer";
|
|
6
7
|
import { CameraParams } from "./Camera";
|
|
7
8
|
import SceneController, { SceneParams } from "./Scene";
|
|
8
|
-
import
|
|
9
|
+
import ControlsController, { ControlsParams } from "./Controls";
|
|
10
|
+
import TransformController from "./TransformControls";
|
|
9
11
|
import CSSRendererController, { CSSRendererParams } from "./CSSRenderer";
|
|
10
|
-
import ComposerController, { BloomParams } from "./Composer";
|
|
12
|
+
import ComposerController, { BloomParams, ToneMappingParams } from "./Composer";
|
|
11
13
|
type DeepRequired<T> = T extends Function | HTMLElement ? T : T extends object ? {
|
|
12
14
|
[P in keyof T]-?: DeepRequired<T[P]>;
|
|
13
15
|
} : T;
|
|
@@ -18,18 +20,23 @@ interface Options {
|
|
|
18
20
|
gui?: boolean;
|
|
19
21
|
axesHelper?: boolean;
|
|
20
22
|
control?: boolean | any;
|
|
21
|
-
controlParams?: Partial<
|
|
23
|
+
controlParams?: Partial<ControlsParams>;
|
|
24
|
+
transformControls?: boolean;
|
|
22
25
|
resizeObserver?: boolean;
|
|
23
26
|
renderer?: {
|
|
24
27
|
antialias?: false | 'fxaa' | 'msaa';
|
|
25
28
|
} & Omit<Partial<RendererParams>, 'antialias'>;
|
|
26
29
|
multisampling?: number;
|
|
30
|
+
frameBufferType?: THREE.TextureDataType;
|
|
27
31
|
passes?: any[];
|
|
28
32
|
staticRender?: boolean;
|
|
29
33
|
scene?: Partial<SceneParams>;
|
|
30
34
|
camera?: Partial<CameraParams> | THREE.PerspectiveCamera;
|
|
31
35
|
bloom?: boolean;
|
|
32
36
|
bloomParams?: Partial<BloomParams>;
|
|
37
|
+
toneMapping?: boolean;
|
|
38
|
+
toneMappingParams?: Partial<ToneMappingParams>;
|
|
39
|
+
crossOpacity?: boolean;
|
|
33
40
|
css2DRenderer?: boolean;
|
|
34
41
|
css2DRendererParams?: Partial<CSSRendererParams>;
|
|
35
42
|
css3DRenderer?: boolean;
|
|
@@ -44,7 +51,8 @@ export default class Pencil {
|
|
|
44
51
|
private rendererController;
|
|
45
52
|
cssRendererController?: CSSRendererController;
|
|
46
53
|
private cameraController;
|
|
47
|
-
|
|
54
|
+
controlsController?: ControlsController;
|
|
55
|
+
transformController?: TransformController;
|
|
48
56
|
sceneController: SceneController;
|
|
49
57
|
stats?: Stats;
|
|
50
58
|
gui?: GUI;
|
|
@@ -52,7 +60,8 @@ export default class Pencil {
|
|
|
52
60
|
private raycaster;
|
|
53
61
|
installPlugins: Map<any, boolean>;
|
|
54
62
|
get renderer(): THREE.WebGLRenderer;
|
|
55
|
-
get control():
|
|
63
|
+
get control(): any;
|
|
64
|
+
get cameraControls(): import("camera-controls").default | undefined;
|
|
56
65
|
get camera(): THREE.PerspectiveCamera;
|
|
57
66
|
get scene(): THREE.Scene;
|
|
58
67
|
event: EventEmitter;
|
|
@@ -64,15 +73,16 @@ export default class Pencil {
|
|
|
64
73
|
gui: boolean;
|
|
65
74
|
axesHelper: boolean;
|
|
66
75
|
control: boolean;
|
|
76
|
+
transformControls: boolean;
|
|
67
77
|
resizeObserver: boolean;
|
|
68
78
|
renderer: {
|
|
69
79
|
antialias: string;
|
|
70
80
|
devicePixelRatio: number;
|
|
71
81
|
powerPreference: string;
|
|
72
|
-
toneMapping: string;
|
|
73
82
|
toneMappingExposure: number;
|
|
74
83
|
alpha: boolean;
|
|
75
|
-
outputEncoding:
|
|
84
|
+
outputEncoding: 3000;
|
|
85
|
+
outputColorSpace: "srgb";
|
|
76
86
|
logarithmicDepthBuffer: boolean;
|
|
77
87
|
preserveDrawingBuffer: boolean;
|
|
78
88
|
stencil: boolean;
|
|
@@ -81,6 +91,7 @@ export default class Pencil {
|
|
|
81
91
|
};
|
|
82
92
|
staticRender: boolean;
|
|
83
93
|
multisampling: number;
|
|
94
|
+
frameBufferType: 1009;
|
|
84
95
|
scene: {
|
|
85
96
|
background: null;
|
|
86
97
|
};
|
|
@@ -92,11 +103,25 @@ export default class Pencil {
|
|
|
92
103
|
};
|
|
93
104
|
bloom: boolean;
|
|
94
105
|
bloomParams: {
|
|
106
|
+
luminancePass: boolean;
|
|
95
107
|
luminanceThreshold: number;
|
|
96
108
|
luminanceSmoothing: number;
|
|
97
109
|
mipmapBlur: boolean;
|
|
98
110
|
intensity: number;
|
|
111
|
+
blendFunction: import("postprocessing").BlendFunction;
|
|
112
|
+
ignoreBackground: boolean;
|
|
99
113
|
};
|
|
114
|
+
toneMapping: boolean;
|
|
115
|
+
toneMappingParams: {
|
|
116
|
+
mode: import("postprocessing").ToneMappingMode;
|
|
117
|
+
resolution: number;
|
|
118
|
+
whitePoint: number;
|
|
119
|
+
middleGrey: number;
|
|
120
|
+
minLuminance: number;
|
|
121
|
+
averageLuminance: number;
|
|
122
|
+
adaptationRate: number;
|
|
123
|
+
};
|
|
124
|
+
crossOpacity: boolean;
|
|
100
125
|
css2DRenderer: boolean;
|
|
101
126
|
css2DRendererParams: {
|
|
102
127
|
zIndex: string;
|
|
@@ -106,12 +131,14 @@ export default class Pencil {
|
|
|
106
131
|
zIndex: string;
|
|
107
132
|
};
|
|
108
133
|
};
|
|
109
|
-
constructor(options: Options);
|
|
134
|
+
constructor(options: Options, plugin?: any);
|
|
110
135
|
use(plugin: any, ...args: any[]): void;
|
|
111
136
|
private init;
|
|
112
137
|
private initComposer;
|
|
138
|
+
get opacity(): any;
|
|
139
|
+
set opacity(value: any);
|
|
113
140
|
private initCSSRenderer;
|
|
114
|
-
private
|
|
141
|
+
private initControls;
|
|
115
142
|
getSize(): {
|
|
116
143
|
width: number;
|
|
117
144
|
height: number;
|
package/dist/core/Renderer.d.ts
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import
|
|
3
|
-
declare const toneMappingOptions: {
|
|
4
|
-
None: THREE.ToneMapping;
|
|
5
|
-
Linear: THREE.ToneMapping;
|
|
6
|
-
Reinhard: THREE.ToneMapping;
|
|
7
|
-
Cineon: THREE.ToneMapping;
|
|
8
|
-
ACESFilmic: THREE.ToneMapping;
|
|
9
|
-
};
|
|
2
|
+
import { ColorSpace, TextureEncoding } from "../utils/colorCorrection";
|
|
10
3
|
export interface RendererParams {
|
|
11
4
|
antialias: boolean;
|
|
12
5
|
devicePixelRatio: number;
|
|
13
6
|
powerPreference: 'high-performance' | 'low-power' | 'default';
|
|
14
|
-
toneMapping: keyof typeof toneMappingOptions;
|
|
15
7
|
toneMappingExposure: number;
|
|
16
8
|
alpha: boolean;
|
|
17
|
-
outputEncoding:
|
|
9
|
+
outputEncoding: (typeof TextureEncoding)[keyof typeof TextureEncoding];
|
|
10
|
+
outputColorSpace: (typeof ColorSpace)[keyof typeof ColorSpace];
|
|
18
11
|
logarithmicDepthBuffer: boolean;
|
|
19
12
|
preserveDrawingBuffer: boolean;
|
|
20
13
|
canvas?: HTMLCanvasElement | THREE.OffscreenCanvas;
|
|
@@ -27,10 +20,10 @@ export declare const defaultRendererParams: {
|
|
|
27
20
|
antialias: boolean;
|
|
28
21
|
devicePixelRatio: number;
|
|
29
22
|
powerPreference: string;
|
|
30
|
-
toneMapping: string;
|
|
31
23
|
toneMappingExposure: number;
|
|
32
24
|
alpha: boolean;
|
|
33
|
-
outputEncoding:
|
|
25
|
+
outputEncoding: 3000;
|
|
26
|
+
outputColorSpace: "srgb";
|
|
34
27
|
logarithmicDepthBuffer: boolean;
|
|
35
28
|
preserveDrawingBuffer: boolean;
|
|
36
29
|
stencil: boolean;
|
|
@@ -51,7 +44,6 @@ export default class {
|
|
|
51
44
|
constructor(options: Options);
|
|
52
45
|
setSize(width: number, height: number): void;
|
|
53
46
|
render(): void;
|
|
54
|
-
setGui(gui: GUI): void;
|
|
55
47
|
dispose(): void;
|
|
56
48
|
}
|
|
57
49
|
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { TransformControls } from 'three/examples/jsm/controls/TransformControls';
|
|
3
|
+
import { EventEmitter } from 'events';
|
|
4
|
+
interface Options {
|
|
5
|
+
renderer: THREE.WebGLRenderer;
|
|
6
|
+
scene: THREE.Scene;
|
|
7
|
+
camera: THREE.Camera;
|
|
8
|
+
}
|
|
9
|
+
export default class {
|
|
10
|
+
controls: TransformControls;
|
|
11
|
+
get detach(): () => TransformControls;
|
|
12
|
+
get attach(): (object: THREE.Object3D<THREE.Event>) => TransformControls;
|
|
13
|
+
event: EventEmitter;
|
|
14
|
+
constructor(options: Options);
|
|
15
|
+
addEvent(): void;
|
|
16
|
+
dispose(): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ShaderMaterial } from 'three';
|
|
2
|
+
import { Pass } from 'postprocessing';
|
|
3
|
+
declare class CrossFadeMaterial extends ShaderMaterial {
|
|
4
|
+
constructor();
|
|
5
|
+
}
|
|
6
|
+
export default class CrossFadePass extends Pass {
|
|
7
|
+
constructor();
|
|
8
|
+
fullscreenMaterial: CrossFadeMaterial;
|
|
9
|
+
render(renderer: THREE.WebGLRenderer, inputBuffer: THREE.WebGLRenderTarget, outputBuffer: THREE.WebGLRenderTarget): void;
|
|
10
|
+
}
|
|
11
|
+
export {};
|