zincjs 1.3.2 → 1.3.3
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 +3 -17
- package/build/zinc.js.map +1 -1
- package/package.json +1 -1
- package/src/primitives/textureSlides.js +1 -1
package/build/zinc.js
CHANGED
|
@@ -839,27 +839,13 @@ function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var inf
|
|
|
839
839
|
/* 25 */
|
|
840
840
|
/***/ (function(module, exports, __webpack_require__) {
|
|
841
841
|
|
|
842
|
-
var THREE=__webpack_require__(3),shader=__webpack_require__(26),TextureSlides=function(textureIn){__webpack_require__(27).TexturePrimitive.call(this,textureIn),this.isTextureSlides=!0;var textureSettings=[],idTextureMap={};this.morph=new THREE.Group,this.morph.userData=this;/**
|
|
843
|
-
@typedef SLIDE_SETTINGS
|
|
844
|
-
@type {Set}
|
|
845
|
-
@property {String} direction - the value must be x, y or z, specify the
|
|
846
|
-
direction the slide should be facing.
|
|
847
|
-
@property {Number} value - Normalised value of the location on direction.
|
|
848
|
-
@property {String} id - ID of the mesh, it is only available if the settings
|
|
849
|
-
is returned from {@link TextureSlides.createSlide} or
|
|
850
|
-
{@link TextureSlides.getTextureSettings}.
|
|
851
|
-
*/ /**
|
|
852
|
-
* Create the slides required for visualisation based on the slide settings.
|
|
853
|
-
* The slides themselves are {THREE.PlanGeometry} objects.
|
|
854
|
-
*
|
|
855
|
-
* @param {SLIDE_SETTINGS} slideSettings - An array to each slide settings.
|
|
856
|
-
*/ /**
|
|
842
|
+
var THREE=__webpack_require__(3),shader=__webpack_require__(26),TextureSlides=function(textureIn){__webpack_require__(27).TexturePrimitive.call(this,textureIn),this.isTextureSlides=!0;var textureSettings=[],idTextureMap={};this.morph=new THREE.Group,this.morph.userData=this;this.createSlides=slideSettings=>{slideSettings.forEach(slide=>this.createSlide(slide))};/**
|
|
857
843
|
* Set the value of the uniforms for a specific mesh in this
|
|
858
844
|
* texture slide object.
|
|
859
845
|
*
|
|
860
846
|
* @param {THREE.Mesh} mesh - Mesh to be modified
|
|
861
847
|
* @param {SLIDE_SETTINGS} slideSettings - Slide settings.
|
|
862
|
-
*/
|
|
848
|
+
*/var setUniformSlideSettingsOfMesh=(mesh,settings)=>{var material=mesh.material,uniforms=material.uniforms;switch(settings.direction){case"x":uniforms.direction.value=1,uniforms.slide.value.set(settings.value,0,0);break;case"y":uniforms.direction.value=2,uniforms.slide.value.set(0,settings.value,0);break;case"z":uniforms.direction.value=3,uniforms.slide.value.set(0,0,settings.value);break;default:}material.needsUpdate=!0,this.boundingBoxUpdateRequired=!0};/**
|
|
863
849
|
* Modify the mesh based on a setting
|
|
864
850
|
*
|
|
865
851
|
* @param {SLIDE_SETTINGS} settings - s.
|
|
@@ -894,7 +880,7 @@ var THREE=__webpack_require__(3),shader=__webpack_require__(26),TextureSlides=fu
|
|
|
894
880
|
* transformation to calculate the position of the box.
|
|
895
881
|
*
|
|
896
882
|
* @return {THREE.Box3}.
|
|
897
|
-
*/this.
|
|
883
|
+
*/this.modifySlideSettings=settings=>{settings&&settings.id&&settings.id in idTextureMap&&idTextureMap[settings.id]&&setUniformSlideSettingsOfMesh(idTextureMap[settings.id],settings)},this.createSlide=settings=>{if(this.texture&&this.texture.isTextureArray&&this.texture.isReady()&&settings&&settings.direction&&void 0!==settings.value){var geometry=new THREE.PlaneGeometry(1,1);geometry.translate(.5,.5,0);var uniforms=shader.getUniforms();uniforms.diffuse.value=this.texture.impl,uniforms.depth.value=this.texture.size.depth;var options={fs:shader.fs,vs:shader.vs,uniforms:uniforms,glslVersion:shader.glslVersion,side:THREE.DoubleSide,transparent:!1},material=this.texture.getMaterial(options);material.needsUpdate=!0;var mesh=new THREE.Mesh(geometry,material),slideSettings={value:settings.value,direction:settings.direction,id:mesh.id};return textureSettings.push(slideSettings),setUniformSlideSettingsOfMesh(mesh,slideSettings),idTextureMap[mesh.id]=mesh,this.morph.add(mesh),slideSettings}},this.getTextureSettings=()=>[...textureSettings],this.getSlides=()=>this.morph?[...this.morph.children]:[],this.removeSlide=slide=>{slide&&this.removeSlideWithId(slide.id)},this.removeSlideWithId=id=>{if(this.morph&&id in idTextureMap&&idTextureMap[id]){if(this.morph.getObjectById(id)){var slide=idTextureMap[id];this.morph.remove(slide),slide.clear(),slide.geometry&&slide.geometry.dispose(),slide.material&&slide.material.dispose(),this.boundingBoxUpdateRequired=!0}var index=textureSettings.findIndex(item=>item.id===id);-1<index&&textureSettings.splice(index)}},this.dispose=()=>{this.morph.children.forEach(slide=>{slide.geometry&&slide.geometry.dispose(),slide.material&&slide.material.dispose()}),__webpack_require__(27).TexturePrimitive.prototype.dispose.call(this),this.boundingBoxUpdateRequired=!0},this.getBoundingBox=function(){return this.morph&&this.morph.children&&this.morph.visible&&this.boundingBoxUpdateRequired&&(this.cachedBoundingBox.makeEmpty(),this.morph.children.forEach(slide=>{var value=slide.material.uniforms.slide.value;this.cachedBoundingBox.expandByPoint(value)}),this.morph.updateWorldMatrix(),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1),this.cachedBoundingBox}};TextureSlides.prototype=Object.create(__webpack_require__(27).TexturePrimitive.prototype),exports.TextureSlides=TextureSlides;
|
|
898
884
|
|
|
899
885
|
/***/ }),
|
|
900
886
|
/* 26 */
|