three-stdlib 2.6.4 → 2.8.0
Sign up to get free protection for your applications and to get access to all the features.
- package/{Nodes-ec4e1143.js → Nodes-894ac9dc.js} +0 -0
- package/{Nodes-427f68b0.js → Nodes-af575af7.js} +0 -0
- package/controls/ArcballControls.cjs.js +1 -1
- package/controls/ArcballControls.d.ts +161 -0
- package/controls/ArcballControls.js +554 -285
- package/controls/FirstPersonControls.cjs.js +1 -1
- package/controls/FirstPersonControls.d.ts +4 -5
- package/controls/FirstPersonControls.js +36 -45
- package/controls/OrbitControls.cjs.js +1 -1
- package/controls/OrbitControls.d.ts +1 -0
- package/controls/OrbitControls.js +13 -2
- package/controls/TransformControls.cjs.js +1 -1
- package/controls/TransformControls.d.ts +2 -1
- package/controls/TransformControls.js +25 -26
- package/geometries/TeapotGeometry.js +2 -2
- package/geometries/TextGeometry.cjs.js +1 -0
- package/geometries/TextGeometry.d.ts +16 -0
- package/geometries/TextGeometry.js +26 -0
- package/index.cjs.js +1 -1
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/loaders/FontLoader.cjs.js +1 -0
- package/loaders/FontLoader.d.ts +32 -0
- package/loaders/FontLoader.js +139 -0
- package/loaders/GLTFLoader.js +1 -3
- package/loaders/NodeMaterialLoader.cjs.js +1 -1
- package/loaders/STLLoader.js +7 -7
- package/nodes/accessors/CameraNode.js +12 -12
- package/nodes/accessors/PositionNode.js +3 -3
- package/nodes/accessors/ReflectNode.js +3 -3
- package/nodes/core/FunctionNode.js +3 -3
- package/nodes/core/InputNode.js +3 -3
- package/nodes/core/Node.js +6 -6
- package/nodes/core/TempNode.js +6 -6
- package/nodes/effects/BlurNode.js +3 -3
- package/nodes/math/MathNode.js +3 -3
- package/nodes/utils/VelocityNode.js +6 -6
- package/package.json +2 -2
- package/renderers/nodes/accessors/UVNode.js +1 -3
- package/renderers/nodes/core/AttributeNode.js +1 -3
- package/renderers/nodes/core/Node.js +4 -12
- package/renderers/nodes/core/NodeBuilder.js +6 -18
- package/webxr/ARButton.js +6 -6
- package/webxr/VRButton.js +6 -6
package/index.d.ts
CHANGED
@@ -246,6 +246,7 @@ export * from './geometries/RoundedBoxGeometry';
|
|
246
246
|
export * from './geometries/BoxLineGeometry';
|
247
247
|
export * from './geometries/DecalGeometry';
|
248
248
|
export * from './geometries/TeapotGeometry';
|
249
|
+
export * from './geometries/TextGeometry';
|
249
250
|
export * from './csm/CSM';
|
250
251
|
export * from './csm/Shader';
|
251
252
|
export * from './csm/CSMHelper';
|
@@ -312,6 +313,7 @@ export * from './effects/AnaglyphEffect';
|
|
312
313
|
export * from './effects/AsciiEffect';
|
313
314
|
export * from './effects/StereoEffect';
|
314
315
|
export * from './loaders/FBXLoader';
|
316
|
+
export * from './loaders/FontLoader';
|
315
317
|
export * from './loaders/TGALoader';
|
316
318
|
export * from './loaders/LUTCubeLoader';
|
317
319
|
export * from './loaders/NRRDLoader';
|
package/index.js
CHANGED
@@ -191,6 +191,7 @@ export { RoundedBoxGeometry } from './geometries/RoundedBoxGeometry.js';
|
|
191
191
|
export { BoxLineGeometry } from './geometries/BoxLineGeometry.js';
|
192
192
|
export { DecalGeometry, DecalVertex } from './geometries/DecalGeometry.js';
|
193
193
|
export { TeapotGeometry } from './geometries/TeapotGeometry.js';
|
194
|
+
export { TextGeometry as TextBufferGeometry, TextGeometry } from './geometries/TextGeometry.js';
|
194
195
|
export { CSM } from './csm/CSM.js';
|
195
196
|
export { CSMHelper } from './csm/CSMHelper.js';
|
196
197
|
export { SMAABlendShader, SMAAEdgesShader, SMAAWeightsShader } from './shaders/SMAAShader.js';
|
@@ -255,6 +256,7 @@ export { AnaglyphEffect } from './effects/AnaglyphEffect.js';
|
|
255
256
|
export { AsciiEffect } from './effects/AsciiEffect.js';
|
256
257
|
export { StereoEffect } from './effects/StereoEffect.js';
|
257
258
|
export { FBXLoader } from './loaders/FBXLoader.js';
|
259
|
+
export { Font, FontLoader } from './loaders/FontLoader.js';
|
258
260
|
export { TGALoader } from './loaders/TGALoader.js';
|
259
261
|
export { LUTCubeLoader } from './loaders/LUTCubeLoader.js';
|
260
262
|
export { NRRDLoader } from './loaders/NRRDLoader.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("three");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=r(e);class a extends t.Loader{constructor(e){super(e)}load(e,r,s,a){const n=new t.FileLoader(this.manager);n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(e,(e=>{if("string"!=typeof e)throw new Error("unsupported data type");const t=JSON.parse(e),s=this.parse(t);r&&r(s)}),s,a)}parse(e){return new n(e)}}class n{constructor(e){s.default(this,"data",void 0),this.data=e}generateShapes(e,t=100){const r=[],s=function(e,t,r){const s=Array.from(e),a=t/r.resolution,n=(r.boundingBox.yMax-r.boundingBox.yMin+r.underlineThickness)*a,i=[];let p=0,l=0;for(let e=0;e<s.length;e++){const t=s[e];if("\n"===t)p=0,l-=n;else{const e=o(t,a,p,l,r);e&&(p+=e.offsetX,i.push(e.path))}}return i}(e,t,this.data);for(let e=0,t=s.length;e<t;e++)Array.prototype.push.apply(r,s[e].toShapes(!1));return r}}function o(e,r,s,a,n){const o=n.glyphs[e]||n.glyphs["?"];if(!o)return void console.error('THREE.Font: character "'+e+'" does not exists in font family '+n.familyName+".");const i=new t.ShapePath;let p,l,u,c,d,h,f,y;if(o.o){const e=o._cachedOutline||(o._cachedOutline=o.o.split(" "));for(let t=0,n=e.length;t<n;){switch(e[t++]){case"m":p=parseInt(e[t++])*r+s,l=parseInt(e[t++])*r+a,i.moveTo(p,l);break;case"l":p=parseInt(e[t++])*r+s,l=parseInt(e[t++])*r+a,i.lineTo(p,l);break;case"q":u=parseInt(e[t++])*r+s,c=parseInt(e[t++])*r+a,d=parseInt(e[t++])*r+s,h=parseInt(e[t++])*r+a,i.quadraticCurveTo(d,h,u,c);break;case"b":u=parseInt(e[t++])*r+s,c=parseInt(e[t++])*r+a,d=parseInt(e[t++])*r+s,h=parseInt(e[t++])*r+a,f=parseInt(e[t++])*r+s,y=parseInt(e[t++])*r+a,i.bezierCurveTo(d,h,f,y,u,c)}}}return{offsetX:o.ha*r,path:i}}s.default(n,"isFont",void 0),s.default(n,"type",void 0),exports.Font=n,exports.FontLoader=a;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { Loader } from 'three';
|
2
|
+
import type { LoadingManager, Shape } from 'three';
|
3
|
+
export declare class FontLoader extends Loader {
|
4
|
+
constructor(manager?: LoadingManager);
|
5
|
+
load(url: string, onLoad?: (responseFont: Font) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
|
6
|
+
parse(json: FontData): Font;
|
7
|
+
}
|
8
|
+
declare type Glyph = {
|
9
|
+
_cachedOutline: string[];
|
10
|
+
ha: number;
|
11
|
+
o: string;
|
12
|
+
};
|
13
|
+
declare type FontData = {
|
14
|
+
boundingBox: {
|
15
|
+
yMax: number;
|
16
|
+
yMin: number;
|
17
|
+
};
|
18
|
+
familyName: string;
|
19
|
+
glyphs: {
|
20
|
+
[k: string]: Glyph;
|
21
|
+
};
|
22
|
+
resolution: number;
|
23
|
+
underlineThickness: number;
|
24
|
+
};
|
25
|
+
export declare class Font {
|
26
|
+
data: FontData;
|
27
|
+
static isFont: true;
|
28
|
+
static type: 'Font';
|
29
|
+
constructor(data: FontData);
|
30
|
+
generateShapes(text: string, size?: number): Shape[];
|
31
|
+
}
|
32
|
+
export {};
|
@@ -0,0 +1,139 @@
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
2
|
+
import { Loader, FileLoader, ShapePath } from 'three';
|
3
|
+
|
4
|
+
class FontLoader extends Loader {
|
5
|
+
constructor(manager) {
|
6
|
+
super(manager);
|
7
|
+
}
|
8
|
+
|
9
|
+
load(url, onLoad, onProgress, onError) {
|
10
|
+
const loader = new FileLoader(this.manager);
|
11
|
+
loader.setPath(this.path);
|
12
|
+
loader.setRequestHeader(this.requestHeader);
|
13
|
+
loader.setWithCredentials(this.withCredentials);
|
14
|
+
loader.load(url, response => {
|
15
|
+
if (typeof response !== 'string') throw new Error('unsupported data type');
|
16
|
+
const json = JSON.parse(response);
|
17
|
+
const font = this.parse(json);
|
18
|
+
if (onLoad) onLoad(font);
|
19
|
+
}, onProgress, onError);
|
20
|
+
}
|
21
|
+
|
22
|
+
parse(json) {
|
23
|
+
return new Font(json);
|
24
|
+
}
|
25
|
+
|
26
|
+
}
|
27
|
+
class Font {
|
28
|
+
constructor(data) {
|
29
|
+
_defineProperty(this, "data", void 0);
|
30
|
+
|
31
|
+
this.data = data;
|
32
|
+
}
|
33
|
+
|
34
|
+
generateShapes(text, size = 100) {
|
35
|
+
const shapes = [];
|
36
|
+
const paths = createPaths(text, size, this.data);
|
37
|
+
|
38
|
+
for (let p = 0, pl = paths.length; p < pl; p++) {
|
39
|
+
Array.prototype.push.apply(shapes, paths[p].toShapes(false));
|
40
|
+
}
|
41
|
+
|
42
|
+
return shapes;
|
43
|
+
}
|
44
|
+
|
45
|
+
}
|
46
|
+
|
47
|
+
_defineProperty(Font, "isFont", void 0);
|
48
|
+
|
49
|
+
_defineProperty(Font, "type", void 0);
|
50
|
+
|
51
|
+
function createPaths(text, size, data) {
|
52
|
+
const chars = Array.from(text);
|
53
|
+
const scale = size / data.resolution;
|
54
|
+
const line_height = (data.boundingBox.yMax - data.boundingBox.yMin + data.underlineThickness) * scale;
|
55
|
+
const paths = [];
|
56
|
+
let offsetX = 0,
|
57
|
+
offsetY = 0;
|
58
|
+
|
59
|
+
for (let i = 0; i < chars.length; i++) {
|
60
|
+
const char = chars[i];
|
61
|
+
|
62
|
+
if (char === '\n') {
|
63
|
+
offsetX = 0;
|
64
|
+
offsetY -= line_height;
|
65
|
+
} else {
|
66
|
+
const ret = createPath(char, scale, offsetX, offsetY, data);
|
67
|
+
|
68
|
+
if (ret) {
|
69
|
+
offsetX += ret.offsetX;
|
70
|
+
paths.push(ret.path);
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
return paths;
|
76
|
+
}
|
77
|
+
|
78
|
+
function createPath(char, scale, offsetX, offsetY, data) {
|
79
|
+
const glyph = data.glyphs[char] || data.glyphs['?'];
|
80
|
+
|
81
|
+
if (!glyph) {
|
82
|
+
console.error('THREE.Font: character "' + char + '" does not exists in font family ' + data.familyName + '.');
|
83
|
+
return;
|
84
|
+
}
|
85
|
+
|
86
|
+
const path = new ShapePath();
|
87
|
+
let x, y, cpx, cpy, cpx1, cpy1, cpx2, cpy2;
|
88
|
+
|
89
|
+
if (glyph.o) {
|
90
|
+
const outline = glyph._cachedOutline || (glyph._cachedOutline = glyph.o.split(' '));
|
91
|
+
|
92
|
+
for (let i = 0, l = outline.length; i < l;) {
|
93
|
+
const action = outline[i++];
|
94
|
+
|
95
|
+
switch (action) {
|
96
|
+
case 'm':
|
97
|
+
// moveTo
|
98
|
+
x = parseInt(outline[i++]) * scale + offsetX;
|
99
|
+
y = parseInt(outline[i++]) * scale + offsetY;
|
100
|
+
path.moveTo(x, y);
|
101
|
+
break;
|
102
|
+
|
103
|
+
case 'l':
|
104
|
+
// lineTo
|
105
|
+
x = parseInt(outline[i++]) * scale + offsetX;
|
106
|
+
y = parseInt(outline[i++]) * scale + offsetY;
|
107
|
+
path.lineTo(x, y);
|
108
|
+
break;
|
109
|
+
|
110
|
+
case 'q':
|
111
|
+
// quadraticCurveTo
|
112
|
+
cpx = parseInt(outline[i++]) * scale + offsetX;
|
113
|
+
cpy = parseInt(outline[i++]) * scale + offsetY;
|
114
|
+
cpx1 = parseInt(outline[i++]) * scale + offsetX;
|
115
|
+
cpy1 = parseInt(outline[i++]) * scale + offsetY;
|
116
|
+
path.quadraticCurveTo(cpx1, cpy1, cpx, cpy);
|
117
|
+
break;
|
118
|
+
|
119
|
+
case 'b':
|
120
|
+
// bezierCurveTo
|
121
|
+
cpx = parseInt(outline[i++]) * scale + offsetX;
|
122
|
+
cpy = parseInt(outline[i++]) * scale + offsetY;
|
123
|
+
cpx1 = parseInt(outline[i++]) * scale + offsetX;
|
124
|
+
cpy1 = parseInt(outline[i++]) * scale + offsetY;
|
125
|
+
cpx2 = parseInt(outline[i++]) * scale + offsetX;
|
126
|
+
cpy2 = parseInt(outline[i++]) * scale + offsetY;
|
127
|
+
path.bezierCurveTo(cpx1, cpy1, cpx2, cpy2, cpx, cpy);
|
128
|
+
break;
|
129
|
+
}
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
return {
|
134
|
+
offsetX: glyph.ha * scale,
|
135
|
+
path
|
136
|
+
};
|
137
|
+
}
|
138
|
+
|
139
|
+
export { Font, FontLoader };
|
package/loaders/GLTFLoader.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three"),s=require("../Nodes-
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three"),s=require("../Nodes-894ac9dc.js");require("../nodes/core/Node.cjs.js"),require("../nodes/core/TempNode.cjs.js"),require("../nodes/core/InputNode.cjs.js"),require("../nodes/core/ConstNode.cjs.js"),require("../nodes/core/VarNode.cjs.js"),require("../nodes/core/StructNode.cjs.js"),require("../nodes/core/AttributeNode.cjs.js"),require("../nodes/core/FunctionNode.cjs.js"),require("../nodes/core/NodeLib.cjs.js"),require("../nodes/core/ExpressionNode.cjs.js"),require("../nodes/core/FunctionCallNode.cjs.js"),require("../nodes/core/NodeUtils.cjs.js"),require("../nodes/core/NodeFrame.cjs.js"),require("../nodes/core/NodeUniform.cjs.js"),require("../nodes/core/NodeBuilder.cjs.js"),require("../nodes/inputs/Vector2Node.cjs.js"),require("../nodes/inputs/Vector3Node.cjs.js"),require("../nodes/inputs/Vector4Node.cjs.js"),require("../nodes/inputs/TextureNode.cjs.js"),require("../nodes/accessors/UVNode.cjs.js"),require("../nodes/utils/ColorSpaceNode.cjs.js"),require("../nodes/inputs/CubeTextureNode.cjs.js"),require("../nodes/accessors/ReflectNode.cjs.js"),require("../nodes/accessors/PositionNode.cjs.js"),require("../nodes/accessors/NormalNode.cjs.js"),require("../nodes/misc/TextureCubeNode.cjs.js"),require("../nodes/inputs/FloatNode.cjs.js"),require("../nodes/misc/TextureCubeUVNode.cjs.js"),require("../nodes/math/OperatorNode.cjs.js"),require("../nodes/math/MathNode.cjs.js"),require("../nodes/inputs/BoolNode.cjs.js"),require("../nodes/inputs/IntNode.cjs.js"),require("../nodes/inputs/ColorNode.cjs.js"),require("../nodes/inputs/Matrix3Node.cjs.js"),require("../nodes/inputs/Matrix4Node.cjs.js"),require("../nodes/inputs/ScreenNode.cjs.js"),require("../nodes/inputs/ReflectorNode.cjs.js"),require("../nodes/inputs/PropertyNode.cjs.js"),require("../nodes/inputs/RTTNode.cjs.js"),require("../nodes/materials/NodeMaterial.cjs.js"),require("../nodes/materials/nodes/RawNode.cjs.js"),require("../nodes/accessors/ColorsNode.cjs.js"),require("../nodes/accessors/CameraNode.cjs.js"),require("../nodes/accessors/LightNode.cjs.js"),require("../nodes/accessors/ScreenUVNode.cjs.js"),require("../nodes/accessors/ResolutionNode.cjs.js"),require("../nodes/math/CondNode.cjs.js"),require("../nodes/procedural/NoiseNode.cjs.js"),require("../nodes/procedural/CheckerNode.cjs.js"),require("../nodes/misc/NormalMapNode.cjs.js"),require("../nodes/misc/BumpMapNode.cjs.js"),require("../nodes/utils/BypassNode.cjs.js"),require("../nodes/utils/JoinNode.cjs.js"),require("../nodes/utils/SwitchNode.cjs.js"),require("../nodes/utils/TimerNode.cjs.js"),require("../nodes/utils/VelocityNode.cjs.js"),require("../nodes/utils/UVTransformNode.cjs.js"),require("../nodes/utils/MaxMIPLevelNode.cjs.js"),require("../nodes/utils/SpecularMIPLevelNode.cjs.js"),require("../nodes/utils/SubSlotNode.cjs.js"),require("../nodes/effects/BlurNode.cjs.js"),require("../nodes/effects/ColorAdjustmentNode.cjs.js"),require("../nodes/effects/LuminanceNode.cjs.js"),require("../nodes/materials/nodes/BasicNode.cjs.js"),require("../nodes/materials/nodes/SpriteNode.cjs.js"),require("../nodes/materials/nodes/PhongNode.cjs.js"),require("../nodes/materials/nodes/StandardNode.cjs.js"),require("../nodes/materials/nodes/MeshStandardNode.cjs.js"),require("../nodes/materials/BasicNodeMaterial.cjs.js"),require("../nodes/materials/SpriteNodeMaterial.cjs.js"),require("../nodes/materials/PhongNodeMaterial.cjs.js"),require("../nodes/materials/StandardNodeMaterial.cjs.js"),require("../nodes/materials/MeshStandardNodeMaterial.cjs.js"),require("../nodes/postprocessing/NodePostProcessing.cjs.js");class r extends e.Loader{constructor(e,s={}){super(e),this.nodes={},this.materials={},this.passes={},this.names={},this.library=s}load(s,r,o,i){const t=this,d=new e.FileLoader(t.manager);return d.setPath(t.path),d.load(s,(function(e){r(t.parse(JSON.parse(e)))}),o,i),this}getObjectByName(e){return this.names[e]}getObjectById(e){return this.library[e]||this.nodes[e]||this.materials[e]||this.passes[e]||this.names[e]}getNode(e){const s=this.getObjectById(e);return s||console.warn('Node "'+e+'" not found.'),s}resolve(e){switch(typeof e){case"boolean":case"number":return e;case"string":return/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/i.test(e)||this.library[e]?this.getNode(e):e;default:if(Array.isArray(e))for(let s=0;s<e.length;s++)e[s]=this.resolve(e[s]);else for(const s in e)"uuid"!==s&&(e[s]=this.resolve(e[s]))}return e}declare(e){let r,o,i;for(r in e.nodes)o=e.nodes[r],i=new s.Nodes[o.nodeType+"Node"],o.name&&(i.name=o.name,this.names[i.name]=i),this.nodes[r]=i;for(r in e.materials)o=e.materials[r],i=new s.Nodes[o.type],o.name&&(i.name=o.name,this.names[i.name]=i),this.materials[r]=i;for(r in e.passes)o=e.passes[r],i=new s.Nodes[o.type],o.name&&(i.name=o.name,this.names[i.name]=i),this.passes[r]=i;return e.material&&(this.material=this.materials[e.material]),e.pass&&(this.pass=this.passes[e.pass]),e}parse(e){let s;for(s in(e=this.resolve(this.declare(e))).nodes)this.nodes[s].copy(e.nodes[s]);for(s in e.materials)this.materials[s].copy(e.materials[s]);for(s in e.passes)this.passes[s].copy(e.passes[s]);return this.material||this.pass||this}}exports.NodeMaterialLoader=r,exports.NodeMaterialLoaderUtils=class{static replaceUUIDObject(e,s,r,o){if(o=void 0===o||o,"object"==typeof s&&(s=s.uuid),"object"==typeof e){const i=Object.keys(e);for(let t=0;t<i.length;t++){const d=i[t];o&&(e[d]=this.replaceUUIDObject(e[d],s,r)),d===s&&(e[s]=e[d],delete e[d])}}return e===s?r:e}static replaceUUID(e,s,r){return this.replaceUUIDObject(e,s,r,!1),this.replaceUUIDObject(e.nodes,s,r),this.replaceUUIDObject(e.materials,s,r),this.replaceUUIDObject(e.passes,s,r),this.replaceUUIDObject(e.library,s,r,!1),e}};
|
package/loaders/STLLoader.js
CHANGED
@@ -135,13 +135,13 @@ class STLLoader extends Loader {
|
|
135
135
|
&& reader.getUint8(index + 5) == 0x3d
|
136
136
|
/*'='*/
|
137
137
|
) {
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
138
|
+
hasColors = true;
|
139
|
+
colors = new Float32Array(faces * 3 * 3);
|
140
|
+
defaultR = reader.getUint8(index + 6) / 255;
|
141
|
+
defaultG = reader.getUint8(index + 7) / 255;
|
142
|
+
defaultB = reader.getUint8(index + 8) / 255;
|
143
|
+
alpha = reader.getUint8(index + 9) / 255;
|
144
|
+
}
|
145
145
|
}
|
146
146
|
|
147
147
|
const dataOffset = 84;
|
@@ -47,9 +47,9 @@ CameraNode.prototype.setScope = function (scope) {
|
|
47
47
|
}
|
48
48
|
};
|
49
49
|
|
50
|
-
CameraNode.prototype.getType = function
|
51
|
-
/* builder */
|
52
|
-
{
|
50
|
+
CameraNode.prototype.getType = function
|
51
|
+
/* builder */
|
52
|
+
() {
|
53
53
|
switch (this.scope) {
|
54
54
|
case CameraNode.DEPTH:
|
55
55
|
return 'f';
|
@@ -58,9 +58,9 @@ CameraNode.prototype.getType = function ()
|
|
58
58
|
return this.type;
|
59
59
|
};
|
60
60
|
|
61
|
-
CameraNode.prototype.getUnique = function
|
62
|
-
/* builder */
|
63
|
-
{
|
61
|
+
CameraNode.prototype.getUnique = function
|
62
|
+
/* builder */
|
63
|
+
() {
|
64
64
|
switch (this.scope) {
|
65
65
|
case CameraNode.DEPTH:
|
66
66
|
case CameraNode.TO_VERTEX:
|
@@ -70,9 +70,9 @@ CameraNode.prototype.getUnique = function ()
|
|
70
70
|
return false;
|
71
71
|
};
|
72
72
|
|
73
|
-
CameraNode.prototype.getShared = function
|
74
|
-
/* builder */
|
75
|
-
{
|
73
|
+
CameraNode.prototype.getShared = function
|
74
|
+
/* builder */
|
75
|
+
() {
|
76
76
|
switch (this.scope) {
|
77
77
|
case CameraNode.POSITION:
|
78
78
|
return false;
|
@@ -102,9 +102,9 @@ CameraNode.prototype.generate = function (builder, output) {
|
|
102
102
|
return builder.format(result, this.getType(builder), output);
|
103
103
|
};
|
104
104
|
|
105
|
-
CameraNode.prototype.onUpdateFrame = function
|
106
|
-
/* frame */
|
107
|
-
{
|
105
|
+
CameraNode.prototype.onUpdateFrame = function
|
106
|
+
/* frame */
|
107
|
+
() {
|
108
108
|
switch (this.scope) {
|
109
109
|
case CameraNode.DEPTH:
|
110
110
|
var camera = this.camera;
|
@@ -23,9 +23,9 @@ PositionNode.prototype.getType = function () {
|
|
23
23
|
return this.type;
|
24
24
|
};
|
25
25
|
|
26
|
-
PositionNode.prototype.getShared = function
|
27
|
-
/* builder */
|
28
|
-
{
|
26
|
+
PositionNode.prototype.getShared = function
|
27
|
+
/* builder */
|
28
|
+
() {
|
29
29
|
switch (this.scope) {
|
30
30
|
case PositionNode.LOCAL:
|
31
31
|
case PositionNode.WORLD:
|
@@ -18,9 +18,9 @@ ReflectNode.prototype.getUnique = function (builder) {
|
|
18
18
|
return !builder.context.viewNormal;
|
19
19
|
};
|
20
20
|
|
21
|
-
ReflectNode.prototype.getType = function
|
22
|
-
/* builder */
|
23
|
-
{
|
21
|
+
ReflectNode.prototype.getType = function
|
22
|
+
/* builder */
|
23
|
+
() {
|
24
24
|
switch (this.scope) {
|
25
25
|
case ReflectNode.SPHERE:
|
26
26
|
return 'v2';
|
@@ -16,9 +16,9 @@ FunctionNode.prototype.constructor = FunctionNode;
|
|
16
16
|
FunctionNode.prototype.nodeType = 'Function';
|
17
17
|
FunctionNode.prototype.useKeywords = true;
|
18
18
|
|
19
|
-
FunctionNode.prototype.getShared = function
|
20
|
-
/* builder, output */
|
21
|
-
{
|
19
|
+
FunctionNode.prototype.getShared = function
|
20
|
+
/* builder, output */
|
21
|
+
() {
|
22
22
|
return !this.isMethod;
|
23
23
|
};
|
24
24
|
|
package/nodes/core/InputNode.js
CHANGED
@@ -16,9 +16,9 @@ InputNode.prototype.setReadonly = function (value) {
|
|
16
16
|
return this;
|
17
17
|
};
|
18
18
|
|
19
|
-
InputNode.prototype.getReadonly = function
|
20
|
-
/* builder */
|
21
|
-
{
|
19
|
+
InputNode.prototype.getReadonly = function
|
20
|
+
/* builder */
|
21
|
+
() {
|
22
22
|
return this.readonly;
|
23
23
|
};
|
24
24
|
|
package/nodes/core/Node.js
CHANGED
@@ -53,9 +53,9 @@ Node.prototype = {
|
|
53
53
|
|
54
54
|
return this.generate(builder, output, uuid);
|
55
55
|
},
|
56
|
-
generate: function
|
57
|
-
|
58
|
-
{// This method needs to be implemented in subclasses
|
56
|
+
generate: function
|
57
|
+
/* builder, output, uuid, type, ns */
|
58
|
+
() {// This method needs to be implemented in subclasses
|
59
59
|
},
|
60
60
|
getHash: function () {
|
61
61
|
var hash = '{';
|
@@ -93,9 +93,9 @@ Node.prototype = {
|
|
93
93
|
this.name = name;
|
94
94
|
return this;
|
95
95
|
},
|
96
|
-
getName: function
|
97
|
-
|
98
|
-
{
|
96
|
+
getName: function
|
97
|
+
/* builder */
|
98
|
+
() {
|
99
99
|
return this.name;
|
100
100
|
},
|
101
101
|
getType: function (builder, output) {
|
package/nodes/core/TempNode.js
CHANGED
@@ -59,9 +59,9 @@ TempNode.prototype.getShared = function (builder, output) {
|
|
59
59
|
return output !== 'sampler2D' && output !== 'samplerCube' && this.shared;
|
60
60
|
};
|
61
61
|
|
62
|
-
TempNode.prototype.getUnique = function
|
63
|
-
/* builder, output */
|
64
|
-
{
|
62
|
+
TempNode.prototype.getUnique = function
|
63
|
+
/* builder, output */
|
64
|
+
() {
|
65
65
|
return this.unique;
|
66
66
|
};
|
67
67
|
|
@@ -70,9 +70,9 @@ TempNode.prototype.setLabel = function (name) {
|
|
70
70
|
return this;
|
71
71
|
};
|
72
72
|
|
73
|
-
TempNode.prototype.getLabel = function
|
74
|
-
/* builder */
|
75
|
-
{
|
73
|
+
TempNode.prototype.getLabel = function
|
74
|
+
/* builder */
|
75
|
+
() {
|
76
76
|
return this.label;
|
77
77
|
};
|
78
78
|
|
@@ -31,9 +31,9 @@ BlurNode.prototype.constructor = BlurNode;
|
|
31
31
|
BlurNode.prototype.nodeType = 'Blur';
|
32
32
|
BlurNode.prototype.hashProperties = ['blurX', 'blurY'];
|
33
33
|
|
34
|
-
BlurNode.prototype.updateFrame = function
|
35
|
-
/* frame */
|
36
|
-
{
|
34
|
+
BlurNode.prototype.updateFrame = function
|
35
|
+
/* frame */
|
36
|
+
() {
|
37
37
|
if (this.size) {
|
38
38
|
this.horizontal.value = this.radius.x / this.size.x;
|
39
39
|
this.vertical.value = this.radius.y / this.size.y;
|
package/nodes/math/MathNode.js
CHANGED
@@ -54,9 +54,9 @@ MathNode.prototype.constructor = MathNode;
|
|
54
54
|
MathNode.prototype.nodeType = 'Math';
|
55
55
|
MathNode.prototype.hashProperties = ['method'];
|
56
56
|
|
57
|
-
MathNode.prototype.getNumInputs = function
|
58
|
-
/*builder*/
|
59
|
-
{
|
57
|
+
MathNode.prototype.getNumInputs = function
|
58
|
+
/*builder*/
|
59
|
+
() {
|
60
60
|
switch (this.method) {
|
61
61
|
case MathNode.MIX:
|
62
62
|
case MathNode.CLAMP:
|
@@ -13,9 +13,9 @@ VelocityNode.prototype = Object.create(Vector3Node.prototype);
|
|
13
13
|
VelocityNode.prototype.constructor = VelocityNode;
|
14
14
|
VelocityNode.prototype.nodeType = 'Velocity';
|
15
15
|
|
16
|
-
VelocityNode.prototype.getReadonly = function
|
17
|
-
/*builder*/
|
18
|
-
{
|
16
|
+
VelocityNode.prototype.getReadonly = function
|
17
|
+
/*builder*/
|
18
|
+
() {
|
19
19
|
return false;
|
20
20
|
};
|
21
21
|
|
@@ -55,9 +55,9 @@ VelocityNode.prototype.setTarget = function (target) {
|
|
55
55
|
}
|
56
56
|
};
|
57
57
|
|
58
|
-
VelocityNode.prototype.updateFrameVelocity = function
|
59
|
-
/*frame*/
|
60
|
-
{
|
58
|
+
VelocityNode.prototype.updateFrameVelocity = function
|
59
|
+
/*frame*/
|
60
|
+
() {
|
61
61
|
if (this.target) {
|
62
62
|
this.position = this.target.getWorldPosition(this.position || new Vector3());
|
63
63
|
this.velocity.subVectors(this.position, this.oldPosition);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "three-stdlib",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.8.0",
|
4
4
|
"private": false,
|
5
5
|
"description": "stand-alone library of threejs examples",
|
6
6
|
"main": "index.cjs.js",
|
@@ -20,7 +20,7 @@
|
|
20
20
|
},
|
21
21
|
"homepage": "https://github.com/pmndrs/three-stdlib#readme",
|
22
22
|
"dependencies": {
|
23
|
-
"@babel/runtime": "^7.
|
23
|
+
"@babel/runtime": "^7.16.7",
|
24
24
|
"@webgpu/glslang": "^0.0.15",
|
25
25
|
"@webxr-input-profiles/motion-controllers": "^1.0.0",
|
26
26
|
"chevrotain": "^9.0.2",
|
@@ -9,27 +9,19 @@ class Node {
|
|
9
9
|
});
|
10
10
|
}
|
11
11
|
|
12
|
-
getUpdateType()
|
13
|
-
/*builder*/
|
14
|
-
{
|
12
|
+
getUpdateType() {
|
15
13
|
return this.updateType;
|
16
14
|
}
|
17
15
|
|
18
|
-
getType()
|
19
|
-
/*builder*/
|
20
|
-
{
|
16
|
+
getType() {
|
21
17
|
return this.type;
|
22
18
|
}
|
23
19
|
|
24
|
-
update()
|
25
|
-
/*frame*/
|
26
|
-
{
|
20
|
+
update() {
|
27
21
|
console.warn('Abstract function.');
|
28
22
|
}
|
29
23
|
|
30
|
-
generate()
|
31
|
-
/*builder, output*/
|
32
|
-
{
|
24
|
+
generate() {
|
33
25
|
console.warn('Abstract function.');
|
34
26
|
}
|
35
27
|
|
@@ -49,9 +49,7 @@ class NodeBuilder {
|
|
49
49
|
this.defines[shaderStage][name] = value;
|
50
50
|
}
|
51
51
|
|
52
|
-
getTexture()
|
53
|
-
/* textureProperty, uvSnippet */
|
54
|
-
{
|
52
|
+
getTexture() {
|
55
53
|
console.warn('Abstract function.');
|
56
54
|
}
|
57
55
|
|
@@ -183,33 +181,23 @@ class NodeBuilder {
|
|
183
181
|
return code;
|
184
182
|
}
|
185
183
|
|
186
|
-
getAttributesBodySnippet()
|
187
|
-
/*shaderStage*/
|
188
|
-
{
|
184
|
+
getAttributesBodySnippet() {
|
189
185
|
console.warn('Abstract function.');
|
190
186
|
}
|
191
187
|
|
192
|
-
getAttributesHeaderSnippet()
|
193
|
-
/*shaderStage*/
|
194
|
-
{
|
188
|
+
getAttributesHeaderSnippet() {
|
195
189
|
console.warn('Abstract function.');
|
196
190
|
}
|
197
191
|
|
198
|
-
getVarysHeaderSnippet()
|
199
|
-
/*shaderStage*/
|
200
|
-
{
|
192
|
+
getVarysHeaderSnippet() {
|
201
193
|
console.warn('Abstract function.');
|
202
194
|
}
|
203
195
|
|
204
|
-
getVarysBodySnippet()
|
205
|
-
/*shaderStage*/
|
206
|
-
{
|
196
|
+
getVarysBodySnippet() {
|
207
197
|
console.warn('Abstract function.');
|
208
198
|
}
|
209
199
|
|
210
|
-
getUniformsHeaderSnippet()
|
211
|
-
/*shaderStage*/
|
212
|
-
{
|
200
|
+
getUniformsHeaderSnippet() {
|
213
201
|
console.warn('Abstract function.');
|
214
202
|
}
|
215
203
|
|
package/webxr/ARButton.js
CHANGED
@@ -2,9 +2,9 @@ class ARButton {
|
|
2
2
|
static createButton(renderer, sessionInit = {}) {
|
3
3
|
const button = document.createElement('button');
|
4
4
|
|
5
|
-
function
|
6
|
-
|
7
|
-
{
|
5
|
+
function
|
6
|
+
/*device*/
|
7
|
+
showStartAR() {
|
8
8
|
if (sessionInit.domOverlay === undefined) {
|
9
9
|
var overlay = document.createElement('div');
|
10
10
|
overlay.style.display = 'none';
|
@@ -47,9 +47,9 @@ class ARButton {
|
|
47
47
|
currentSession = session;
|
48
48
|
}
|
49
49
|
|
50
|
-
function
|
51
|
-
|
52
|
-
{
|
50
|
+
function
|
51
|
+
/*event*/
|
52
|
+
onSessionEnded() {
|
53
53
|
currentSession.removeEventListener('end', onSessionEnded);
|
54
54
|
button.textContent = 'START AR';
|
55
55
|
sessionInit.domOverlay.root.style.display = 'none';
|