zincjs 1.16.2 → 1.16.4
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/build/zinc.frontend.js +1 -1
- package/build/zinc.js +50 -49
- package/build/zinc.js.map +1 -1
- package/package.json +1 -1
- package/src/primitives/lines2.js +4 -3
- package/src/primitives/pointset.js +8 -2
- package/src/primitives/textureVolume.js +317 -0
- package/src/primitives/zincObject.js +53 -50
- package/src/shaders/volumeRender_old.js +287 -0
package/build/zinc.js
CHANGED
|
@@ -32,7 +32,7 @@ module.exports = require("url-polyfill");
|
|
|
32
32
|
/***/ ((module) => {
|
|
33
33
|
|
|
34
34
|
"use strict";
|
|
35
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"zincjs","version":"1.16.
|
|
35
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"zincjs","version":"1.16.4","description":"ZincJS (Web-based-Zinc-Visualisation)","main":"build/zinc.js","directories":{"doc":"docs"},"files":["package.json","LICENSE","README.md","src/*","build/zinc.js","build/zinc.frontend.js","build/zinc.js.map","webpack.config.js"],"scripts":{"build-bundle":"webpack --config webpack.frontend.js; webpack --config webpack.backend.js","build-backend":"webpack --config webpack.backend.js","test":"npm --prefix ./test install && npm --prefix ./test run test-ci","changelog":"auto-changelog -p --output CHANGELOG.md --template keepachangelog","jsdoc":"jsdoc -c jsdoc_conf.json","version":"npm run build-bundle;npm run jsdoc;npm run changelog; git add CHANGELOG.md docs","release:beta":"npm version prerelease --preid=beta; npm publish --tag beta","release:minor":"npm version minor; npm publish","release:patch":"npm version patch; npm publish"},"repository":{"type":"git","url":"git+https://github.com/alan-wu/ZincJS.git"},"keywords":["library","webgl","3d","zincjs"],"author":"Alan Wu <alan.wu@auckland.ac.nz>","license":"MIT","bugs":{"url":"https://github.com/alan-wu/ZincJS/issues"},"homepage":"http://alan-wu.github.io/ZincJS/","devDependencies":{"@babel/core":"^7.23.9","@babel/preset-env":"^7.23.9","auto-changelog":"^2.4.0","babel-loader":"^9.1.3","babel-preset-minify":"^0.5.1","file-loader":"^6.2.0","jsdoc":"^4.0.2","raw-loader":"^4.0.2","webpack":"^5.90.3","webpack-cli":"^5.1.4","webpack-node-externals":"^3.0.0"},"dependencies":{"css-element-queries":"^1.2.2","lodash":"^4.17.19","promise-polyfill":"^8.1.3","three":"^0.130.1","three-spritetext":"1.6.2","url-loader":"^4.1.1","url-polyfill":"^1.1.7","webworkify-webpack":"^2.1.5"}}');
|
|
36
36
|
|
|
37
37
|
/***/ }),
|
|
38
38
|
/* 3 */
|
|
@@ -269,7 +269,7 @@ var THREE=__webpack_require__(4),createBufferGeometry=(__webpack_require__(5).cr
|
|
|
269
269
|
/**
|
|
270
270
|
* Groupname given to this geometry.
|
|
271
271
|
*/ /**
|
|
272
|
-
* Total duration of the animation, this value interacts with the
|
|
272
|
+
* Total duration of the animation, this value interacts with the
|
|
273
273
|
* {@link Renderer#playRate} to produce the actual duration of the
|
|
274
274
|
* animation. Actual time in second = duration / playRate.
|
|
275
275
|
*/ //Draw range is only used by primitives added
|
|
@@ -278,17 +278,17 @@ var THREE=__webpack_require__(4),createBufferGeometry=(__webpack_require__(5).cr
|
|
|
278
278
|
this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new THREE.Group,this._lod=new((__webpack_require__(11).LOD))(this),this.groupName=void 0,this.timeEnabled=!1,this.morphColour=!1,this.inbuildTime=0,this.mixer=void 0,this.animationGroup=void 0,this.duration=6e3,this.clipAction=void 0,this.userData={},this.videoHandler=void 0,this.marker=void 0,this.markerNumber=void 0,this.markerUpdateRequired=!0,this.closestVertexIndex=-1,this.boundingBoxUpdateRequired=!0,this.cachedBoundingBox=new THREE.Box3,this.anatomicalId=void 0,this.region=void 0,this.animationClip=void 0,this.markerMode="inherited",this.uuid=getUniqueId(),this._v1=new THREE.Vector3,this._v2=new THREE.Vector3,this._b1=new THREE.Box3,this.center=new THREE.Vector3,this.radius=0,this.visible=!0,this.drawRange=-1,this.origColour=void 0,this.origVertexColors=!1,this.isPickable=!0};/**
|
|
279
279
|
* Provides the base object for other primitive types.
|
|
280
280
|
* This class contains multiple base methods.
|
|
281
|
-
*
|
|
281
|
+
*
|
|
282
282
|
* @class
|
|
283
283
|
* @author Alan Wu
|
|
284
284
|
* @return {ZincObject}
|
|
285
285
|
*/ /**
|
|
286
286
|
* Set the duration of the animation of this object.
|
|
287
|
-
*
|
|
287
|
+
*
|
|
288
288
|
* @param {Number} durationIn - Duration of the animation.
|
|
289
289
|
*/ /**
|
|
290
290
|
* Get the duration of the animation of this object.
|
|
291
|
-
*
|
|
291
|
+
*
|
|
292
292
|
* @return {Number}
|
|
293
293
|
*/ /**
|
|
294
294
|
* Set the region this object belongs to.
|
|
@@ -296,24 +296,24 @@ this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new THREE
|
|
|
296
296
|
* @param {Region} region
|
|
297
297
|
*/ /**
|
|
298
298
|
* Get the region this object belongs to.
|
|
299
|
-
*
|
|
299
|
+
*
|
|
300
300
|
* @return {Region}
|
|
301
301
|
*/ /**
|
|
302
|
-
* Get the threejs object3D.
|
|
303
|
-
*
|
|
302
|
+
* Get the threejs object3D.
|
|
303
|
+
*
|
|
304
304
|
* @return {Object}
|
|
305
305
|
*/ /**
|
|
306
|
-
* Get the threejs object3D.
|
|
307
|
-
*
|
|
306
|
+
* Get the threejs object3D.
|
|
307
|
+
*
|
|
308
308
|
* @return {Object}
|
|
309
309
|
*/ /**
|
|
310
|
-
* Set the internal threejs object3D.
|
|
310
|
+
* Set the internal threejs object3D.
|
|
311
311
|
*/ /**
|
|
312
312
|
* Handle transparent mesh, create a clone for backside rendering if it is
|
|
313
313
|
* transparent.
|
|
314
314
|
*/ /**
|
|
315
315
|
* Set the mesh function for zincObject.
|
|
316
|
-
*
|
|
316
|
+
*
|
|
317
317
|
* @param {THREE.Mesh} mesh - Mesh to be set for this zinc object.
|
|
318
318
|
* @param {Boolean} localTimeEnabled - A flag to indicate either the mesh is
|
|
319
319
|
* time dependent.
|
|
@@ -321,105 +321,105 @@ this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new THREE
|
|
|
321
321
|
* time dependent.
|
|
322
322
|
*/ /**
|
|
323
323
|
* Set isPickable for this ZincObject.
|
|
324
|
-
*
|
|
324
|
+
*
|
|
325
325
|
* @param {String} isPickable - Boolean to enable object pick.
|
|
326
326
|
*/ /**
|
|
327
327
|
* Set the anatomicalId for this ZincObject.
|
|
328
|
-
*
|
|
328
|
+
*
|
|
329
329
|
* @param {String} anatomicalId - Id to be set.
|
|
330
330
|
*/ /**
|
|
331
331
|
* Set the name for this ZincObject.
|
|
332
|
-
*
|
|
332
|
+
*
|
|
333
333
|
* @param {String} groupNameIn - Name to be set.
|
|
334
334
|
*/ /**
|
|
335
|
-
* Get the local time of this geometry, it returns a value between
|
|
335
|
+
* Get the local time of this geometry, it returns a value between
|
|
336
336
|
* 0 and the duration.
|
|
337
|
-
*
|
|
337
|
+
*
|
|
338
338
|
* @return {Number}
|
|
339
339
|
*/ /**
|
|
340
340
|
* Set the local time of this geometry.
|
|
341
|
-
*
|
|
341
|
+
*
|
|
342
342
|
* @param {Number} time - Can be any value between 0 to duration.
|
|
343
343
|
*/ /**
|
|
344
344
|
* Check if the geometry is time varying.
|
|
345
|
-
*
|
|
345
|
+
*
|
|
346
346
|
* @return {Boolean}
|
|
347
347
|
*/ /**
|
|
348
348
|
* Get the visibility of this Geometry.
|
|
349
|
-
*
|
|
349
|
+
*
|
|
350
350
|
*/ /**
|
|
351
351
|
* Set the visibility of this Geometry.
|
|
352
|
-
*
|
|
353
|
-
* @param {Boolean} visible - a boolean flag indicate the visibility to be set
|
|
352
|
+
*
|
|
353
|
+
* @param {Boolean} visible - a boolean flag indicate the visibility to be set
|
|
354
354
|
*/ /**
|
|
355
355
|
* Set the opacity of this Geometry. This function will also set the isTransparent
|
|
356
356
|
* flag according to the provided alpha value.
|
|
357
|
-
*
|
|
358
|
-
* @param {Number} alpah - Alpha value to set for this geometry,
|
|
357
|
+
*
|
|
358
|
+
* @param {Number} alpah - Alpha value to set for this geometry,
|
|
359
359
|
* can be any value between from 0 to 1.0.
|
|
360
360
|
*/ /**
|
|
361
361
|
* The rendering will be culled if it is outside of the frustrum
|
|
362
362
|
* when this flag is set to true, it should be set to false if
|
|
363
363
|
* morphing is enabled.
|
|
364
|
-
*
|
|
364
|
+
*
|
|
365
365
|
* @param {Boolean} flag - Set frustrum culling on/off based on this flag.
|
|
366
366
|
*/ /**
|
|
367
367
|
* Set rather a zinc object should be displayed using per vertex colour or
|
|
368
368
|
* not.
|
|
369
|
-
*
|
|
369
|
+
*
|
|
370
370
|
* @param {Boolean} vertexColors - Set display with vertex color on/off.
|
|
371
371
|
*/ /**
|
|
372
372
|
* Get the colour of the mesh.
|
|
373
|
-
*
|
|
373
|
+
*
|
|
374
374
|
* @return {THREE.Color}
|
|
375
375
|
*/ /**
|
|
376
376
|
* Set the colour of the mesh.
|
|
377
|
-
*
|
|
377
|
+
*
|
|
378
378
|
* @param {THREE.Color} colour - Colour to be set for this geometry.
|
|
379
379
|
*/ /**
|
|
380
380
|
* Set the colour of the mesh.
|
|
381
|
-
*
|
|
381
|
+
*
|
|
382
382
|
* @param {THREE.Color} colour - Colour to be set for this geometry.
|
|
383
383
|
*/ /**
|
|
384
384
|
* Get the colour of the mesh in hex string form.
|
|
385
|
-
*
|
|
385
|
+
*
|
|
386
386
|
* @return {String}
|
|
387
387
|
*/ /**
|
|
388
388
|
* Set the colour of the mesh using hex in string form.
|
|
389
|
-
*
|
|
389
|
+
*
|
|
390
390
|
* @param {String} hex - The colour value in hex form.
|
|
391
391
|
*/ /**
|
|
392
392
|
* Set the emissive rgb of the mesh using rgb.
|
|
393
|
-
*
|
|
393
|
+
*
|
|
394
394
|
* @param {String} colour - The colour value in rgb form.
|
|
395
395
|
*/ /**
|
|
396
396
|
* Set the material of the geometry.
|
|
397
|
-
*
|
|
397
|
+
*
|
|
398
398
|
* @param {THREE.Material} material - Material to be set for this geometry.
|
|
399
399
|
*/ /**
|
|
400
400
|
* Get the index of the closest vertex to centroid.
|
|
401
|
-
*
|
|
401
|
+
*
|
|
402
402
|
* @return {Number} - integer index in the array
|
|
403
403
|
*/ /**
|
|
404
404
|
* Get the closest vertex to centroid.
|
|
405
|
-
*
|
|
405
|
+
*
|
|
406
406
|
* @return {THREE.Vector3}
|
|
407
407
|
*/ /**
|
|
408
408
|
* Get the bounding box of this geometry.
|
|
409
|
-
*
|
|
409
|
+
*
|
|
410
410
|
* @return {THREE.Box3}.
|
|
411
411
|
*/ /**
|
|
412
412
|
* Clear this geometry and free the memory.
|
|
413
413
|
*/ /**
|
|
414
|
-
* Check if marker is enabled based on the objects settings with
|
|
414
|
+
* Check if marker is enabled based on the objects settings with
|
|
415
415
|
* the provided scene options.
|
|
416
|
-
*
|
|
417
|
-
* @return {Boolean}
|
|
416
|
+
*
|
|
417
|
+
* @return {Boolean}
|
|
418
418
|
*/ /**
|
|
419
|
-
* Update the marker's position and size based on current viewport.
|
|
419
|
+
* Update the marker's position and size based on current viewport.
|
|
420
420
|
*/ /**
|
|
421
421
|
* Get the windows coordinates.
|
|
422
|
-
*
|
|
422
|
+
*
|
|
423
423
|
* @return {Object} - position and rather the closest vertex is on screen.
|
|
424
424
|
*/ /**
|
|
425
425
|
* Set marker mode for this zinc object which determine rather the
|
|
@@ -430,8 +430,8 @@ this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new THREE
|
|
|
430
430
|
* "off" - marker is disabled regardless of settings of scene
|
|
431
431
|
* "inherited" - Marker settings on scene will determine the visibility
|
|
432
432
|
* of the marker.
|
|
433
|
-
*
|
|
434
|
-
* @return {Boolean}
|
|
433
|
+
*
|
|
434
|
+
* @return {Boolean}
|
|
435
435
|
*/ //Update the geometry and colours depending on the morph.
|
|
436
436
|
/**
|
|
437
437
|
* Add lod from an url into the lod object.
|
|
@@ -444,10 +444,11 @@ this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new THREE
|
|
|
444
444
|
*/ZincObject.prototype.setDuration=function(durationIn){this.duration=durationIn,this.clipAction&&this.clipAction.setDuration(this.duration)},ZincObject.prototype.getDuration=function(){return this.duration},ZincObject.prototype.setRegion=function(region){this.region=region},ZincObject.prototype.getRegion=function(){return this.region},ZincObject.prototype.getMorph=function(){var morph=this._lod.getCurrentMorph();return morph?morph:this.morph},ZincObject.prototype.getGroup=function(){return this.group},ZincObject.prototype.setMorph=function(mesh){this.morph=mesh,this.group.add(this.morph);//this is the base level object
|
|
445
445
|
var distance=this._lod.calculateDistance("far");this._lod.addLevel(mesh,distance),this._lod.setMaterial(mesh.material)},ZincObject.prototype.checkTransparentMesh=function(){},ZincObject.prototype.setMesh=function(mesh,localTimeEnabled,localMorphColour){this.animationGroup=new THREE.AnimationObjectGroup(mesh),this.mixer=new THREE.AnimationMixer(this.animationGroup);var geometry=mesh.geometry;if(this.geometry=mesh.geometry,this.clipAction=void 0,geometry&&geometry.morphAttributes){var morphAttribute=geometry.morphAttributes.position;morphAttribute||(morphAttribute=geometry.morphAttributes.color?geometry.morphAttributes.color:geometry.morphAttributes.normal),morphAttribute&&(this.animationClip=THREE.AnimationClip.CreateClipsFromMorphTargetSequences(morphAttribute,10,!0),this.animationClip&&null!=this.animationClip[0]&&(this.clipAction=this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration),this.clipAction.loop=THREE.loopOnce,this.clipAction.clampWhenFinished=!0,this.clipAction.play()))}this.timeEnabled=localTimeEnabled,this.morphColour=localMorphColour,mesh.userData=this,mesh.matrixAutoUpdate=!1,this.setMorph(mesh),this.checkTransparentMesh(),this.timeEnabled?this.setFrustumCulled(!1):this.morphColour&&(geometry.setAttribute("morphTarget0",geometry.getAttribute("position")),geometry.setAttribute("morphTarget1",geometry.getAttribute("position"))),this.boundingBoxUpdateRequired=!0},ZincObject.prototype.setIsPickable=function(isPickable){this.isPickable!==isPickable&&(this.isPickable=isPickable,this.region&&(this.region.pickableUpdateRequired=!0))},ZincObject.prototype.setAnatomicalId=function(anatomicalId){this.anatomicalId=anatomicalId},ZincObject.prototype.setName=function(groupNameIn){this.groupName=groupNameIn,this._lod.setName(groupNameIn)},ZincObject.prototype.getCurrentTime=function(){if(this.clipAction){var ratio=this.clipAction.time/this.clipAction._clip.duration;return this.duration*ratio}return this.inbuildTime},ZincObject.prototype.setMorphTime=function(time){var timeChanged=!1;if(this.clipAction){var ratio=time/this.duration,actualDuration=this.clipAction._clip.duration,newTime=ratio*actualDuration;newTime!=this.clipAction.time&&(this.clipAction.time=newTime,timeChanged=!0),timeChanged&&this.isTimeVarying()&&this.mixer.update(0)}else{var _newTime=time;_newTime=time>this.duration?this.duration:0>time?0:time,_newTime!=this.inbuildTime&&(this.inbuildTime=_newTime,timeChanged=!0)}timeChanged&&(this.boundingBoxUpdateRequired=!0,this._lod.updateMorphColorAttribute(!0),this.timeEnabled&&(this.markerUpdateRequired=!0))},ZincObject.prototype.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour)},ZincObject.prototype.getVisibility=function(){return this.visible},ZincObject.prototype.setVisibility=function(visible){visible!==this.visible&&(this.visible=visible,this.group.visible=visible,this.region&&(this.region.pickableUpdateRequired=!0))},ZincObject.prototype.setAlpha=function(alpha){var material=this._lod._material,isTransparent=!1;1>alpha&&(isTransparent=!0),material.opacity=alpha,material.transparent=isTransparent,this.checkTransparentMesh()},ZincObject.prototype.setFrustumCulled=function(flag){//multilayers - set for all layers
|
|
446
446
|
this._lod.setFrustumCulled(flag)},ZincObject.prototype.setVertexColors=function(vertexColors){//multilayers - set for all
|
|
447
|
-
this._lod.setVertexColors(vertexColors)},ZincObject.prototype.getColour=function(){return this._lod._material?this._lod._material.color:void 0},ZincObject.prototype.setColour=function(colour){this._lod.setColour(colour)},ZincObject.prototype.setGreyScale=function(flag){if(flag){if(!this.origColour&&this._lod._material)return this.origColour=this._lod._material.color,this.origVertexColors=this._lod._material.vertexColors,this._lod.setVertexColors(!1),this._lod.setColour(new THREE.Color().setHex(12303291)),!0;}else if(this.origColour)return this._lod.setColour(this.origColour),this._lod.setVertexColors(this.origVertexColors),this.origColour=void 0,!0;return!1},ZincObject.prototype.getColourHex=function(){return!this.morphColour&&this._lod._material&&this._lod._material.color?this._lod._material.color.getHexString():void 0},ZincObject.prototype.setColourHex=function(hex){this._lod._material.color.setHex(hex),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(hex)},ZincObject.prototype.setEmissiveRGB=function(colour){this._lod._material&&this._lod._material.emissive&&this._lod._material.emissive.setRGB(...colour),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.emissive.setRGB(...colour)},ZincObject.prototype.setMaterial=function(material){this._lod.setMaterial(material)},ZincObject.prototype.getClosestVertexIndex=function(){var closestIndex=-1,morph=this.getMorph();if(morph&&morph.
|
|
447
|
+
this._lod.setVertexColors(vertexColors)},ZincObject.prototype.getColour=function(){return this._lod._material?this._lod._material.color:void 0},ZincObject.prototype.setColour=function(colour){this._lod.setColour(colour)},ZincObject.prototype.setGreyScale=function(flag){if(flag){if(!this.origColour&&this._lod._material)return this.origColour=this._lod._material.color,this.origVertexColors=this._lod._material.vertexColors,this._lod.setVertexColors(!1),this._lod.setColour(new THREE.Color().setHex(12303291)),!0;}else if(this.origColour)return this._lod.setColour(this.origColour),this._lod.setVertexColors(this.origVertexColors),this.origColour=void 0,!0;return!1},ZincObject.prototype.getColourHex=function(){return!this.morphColour&&this._lod._material&&this._lod._material.color?this._lod._material.color.getHexString():void 0},ZincObject.prototype.setColourHex=function(hex){this._lod._material.color.setHex(hex),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(hex)},ZincObject.prototype.setEmissiveRGB=function(colour){this._lod._material&&this._lod._material.emissive&&this._lod._material.emissive.setRGB(...colour),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.emissive.setRGB(...colour)},ZincObject.prototype.setMaterial=function(material){this._lod.setMaterial(material)},ZincObject.prototype.getClosestVertexIndex=function(){var closestIndex=-1,morph=this.getMorph();if(morph&&morph.geometry){var position=morph.geometry.attributes.position;if(position){this._b1.setFromBufferAttribute(position),this._b1.getCenter(this._v1);for(var distance=-1,currentDistance=0,i=0;i<position.count;i++)this._v2.fromArray(position.array,3*i),currentDistance=this._v2.distanceTo(this._v1),-1==distance?distance=currentDistance:distance>currentDistance&&(distance=currentDistance,closestIndex=i)}}return closestIndex},ZincObject.prototype.getClosestVertex=function(applyMatrixWorld){var position=new THREE.Vector3;-1==this.closestVertexIndex&&(this.closestVertexIndex=this.getClosestVertexIndex());var morph=this.getMorph();if(morph&&morph.geometry&&0<=this.closestVertexIndex){var influences=morph.morphTargetInfluences,attributes=morph.geometry.morphAttributes;if(influences&&attributes&&attributes.position){for(var found=!1,i=0;i<influences.length;i++)0<influences[i]&&(found=!0,this._v1.fromArray(attributes.position[i].array,3*this.closestVertexIndex),position.add(this._v1.multiplyScalar(influences[i])));if(found)return applyMatrixWorld?position.applyMatrix4(morph.matrixWorld):position}else return position.fromArray(morph.geometry.attributes.position.array,3*this.closestVertexIndex),applyMatrixWorld?position.applyMatrix4(morph.matrixWorld):position}//Matrix world has already been applied
|
|
448
|
+
return this.getBoundingBox(),position.copy(this.center),position},ZincObject.prototype.getBoundingBox=function(){if(this.visible){var morph=this._lod.getCurrentMorph();if(morph&&morph.visible)return this.boundingBoxUpdateRequired&&((__webpack_require__(5).getBoundingBox)(morph,this.cachedBoundingBox,this._b1,this._v1,this._v2),this.cachedBoundingBox.getCenter(this.center),this.radius=this.center.distanceTo(this.cachedBoundingBox.max),this.boundingBoxUpdateRequired=!1),this.cachedBoundingBox}},ZincObject.prototype.dispose=function(){//multilayyers
|
|
448
449
|
this._lod.dispose(),this.animationGroup=void 0,this.mixer=void 0,this.morph=void 0,this.group=void 0,this.clipAction=void 0,this.groupName=void 0},ZincObject.prototype.markerIsRequired=function(options){return!!(this.visible&&("on"===this.markerMode||options&&options.displayMarkers&&"inherited"===this.markerMode))},ZincObject.prototype.updateMarker=function(playAnimation,options){if(!1==playAnimation&&this.markerIsRequired(options)){var ndcToBeUpdated=options.ndcToBeUpdated;if(this.groupName){if(this.marker||(this.marker=new((__webpack_require__(14).Marker))(this),this.markerUpdateRequired=!0),this.markerUpdateRequired){var position=this.getClosestVertex(!1);position&&(this.marker.setPosition(position.x,position.y,position.z),this.markerUpdateRequired=!1)}this.marker.isEnabled()||(options.markersList&&!(this.marker.uuid in options.markersList)&&(ndcToBeUpdated=!0,options.markersList[this.marker.uuid]=this.marker),this.marker.enable(),this.group.add(this.marker.morph)),this.marker.setNumber(this.markerNumber),this.markerImgURL?this.marker.loadUserSprite(this.markerImgURL):this.marker.setDefaultSprite(),options&&options.camera&&(ndcToBeUpdated||options.markerCluster.markerUpdateRequired)&&(this.marker.updateNDC(options.camera.cameraObject),options.markerCluster.markerUpdateRequired=!0)}}else this.marker&&this.marker.isEnabled()&&(this.marker.disable(),this.group.remove(this.marker.morph),options.markersList&&this.marker.uuid in options.markersList&&(options.markerCluster.markerUpdateRequired=!0,delete options.markersList[this.marker.uuid])),this.markerUpdateRequired=!0},ZincObject.prototype.processMarkerVisual=function(min,max){this.marker&&this.marker.isEnabled()&&this.marker.updateVisual(min,max)},ZincObject.prototype.initiateMorphColor=function(){1==this.morphColour&&this._lod.updateMorphColorAttribute(!1)},ZincObject.prototype.setRenderOrder=function(renderOrder){//multiilayers
|
|
449
450
|
this._lod.setRenderOrder(renderOrder)},ZincObject.prototype.getClosestVertexDOMElementCoords=function(scene){if(scene&&scene.camera){var inView=!0,position=this.getClosestVertex(!0);return position.project(scene.camera),position.z=Math.min(Math.max(position.z,0),1),(1<position.x||-1>position.x||1<position.y||-1>position.y)&&(inView=!1),scene.getZincCameraControls().getRelativeCoordsFromNDC(position.x,position.y,position),{position,inView}}},ZincObject.prototype.setMarkerMode=function(mode,options){mode!==this.markerMode&&(this.markerMode="on"===mode||"off"===mode?mode:"inherited",this.region&&(this.region.pickableUpdateRequired=!0)),options&&(this.markerNumber=options.number,this.markerImgURL=options.imgURL)},ZincObject.prototype.render=function(delta,playAnimation,cameraControls,options){if(this.visible&&!(this.timeEnabled&&playAnimation)&&this._lod.update(cameraControls,this.center),!0==playAnimation){if(this.clipAction&&this.isTimeVarying())this.mixer.update(delta);else{var targetTime=this.inbuildTime+delta;targetTime>this.duration&&(targetTime-=this.duration),this.inbuildTime=targetTime}//multilayers
|
|
450
|
-
this.visible&&0!=delta&&(this.boundingBoxUpdateRequired=!0,1==this.morphColour&&this._lod.updateMorphColorAttribute(!0))}this.updateMarker(playAnimation,options)},ZincObject.prototype.addLOD=function(loader,level,url,index,preload){this._lod.addLevelFromURL(loader,level,url,index,preload)},ZincObject.prototype.addVertices=function(coords){var mesh=this.getMorph(),geometry=void 0;if(!mesh)geometry=createBufferGeometry(500,coords),this.drawRange=coords.length;else if(-1<this.drawRange){var positionAttribute=mesh.geometry.getAttribute("position");coords.forEach(coord=>{positionAttribute.setXYZ(this.drawRange,coord[0],coord[1],coord[2]),++this.drawRange}),positionAttribute.needsUpdate=!0,mesh.geometry.setDrawRange(0,this.drawRange),mesh.geometry.computeBoundingBox(),mesh.geometry.computeBoundingSphere(),geometry=mesh.geoemtry,this.boundingBoxUpdateRequired=!0}return geometry},ZincObject.prototype.setPosition=function(x,y,z){var group=this.getGroup();group&&(group.position.set(x,y,z),group.updateMatrix(),this.boundingBoxUpdateRequired=!0)},ZincObject.prototype.loadAdditionalSources=function(primitivesLoader){primitivesLoader.load(resolveURL(filename),meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,void 0,finishCallback),this.onProgress(filename),this.onError(finishCallback))},ZincObject.prototype.setScaleAll=function(scale){var group=this.getGroup();group&&(group.scale.set(scale,scale,scale),group.updateMatrix(),this.boundingBoxUpdateRequired=!0)},exports.ZincObject=ZincObject;
|
|
451
|
+
this.visible&&0!=delta&&(this.boundingBoxUpdateRequired=!0,1==this.morphColour&&this._lod.updateMorphColorAttribute(!0))}this.updateMarker(playAnimation,options)},ZincObject.prototype.addLOD=function(loader,level,url,index,preload){this._lod.addLevelFromURL(loader,level,url,index,preload)},ZincObject.prototype.addVertices=function(coords){var mesh=this.getMorph(),geometry=void 0;if(!mesh)geometry=createBufferGeometry(500,coords),this.drawRange=coords.length;else if(-1<this.drawRange){var positionAttribute=mesh.geometry.getAttribute("position");coords.forEach(coord=>{positionAttribute.setXYZ(this.drawRange,coord[0],coord[1],coord[2]),++this.drawRange}),positionAttribute.needsUpdate=!0,mesh.geometry.setDrawRange(0,this.drawRange),mesh.geometry.computeBoundingBox(),mesh.geometry.computeBoundingSphere(),geometry=mesh.geoemtry,this.boundingBoxUpdateRequired=!0}return geometry},ZincObject.prototype.setPosition=function(x,y,z){var group=this.getGroup();group&&(group.position.set(x,y,z),group.matrixWorldNeedsUpdate=!0,group.updateMatrix(),group.updateWorldMatrix(!0,!0),this.boundingBoxUpdateRequired=!0)},ZincObject.prototype.loadAdditionalSources=function(primitivesLoader){primitivesLoader.load(resolveURL(filename),meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,void 0,finishCallback),this.onProgress(filename),this.onError(finishCallback))},ZincObject.prototype.setScaleAll=function(scale){var group=this.getGroup();group&&(group.scale.set(scale,scale,scale),group.updateMatrix(),this.boundingBoxUpdateRequired=!0)},exports.ZincObject=ZincObject;
|
|
451
452
|
|
|
452
453
|
/***/ }),
|
|
453
454
|
/* 11 */
|
|
@@ -837,7 +838,7 @@ var THREE=__webpack_require__(4),Points=(__webpack_require__(23).Points),toBuffe
|
|
|
837
838
|
*
|
|
838
839
|
* @param {Boolean} flag - Determin either size attenuation
|
|
839
840
|
* should be on or off.
|
|
840
|
-
*/this.addPoints=(coords,labels,colour)=>{if(coords&&0<coords.length){var current=this.drawRange
|
|
841
|
+
*/this.addPoints=(coords,labels,colour)=>{if(coords&&0<coords.length){var current=this.drawRange;-1===current&&(current=0);var geometry=this.addVertices(coords),mesh=this.getMorph();if(!mesh){var material=new THREE.PointsMaterial({alphaTest:.5,size:10,color:colour,sizeAttenuation:!1});geometry.colorsNeedUpdate=!0,this.createMesh(geometry,material,{localTimeEnabled:!1,localMorphColour:!1})}var end=current+coords.length,index=0;if(Array.isArray(labels)&&labels.length===coords.length||"string"==typeof labels){labelSets.length;for(current;current+index<end;){var labelText="string"==typeof labels?labels:labels[index];addLabel(current+index,coords[index],labelText,this._lod._material.color),index++}}this.region&&(this.region.pickableUpdateRequired=!0)}},this.setColourHex=function(hex){this._lod._material.color.setHex(hex),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(hex);for(var i=0;i<labelSets.length;i++)labelSets[i]&&labelSets[i].setColour(this._lod._material.color)},this.setColour=colour=>{this._lod.setColour(colour);for(var i=0;i<labelSets.length;i++)labelSets[i]&&labelSets[i].setColour(this._lod._material.color)},this.setSize=size=>{this.morph&&this.morph.material&&(this.morph.material.size=size,this.morph.material.needsUpdate=!0)},this.setSizeAttenuation=flag=>{this.morph&&this.morph.material&&(this.morph.material.sizeAttenuation=flag,this.morph.material.needsUpdate=!0)},this.getVerticesByIndex=function(index){if(0<=index&&this.drawRange>index){var positionAttribute=this.getMorph().geometry.getAttribute("position");return[positionAttribute.getX(index),positionAttribute.getY(index),positionAttribute.getZ(index)]}},this.editVertices=function(coords,i){if(coords&&coords.length){var mesh=this.getMorph(),maxIndex=i+coords.length-1;if(!mesh||0>i||maxIndex>=this.drawRange)return;var positionAttribute=mesh.geometry.getAttribute("position"),index=i;coords.forEach(coord=>{var label=labelSets[index];label&&label.setPosition(coord[0],coord[1],coord[2]),positionAttribute.setXYZ(index++,coord[0],coord[1],coord[2])}),positionAttribute.needsUpdate=!0,this.boundingBoxUpdateRequired=!0}},this.render=(delta,playAnimation,cameraControls,options)=>{this.morph&&cameraControls&&(this.morph.sizePerPixel=cameraControls.pixelHeight),Pointset.prototype.render.call(this,delta,playAnimation,cameraControls,options)}};/**
|
|
841
842
|
* Provides an object which stores points and provides method which controls its position.
|
|
842
843
|
* This is created when a valid json file containing point is read into a {@link Zinc.Scene}
|
|
843
844
|
* object.
|
|
@@ -2302,7 +2303,7 @@ allObjects.forEach(zincObject=>{zincObject.render(playRate*delta,playAnimation,c
|
|
|
2302
2303
|
|
|
2303
2304
|
var THREE=__webpack_require__(4),toBufferGeometry=(__webpack_require__(5).toBufferGeometry),LineSegments2=(__webpack_require__(47).LineSegments2),LineMaterial=(__webpack_require__(49).LineMaterial),LineSegmentsGeometry=(__webpack_require__(48).LineSegmentsGeometry),Lines2=function(){(__webpack_require__(24).Lines).call(this),this.isLines2=!0;var positions=Array(300);/**
|
|
2304
2305
|
* Create the line segements using geometry and material.
|
|
2305
|
-
*
|
|
2306
|
+
*
|
|
2306
2307
|
* @param {Array} arrayIn - Geometry of lines to be rendered.
|
|
2307
2308
|
* @param {THREE.Material} materialIn - Material to be set for the lines.
|
|
2308
2309
|
* @param {Object} options - Provide various options
|
|
@@ -2312,7 +2313,7 @@ var THREE=__webpack_require__(4),toBufferGeometry=(__webpack_require__(5).toBuff
|
|
|
2312
2313
|
* time dependent.
|
|
2313
2314
|
*/ /**
|
|
2314
2315
|
* Set the width for the lines.
|
|
2315
|
-
*
|
|
2316
|
+
*
|
|
2316
2317
|
* @param {Number} width - Width of the lines.
|
|
2317
2318
|
*/ /**
|
|
2318
2319
|
* Add new vertices into the array
|
|
@@ -2331,7 +2332,7 @@ if(coords.forEach(coord=>{positions[index++]=coord[0],positions[index++]=coord[1
|
|
|
2331
2332
|
* Provides an object which stores lines.
|
|
2332
2333
|
* This is created when a valid json file containing lines is read into a {@link Zinc.Scene}
|
|
2333
2334
|
* object.
|
|
2334
|
-
*
|
|
2335
|
+
*
|
|
2335
2336
|
* @class
|
|
2336
2337
|
* @author Alan Wu
|
|
2337
2338
|
* @return {Lines}
|