viral-viewer-2 3.1.8 → 3.2.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/LICENSE +57 -57
- package/dist/components/mouse/viral-mouse.d.ts +1 -0
- package/dist/components/mouse/viral-mouse.js +11 -0
- package/dist/components/mouse/viral-mouse.js.map +1 -1
- package/dist/components/spinner/viral-spinner.js +159 -159
- package/dist/components/worker/load-model.d.ts +126 -0
- package/dist/components/worker/load-model.js +1265 -0
- package/dist/components/worker/load-model.js.map +1 -0
- package/dist/components/worker/test-worker-pool.d.ts +6 -0
- package/dist/components/worker/test-worker-pool.js +21 -0
- package/dist/components/worker/test-worker-pool.js.map +1 -0
- package/dist/components/worker-script/load-model-worker-3.script.d.ts +0 -0
- package/dist/components/worker-script/load-model-worker-3.script.js +170 -0
- package/dist/components/worker-script/load-model-worker-3.script.js.map +1 -0
- package/dist/components/worker-script/test-worker-pool.script.js +12 -0
- package/dist/components/worker-script/test-worker-pool.script.js.map +1 -0
- package/dist/components/worker-script/threejs.types.js +211 -226
- package/dist/components/worker-script/threejs.types.js.map +1 -1
- package/package.json +29 -29
- package/dist/components/worker/test-worker.worker.d.ts +0 -6
- package/dist/components/worker/test-worker.worker.js +0 -21
- package/dist/components/worker/test-worker.worker.js.map +0 -1
- package/dist/components/worker-script/threejs.script.js +0 -16
- package/dist/components/worker-script/threejs.script.js.map +0 -1
- /package/dist/components/worker-script/{threejs.script.d.ts → test-worker-pool.script.d.ts} +0 -0
|
@@ -8485,42 +8485,42 @@ function workerFunction() {
|
|
|
8485
8485
|
uniforms: {
|
|
8486
8486
|
tEquirect: { value: null },
|
|
8487
8487
|
},
|
|
8488
|
-
vertexShader: /* glsl */ `
|
|
8489
|
-
|
|
8490
|
-
varying vec3 vWorldDirection;
|
|
8491
|
-
|
|
8492
|
-
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|
8493
|
-
|
|
8494
|
-
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|
8495
|
-
|
|
8496
|
-
}
|
|
8497
|
-
|
|
8498
|
-
void main() {
|
|
8499
|
-
|
|
8500
|
-
vWorldDirection = transformDirection( position, modelMatrix );
|
|
8501
|
-
|
|
8502
|
-
#include <begin_vertex>
|
|
8503
|
-
#include <project_vertex>
|
|
8504
|
-
|
|
8505
|
-
}
|
|
8488
|
+
vertexShader: /* glsl */ `
|
|
8489
|
+
|
|
8490
|
+
varying vec3 vWorldDirection;
|
|
8491
|
+
|
|
8492
|
+
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|
8493
|
+
|
|
8494
|
+
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|
8495
|
+
|
|
8496
|
+
}
|
|
8497
|
+
|
|
8498
|
+
void main() {
|
|
8499
|
+
|
|
8500
|
+
vWorldDirection = transformDirection( position, modelMatrix );
|
|
8501
|
+
|
|
8502
|
+
#include <begin_vertex>
|
|
8503
|
+
#include <project_vertex>
|
|
8504
|
+
|
|
8505
|
+
}
|
|
8506
8506
|
`,
|
|
8507
|
-
fragmentShader: /* glsl */ `
|
|
8508
|
-
|
|
8509
|
-
uniform sampler2D tEquirect;
|
|
8510
|
-
|
|
8511
|
-
varying vec3 vWorldDirection;
|
|
8512
|
-
|
|
8513
|
-
#include <common>
|
|
8514
|
-
|
|
8515
|
-
void main() {
|
|
8516
|
-
|
|
8517
|
-
vec3 direction = normalize( vWorldDirection );
|
|
8518
|
-
|
|
8519
|
-
vec2 sampleUV = equirectUv( direction );
|
|
8520
|
-
|
|
8521
|
-
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
8522
|
-
|
|
8523
|
-
}
|
|
8507
|
+
fragmentShader: /* glsl */ `
|
|
8508
|
+
|
|
8509
|
+
uniform sampler2D tEquirect;
|
|
8510
|
+
|
|
8511
|
+
varying vec3 vWorldDirection;
|
|
8512
|
+
|
|
8513
|
+
#include <common>
|
|
8514
|
+
|
|
8515
|
+
void main() {
|
|
8516
|
+
|
|
8517
|
+
vec3 direction = normalize( vWorldDirection );
|
|
8518
|
+
|
|
8519
|
+
vec2 sampleUV = equirectUv( direction );
|
|
8520
|
+
|
|
8521
|
+
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
8522
|
+
|
|
8523
|
+
}
|
|
8524
8524
|
`,
|
|
8525
8525
|
};
|
|
8526
8526
|
const geometry = new BoxGeometry(5, 5, 5);
|
|
@@ -11055,66 +11055,66 @@ function workerFunction() {
|
|
|
11055
11055
|
poleAxis: { value: poleAxis },
|
|
11056
11056
|
},
|
|
11057
11057
|
vertexShader: _getCommonVertexShader(),
|
|
11058
|
-
fragmentShader: /* glsl */ `
|
|
11059
|
-
|
|
11060
|
-
precision mediump float;
|
|
11061
|
-
precision mediump int;
|
|
11062
|
-
|
|
11063
|
-
varying vec3 vOutputDirection;
|
|
11064
|
-
|
|
11065
|
-
uniform sampler2D envMap;
|
|
11066
|
-
uniform int samples;
|
|
11067
|
-
uniform float weights[ n ];
|
|
11068
|
-
uniform bool latitudinal;
|
|
11069
|
-
uniform float dTheta;
|
|
11070
|
-
uniform float mipInt;
|
|
11071
|
-
uniform vec3 poleAxis;
|
|
11072
|
-
|
|
11073
|
-
#define ENVMAP_TYPE_CUBE_UV
|
|
11074
|
-
#include <cube_uv_reflection_fragment>
|
|
11075
|
-
|
|
11076
|
-
vec3 getSample( float theta, vec3 axis ) {
|
|
11077
|
-
|
|
11078
|
-
float cosTheta = cos( theta );
|
|
11079
|
-
// Rodrigues' axis-angle rotation
|
|
11080
|
-
vec3 sampleDirection = vOutputDirection * cosTheta
|
|
11081
|
-
+ cross( axis, vOutputDirection ) * sin( theta )
|
|
11082
|
-
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
|
|
11083
|
-
|
|
11084
|
-
return bilinearCubeUV( envMap, sampleDirection, mipInt );
|
|
11085
|
-
|
|
11086
|
-
}
|
|
11087
|
-
|
|
11088
|
-
void main() {
|
|
11089
|
-
|
|
11090
|
-
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
|
|
11091
|
-
|
|
11092
|
-
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
|
|
11093
|
-
|
|
11094
|
-
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
|
|
11095
|
-
|
|
11096
|
-
}
|
|
11097
|
-
|
|
11098
|
-
axis = normalize( axis );
|
|
11099
|
-
|
|
11100
|
-
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
11101
|
-
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
|
|
11102
|
-
|
|
11103
|
-
for ( int i = 1; i < n; i++ ) {
|
|
11104
|
-
|
|
11105
|
-
if ( i >= samples ) {
|
|
11106
|
-
|
|
11107
|
-
break;
|
|
11108
|
-
|
|
11109
|
-
}
|
|
11110
|
-
|
|
11111
|
-
float theta = dTheta * float( i );
|
|
11112
|
-
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
|
|
11113
|
-
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
|
|
11114
|
-
|
|
11115
|
-
}
|
|
11116
|
-
|
|
11117
|
-
}
|
|
11058
|
+
fragmentShader: /* glsl */ `
|
|
11059
|
+
|
|
11060
|
+
precision mediump float;
|
|
11061
|
+
precision mediump int;
|
|
11062
|
+
|
|
11063
|
+
varying vec3 vOutputDirection;
|
|
11064
|
+
|
|
11065
|
+
uniform sampler2D envMap;
|
|
11066
|
+
uniform int samples;
|
|
11067
|
+
uniform float weights[ n ];
|
|
11068
|
+
uniform bool latitudinal;
|
|
11069
|
+
uniform float dTheta;
|
|
11070
|
+
uniform float mipInt;
|
|
11071
|
+
uniform vec3 poleAxis;
|
|
11072
|
+
|
|
11073
|
+
#define ENVMAP_TYPE_CUBE_UV
|
|
11074
|
+
#include <cube_uv_reflection_fragment>
|
|
11075
|
+
|
|
11076
|
+
vec3 getSample( float theta, vec3 axis ) {
|
|
11077
|
+
|
|
11078
|
+
float cosTheta = cos( theta );
|
|
11079
|
+
// Rodrigues' axis-angle rotation
|
|
11080
|
+
vec3 sampleDirection = vOutputDirection * cosTheta
|
|
11081
|
+
+ cross( axis, vOutputDirection ) * sin( theta )
|
|
11082
|
+
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
|
|
11083
|
+
|
|
11084
|
+
return bilinearCubeUV( envMap, sampleDirection, mipInt );
|
|
11085
|
+
|
|
11086
|
+
}
|
|
11087
|
+
|
|
11088
|
+
void main() {
|
|
11089
|
+
|
|
11090
|
+
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
|
|
11091
|
+
|
|
11092
|
+
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
|
|
11093
|
+
|
|
11094
|
+
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
|
|
11095
|
+
|
|
11096
|
+
}
|
|
11097
|
+
|
|
11098
|
+
axis = normalize( axis );
|
|
11099
|
+
|
|
11100
|
+
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
11101
|
+
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
|
|
11102
|
+
|
|
11103
|
+
for ( int i = 1; i < n; i++ ) {
|
|
11104
|
+
|
|
11105
|
+
if ( i >= samples ) {
|
|
11106
|
+
|
|
11107
|
+
break;
|
|
11108
|
+
|
|
11109
|
+
}
|
|
11110
|
+
|
|
11111
|
+
float theta = dTheta * float( i );
|
|
11112
|
+
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
|
|
11113
|
+
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
|
|
11114
|
+
|
|
11115
|
+
}
|
|
11116
|
+
|
|
11117
|
+
}
|
|
11118
11118
|
`,
|
|
11119
11119
|
blending: NoBlending,
|
|
11120
11120
|
depthTest: false,
|
|
@@ -11129,25 +11129,25 @@ function workerFunction() {
|
|
|
11129
11129
|
envMap: { value: null },
|
|
11130
11130
|
},
|
|
11131
11131
|
vertexShader: _getCommonVertexShader(),
|
|
11132
|
-
fragmentShader: /* glsl */ `
|
|
11133
|
-
|
|
11134
|
-
precision mediump float;
|
|
11135
|
-
precision mediump int;
|
|
11136
|
-
|
|
11137
|
-
varying vec3 vOutputDirection;
|
|
11138
|
-
|
|
11139
|
-
uniform sampler2D envMap;
|
|
11140
|
-
|
|
11141
|
-
#include <common>
|
|
11142
|
-
|
|
11143
|
-
void main() {
|
|
11144
|
-
|
|
11145
|
-
vec3 outputDirection = normalize( vOutputDirection );
|
|
11146
|
-
vec2 uv = equirectUv( outputDirection );
|
|
11147
|
-
|
|
11148
|
-
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
|
11149
|
-
|
|
11150
|
-
}
|
|
11132
|
+
fragmentShader: /* glsl */ `
|
|
11133
|
+
|
|
11134
|
+
precision mediump float;
|
|
11135
|
+
precision mediump int;
|
|
11136
|
+
|
|
11137
|
+
varying vec3 vOutputDirection;
|
|
11138
|
+
|
|
11139
|
+
uniform sampler2D envMap;
|
|
11140
|
+
|
|
11141
|
+
#include <common>
|
|
11142
|
+
|
|
11143
|
+
void main() {
|
|
11144
|
+
|
|
11145
|
+
vec3 outputDirection = normalize( vOutputDirection );
|
|
11146
|
+
vec2 uv = equirectUv( outputDirection );
|
|
11147
|
+
|
|
11148
|
+
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
|
11149
|
+
|
|
11150
|
+
}
|
|
11151
11151
|
`,
|
|
11152
11152
|
blending: NoBlending,
|
|
11153
11153
|
depthTest: false,
|
|
@@ -11162,22 +11162,22 @@ function workerFunction() {
|
|
|
11162
11162
|
flipEnvMap: { value: -1 },
|
|
11163
11163
|
},
|
|
11164
11164
|
vertexShader: _getCommonVertexShader(),
|
|
11165
|
-
fragmentShader: /* glsl */ `
|
|
11166
|
-
|
|
11167
|
-
precision mediump float;
|
|
11168
|
-
precision mediump int;
|
|
11169
|
-
|
|
11170
|
-
uniform float flipEnvMap;
|
|
11171
|
-
|
|
11172
|
-
varying vec3 vOutputDirection;
|
|
11173
|
-
|
|
11174
|
-
uniform samplerCube envMap;
|
|
11175
|
-
|
|
11176
|
-
void main() {
|
|
11177
|
-
|
|
11178
|
-
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
|
|
11179
|
-
|
|
11180
|
-
}
|
|
11165
|
+
fragmentShader: /* glsl */ `
|
|
11166
|
+
|
|
11167
|
+
precision mediump float;
|
|
11168
|
+
precision mediump int;
|
|
11169
|
+
|
|
11170
|
+
uniform float flipEnvMap;
|
|
11171
|
+
|
|
11172
|
+
varying vec3 vOutputDirection;
|
|
11173
|
+
|
|
11174
|
+
uniform samplerCube envMap;
|
|
11175
|
+
|
|
11176
|
+
void main() {
|
|
11177
|
+
|
|
11178
|
+
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
|
|
11179
|
+
|
|
11180
|
+
}
|
|
11181
11181
|
`,
|
|
11182
11182
|
blending: NoBlending,
|
|
11183
11183
|
depthTest: false,
|
|
@@ -11185,61 +11185,61 @@ function workerFunction() {
|
|
|
11185
11185
|
});
|
|
11186
11186
|
}
|
|
11187
11187
|
function _getCommonVertexShader() {
|
|
11188
|
-
return /* glsl */ `
|
|
11189
|
-
|
|
11190
|
-
precision mediump float;
|
|
11191
|
-
precision mediump int;
|
|
11192
|
-
|
|
11193
|
-
attribute float faceIndex;
|
|
11194
|
-
|
|
11195
|
-
varying vec3 vOutputDirection;
|
|
11196
|
-
|
|
11197
|
-
// RH coordinate system; PMREM face-indexing convention
|
|
11198
|
-
vec3 getDirection( vec2 uv, float face ) {
|
|
11199
|
-
|
|
11200
|
-
uv = 2.0 * uv - 1.0;
|
|
11201
|
-
|
|
11202
|
-
vec3 direction = vec3( uv, 1.0 );
|
|
11203
|
-
|
|
11204
|
-
if ( face == 0.0 ) {
|
|
11205
|
-
|
|
11206
|
-
direction = direction.zyx; // ( 1, v, u ) pos x
|
|
11207
|
-
|
|
11208
|
-
} else if ( face == 1.0 ) {
|
|
11209
|
-
|
|
11210
|
-
direction = direction.xzy;
|
|
11211
|
-
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
|
|
11212
|
-
|
|
11213
|
-
} else if ( face == 2.0 ) {
|
|
11214
|
-
|
|
11215
|
-
direction.x *= -1.0; // ( -u, v, 1 ) pos z
|
|
11216
|
-
|
|
11217
|
-
} else if ( face == 3.0 ) {
|
|
11218
|
-
|
|
11219
|
-
direction = direction.zyx;
|
|
11220
|
-
direction.xz *= -1.0; // ( -1, v, -u ) neg x
|
|
11221
|
-
|
|
11222
|
-
} else if ( face == 4.0 ) {
|
|
11223
|
-
|
|
11224
|
-
direction = direction.xzy;
|
|
11225
|
-
direction.xy *= -1.0; // ( -u, -1, v ) neg y
|
|
11226
|
-
|
|
11227
|
-
} else if ( face == 5.0 ) {
|
|
11228
|
-
|
|
11229
|
-
direction.z *= -1.0; // ( u, v, -1 ) neg z
|
|
11230
|
-
|
|
11231
|
-
}
|
|
11232
|
-
|
|
11233
|
-
return direction;
|
|
11234
|
-
|
|
11235
|
-
}
|
|
11236
|
-
|
|
11237
|
-
void main() {
|
|
11238
|
-
|
|
11239
|
-
vOutputDirection = getDirection( uv, faceIndex );
|
|
11240
|
-
gl_Position = vec4( position, 1.0 );
|
|
11241
|
-
|
|
11242
|
-
}
|
|
11188
|
+
return /* glsl */ `
|
|
11189
|
+
|
|
11190
|
+
precision mediump float;
|
|
11191
|
+
precision mediump int;
|
|
11192
|
+
|
|
11193
|
+
attribute float faceIndex;
|
|
11194
|
+
|
|
11195
|
+
varying vec3 vOutputDirection;
|
|
11196
|
+
|
|
11197
|
+
// RH coordinate system; PMREM face-indexing convention
|
|
11198
|
+
vec3 getDirection( vec2 uv, float face ) {
|
|
11199
|
+
|
|
11200
|
+
uv = 2.0 * uv - 1.0;
|
|
11201
|
+
|
|
11202
|
+
vec3 direction = vec3( uv, 1.0 );
|
|
11203
|
+
|
|
11204
|
+
if ( face == 0.0 ) {
|
|
11205
|
+
|
|
11206
|
+
direction = direction.zyx; // ( 1, v, u ) pos x
|
|
11207
|
+
|
|
11208
|
+
} else if ( face == 1.0 ) {
|
|
11209
|
+
|
|
11210
|
+
direction = direction.xzy;
|
|
11211
|
+
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
|
|
11212
|
+
|
|
11213
|
+
} else if ( face == 2.0 ) {
|
|
11214
|
+
|
|
11215
|
+
direction.x *= -1.0; // ( -u, v, 1 ) pos z
|
|
11216
|
+
|
|
11217
|
+
} else if ( face == 3.0 ) {
|
|
11218
|
+
|
|
11219
|
+
direction = direction.zyx;
|
|
11220
|
+
direction.xz *= -1.0; // ( -1, v, -u ) neg x
|
|
11221
|
+
|
|
11222
|
+
} else if ( face == 4.0 ) {
|
|
11223
|
+
|
|
11224
|
+
direction = direction.xzy;
|
|
11225
|
+
direction.xy *= -1.0; // ( -u, -1, v ) neg y
|
|
11226
|
+
|
|
11227
|
+
} else if ( face == 5.0 ) {
|
|
11228
|
+
|
|
11229
|
+
direction.z *= -1.0; // ( u, v, -1 ) neg z
|
|
11230
|
+
|
|
11231
|
+
}
|
|
11232
|
+
|
|
11233
|
+
return direction;
|
|
11234
|
+
|
|
11235
|
+
}
|
|
11236
|
+
|
|
11237
|
+
void main() {
|
|
11238
|
+
|
|
11239
|
+
vOutputDirection = getDirection( uv, faceIndex );
|
|
11240
|
+
gl_Position = vec4( position, 1.0 );
|
|
11241
|
+
|
|
11242
|
+
}
|
|
11243
11243
|
`;
|
|
11244
11244
|
}
|
|
11245
11245
|
function WebGLCubeUVMaps(renderer) {
|
|
@@ -34103,17 +34103,15 @@ function workerFunction() {
|
|
|
34103
34103
|
dummyGeometry.setAttribute("position", new BufferAttribute(buffer, 3));
|
|
34104
34104
|
if (event.data.Instances.length > 0) {
|
|
34105
34105
|
let geometry = new BufferGeometry();
|
|
34106
|
-
//
|
|
34107
|
-
|
|
34108
|
-
|
|
34109
|
-
|
|
34110
|
-
|
|
34111
|
-
|
|
34112
|
-
|
|
34113
|
-
|
|
34114
|
-
|
|
34115
|
-
geometry = modifier.modify(dummyGeometry, maxPolygonPerObject);
|
|
34116
|
-
console.log(dummyGeometry.attributes.position.count, geometry.attributes.position.count);
|
|
34106
|
+
// In case number of polygon larger than expect, merge them to reduce polygon first, for optimize purpose
|
|
34107
|
+
if (dummyGeometry.attributes.position.count > maxPolygonPerObject) {
|
|
34108
|
+
let modifier = new SimplifyModifier();
|
|
34109
|
+
geometry = modifier.modify(dummyGeometry, maxPolygonPerObject);
|
|
34110
|
+
console.log(dummyGeometry.attributes.position.count, geometry.attributes.position.count);
|
|
34111
|
+
}
|
|
34112
|
+
else {
|
|
34113
|
+
geometry = dummyGeometry;
|
|
34114
|
+
}
|
|
34117
34115
|
geometry.computeVertexNormals();
|
|
34118
34116
|
const childMesh = new InstancedMesh(geometry, new MeshBasicMaterial(), event.data.Instances.length);
|
|
34119
34117
|
childMesh.castShadow = true;
|
|
@@ -34143,40 +34141,27 @@ function workerFunction() {
|
|
|
34143
34141
|
matrix4.fromArray(numbers);
|
|
34144
34142
|
childMesh.setMatrixAt(index, matrix4);
|
|
34145
34143
|
//if number of polygon smaller than expect, generate edges
|
|
34146
|
-
|
|
34147
|
-
|
|
34148
|
-
|
|
34149
|
-
|
|
34150
|
-
|
|
34151
|
-
|
|
34152
|
-
|
|
34153
|
-
|
|
34154
|
-
|
|
34155
|
-
|
|
34156
|
-
|
|
34157
|
-
|
|
34158
|
-
|
|
34159
|
-
|
|
34160
|
-
|
|
34161
|
-
|
|
34162
|
-
|
|
34163
|
-
// new LineBasicMaterial({ color: "#666", linewidth: 0.5 })
|
|
34164
|
-
// );
|
|
34165
|
-
// line.applyMatrix4(matrix4);
|
|
34166
|
-
// line.updateMatrix();
|
|
34167
|
-
// childMesh.add(line);
|
|
34168
|
-
// }
|
|
34144
|
+
if (geometry.attributes.position.count < maxPolygonForEdge) {
|
|
34145
|
+
const edges = new EdgesGeometry(geometry, 90);
|
|
34146
|
+
const positions = edges.attributes.position.array;
|
|
34147
|
+
const indices = [];
|
|
34148
|
+
for (let i = 0; i < positions.length / 3; i += 2) {
|
|
34149
|
+
indices.push(i, i + 1);
|
|
34150
|
+
}
|
|
34151
|
+
const bufferGeometry = new BufferGeometry();
|
|
34152
|
+
// Set the position attribute
|
|
34153
|
+
bufferGeometry.setAttribute("position", new BufferAttribute(new Float32Array(positions), 3));
|
|
34154
|
+
// Set the index attribute
|
|
34155
|
+
bufferGeometry.setIndex(indices);
|
|
34156
|
+
const line = new LineSegments(bufferGeometry, new LineBasicMaterial({ color: "#666", linewidth: 0.5 }));
|
|
34157
|
+
line.applyMatrix4(matrix4);
|
|
34158
|
+
line.updateMatrix();
|
|
34159
|
+
childMesh.add(line);
|
|
34160
|
+
}
|
|
34169
34161
|
}
|
|
34170
34162
|
// childMesh.instanceMatrix.needsUpdate = true;
|
|
34171
34163
|
childMesh.updateMatrix();
|
|
34172
|
-
childMesh.uuid;
|
|
34173
34164
|
let jsonData = childMesh.toJSON();
|
|
34174
|
-
// jsonData.object.type = "InstancedMesh";
|
|
34175
|
-
// jsonData.object.count = childMesh.count;
|
|
34176
|
-
// jsonData.object.instanceMatrix = childMesh.instanceMatrix.toJSON();
|
|
34177
|
-
// if (this.instanceColor !== null)
|
|
34178
|
-
// jsonData.object.instanceColor = childMesh.instanceColor.toJSON();
|
|
34179
|
-
console.log(jsonData);
|
|
34180
34165
|
self.postMessage(jsonData);
|
|
34181
34166
|
}
|
|
34182
34167
|
else {
|