super-three 0.136.1 → 0.137.0
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 +1 -1
- package/build/three.cjs +37132 -0
- package/build/three.js +71 -53
- package/build/three.min.js +2 -2
- package/build/three.module.js +80 -47
- package/examples/js/animation/MMDAnimationHelper.js +3 -1
- package/examples/js/controls/experimental/CameraControls.js +6 -2
- package/examples/js/exporters/GLTFExporter.js +82 -39
- package/examples/js/geometries/TextGeometry.js +12 -10
- package/examples/js/interactive/HTMLMesh.js +14 -2
- package/examples/js/loaders/EXRLoader.js +20 -9
- package/examples/js/loaders/GLTFLoader.js +1 -1
- package/examples/js/loaders/LDrawLoader.js +541 -425
- package/examples/js/loaders/MD2Loader.js +5 -5
- package/examples/js/loaders/MTLLoader.js +10 -3
- package/examples/js/loaders/PCDLoader.js +2 -2
- package/examples/js/loaders/STLLoader.js +1 -1
- package/examples/js/loaders/SVGLoader.js +3 -2
- package/examples/js/modifiers/EdgeSplitModifier.js +0 -6
- package/examples/js/modifiers/SimplifyModifier.js +0 -10
- package/examples/js/objects/Lensflare.js +2 -2
- package/examples/js/postprocessing/OutlinePass.js +1 -5
- package/examples/js/renderers/CSS2DRenderer.js +25 -19
- package/examples/js/renderers/CSS3DRenderer.js +37 -32
- package/examples/js/utils/LDrawUtils.js +182 -0
- package/examples/jsm/exporters/GLTFExporter.js +80 -12
- package/examples/jsm/geometries/TextGeometry.js +13 -13
- package/examples/jsm/interactive/HTMLMesh.js +16 -2
- package/examples/jsm/libs/flow.module.js +930 -169
- package/examples/jsm/loaders/EXRLoader.js +19 -9
- package/examples/jsm/loaders/GLTFLoader.js +1 -1
- package/examples/jsm/loaders/LDrawLoader.js +534 -442
- package/examples/jsm/loaders/MD2Loader.js +5 -5
- package/examples/jsm/loaders/MTLLoader.js +11 -4
- package/examples/jsm/loaders/PCDLoader.js +2 -2
- package/examples/jsm/loaders/STLLoader.js +1 -1
- package/examples/jsm/loaders/SVGLoader.js +3 -1
- package/examples/jsm/loaders/VRMLLoader.js +0 -1
- package/examples/jsm/modifiers/EdgeSplitModifier.js +0 -6
- package/examples/jsm/modifiers/SimplifyModifier.js +0 -10
- package/examples/jsm/node-editor/NodeEditor.js +435 -181
- package/examples/jsm/node-editor/accessors/NormalEditor.js +8 -8
- package/examples/jsm/node-editor/accessors/PositionEditor.js +8 -8
- package/examples/jsm/node-editor/accessors/UVEditor.js +6 -7
- package/examples/jsm/node-editor/core/BaseNode.js +83 -0
- package/examples/jsm/node-editor/display/BlendEditor.js +7 -6
- package/examples/jsm/node-editor/examples/animate-uv.json +1 -1
- package/examples/jsm/node-editor/examples/fake-top-light.json +1 -1
- package/examples/jsm/node-editor/examples/oscillator-color.json +1 -1
- package/examples/jsm/node-editor/examples/rim.json +1 -1
- package/examples/jsm/node-editor/inputs/ColorEditor.js +14 -10
- package/examples/jsm/node-editor/inputs/FloatEditor.js +6 -7
- package/examples/jsm/node-editor/inputs/SliderEditor.js +4 -5
- package/examples/jsm/node-editor/inputs/Vector2Editor.js +6 -7
- package/examples/jsm/node-editor/inputs/Vector3Editor.js +8 -9
- package/examples/jsm/node-editor/inputs/Vector4Editor.js +9 -10
- package/examples/jsm/node-editor/materials/BasicMaterialEditor.js +87 -0
- package/examples/jsm/node-editor/materials/PointsMaterialEditor.js +97 -0
- package/examples/jsm/node-editor/materials/StandardMaterialEditor.js +20 -17
- package/examples/jsm/node-editor/math/AngleEditor.js +39 -0
- package/examples/jsm/node-editor/math/DotEditor.js +6 -7
- package/examples/jsm/node-editor/math/InvertEditor.js +4 -3
- package/examples/jsm/node-editor/math/LimiterEditor.js +11 -10
- package/examples/jsm/node-editor/math/NormalizeEditor.js +6 -5
- package/examples/jsm/node-editor/math/OperatorEditor.js +12 -11
- package/examples/jsm/node-editor/math/PowerEditor.js +6 -5
- package/examples/jsm/node-editor/math/TrigonometryEditor.js +12 -7
- package/examples/jsm/node-editor/procedural/CheckerEditor.js +4 -3
- package/examples/jsm/node-editor/scene/MeshEditor.js +99 -0
- package/examples/jsm/node-editor/scene/Object3DEditor.js +160 -0
- package/examples/jsm/node-editor/scene/PointsEditor.js +99 -0
- package/examples/jsm/node-editor/utils/JoinEditor.js +58 -0
- package/examples/jsm/node-editor/utils/OscillatorEditor.js +7 -6
- package/examples/jsm/node-editor/utils/SplitEditor.js +39 -0
- package/examples/jsm/node-editor/utils/TimerEditor.js +6 -5
- package/examples/jsm/postprocessing/OutlinePass.js +1 -4
- package/examples/jsm/renderers/CSS2DRenderer.js +24 -19
- package/examples/jsm/renderers/CSS3DRenderer.js +36 -30
- package/examples/jsm/renderers/nodes/accessors/UVNode.js +4 -4
- package/examples/jsm/renderers/nodes/core/NodeBuilder.js +2 -1
- package/examples/jsm/renderers/nodes/utils/SplitNode.js +19 -4
- package/examples/jsm/utils/LDrawUtils.js +18 -11
- package/package.json +16 -9
- package/src/constants.js +1 -3
- package/src/core/BufferGeometry.js +2 -2
- package/src/geometries/LatheGeometry.js +1 -1
- package/src/loaders/FileLoader.js +20 -3
- package/src/math/Box3.js +24 -10
- package/src/renderers/WebGLRenderTarget.js +4 -1
- package/src/renderers/WebGLRenderer.js +3 -3
- package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +2 -2
- package/src/renderers/webgl/WebGLBackground.js +2 -2
- package/src/renderers/webgl/WebGLGeometries.js +2 -2
- package/src/renderers/webgl/WebGLPrograms.js +2 -2
- package/src/renderers/webgl/WebGLState.js +2 -2
- package/src/renderers/webgl/WebGLTextures.js +9 -6
- package/src/renderers/webgl/WebGLUtils.js +1 -3
- package/src/renderers/webxr/WebXRManager.js +2 -0
- package/src/utils.js +15 -1
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { LabelElement } from '../../libs/flow.module.js';
|
|
2
|
+
import { Object3DEditor } from './Object3DEditor.js';
|
|
3
|
+
import { Mesh } from 'three';
|
|
4
|
+
|
|
5
|
+
export class MeshEditor extends Object3DEditor {
|
|
6
|
+
|
|
7
|
+
constructor( mesh = null ) {
|
|
8
|
+
|
|
9
|
+
if ( mesh === null ) {
|
|
10
|
+
|
|
11
|
+
mesh = new Mesh();
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
super( mesh, 'Mesh' );
|
|
16
|
+
|
|
17
|
+
this.material = null;
|
|
18
|
+
|
|
19
|
+
this.defaultMaterial = null;
|
|
20
|
+
|
|
21
|
+
this._initMaterial();
|
|
22
|
+
|
|
23
|
+
this.updateDefault();
|
|
24
|
+
this.restoreDefault();
|
|
25
|
+
this.update();
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
get mesh() {
|
|
30
|
+
|
|
31
|
+
return this.value;
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
_initMaterial() {
|
|
36
|
+
|
|
37
|
+
const materialElement = new LabelElement( 'Material' ).setInputColor( 'forestgreen' ).setInput( 1 );
|
|
38
|
+
|
|
39
|
+
materialElement.onValid( ( source, target, stage ) => {
|
|
40
|
+
|
|
41
|
+
const object = target.getObject();
|
|
42
|
+
|
|
43
|
+
if ( object && object.isMaterial !== true ) {
|
|
44
|
+
|
|
45
|
+
if ( stage === 'dragged' ) {
|
|
46
|
+
|
|
47
|
+
const name = target.node.getName();
|
|
48
|
+
|
|
49
|
+
this.editor.tips.error( `"${name}" is not a Material.` );
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return false;
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
} ).onConnect( () => {
|
|
58
|
+
|
|
59
|
+
this.material = materialElement.getLinkedObject() || this.defaultMaterial;
|
|
60
|
+
|
|
61
|
+
this.update();
|
|
62
|
+
|
|
63
|
+
} );
|
|
64
|
+
|
|
65
|
+
this.add( materialElement );
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
update() {
|
|
70
|
+
|
|
71
|
+
super.update();
|
|
72
|
+
|
|
73
|
+
const mesh = this.mesh;
|
|
74
|
+
|
|
75
|
+
if ( mesh ) {
|
|
76
|
+
|
|
77
|
+
mesh.material = this.material || this.defaultMaterial;
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
updateDefault() {
|
|
84
|
+
|
|
85
|
+
super.updateDefault();
|
|
86
|
+
|
|
87
|
+
this.defaultMaterial = this.mesh.material;
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
restoreDefault() {
|
|
92
|
+
|
|
93
|
+
super.restoreDefault();
|
|
94
|
+
|
|
95
|
+
this.mesh.material = this.defaultMaterial;
|
|
96
|
+
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { NumberInput, StringInput, LabelElement } from '../../libs/flow.module.js';
|
|
2
|
+
import { BaseNode } from '../core/BaseNode.js';
|
|
3
|
+
import { Group, MathUtils, Vector3 } from 'three';
|
|
4
|
+
|
|
5
|
+
export class Object3DEditor extends BaseNode {
|
|
6
|
+
|
|
7
|
+
constructor( object3d = null, name = 'Object 3D' ) {
|
|
8
|
+
|
|
9
|
+
if ( object3d === null ) {
|
|
10
|
+
|
|
11
|
+
object3d = new Group();
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
super( name, 1, object3d );
|
|
16
|
+
|
|
17
|
+
this.defaultPosition = new Vector3();
|
|
18
|
+
this.defaultRotation = new Vector3();
|
|
19
|
+
this.defaultScale = new Vector3( 100, 100, 100 );
|
|
20
|
+
|
|
21
|
+
this._initTags();
|
|
22
|
+
this._initTransform();
|
|
23
|
+
|
|
24
|
+
this.onValidElement = () => {};
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
setEditor( editor ) {
|
|
29
|
+
|
|
30
|
+
if ( this.editor ) {
|
|
31
|
+
|
|
32
|
+
this.restoreDefault();
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
super.setEditor( editor );
|
|
37
|
+
|
|
38
|
+
if ( editor ) {
|
|
39
|
+
|
|
40
|
+
const name = this.nameInput.getValue();
|
|
41
|
+
const object3d = editor.scene.getObjectByName( name );
|
|
42
|
+
|
|
43
|
+
this.value = object3d;
|
|
44
|
+
|
|
45
|
+
this.updateDefault();
|
|
46
|
+
this.restoreDefault();
|
|
47
|
+
this.update();
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return this;
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
get object3d() {
|
|
56
|
+
|
|
57
|
+
return this.value;
|
|
58
|
+
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
_initTags() {
|
|
62
|
+
|
|
63
|
+
this.nameInput = new StringInput( this.object3d.name ).setReadOnly( true )
|
|
64
|
+
.onChange( () => this.object3d.name = this.nameInput.getValue() );
|
|
65
|
+
|
|
66
|
+
this.add( new LabelElement( 'Name' ).add( this.nameInput ) );
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
_initTransform() {
|
|
71
|
+
|
|
72
|
+
const update = () => this.update();
|
|
73
|
+
|
|
74
|
+
const posX = new NumberInput().setTagColor( 'red' ).onChange( update );
|
|
75
|
+
const posY = new NumberInput().setTagColor( 'green' ).onChange( update );
|
|
76
|
+
const posZ = new NumberInput().setTagColor( 'blue' ).onChange( update );
|
|
77
|
+
|
|
78
|
+
const rotationStep = 1;
|
|
79
|
+
|
|
80
|
+
const rotX = new NumberInput().setTagColor( 'red' ).setStep( rotationStep ).onChange( update );
|
|
81
|
+
const rotY = new NumberInput().setTagColor( 'green' ).setStep( rotationStep ).onChange( update );
|
|
82
|
+
const rotZ = new NumberInput().setTagColor( 'blue' ).setStep( rotationStep ).onChange( update );
|
|
83
|
+
|
|
84
|
+
const scaleX = new NumberInput( 100 ).setTagColor( 'red' ).setStep( rotationStep ).onChange( update );
|
|
85
|
+
const scaleY = new NumberInput( 100 ).setTagColor( 'green' ).setStep( rotationStep ).onChange( update );
|
|
86
|
+
const scaleZ = new NumberInput( 100 ).setTagColor( 'blue' ).setStep( rotationStep ).onChange( update );
|
|
87
|
+
|
|
88
|
+
this.add( new LabelElement( 'Position' ).add( posX ).add( posY ).add( posZ ) )
|
|
89
|
+
.add( new LabelElement( 'Rotation' ).add( rotX ).add( rotY ).add( rotZ ) )
|
|
90
|
+
.add( new LabelElement( 'Scale' ).add( scaleX ).add( scaleY ).add( scaleZ ) );
|
|
91
|
+
|
|
92
|
+
this.posX = posX;
|
|
93
|
+
this.posY = posY;
|
|
94
|
+
this.posZ = posZ;
|
|
95
|
+
|
|
96
|
+
this.rotX = rotX;
|
|
97
|
+
this.rotY = rotY;
|
|
98
|
+
this.rotZ = rotZ;
|
|
99
|
+
|
|
100
|
+
this.scaleX = scaleX;
|
|
101
|
+
this.scaleY = scaleY;
|
|
102
|
+
this.scaleZ = scaleZ;
|
|
103
|
+
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
update() {
|
|
107
|
+
|
|
108
|
+
const object3d = this.object3d;
|
|
109
|
+
|
|
110
|
+
if ( object3d ) {
|
|
111
|
+
|
|
112
|
+
const { position, rotation, scale } = object3d;
|
|
113
|
+
|
|
114
|
+
position.x = this.posX.getValue();
|
|
115
|
+
position.y = this.posY.getValue();
|
|
116
|
+
position.z = this.posZ.getValue();
|
|
117
|
+
|
|
118
|
+
rotation.x = MathUtils.degToRad( this.rotX.getValue() );
|
|
119
|
+
rotation.y = MathUtils.degToRad( this.rotY.getValue() );
|
|
120
|
+
rotation.z = MathUtils.degToRad( this.rotZ.getValue() );
|
|
121
|
+
|
|
122
|
+
scale.x = this.scaleX.getValue() / 100;
|
|
123
|
+
scale.y = this.scaleY.getValue() / 100;
|
|
124
|
+
scale.z = this.scaleZ.getValue() / 100;
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
updateDefault() {
|
|
131
|
+
|
|
132
|
+
const { position, rotation, scale } = this.object3d;
|
|
133
|
+
|
|
134
|
+
this.defaultPosition = position.clone();
|
|
135
|
+
this.defaultRotation = new Vector3( MathUtils.radToDeg( rotation.x ), MathUtils.radToDeg( rotation.y ), MathUtils.radToDeg( rotation.z ) );
|
|
136
|
+
this.defaultScale = scale.clone().multiplyScalar( 100 );
|
|
137
|
+
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
restoreDefault() {
|
|
141
|
+
|
|
142
|
+
const position = this.defaultPosition;
|
|
143
|
+
const rotation = this.defaultRotation;
|
|
144
|
+
const scale = this.defaultScale;
|
|
145
|
+
|
|
146
|
+
this.posX.setValue( position.x );
|
|
147
|
+
this.posY.setValue( position.y );
|
|
148
|
+
this.posZ.setValue( position.z );
|
|
149
|
+
|
|
150
|
+
this.rotX.setValue( rotation.x );
|
|
151
|
+
this.rotY.setValue( rotation.y );
|
|
152
|
+
this.rotZ.setValue( rotation.z );
|
|
153
|
+
|
|
154
|
+
this.scaleX.setValue( scale.x );
|
|
155
|
+
this.scaleY.setValue( scale.y );
|
|
156
|
+
this.scaleZ.setValue( scale.z );
|
|
157
|
+
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { LabelElement } from '../../libs/flow.module.js';
|
|
2
|
+
import { Object3DEditor } from './Object3DEditor.js';
|
|
3
|
+
import { Points } from 'three';
|
|
4
|
+
|
|
5
|
+
export class PointsEditor extends Object3DEditor {
|
|
6
|
+
|
|
7
|
+
constructor( points = null ) {
|
|
8
|
+
|
|
9
|
+
if ( points === null ) {
|
|
10
|
+
|
|
11
|
+
points = new Points();
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
super( points, 'Points' );
|
|
16
|
+
|
|
17
|
+
this.material = null;
|
|
18
|
+
|
|
19
|
+
this.defaultMaterial = null;
|
|
20
|
+
|
|
21
|
+
this._initMaterial();
|
|
22
|
+
|
|
23
|
+
this.updateDefault();
|
|
24
|
+
this.restoreDefault();
|
|
25
|
+
this.update();
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
get points() {
|
|
30
|
+
|
|
31
|
+
return this.value;
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
_initMaterial() {
|
|
36
|
+
|
|
37
|
+
const materialElement = new LabelElement( 'Material' ).setInputColor( 'forestgreen' ).setInput( 1 );
|
|
38
|
+
|
|
39
|
+
materialElement.onValid( ( source, target, stage ) => {
|
|
40
|
+
|
|
41
|
+
const object = target.getObject();
|
|
42
|
+
|
|
43
|
+
if ( object && object.isMaterial !== true ) {
|
|
44
|
+
|
|
45
|
+
if ( stage === 'dragged' ) {
|
|
46
|
+
|
|
47
|
+
const name = target.node.getName();
|
|
48
|
+
|
|
49
|
+
this.editor.tips.error( `"${name}" is not a Material.` );
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return false;
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
} ).onConnect( () => {
|
|
58
|
+
|
|
59
|
+
this.material = materialElement.getLinkedObject() || this.defaultMaterial;
|
|
60
|
+
|
|
61
|
+
this.update();
|
|
62
|
+
|
|
63
|
+
} );
|
|
64
|
+
|
|
65
|
+
this.add( materialElement );
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
update() {
|
|
70
|
+
|
|
71
|
+
super.update();
|
|
72
|
+
|
|
73
|
+
const points = this.points;
|
|
74
|
+
|
|
75
|
+
if ( points ) {
|
|
76
|
+
|
|
77
|
+
points.material = this.material || this.defaultMaterial;
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
updateDefault() {
|
|
84
|
+
|
|
85
|
+
super.updateDefault();
|
|
86
|
+
|
|
87
|
+
this.defaultMaterial = this.points.material;
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
restoreDefault() {
|
|
92
|
+
|
|
93
|
+
super.restoreDefault();
|
|
94
|
+
|
|
95
|
+
this.points.material = this.defaultMaterial;
|
|
96
|
+
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { LabelElement } from '../../libs/flow.module.js';
|
|
2
|
+
import { BaseNode } from '../core/BaseNode.js';
|
|
3
|
+
import { JoinNode, FloatNode } from '../../renderers/nodes/Nodes.js';
|
|
4
|
+
|
|
5
|
+
const NULL_VALUE = new FloatNode();
|
|
6
|
+
|
|
7
|
+
export class JoinEditor extends BaseNode {
|
|
8
|
+
|
|
9
|
+
constructor() {
|
|
10
|
+
|
|
11
|
+
const node = new JoinNode();
|
|
12
|
+
|
|
13
|
+
super( 'Join', 1, node, 175 );
|
|
14
|
+
|
|
15
|
+
const update = () => {
|
|
16
|
+
|
|
17
|
+
const values = [
|
|
18
|
+
xElement.getLinkedObject(),
|
|
19
|
+
yElement.getLinkedObject(),
|
|
20
|
+
zElement.getLinkedObject(),
|
|
21
|
+
wElement.getLinkedObject()
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
let length = 1;
|
|
25
|
+
|
|
26
|
+
if ( values[ 3 ] !== null ) length = 4;
|
|
27
|
+
else if ( values[ 2 ] !== null ) length = 3;
|
|
28
|
+
else if ( values[ 1 ] !== null ) length = 2;
|
|
29
|
+
|
|
30
|
+
const nodes = [];
|
|
31
|
+
|
|
32
|
+
for ( let i = 0; i < length; i ++ ) {
|
|
33
|
+
|
|
34
|
+
nodes.push( values[ i ] || NULL_VALUE );
|
|
35
|
+
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
node.nodes = nodes;
|
|
39
|
+
|
|
40
|
+
this.invalidate();
|
|
41
|
+
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const xElement = new LabelElement( 'X | R' ).setInput( 1 ).onConnect( update );
|
|
45
|
+
const yElement = new LabelElement( 'Y | G' ).setInput( 1 ).onConnect( update );
|
|
46
|
+
const zElement = new LabelElement( 'Z | B' ).setInput( 1 ).onConnect( update );
|
|
47
|
+
const wElement = new LabelElement( 'W | A' ).setInput( 1 ).onConnect( update );
|
|
48
|
+
|
|
49
|
+
this.add( xElement )
|
|
50
|
+
.add( yElement )
|
|
51
|
+
.add( zElement )
|
|
52
|
+
.add( wElement );
|
|
53
|
+
|
|
54
|
+
update();
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SelectInput, LabelElement, Element } from '../../libs/flow.module.js';
|
|
2
|
+
import { BaseNode } from '../core/BaseNode.js';
|
|
2
3
|
import { OscNode, FloatNode } from '../../renderers/nodes/Nodes.js';
|
|
3
4
|
|
|
4
5
|
const NULL_VALUE = new FloatNode();
|
|
5
6
|
|
|
6
|
-
export class OscillatorEditor extends
|
|
7
|
+
export class OscillatorEditor extends BaseNode {
|
|
7
8
|
|
|
8
9
|
constructor() {
|
|
9
10
|
|
|
10
11
|
const node = new OscNode( OscNode.SINE, NULL_VALUE );
|
|
11
12
|
|
|
12
|
-
super( 'Oscillator', 1, node,
|
|
13
|
+
super( 'Oscillator', 1, node, 175 );
|
|
13
14
|
|
|
14
15
|
const methodInput = new SelectInput( [
|
|
15
16
|
{ name: 'Sine', value: OscNode.SINE },
|
|
16
17
|
{ name: 'Square', value: OscNode.SQUARE },
|
|
17
18
|
{ name: 'Triangle', value: OscNode.TRIANGLE },
|
|
18
19
|
{ name: 'Sawtooth', value: OscNode.SAWTOOTH }
|
|
19
|
-
] );
|
|
20
|
+
], OscNode.SINE );
|
|
20
21
|
|
|
21
22
|
methodInput.onChange( () => {
|
|
22
23
|
|
|
@@ -30,11 +31,11 @@ export class OscillatorEditor extends ObjectNode {
|
|
|
30
31
|
|
|
31
32
|
timeElement.onConnect( () => {
|
|
32
33
|
|
|
33
|
-
node.timeNode = timeElement.
|
|
34
|
+
node.timeNode = timeElement.getLinkedObject() || NULL_VALUE;
|
|
34
35
|
|
|
35
36
|
} );
|
|
36
37
|
|
|
37
|
-
this.add( new
|
|
38
|
+
this.add( new Element().add( methodInput ) )
|
|
38
39
|
.add( timeElement );
|
|
39
40
|
|
|
40
41
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { SelectInput, Element } from '../../libs/flow.module.js';
|
|
2
|
+
import { BaseNode } from '../core/BaseNode.js';
|
|
3
|
+
import { SplitNode, FloatNode } from '../../renderers/nodes/Nodes.js';
|
|
4
|
+
|
|
5
|
+
const NULL_VALUE = new FloatNode();
|
|
6
|
+
|
|
7
|
+
export class SplitEditor extends BaseNode {
|
|
8
|
+
|
|
9
|
+
constructor() {
|
|
10
|
+
|
|
11
|
+
const node = new SplitNode( NULL_VALUE, 'x' );
|
|
12
|
+
|
|
13
|
+
super( 'Split', 1, node, 175 );
|
|
14
|
+
|
|
15
|
+
const componentsField = new SelectInput( [
|
|
16
|
+
{ name: 'X | R', value: 'x' },
|
|
17
|
+
{ name: 'Y | G', value: 'y' },
|
|
18
|
+
{ name: 'Z | B', value: 'z' },
|
|
19
|
+
{ name: 'W | A', value: 'w' }
|
|
20
|
+
], node.components ).onChange( () => {
|
|
21
|
+
|
|
22
|
+
node.components = componentsField.getValue();
|
|
23
|
+
|
|
24
|
+
this.invalidate();
|
|
25
|
+
|
|
26
|
+
} );
|
|
27
|
+
|
|
28
|
+
const componentsElement = new Element().add( componentsField ).setInput( 1 )
|
|
29
|
+
.onConnect( () => {
|
|
30
|
+
|
|
31
|
+
node.node = componentsElement.getLinkedObject() || NULL_VALUE;
|
|
32
|
+
|
|
33
|
+
} );
|
|
34
|
+
|
|
35
|
+
this.add( componentsElement );
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NumberInput, LabelElement, Element, ButtonInput } from '../../libs/flow.module.js';
|
|
2
|
+
import { BaseNode } from '../core/BaseNode.js';
|
|
2
3
|
import { TimerNode } from '../../renderers/nodes/Nodes.js';
|
|
3
4
|
|
|
4
|
-
export class TimerEditor extends
|
|
5
|
+
export class TimerEditor extends BaseNode {
|
|
5
6
|
|
|
6
7
|
constructor() {
|
|
7
8
|
|
|
8
9
|
const node = new TimerNode();
|
|
9
10
|
|
|
10
|
-
super( 'Timer', 1, node,
|
|
11
|
+
super( 'Timer', 1, node, 200 );
|
|
11
12
|
|
|
12
13
|
this.title.setIcon( 'ti ti-clock' );
|
|
13
14
|
|
|
@@ -37,8 +38,8 @@ export class TimerEditor extends ObjectNode {
|
|
|
37
38
|
|
|
38
39
|
} ) ).setSerializable( false );
|
|
39
40
|
|
|
40
|
-
this.add( new
|
|
41
|
-
.add( new LabelElement( '
|
|
41
|
+
this.add( new Element().add( field ).setSerializable( false ) )
|
|
42
|
+
.add( new LabelElement( 'Speed' ).add( scaleField ) )
|
|
42
43
|
.add( moreElement );
|
|
43
44
|
|
|
44
45
|
// extends node
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
DoubleSide,
|
|
5
5
|
LinearFilter,
|
|
6
6
|
Matrix4,
|
|
7
|
-
MeshBasicMaterial,
|
|
8
7
|
MeshDepthMaterial,
|
|
9
8
|
NoBlending,
|
|
10
9
|
RGBADepthPacking,
|
|
@@ -46,8 +45,6 @@ class OutlinePass extends Pass {
|
|
|
46
45
|
const resx = Math.round( this.resolution.x / this.downSampleRatio );
|
|
47
46
|
const resy = Math.round( this.resolution.y / this.downSampleRatio );
|
|
48
47
|
|
|
49
|
-
this.maskBufferMaterial = new MeshBasicMaterial( { color: 0xffffff } );
|
|
50
|
-
this.maskBufferMaterial.side = DoubleSide;
|
|
51
48
|
this.renderTargetMaskBuffer = new WebGLRenderTarget( this.resolution.x, this.resolution.y, pars );
|
|
52
49
|
this.renderTargetMaskBuffer.texture.name = 'OutlinePass.mask';
|
|
53
50
|
this.renderTargetMaskBuffer.texture.generateMipmaps = false;
|
|
@@ -129,7 +126,7 @@ class OutlinePass extends Pass {
|
|
|
129
126
|
|
|
130
127
|
function replaceDepthToViewZ( string, camera ) {
|
|
131
128
|
|
|
132
|
-
|
|
129
|
+
const type = camera.isPerspectiveCamera ? 'perspective' : 'orthographic';
|
|
133
130
|
|
|
134
131
|
return string.replace( /DEPTH_TO_VIEW_Z/g, type + 'DepthToViewZ' );
|
|
135
132
|
|
|
@@ -113,39 +113,44 @@ class CSS2DRenderer {
|
|
|
113
113
|
|
|
114
114
|
if ( object.isCSS2DObject ) {
|
|
115
115
|
|
|
116
|
-
object.
|
|
116
|
+
const visible = object.visible && _vector.z >= - 1 && _vector.z <= 1 && object.layers.test( camera.layers );
|
|
117
|
+
object.element.style.display = visible ? '' : 'none';
|
|
117
118
|
|
|
118
|
-
|
|
119
|
-
_vector.applyMatrix4( _viewProjectionMatrix );
|
|
119
|
+
if ( visible ) {
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
object.onBeforeRender( _this, scene, camera );
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
_vector.setFromMatrixPosition( object.matrixWorld );
|
|
124
|
+
_vector.applyMatrix4( _viewProjectionMatrix );
|
|
124
125
|
|
|
125
|
-
|
|
126
|
-
element.style.transform = 'translate(-50%,-50%) translate(' + Math.round( _vector.x * _widthHalf + _widthHalf ) + 'px,' + Math.round( - _vector.y * _heightHalf + _heightHalf ) + 'px)';
|
|
126
|
+
const element = object.element;
|
|
127
127
|
|
|
128
|
-
|
|
128
|
+
if ( /apple/i.test( navigator.vendor ) ) {
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
// https://github.com/mrdoob/three.js/issues/21415
|
|
131
|
+
element.style.transform = 'translate(-50%,-50%) translate(' + Math.round( _vector.x * _widthHalf + _widthHalf ) + 'px,' + Math.round( - _vector.y * _heightHalf + _heightHalf ) + 'px)';
|
|
131
132
|
|
|
132
|
-
|
|
133
|
+
} else {
|
|
133
134
|
|
|
134
|
-
|
|
135
|
+
element.style.transform = 'translate(-50%,-50%) translate(' + ( _vector.x * _widthHalf + _widthHalf ) + 'px,' + ( - _vector.y * _heightHalf + _heightHalf ) + 'px)';
|
|
135
136
|
|
|
136
|
-
|
|
137
|
-
distanceToCameraSquared: getDistanceToSquared( camera, object )
|
|
138
|
-
};
|
|
137
|
+
}
|
|
139
138
|
|
|
140
|
-
|
|
139
|
+
const objectData = {
|
|
140
|
+
distanceToCameraSquared: getDistanceToSquared( camera, object )
|
|
141
|
+
};
|
|
141
142
|
|
|
142
|
-
|
|
143
|
+
cache.objects.set( object, objectData );
|
|
143
144
|
|
|
144
|
-
|
|
145
|
+
if ( element.parentNode !== domElement ) {
|
|
145
146
|
|
|
146
|
-
|
|
147
|
+
domElement.appendChild( element );
|
|
148
|
+
|
|
149
|
+
}
|
|
147
150
|
|
|
148
|
-
|
|
151
|
+
object.onAfterRender( _this, scene, camera );
|
|
152
|
+
|
|
153
|
+
}
|
|
149
154
|
|
|
150
155
|
}
|
|
151
156
|
|