zincjs 1.3.0 → 1.4.0-beta.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/build/zinc.frontend.js +2 -2
- package/build/zinc.js +302 -236
- package/build/zinc.js.map +1 -1
- package/package.json +1 -1
- package/src/geometryCSG.js +14 -14
- package/src/glyphsetCSG.js +2 -2
- package/src/loaders/GLTFToZincJSLoader.js +3 -2
- package/src/loaders/primitivesLoader.js +3 -1
- package/src/primitives/geometry.js +70 -54
- package/src/primitives/glyphset.js +6 -6
- package/src/primitives/lines.js +2 -1
- package/src/primitives/lod.js +378 -0
- package/src/primitives/marker.js +1 -0
- package/src/primitives/pointset.js +2 -1
- package/src/primitives/textureSlides.js +1 -1
- package/src/primitives/zincObject.js +132 -197
- package/src/region.js +10 -8
- package/src/scene.js +2 -2
- package/src/sceneExporter.js +1 -1
- package/src/sceneLoader.js +27 -36
- package/src/utilities.js +226 -145
- package/src/workers/geometryCSG.worker.js +4 -4
package/build/zinc.js
CHANGED
|
@@ -103,7 +103,7 @@ __webpack_require__(1);/**
|
|
|
103
103
|
*
|
|
104
104
|
* @namespace
|
|
105
105
|
* @author Alan Wu
|
|
106
|
-
*/var Zinc=function(){this.Revision="1.0.12",this.defaultMaterialColor=16777215,this.defaultOpacity=1,this.modelPrefix=void 0,this.Geometry=__webpack_require__(2).Geometry,this.Glyph=__webpack_require__(
|
|
106
|
+
*/var Zinc=function(){this.Revision="1.0.12",this.defaultMaterialColor=16777215,this.defaultOpacity=1,this.modelPrefix=void 0,this.Geometry=__webpack_require__(2).Geometry,this.Glyph=__webpack_require__(11).Glyph,this.Glyphset=__webpack_require__(14).Glyphset,this.Pointset=__webpack_require__(18).Pointset,this.Lines=__webpack_require__(21).Lines,this.TextureArray=__webpack_require__(24).TextureArray,this.TextureSlides=__webpack_require__(26).TextureSlides,this.Renderer=__webpack_require__(29).Renderer,this.Scene=__webpack_require__(31).Scene,this.GeometryCSG=__webpack_require__(43).GeometryCSG,this.GlyphsetCSG=__webpack_require__(49).GlyphsetCSG,this.Viewport=__webpack_require__(40).Viewport,this.CameraControls=__webpack_require__(40).CameraControls,this.SmoothCameraTransition=__webpack_require__(40).SmoothCameraTransition,this.RayCaster=__webpack_require__(40).RayCaster,this.CameraAutoTumble=__webpack_require__(40).CameraAutoTumble,this.StereoEffect=__webpack_require__(40).StereoEffect,this.loadExternalFile=__webpack_require__(4).loadExternalFile,this.loadExternalFiles=__webpack_require__(4).loadExternalFiles,this.THREE=__webpack_require__(3)};module.exports=new Zinc;
|
|
107
107
|
|
|
108
108
|
/***/ }),
|
|
109
109
|
/* 1 */
|
|
@@ -115,7 +115,8 @@ module.exports = require("url-polyfill");
|
|
|
115
115
|
/* 2 */
|
|
116
116
|
/***/ (function(module, exports, __webpack_require__) {
|
|
117
117
|
|
|
118
|
-
var THREE=__webpack_require__(3),
|
|
118
|
+
var THREE=__webpack_require__(3),toBufferGeometry=__webpack_require__(4).toBufferGeometry,createMeshForGeometry=(geometryIn,materialIn,options)=>{// First copy the geometry
|
|
119
|
+
var geometry=toBufferGeometry(geometryIn,options),isTransparent=!1;1>options.opacity&&(isTransparent=!0);var material;if(geometry._video===void 0){var morphTargets=options.localTimeEnabled||options.localMorphColour;materialIn?(material=materialIn,material.morphTargets=morphTargets,material.morphNormals=options.localTimeEnabled):geometry instanceof THREE.BufferGeometry&&geometry.attributes.color===void 0?material=new THREE.MeshPhongMaterial({color:options.colour,morphTargets:morphTargets,morphNormals:options.localTimeEnabled,transparent:isTransparent,opacity:options.opacity,side:THREE.DoubleSide}):material=new THREE.MeshPhongMaterial({color:options.colour,morphTargets:morphTargets,morphNormals:options.localTimeEnabled,vertexColors:THREE.VertexColors,transparent:isTransparent,opacity:options.opacity,side:THREE.DoubleSide}),options.localMorphColour&&geometry.morphAttributes.color&&(material.onBeforeCompile=__webpack_require__(6).augmentMorphColor())}else{var videoTexture=geometry._video.createCanvasVideoTexture();material=new THREE.MeshBasicMaterial({morphTargets:options.localTimeEnabled,color:new THREE.Color(1,1,1),transparent:isTransparent,opacity:options.opacity,map:videoTexture,side:THREE.DoubleSide}),this.videoHandler=geometry._video}return new THREE.Mesh(geometry,material)},Geometry=function(){// THREE.Geometry or THREE.BufferGeometry
|
|
119
120
|
/**
|
|
120
121
|
* Create the mesh for rendering
|
|
121
122
|
*
|
|
@@ -130,20 +131,15 @@ var THREE=__webpack_require__(3),Geometry=function(){// THREE.Geometry or THREE.
|
|
|
130
131
|
* @param {Number} options.opacity - Opacity to be set for the geometry
|
|
131
132
|
*/ /**
|
|
132
133
|
* Calculate the UV for texture rendering.
|
|
134
|
+
*/ /**
|
|
135
|
+
* Handle transparent mesh, create a clone for backside rendering if it is
|
|
136
|
+
* transparent.
|
|
133
137
|
*/ /**
|
|
134
138
|
* Set wireframe display for this geometry.
|
|
135
139
|
*
|
|
136
140
|
* @param {Boolean} wireframe - Flag to turn on/off wireframe display.
|
|
137
|
-
*/__webpack_require__(
|
|
138
|
-
|
|
139
|
-
* Provides an object which stores geometry and provides method which controls its animations.
|
|
140
|
-
* This is created when a valid json file containging geometry is read into a {@link Zinc.Scene}
|
|
141
|
-
* object.
|
|
142
|
-
*
|
|
143
|
-
* @class
|
|
144
|
-
* @author Alan Wu
|
|
145
|
-
* @return {Geometry}
|
|
146
|
-
*/Geometry.prototype=Object.create(__webpack_require__(4).ZincObject.prototype),exports.Geometry=Geometry;
|
|
141
|
+
*/__webpack_require__(7).ZincObject.call(this),this.videoHandler=void 0,this.isGeometry=!0,this.createMesh=(geometryIn,materialIn,options)=>{//Skip if there is a morph already
|
|
142
|
+
if(!(this.morph&&this.morph.geometry&&null!=geometryIn)){var mesh=createMeshForGeometry(geometryIn,materialIn,options);this.setMesh(mesh,options.localTimeEnabled,options.localMorphColour)}},this.calculateUVs=()=>{this.geometry.computeBoundingBox();var max=this.geometry.boundingBox.max,min=this.geometry.boundingBox.min,offset=new THREE.Vector2(0-min.x,0-min.y),range=new THREE.Vector2(max.x-min.x,max.y-min.y);this.geometry.faceVertexUvs[0]=[];for(var i=0;i<this.geometry.faces.length;i++){var v1=this.geometry.vertices[this.geometry.faces[i].a],v2=this.geometry.vertices[this.geometry.faces[i].b],v3=this.geometry.vertices[this.geometry.faces[i].c];geometry.faceVertexUvs[0].push([new THREE.Vector2((v1.x+offset.x)/range.x,(v1.y+offset.y)/range.y),new THREE.Vector2((v2.x+offset.x)/range.x,(v2.y+offset.y)/range.y),new THREE.Vector2((v3.x+offset.x)/range.x,(v3.y+offset.y)/range.y)])}geometry.uvsNeedUpdate=!0},this.checkTransparentMesh=function(transparentChanged){this._lod.checkTransparentMesh(this.animationGroup,transparentChanged)},this.setWireframe=wireframe=>{this.morph.material.wireframe=wireframe}};Geometry.prototype=Object.create(__webpack_require__(7).ZincObject.prototype),exports.Geometry=Geometry;
|
|
147
143
|
|
|
148
144
|
/***/ }),
|
|
149
145
|
/* 3 */
|
|
@@ -155,105 +151,26 @@ module.exports = require("three");
|
|
|
155
151
|
/* 4 */
|
|
156
152
|
/***/ (function(module, exports, __webpack_require__) {
|
|
157
153
|
|
|
158
|
-
var THREE=__webpack_require__(3),THREEGeometry=__webpack_require__(5).Geometry
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
*/ /**
|
|
179
|
-
* Set the visibility of this Geometry.
|
|
180
|
-
*
|
|
181
|
-
* @param {Boolean} visible - a boolean flag indicate the visibility to be set
|
|
182
|
-
*/ /**
|
|
183
|
-
* Set the opacity of this Geometry. This function will also set the isTransparent
|
|
184
|
-
* flag according to the provided alpha value.
|
|
185
|
-
*
|
|
186
|
-
* @param {Number} alpah - Alpha value to set for this geometry,
|
|
187
|
-
* can be any value between from 0 to 1.0.
|
|
188
|
-
*/ /**
|
|
189
|
-
* The rendering will be culled if it is outside of the frustrum
|
|
190
|
-
* when this flag is set to true, it should be set to false if
|
|
191
|
-
* morphing is enabled.
|
|
192
|
-
*
|
|
193
|
-
* @param {Boolean} flag - Set frustrum culling on/off based on this flag.
|
|
194
|
-
*/ /**
|
|
195
|
-
* Set rather a zinc object should be displayed using per vertex colour or
|
|
196
|
-
* not.
|
|
197
|
-
*
|
|
198
|
-
* @param {Boolean} vertexColors - Set display with vertex color on/off.
|
|
199
|
-
*/ /**
|
|
200
|
-
* Get the colour of the mesh.
|
|
201
|
-
*
|
|
202
|
-
* @return {THREE.Color}
|
|
203
|
-
*/ /**
|
|
204
|
-
* Set the colour of the mesh.
|
|
205
|
-
*
|
|
206
|
-
* @param {THREE.Color} colour - Colour to be set for this geometry.
|
|
207
|
-
*/ /**
|
|
208
|
-
* Get the colour of the mesh in hex string form.
|
|
209
|
-
*
|
|
210
|
-
* @return {String}
|
|
211
|
-
*/ /**
|
|
212
|
-
* Set the colour of the mesh using hex in string form.
|
|
213
|
-
*
|
|
214
|
-
* @param {String} hex - The colour value in hex form.
|
|
215
|
-
*/ /**
|
|
216
|
-
* Set the material of the geometry.
|
|
217
|
-
*
|
|
218
|
-
* @param {THREE.Material} material - Material to be set for this geometry.
|
|
219
|
-
*/ /**
|
|
220
|
-
* Get the index of the closest vertex to centroid.
|
|
221
|
-
*
|
|
222
|
-
* @return {Number} - integer index in the array
|
|
223
|
-
*/ /**
|
|
224
|
-
* Get the closest vertex to centroid.
|
|
225
|
-
*
|
|
226
|
-
* @return {THREE.Vector3}
|
|
227
|
-
*/ /**
|
|
228
|
-
* Get the bounding box of this geometry.
|
|
229
|
-
*
|
|
230
|
-
* @return {THREE.Box3}.
|
|
231
|
-
*/ /**
|
|
232
|
-
* Clear this geometry and free the memory.
|
|
233
|
-
*/ /**
|
|
234
|
-
* Check if marker is enabled based on the objects settings with
|
|
235
|
-
* the provided scene options.
|
|
236
|
-
*
|
|
237
|
-
* @return {Boolean}
|
|
238
|
-
*/ /**
|
|
239
|
-
* Update the marker's position and size based on current viewport.
|
|
240
|
-
*/ /**
|
|
241
|
-
* Get the windows coordinates.
|
|
242
|
-
*
|
|
243
|
-
* @return {Object} - position and rather the closest vertex is on screen.
|
|
244
|
-
*/ /**
|
|
245
|
-
* Set marker mode for this zinc object which determine rather the
|
|
246
|
-
* markers should be displayed or not.
|
|
247
|
-
*
|
|
248
|
-
* @param {string} mode - There are three options:
|
|
249
|
-
* "on" - marker is enabled regardless of settings of scene
|
|
250
|
-
* "off" - marker is disabled regardless of settings of scene
|
|
251
|
-
* "inherited" - Marker settings on scene will determine the visibility
|
|
252
|
-
* of the marker.
|
|
253
|
-
*
|
|
254
|
-
* @return {Boolean}
|
|
255
|
-
*/ //Update the geometry and colours depending on the morph.
|
|
256
|
-
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,updateMorphColorAttribute(this.geometry,this.morph),this.timeEnabled&&(this.markerUpdateRequired=!0))},ZincObject.prototype.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour)},ZincObject.prototype.getVisibility=function(){return!!this.morph&&this.morph.visible},ZincObject.prototype.setVisibility=function(visible){this.morph.visible!==visible&&(this.morph.visible=visible,this.region&&(this.region.pickableUpdateRequired=!0))},ZincObject.prototype.setAlpha=function(alpha){var material=this.morph.material,isTransparent=!1;1>alpha&&(isTransparent=!0);var transparentChanged=material.transparent!=isTransparent;material.opacity=alpha,material.transparent=isTransparent,transparentChanged&&(isTransparent?this.checkAndCreateTransparentMesh():this.checkAndRemoveTransparentMesh()),this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.opacity=alpha)},ZincObject.prototype.setFrustumCulled=function(flag){this.morph&&(this.morph.frustumCulled=flag)},ZincObject.prototype.setVertexColors=function(vertexColors){this.morph.material.vertexColors=vertexColors,this.geometry.colorsNeedUpdate=!0,this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.vertexColors=vertexColors)},ZincObject.prototype.getColour=function(){return this.morph&&this.morph.material?this.morph.material.color:void 0},ZincObject.prototype.setColour=function(colour){this.morph.material.color=colour,this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.color=colour),this.geometry.colorsNeedUpdate=!0},ZincObject.prototype.getColourHex=function(){return!this.morphColour&&this.morph&&this.morph.material&&this.morph.material.color?this.morph.material.color.getHexString():void 0},ZincObject.prototype.setColourHex=function(hex){this.morph.material.color.setHex(hex),this.secondaryMesh&&this.secondaryMesh.material&&this.secondaryMesh.material.color.setHex(hex)},ZincObject.prototype.setMaterial=function(material){this.morph.material=material,this.geometry.colorsNeedUpdate=!0,this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.dispose(),this.secondaryMesh.material=material.clone(),this.secondaryMesh.material.side=THREE.FrontSide)},ZincObject.prototype.getClosestVertexIndex=function(){var closestIndex=-1;if(this.morph){var position=this.morph.geometry.attributes.position,boundingBox=new THREE.Box3().setFromBufferAttribute(position),center=new THREE.Vector3;if(boundingBox.getCenter(center),position&&boundingBox)for(var distance=-1,currentDistance=0,current=new THREE.Vector3,i=0;i<position.count;i++)current.fromArray(position.array,3*i),currentDistance=current.distanceTo(center),-1==distance?distance=currentDistance:distance>currentDistance&&(distance=currentDistance,closestIndex=i)}return closestIndex},ZincObject.prototype.getClosestVertex=function(applyMatrixWorld){var position=new THREE.Vector3;if(-1==this.closestVertexIndex&&(this.closestVertexIndex=this.getClosestVertexIndex()),0<=this.closestVertexIndex){var influences=this.morph.morphTargetInfluences,attributes=this.morph.geometry.morphAttributes;if(influences&&attributes&&attributes.position){for(var found=!1,i=0;i<influences.length;i++)0<influences[i]&&(found=!0,this._vertex.fromArray(attributes.position[i].array,3*this.closestVertexIndex),position.add(this._vertex.multiplyScalar(influences[i])));if(found)return applyMatrixWorld?position.applyMatrix4(this.morph.matrixWorld):position}else return position.fromArray(this.morph.geometry.attributes.position.array,3*this.closestVertexIndex),applyMatrixWorld?position.applyMatrix4(this.morph.matrixWorld):position}return this.getBoundingBox().getCenter(position),applyMatrixWorld?position.applyMatrix4(this.morph.matrixWorld):position},ZincObject.prototype.getBoundingBox=function(){if(this.morph&&this.morph.visible){if(this.boundingBoxUpdateRequired){var influences=this.morph.morphTargetInfluences,attributes=void 0;this.morph.geometry&&(attributes=this.morph.geometry.morphAttributes);var found=!1;if(influences&&attributes&&attributes.position){for(var min=new THREE.Vector3,max=new THREE.Vector3,box=new THREE.Box3,i=0;i<influences.length;i++)0<influences[i]&&(found=!0,box.setFromArray(attributes.position[i].array),min.add(box.min.multiplyScalar(influences[i])),max.add(box.max.multiplyScalar(influences[i])));found&&this.cachedBoundingBox.set(min,max)}found||this.cachedBoundingBox.setFromBufferAttribute(this.morph.geometry.attributes.position),this.morph.updateWorldMatrix(),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1}return this.cachedBoundingBox}},ZincObject.prototype.dispose=function(){this.morph&&this.morph.geometry&&this.morph.geometry.dispose(),this.morph&&this.morph.material&&this.morph.material.dispose(),this.secondaryMesh&&this.secondaryMesh.material&&this.secondaryMesh.material.dispose(),this.geometry&&this.geometry.dispose(),this.animationGroup=void 0,this.mixer=void 0,this.morph=void 0,this.clipAction=void 0,this.groupName=void 0},ZincObject.prototype.markerIsEnabled=function(options){return!!("on"===this.markerMode||options&&options.displayMarkers&&"inherited"===this.markerMode)},ZincObject.prototype.updateMarker=function(playAnimation,options){if(!(!1==playAnimation&&this.markerIsEnabled(options)))this.marker&&this.marker.isEnabled()&&(this.marker.disable(),this.morph.remove(this.marker.morph)),this.markerUpdateRequired=!0;else if(this.groupName){if(this.marker||(this.marker=new(__webpack_require__(7).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)}options&&options.camera&&options.markerDepths&&options.markerDepths.push(this.marker.updateNDC(options.camera.cameraObject)),this.marker.isEnabled()||(this.marker.enable(),this.morph.add(this.marker.morph))}},ZincObject.prototype.processMarkerVisual=function(min,max){this.marker&&this.marker.isEnabled()&&this.marker.updateVisual(min,max)},ZincObject.prototype.initiateMorphColor=function(){1==this.morphColour&&"undefined"!=typeof this.geometry&&(this.morph.material.vertexColors==THREE.VertexColors||!0==this.morph.material.vertexColors)&&updateMorphColorAttribute(this.geometry,this.morph)},ZincObject.prototype.setRenderOrder=function(renderOrder){this.morph&&renderOrder!==void 0&&(this.morph.renderOrder=renderOrder,this.secondaryMesh&&(this.secondaryMesh.renderOrder=this.morph.renderOrder+1))},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){mode!==this.markerMode&&(this.markerMode="on"===mode||"off"===mode?mode:"inherited",this.region&&(this.region.pickableUpdateRequired=!0))},ZincObject.prototype.render=function(delta,playAnimation,options){if(!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}0!=delta&&(this.boundingBoxUpdateRequired=!0,1==this.morphColour&&"undefined"!=typeof this.geometry&&(this.morph.material.vertexColors==THREE.VertexColors||!0==this.morph.material.vertexColors)&&updateMorphColorAttribute(this.geometry,this.morph))}this.updateMarker(playAnimation,options)},exports.ZincObject=ZincObject;
|
|
154
|
+
function _readOnlyError(name){throw new Error("\""+name+"\" is read-only")}var THREE=__webpack_require__(3),THREEGeometry=__webpack_require__(5).Geometry;function resolveURL(url){var actualURL=url,prefix=__webpack_require__(0).modelPrefix;if(prefix){"/"!=prefix[prefix.length-1]&&(prefix=(_readOnlyError("prefix"),prefix+"/"));var r=/^(?:[a-z]+:)?\/\//i;r.test(url)||(actualURL=prefix+url)}return actualURL}/*
|
|
155
|
+
* Calculate the bounding box of a mesh, values will be
|
|
156
|
+
* set for cachedBox, b1, v1 and v2 and they need to be
|
|
157
|
+
* defined.
|
|
158
|
+
*/function getBoundingBox(mesh,cachedBox,b1,v1,v2){var influences=mesh.morphTargetInfluences,attributes=void 0;mesh.geometry&&(attributes=mesh.geometry.morphAttributes);var found=!1;if(influences&&attributes&&attributes.position){v1.set(0,0,0),v2.set(0,0,0);for(var i=0;i<influences.length;i++)0<influences[i]&&(found=!0,b1.setFromArray(attributes.position[i].array),v1.add(b1.min.multiplyScalar(influences[i])),v2.add(b1.max.multiplyScalar(influences[i])));found&&cachedBox.set(v1,v2)}found||cachedBox.setFromBufferAttribute(mesh.geometry.attributes.position),mesh.updateWorldMatrix(),cachedBox.applyMatrix4(mesh.matrixWorld)}//Convenient function
|
|
159
|
+
function loadExternalFile(url,data,callback,errorCallback){// Set up an asynchronous request
|
|
160
|
+
var request=new XMLHttpRequest;// Hook the event that gets called as the request progresses
|
|
161
|
+
request.open("GET",resolveURL(url),!0),request.onreadystatechange=()=>{4==request.readyState&&(200==request.status?callback(request.responseText,data):errorCallback(url))},request.send(null)}function loadExternalFiles(urls,callback,errorCallback){// Callback for a single file
|
|
162
|
+
function partialCallback(text,urlIndex){result[urlIndex]=text,numComplete++,numComplete==numUrls&&callback(result)}for(var numUrls=urls.length,numComplete=0,result=[],i=0;i<numUrls;i++)loadExternalFile(urls[i],i,partialCallback,errorCallback)}//Get the colours at index
|
|
163
|
+
exports.getColorsRGB=(colors,index)=>{var index_in_colors=Math.floor(index/3),remainder=index%3,hex_value=0;0==remainder?hex_value=colors[index_in_colors].r:1==remainder?hex_value=colors[index_in_colors].g:2==remainder&&(hex_value=colors[index_in_colors].b);var mycolor=new THREE.Color(hex_value);return[mycolor.r,mycolor.g,mycolor.b]},exports.updateMorphColorAttribute=function(targetGeometry,morph){if(morph&&targetGeometry&&targetGeometry.morphAttributes&&targetGeometry.morphAttributes.color){var morphColors=targetGeometry.morphAttributes.color,influences=morph.morphTargetInfluences,length=influences.length;targetGeometry.deleteAttribute("morphColor0"),targetGeometry.deleteAttribute("morphColor1");for(var bound=0,morphArray=[],i=0;1>bound||i<length;i++)0<influences[i]&&(bound++,morphArray.push([i,influences[i]]));2==morphArray.length?(targetGeometry.setAttribute("morphColor0",morphColors[morphArray[0][0]]),targetGeometry.setAttribute("morphColor1",morphColors[morphArray[1][0]])):1==morphArray.length&&(targetGeometry.setAttribute("morphColor0",morphColors[morphArray[0][0]]),targetGeometry.setAttribute("morphColor1",morphColors[morphArray[0][0]]))}},exports.toBufferGeometry=(geometryIn,options)=>{var geometry;return geometryIn instanceof THREEGeometry?(options.localTimeEnabled&&!geometryIn.morphNormalsReady&&(null==geometryIn.morphNormals||0==geometryIn.morphNormals.length)&&geometryIn.computeMorphNormals(),geometry=geometryIn.toIndexedBufferGeometry(),options.localMorphColour&©MorphColorsToIndexedBufferGeometry(geometryIn,geometry)):geometryIn instanceof THREE.BufferGeometry&&(geometry=geometryIn.clone()),geometry.colorsNeedUpdate=!0,geometry.computeBoundingBox(),geometry.computeBoundingSphere(),geometryIn._video&&(geometry._video=geometryIn._video),geometry},exports.copyMorphColorsToBufferGeometry=(geometry,bufferGeometry)=>{if(geometry&&geometry.morphColors&&0<geometry.morphColors.length){for(var array=[],morphColors=geometry.morphColors,getColorsRGB=__webpack_require__(4).getColorsRGB,i=0,l=morphColors.length;i<l;i++){for(var morphColor=morphColors[i],colorArray=[],j=0;j<geometry.faces.length;j++){var face=geometry.faces[j],color=getColorsRGB(morphColor.colors,face.a);colorArray.push(color[0],color[1],color[2]),color=getColorsRGB(morphColor.colors,face.b),colorArray.push(color[0],color[1],color[2]),color=getColorsRGB(morphColor.colors,face.c),colorArray.push(color[0],color[1],color[2])}var attribute=new THREE.Float32BufferAttribute(3*(3*geometry.faces.length),3);attribute.name=morphColor.name,array.push(attribute.copyArray(colorArray))}bufferGeometry.morphAttributes.color=array}};var copyMorphColorsToIndexedBufferGeometry=(geometry,bufferGeometry)=>{if(geometry&&geometry.morphColors&&0<geometry.morphColors.length){for(var array=[],morphColors=geometry.morphColors,getColorsRGB=__webpack_require__(4).getColorsRGB,i=0,l=morphColors.length;i<l;i++){for(var color,morphColor=morphColors[i],colorArray=[],j=0;j<3*morphColor.colors.length;j++)color=getColorsRGB(morphColor.colors,j),colorArray.push(color[0],color[1],color[2]);var attribute=new THREE.Float32BufferAttribute(colorArray,3);attribute.name=morphColor.name,array.push(attribute)}bufferGeometry.morphAttributes.color=array}};exports.mergeVertices=function(geometry){var tolerance=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1e-4;tolerance=Math.max(tolerance,Number.EPSILON);// initialize the arrays
|
|
164
|
+
for(var name,hashToIndex={},indices=geometry.getIndex(),positions=geometry.getAttribute("position"),vertexCount=indices?indices.count:positions.count,nextIndex=0,attributeNames=Object.keys(geometry.attributes),attrArrays={},morphAttrsArrays={},newIndices=[],getters=["getX","getY","getZ","getW"],i=0,l=attributeNames.length;i<l;i++){name=attributeNames[i],attrArrays[name]=[];var morphAttr=geometry.morphAttributes[name];morphAttr&&(morphAttrsArrays[name]=Array(morphAttr.length).fill().map(()=>[]))}// convert the error tolerance to an amount of decimal places to truncate to
|
|
165
|
+
for(var decimalShift=Math.log10(1/tolerance),shiftMultiplier=Math.pow(10,decimalShift),i=0;i<vertexCount;i++){for(var index=indices?indices.getX(i):i,hash="",j=0,l=attributeNames.length;j<l;j++)for(var name=attributeNames[j],attribute=geometry.getAttribute(name),itemSize=attribute.itemSize,k=0;k<itemSize;k++)// double tilde truncates the decimal value
|
|
166
|
+
hash+="".concat(~~(attribute[getters[k]](index)*shiftMultiplier),",");// Add another reference to the vertex if it's already
|
|
167
|
+
// used by another index
|
|
168
|
+
if(hash in hashToIndex)newIndices.push(hashToIndex[hash]);else{// copy data to the new index in the attribute arrays
|
|
169
|
+
for(var j=0,l=attributeNames.length;j<l;j++)for(var getterFunc,name=attributeNames[j],attribute=geometry.getAttribute(name),morphAttr=geometry.morphAttributes[name],itemSize=attribute.itemSize,newarray=attrArrays[name],newMorphArrays=morphAttrsArrays[name],k=0;k<itemSize;k++)if(getterFunc=getters[k],newarray.push(attribute[getterFunc](index)),morphAttr)for(var m=0,ml=morphAttr.length;m<ml;m++)newMorphArrays[m].push(morphAttr[m][getterFunc](index));hashToIndex[hash]=nextIndex,newIndices.push(nextIndex),nextIndex++}}// Generate typed arrays from new attribute arrays and update
|
|
170
|
+
// the attributeBuffers
|
|
171
|
+
for(var result=geometry.clone(),i=0,l=attributeNames.length;i<l;i++){var attribute,name=attributeNames[i],oldAttribute=geometry.getAttribute(name),buffer=new oldAttribute.array.constructor(attrArrays[name]);// Update the attribute arrays
|
|
172
|
+
if(oldAttribute.isInterleavedBufferAttribute?attribute=new THREE.BufferAttribute(buffer,oldAttribute.itemSize,oldAttribute.itemSize):(attribute=geometry.getAttribute(name).clone(),attribute.setArray(buffer)),result.setAttribute(name,attribute),name in morphAttrsArrays)for(var morphAttribute,j=0;j<morphAttrsArrays[name].length;j++)morphAttribute=geometry.morphAttributes[name][j].clone(),morphAttribute.setArray(new morphAttribute.array.constructor(morphAttrsArrays[name][j])),result.morphAttributes[name][j]=morphAttribute}// Generate an index buffer typed array
|
|
173
|
+
var cons=Uint8Array;newIndices.length>=Math.pow(2,8)&&(cons=Uint16Array),newIndices.length>=Math.pow(2,16)&&(cons=Uint32Array);var newIndexBuffer=new cons(newIndices),newIndices=null;return null===indices?newIndices=new THREE.BufferAttribute(newIndexBuffer,1):(newIndices=geometry.getIndex().clone(),newIndices.setArray(newIndexBuffer)),result.setIndex(newIndices),result};function PhongToToon(materialIn){if(materialIn.isMeshPhongMaterial){var material=new THREE.MeshToonMaterial({color:materialIn.color.clone(),morphTargets:materialIn.morphTargets,morphNormals:materialIn.morphNormals,vertexColors:materialIn.vertexColors,transparent:materialIn.transparent,opacity:materialIn.opacity,side:materialIn.side});return materialIn.map&&(material.map=materialIn.map),material}return materialIn}exports.getBoundingBox=getBoundingBox,exports.resolveURL=resolveURL,exports.loadExternalFile=loadExternalFile,exports.loadExternalFiles=loadExternalFiles,exports.PhongToToon=PhongToToon;
|
|
257
174
|
|
|
258
175
|
/***/ }),
|
|
259
176
|
/* 5 */
|
|
@@ -352,30 +269,194 @@ hasSkinIndices&&this.skinIndices.push(skinIndices[face.a],skinIndices[face.b],sk
|
|
|
352
269
|
|
|
353
270
|
/***/ }),
|
|
354
271
|
/* 6 */
|
|
355
|
-
/***/ (function(module, exports
|
|
272
|
+
/***/ (function(module, exports) {
|
|
356
273
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
request.open("GET",resolveURL(url),!0),request.onreadystatechange=()=>{4==request.readyState&&(200==request.status?callback(request.responseText,data):errorCallback(url))},request.send(null)}function loadExternalFiles(urls,callback,errorCallback){// Callback for a single file
|
|
361
|
-
function partialCallback(text,urlIndex){result[urlIndex]=text,numComplete++,numComplete==numUrls&&callback(result)}for(var numUrls=urls.length,numComplete=0,result=[],i=0;i<numUrls;i++)loadExternalFile(urls[i],i,partialCallback,errorCallback)}//Get the colours at index
|
|
362
|
-
exports.getColorsRGB=(colors,index)=>{var index_in_colors=Math.floor(index/3),remainder=index%3,hex_value=0;0==remainder?hex_value=colors[index_in_colors].r:1==remainder?hex_value=colors[index_in_colors].g:2==remainder&&(hex_value=colors[index_in_colors].b);var mycolor=new THREE.Color(hex_value);return[mycolor.r,mycolor.g,mycolor.b]},exports.copyMorphColorsToBufferGeometry=(geometry,bufferGeometry)=>{if(geometry&&geometry.morphColors&&0<geometry.morphColors.length){for(var array=[],morphColors=geometry.morphColors,getColorsRGB=__webpack_require__(6).getColorsRGB,i=0,l=morphColors.length;i<l;i++){for(var morphColor=morphColors[i],colorArray=[],j=0;j<geometry.faces.length;j++){var face=geometry.faces[j],color=getColorsRGB(morphColor.colors,face.a);colorArray.push(color[0],color[1],color[2]),color=getColorsRGB(morphColor.colors,face.b),colorArray.push(color[0],color[1],color[2]),color=getColorsRGB(morphColor.colors,face.c),colorArray.push(color[0],color[1],color[2])}var attribute=new THREE.Float32BufferAttribute(3*(3*geometry.faces.length),3);attribute.name=morphColor.name,array.push(attribute.copyArray(colorArray))}bufferGeometry.morphAttributes.color=array}},exports.copyMorphColorsToIndexedBufferGeometry=(geometry,bufferGeometry)=>{if(geometry&&geometry.morphColors&&0<geometry.morphColors.length){for(var array=[],morphColors=geometry.morphColors,getColorsRGB=__webpack_require__(6).getColorsRGB,i=0,l=morphColors.length;i<l;i++){for(var color,morphColor=morphColors[i],colorArray=[],j=0;j<3*morphColor.colors.length;j++)color=getColorsRGB(morphColor.colors,j),colorArray.push(color[0],color[1],color[2]);var attribute=new THREE.Float32BufferAttribute(colorArray,3);attribute.name=morphColor.name,array.push(attribute)}bufferGeometry.morphAttributes.color=array}},exports.mergeVertices=function(geometry){var tolerance=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1e-4;tolerance=Math.max(tolerance,Number.EPSILON);// initialize the arrays
|
|
363
|
-
for(var name,hashToIndex={},indices=geometry.getIndex(),positions=geometry.getAttribute("position"),vertexCount=indices?indices.count:positions.count,nextIndex=0,attributeNames=Object.keys(geometry.attributes),attrArrays={},morphAttrsArrays={},newIndices=[],getters=["getX","getY","getZ","getW"],i=0,l=attributeNames.length;i<l;i++){name=attributeNames[i],attrArrays[name]=[];var morphAttr=geometry.morphAttributes[name];morphAttr&&(morphAttrsArrays[name]=Array(morphAttr.length).fill().map(()=>[]))}// convert the error tolerance to an amount of decimal places to truncate to
|
|
364
|
-
for(var decimalShift=Math.log10(1/tolerance),shiftMultiplier=Math.pow(10,decimalShift),i=0;i<vertexCount;i++){for(var index=indices?indices.getX(i):i,hash="",j=0,l=attributeNames.length;j<l;j++)for(var name=attributeNames[j],attribute=geometry.getAttribute(name),itemSize=attribute.itemSize,k=0;k<itemSize;k++)// double tilde truncates the decimal value
|
|
365
|
-
hash+="".concat(~~(attribute[getters[k]](index)*shiftMultiplier),",");// Add another reference to the vertex if it's already
|
|
366
|
-
// used by another index
|
|
367
|
-
if(hash in hashToIndex)newIndices.push(hashToIndex[hash]);else{// copy data to the new index in the attribute arrays
|
|
368
|
-
for(var j=0,l=attributeNames.length;j<l;j++)for(var getterFunc,name=attributeNames[j],attribute=geometry.getAttribute(name),morphAttr=geometry.morphAttributes[name],itemSize=attribute.itemSize,newarray=attrArrays[name],newMorphArrays=morphAttrsArrays[name],k=0;k<itemSize;k++)if(getterFunc=getters[k],newarray.push(attribute[getterFunc](index)),morphAttr)for(var m=0,ml=morphAttr.length;m<ml;m++)newMorphArrays[m].push(morphAttr[m][getterFunc](index));hashToIndex[hash]=nextIndex,newIndices.push(nextIndex),nextIndex++}}// Generate typed arrays from new attribute arrays and update
|
|
369
|
-
// the attributeBuffers
|
|
370
|
-
for(var result=geometry.clone(),i=0,l=attributeNames.length;i<l;i++){var attribute,name=attributeNames[i],oldAttribute=geometry.getAttribute(name),buffer=new oldAttribute.array.constructor(attrArrays[name]);// Update the attribute arrays
|
|
371
|
-
if(oldAttribute.isInterleavedBufferAttribute?attribute=new THREE.BufferAttribute(buffer,oldAttribute.itemSize,oldAttribute.itemSize):(attribute=geometry.getAttribute(name).clone(),attribute.setArray(buffer)),result.setAttribute(name,attribute),name in morphAttrsArrays)for(var morphAttribute,j=0;j<morphAttrsArrays[name].length;j++)morphAttribute=geometry.morphAttributes[name][j].clone(),morphAttribute.setArray(new morphAttribute.array.constructor(morphAttrsArrays[name][j])),result.morphAttributes[name][j]=morphAttribute}// Generate an index buffer typed array
|
|
372
|
-
var cons=Uint8Array;newIndices.length>=Math.pow(2,8)&&(cons=Uint16Array),newIndices.length>=Math.pow(2,16)&&(cons=Uint32Array);var newIndexBuffer=new cons(newIndices),newIndices=null;return null===indices?newIndices=new THREE.BufferAttribute(newIndexBuffer,1):(newIndices=geometry.getIndex().clone(),newIndices.setArray(newIndexBuffer)),result.setIndex(newIndices),result};function PhongToToon(materialIn){if(materialIn.isMeshPhongMaterial){var material=new THREE.MeshToonMaterial({color:materialIn.color.clone(),morphTargets:materialIn.morphTargets,morphNormals:materialIn.morphNormals,vertexColors:materialIn.vertexColors,transparent:materialIn.transparent,opacity:materialIn.opacity,side:materialIn.side});return materialIn.map&&(material.map=materialIn.map),material}return materialIn}exports.resolveURL=resolveURL,exports.loadExternalFile=loadExternalFile,exports.loadExternalFiles=loadExternalFiles,exports.PhongToToon=PhongToToon;
|
|
274
|
+
/**
|
|
275
|
+
* Provide additional shaders to render time dependent color.
|
|
276
|
+
*/exports.augmentMorphColor=function(){return function(shader){shader.vertexShader=shader.vertexShader.replace("#include <color_pars_vertex>",["varying vec3 vColor;","attribute vec3 morphColor0;","attribute vec3 morphColor1;"].join("\n")),shader.vertexShader=shader.vertexShader.replace("#include <color_vertex>",["vColor.xyz = color.xyz;","#ifdef USE_MORPHTARGETS","vColor = morphColor0 * morphTargetInfluences[ 0 ];","vColor += morphColor1 * morphTargetInfluences[ 1 ];","#endif"].join("\n"))}};
|
|
373
277
|
|
|
374
278
|
/***/ }),
|
|
375
279
|
/* 7 */
|
|
376
280
|
/***/ (function(module, exports, __webpack_require__) {
|
|
377
281
|
|
|
378
|
-
var THREE=__webpack_require__(3),
|
|
282
|
+
var THREE=__webpack_require__(3),uniqueiId=0,getUniqueId=function(){return"pr"+uniqueiId++},ZincObject=function(){// THREE.Mesh
|
|
283
|
+
/**
|
|
284
|
+
* Groupname given to this geometry.
|
|
285
|
+
*/ /**
|
|
286
|
+
* Total duration of the animation, this value interacts with the
|
|
287
|
+
* {@link Renderer#playRate} to produce the actual duration of the
|
|
288
|
+
* animation. Actual time in second = duration / playRate.
|
|
289
|
+
*/this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new THREE.Group,this._lod=new(__webpack_require__(8).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.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};/**
|
|
290
|
+
* Set the duration of the animation of this object.
|
|
291
|
+
*
|
|
292
|
+
* @param {Number} durationIn - Duration of the animation.
|
|
293
|
+
*/ /**
|
|
294
|
+
* Get the duration of the animation of this object.
|
|
295
|
+
*
|
|
296
|
+
* @return {Number}
|
|
297
|
+
*/ /**
|
|
298
|
+
* Set the region this object belongs to.
|
|
299
|
+
*
|
|
300
|
+
* @param {Region} region
|
|
301
|
+
*/ /**
|
|
302
|
+
* Get the region this object belongs to.
|
|
303
|
+
*
|
|
304
|
+
* @return {Region}
|
|
305
|
+
*/ /**
|
|
306
|
+
* Get the threejs object3D.
|
|
307
|
+
*
|
|
308
|
+
* @return {Object}
|
|
309
|
+
*/ /**
|
|
310
|
+
* Get the threejs object3D.
|
|
311
|
+
*
|
|
312
|
+
* @return {Object}
|
|
313
|
+
*/ /**
|
|
314
|
+
* Set the internal threejs object3D.
|
|
315
|
+
*/ /**
|
|
316
|
+
* Handle transparent mesh, create a clone for backside rendering if it is
|
|
317
|
+
* transparent.
|
|
318
|
+
*/ /**
|
|
319
|
+
* Set the mesh function for zincObject.
|
|
320
|
+
*
|
|
321
|
+
* @param {THREE.Mesh} mesh - Mesh to be set for this zinc object.
|
|
322
|
+
* @param {Boolean} localTimeEnabled - A flag to indicate either the mesh is
|
|
323
|
+
* time dependent.
|
|
324
|
+
* @param {Boolean} localMorphColour - A flag to indicate either the colour is
|
|
325
|
+
* time dependent.
|
|
326
|
+
*/ /**
|
|
327
|
+
* Set the name for this ZincObject.
|
|
328
|
+
*
|
|
329
|
+
* @param {String} groupNameIn - Name to be set.
|
|
330
|
+
*/ /**
|
|
331
|
+
* Get the local time of this geometry, it returns a value between
|
|
332
|
+
* 0 and the duration.
|
|
333
|
+
*
|
|
334
|
+
* @return {Number}
|
|
335
|
+
*/ /**
|
|
336
|
+
* Set the local time of this geometry.
|
|
337
|
+
*
|
|
338
|
+
* @param {Number} time - Can be any value between 0 to duration.
|
|
339
|
+
*/ /**
|
|
340
|
+
* Check if the geometry is time varying.
|
|
341
|
+
*
|
|
342
|
+
* @return {Boolean}
|
|
343
|
+
*/ /**
|
|
344
|
+
* Get the visibility of this Geometry.
|
|
345
|
+
*
|
|
346
|
+
*/ /**
|
|
347
|
+
* Set the visibility of this Geometry.
|
|
348
|
+
*
|
|
349
|
+
* @param {Boolean} visible - a boolean flag indicate the visibility to be set
|
|
350
|
+
*/ /**
|
|
351
|
+
* Set the opacity of this Geometry. This function will also set the isTransparent
|
|
352
|
+
* flag according to the provided alpha value.
|
|
353
|
+
*
|
|
354
|
+
* @param {Number} alpah - Alpha value to set for this geometry,
|
|
355
|
+
* can be any value between from 0 to 1.0.
|
|
356
|
+
*/ /**
|
|
357
|
+
* The rendering will be culled if it is outside of the frustrum
|
|
358
|
+
* when this flag is set to true, it should be set to false if
|
|
359
|
+
* morphing is enabled.
|
|
360
|
+
*
|
|
361
|
+
* @param {Boolean} flag - Set frustrum culling on/off based on this flag.
|
|
362
|
+
*/ /**
|
|
363
|
+
* Set rather a zinc object should be displayed using per vertex colour or
|
|
364
|
+
* not.
|
|
365
|
+
*
|
|
366
|
+
* @param {Boolean} vertexColors - Set display with vertex color on/off.
|
|
367
|
+
*/ /**
|
|
368
|
+
* Get the colour of the mesh.
|
|
369
|
+
*
|
|
370
|
+
* @return {THREE.Color}
|
|
371
|
+
*/ /**
|
|
372
|
+
* Set the colour of the mesh.
|
|
373
|
+
*
|
|
374
|
+
* @param {THREE.Color} colour - Colour to be set for this geometry.
|
|
375
|
+
*/ /**
|
|
376
|
+
* Get the colour of the mesh in hex string form.
|
|
377
|
+
*
|
|
378
|
+
* @return {String}
|
|
379
|
+
*/ /**
|
|
380
|
+
* Set the colour of the mesh using hex in string form.
|
|
381
|
+
*
|
|
382
|
+
* @param {String} hex - The colour value in hex form.
|
|
383
|
+
*/ /**
|
|
384
|
+
* Set the material of the geometry.
|
|
385
|
+
*
|
|
386
|
+
* @param {THREE.Material} material - Material to be set for this geometry.
|
|
387
|
+
*/ /**
|
|
388
|
+
* Get the index of the closest vertex to centroid.
|
|
389
|
+
*
|
|
390
|
+
* @return {Number} - integer index in the array
|
|
391
|
+
*/ /**
|
|
392
|
+
* Get the closest vertex to centroid.
|
|
393
|
+
*
|
|
394
|
+
* @return {THREE.Vector3}
|
|
395
|
+
*/ /**
|
|
396
|
+
* Get the bounding box of this geometry.
|
|
397
|
+
*
|
|
398
|
+
* @return {THREE.Box3}.
|
|
399
|
+
*/ /**
|
|
400
|
+
* Clear this geometry and free the memory.
|
|
401
|
+
*/ /**
|
|
402
|
+
* Check if marker is enabled based on the objects settings with
|
|
403
|
+
* the provided scene options.
|
|
404
|
+
*
|
|
405
|
+
* @return {Boolean}
|
|
406
|
+
*/ /**
|
|
407
|
+
* Update the marker's position and size based on current viewport.
|
|
408
|
+
*/ /**
|
|
409
|
+
* Get the windows coordinates.
|
|
410
|
+
*
|
|
411
|
+
* @return {Object} - position and rather the closest vertex is on screen.
|
|
412
|
+
*/ /**
|
|
413
|
+
* Set marker mode for this zinc object which determine rather the
|
|
414
|
+
* markers should be displayed or not.
|
|
415
|
+
*
|
|
416
|
+
* @param {string} mode - There are three options:
|
|
417
|
+
* "on" - marker is enabled regardless of settings of scene
|
|
418
|
+
* "off" - marker is disabled regardless of settings of scene
|
|
419
|
+
* "inherited" - Marker settings on scene will determine the visibility
|
|
420
|
+
* of the marker.
|
|
421
|
+
*
|
|
422
|
+
* @return {Boolean}
|
|
423
|
+
*/ //Update the geometry and colours depending on the morph.
|
|
424
|
+
/**
|
|
425
|
+
* Add lod from an url into the lod object.
|
|
426
|
+
*/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
|
|
427
|
+
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(!0),this.timeEnabled?this.setFrustumCulled(!1):this.morphColour&&(geometry.setAttribute("morphTarget0",geometry.getAttribute("position")),geometry.setAttribute("morphTarget1",geometry.getAttribute("position"))),this.boundingBoxUpdateRequired=!0},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)}if(timeChanged){this.boundingBoxUpdateRequired=!0;this._lod.getCurrentMorph();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){this.visible=visible,this.group.visible=visible},ZincObject.prototype.setAlpha=function(alpha){var material=this._lod._material,isTransparent=!1;1>alpha&&(isTransparent=!0);var transparentChanged=material.transparent!=isTransparent;material.opacity=alpha,material.transparent=isTransparent,this.checkTransparentMesh(transparentChanged)},ZincObject.prototype.setFrustumCulled=function(flag){//multilayers - set for all layers
|
|
428
|
+
this._lod.setFrustumCulled(flag)},ZincObject.prototype.setVertexColors=function(vertexColors){//multilayers - set for all
|
|
429
|
+
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.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.setMaterial=function(material){this._lod.setMaterial(material)},ZincObject.prototype.getClosestVertexIndex=function(){var closestIndex=-1,morph=this.getMorph();if(morph){var position=morph.geometry.attributes.position;if(this._b1.setFromBufferAttribute(position),this._b1.getCenter(this._v1),position)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;if(-1==this.closestVertexIndex&&(this.closestVertexIndex=this.getClosestVertexIndex()),0<=this.closestVertexIndex){var influences=this.morph.morphTargetInfluences,attributes=this.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(this.morph.matrixWorld):position}else return position.fromArray(this.morph.geometry.attributes.position.array,3*this.closestVertexIndex),applyMatrixWorld?position.applyMatrix4(this.morph.matrixWorld):position}return this.getBoundingBox(),position.copy(this.center),applyMatrixWorld?position.applyMatrix4(this.morph.matrixWorld):position},ZincObject.prototype.getBoundingBox=function(){var morph=this._lod.getCurrentMorph();return morph&&morph.visible?(this.boundingBoxUpdateRequired&&(__webpack_require__(4).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):void 0},ZincObject.prototype.dispose=function(){//multilayyers
|
|
430
|
+
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.markerIsEnabled=function(options){return!!("on"===this.markerMode||options&&options.displayMarkers&&"inherited"===this.markerMode)},ZincObject.prototype.updateMarker=function(playAnimation,options){if(!(!1==playAnimation&&this.markerIsEnabled(options)))this.marker&&this.marker.isEnabled()&&(this.marker.disable(),this.group.remove(this.marker.morph)),this.markerUpdateRequired=!0;else if(this.groupName){if(this.marker||(this.marker=new(__webpack_require__(9).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)}options&&options.camera&&options.markerDepths&&options.markerDepths.push(this.marker.updateNDC(options.camera.cameraObject)),this.marker.isEnabled()||(this.marker.enable(),this.group.add(this.marker.morph))}},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
|
|
431
|
+
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){mode!==this.markerMode&&(this.markerMode="on"===mode||"off"===mode?mode:"inherited",this.region&&(this.region.pickableUpdateRequired=!0))},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
|
|
432
|
+
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,preload){this._lod.addLevelFromURL(loader,level,url,preload)},exports.ZincObject=ZincObject;
|
|
433
|
+
|
|
434
|
+
/***/ }),
|
|
435
|
+
/* 8 */
|
|
436
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
437
|
+
|
|
438
|
+
var THREE=__webpack_require__(3),updateMorphColorAttribute=__webpack_require__(4).updateMorphColorAttribute,toBufferGeometry=__webpack_require__(4).toBufferGeometry,LOD=function(parent){//The owning Zinc Object
|
|
439
|
+
/*
|
|
440
|
+
* Add a level of LOD at the specified distance
|
|
441
|
+
*/ /*
|
|
442
|
+
* This is called once an ondemand level is loaded
|
|
443
|
+
*/ //load the mesh at index, return true if morph is not ready
|
|
444
|
+
/**
|
|
445
|
+
* Check if there are multiple levels.
|
|
446
|
+
*/ /**
|
|
447
|
+
* Check if material is transparent, create secondary mesh
|
|
448
|
+
* for better rendering if required.
|
|
449
|
+
*/ /**
|
|
450
|
+
* Loader for lod object
|
|
451
|
+
*/ /* Update layers based on the */this.levels=[],this._currentLevel=0,this._renderOrder=1,this._material=void 0,this._secondaryMaterial=void 0,this._loader=void 0,this._parent=parent,this.addLevel=(object,distanceIn)=>{if(object){var _l,distance=Math.abs(distanceIn);for(_l=0;_l<this.levels.length&&!(distance<this.levels[_l].distance);_l++);this.levels.splice(_l,0,{distance:distance,morph:object,loaded:!0,loading:!1,url:""}),object.renderOrder=this._renderOrder}},this.levelLoaded=(object,distanceIn)=>{if(object){var _l2,distance=Math.abs(distanceIn);for(_l2=0;_l2<this.levels.length;_l2++)if(distance===this.levels[_l2].distance){this._parent.group.add(object),this.levels[_l2].morph=object,this.levels[_l2].loaded=!0,this.levels[_l2].loading=!1;break}}},this.addLevelFromURL=(loader,level,url,preload)=>{this._loader=loader;var distance=this.calculateDistance(level);for(l=0;l<this.levels.length&&!(distance<this.levels[l].distance);l++);this.levels.splice(l,0,{distance:distance,morph:void 0,loaded:!1,loading:!1,url:url}),preload&&this.loadLevel(l)},this.loadLevel=index=>{var level=this.levels[index];return level.morph||level.loaded||level.loading||(level.loading=!0,this._loader.load(level.url,this.lodLoader(level.distance),void 0,void 0)),void 0===level.morph},this.calculateDistance=function(level){this._parent.getBoundingBox();var radius=this._parent.radius,distance=0;return"far"===level?distance=4.5*radius:"medium"===level?distance=2.5*radius:"close"==level&&(distance=0),distance},this.containsLevels=()=>!!(this.levels&&1<this.levels.length),this.checkTransparentMesh=(animationGroup,transparentChanged)=>{var level=this.levels[this._currentLevel];this._material&&(this._material.transparent?(!this._secondaryMaterial&&(this._secondaryMaterial=this._material.clone(),this._secondaryMaterial.side=THREE.FrontSide),this._secondaryMaterial.opacity=this._material.opacity,!level.secondaryMesh&&(level.secondaryMesh=new THREE.Mesh(level.morph.geometry,this._secondaryMaterial),level.secondaryMesh.renderOrder=level.morph.renderOrder+1,level.secondaryMesh.userData=level.morph.userData,level.secondaryMesh.name=level.morph.name),transparentChanged&&(this._material.side=THREE.BackSide,this._material.needsUpdate=!0,level.morph.add(level.secondaryMesh),animationGroup.add(level.secondaryMesh))):(level.secondaryMesh&&(level.morph.remove(level.secondaryMesh),animationGroup.uncache(level.secondaryMesh),animationGroup.remove(level.secondaryMesh)),this._material.side=THREE.DoubleSide))},this.dispose=()=>{this.levels.forEach(level=>{level.morph&&level.morph.geometry&&level.morph.geometry.dispose()}),this._material&&this._material.dispose(),this._secondaryMaterial&&this._secondaryMaterial.dispose()},this.getCurrentLevel=()=>this._currentLevel,this.getCurrentMorph=()=>{var level=this.levels[this._currentLevel];return level&&level.morph?level.morph:this._parent.morph},this.lodLoader=function(distance){return geometryIn=>{var material=this._material,options={localTimeEnabled:this._parent.timeEnabled,localMorphColour:this._parent.morphColour},geometry=toBufferGeometry(geometryIn,options),mesh=new THREE.Mesh(geometry,material);geometryIn.dispose(),this.levelLoaded(mesh,distance)}},this.updateMorphColorAttribute=currentOnly=>{//Multilayers - set all
|
|
452
|
+
if(this._material&&(this._material.vertexColors==THREE.VertexColors||!0==this._material.vertexColors))if(currentOnly){var morph=this.getCurrentMorph();updateMorphColorAttribute(morph.geometry,morph)}else this.levels.forEach(level=>{level.morph&&level.morph.geometry&&updateMorphColorAttribute(level.morph.geometry,level.morph)})},this.setColour=colour=>{this._material.color=colour,this._secondaryMaterial&&(this._secondaryMaterial.color=colour),updateGeometryColour()},this.setFrustumCulled=flag=>{this.levels.forEach(level=>{level.morph&&(level.morph.frustumCulled=flag),level.secondaryMesh&&(level.secondaryMesh.frustumCulled=flag)})},this.setMaterial=material=>{material&&(!this._material||this._material.id!==material.id)&&(this._material=material,this._secondaryMaterial&&(this._secondaryMaterial.dispose(),this._secondaryMaterial=material.clone(),this._secondaryMaterial.side=THREE.FrontSide),this.levels.forEach(level=>{level.morph&&(level.morph.material=this._material,level.morph.geometry&&(level.morph.geometry.colorsNeedUpdate=!0)),level.secondaryMesh&&(level.secondaryMesh.material=this._secondaryMaterial)}))},this.setName=name=>{this.levels.forEach(level=>{level.morph&&(level.morph.name=name),level.secondaryMesh&&(level.secondaryMesh.name=name)})},this.setRenderOrder=order=>{this._renderOrder=order,this.levels.forEach(level=>{level.morph&&(level.morph.renderOrder=order),level.secondaryMesh&&(level.secondaryMesh.renderOrder=order)})},this.setVertexColors=vertexColors=>{this._material.vertexColors=vertexColors,updateGeometryColour(),this._secondaryMaterial&&(this._secondaryMaterial.vertexColors=vertexColors)},this.update=(camera,center)=>{var levels=this.levels;if(1<levels.length){var i,_l3,distance=camera.cameraObject.position.distanceTo(center),visibleIndex=-1,optimalIndex=-1;//Found a visible index that is within range of the LOD
|
|
453
|
+
for(i=0,_l3=levels.length;i<_l3&&distance>=levels[i].distance;i++)levels[i].morph?(-1<visibleIndex&&levels[visibleIndex].morph&&(levels[visibleIndex].morph.visible=!1),visibleIndex=i,levels[i].morph.visible=!0,optimalIndex=-1):optimalIndex=i;for(-1<optimalIndex&&this.loadLevel(optimalIndex);i<_l3;i++)levels[i].morph&&(-1<visibleIndex?levels[i].morph.visible=!1:(levels[i].morph.visible=!0,visibleIndex=i));this._currentLevel=visibleIndex}},this.toggleMarker=(marker,flag)=>{this.levels.forEach(level=>{level.morph&&(flag?level.morph.add(marker):level.morph.remove(marker))})},updateGeometryColour=()=>{this.levels.forEach(level=>{level.morph&&level.morph.geometry&&(level.morph.geometry.colorsNeedUpdate=!0)})}};exports.LOD=LOD;
|
|
454
|
+
|
|
455
|
+
/***/ }),
|
|
456
|
+
/* 9 */
|
|
457
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
458
|
+
|
|
459
|
+
var THREE=__webpack_require__(3),markerImage=new Image(128,128);markerImage.src=__webpack_require__(10);var texture=new THREE.Texture;texture.image=markerImage,texture.needsUpdate=!0;var size=[.015,.02,1],Marker=function(zincObject){__webpack_require__(7).ZincObject.call(this),this.texture=texture;var spriteMaterial=void 0,sprite=void 0;this.morph=new THREE.Group,this.group=this.morph,this.parent=zincObject,this.isMarker=!0;var enabled=!1,vector=new THREE.Vector3,initialise=()=>{spriteMaterial=new THREE.SpriteMaterial({map:texture,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),sprite=new THREE.Sprite(spriteMaterial),sprite.center.set(.5,0),this.morph.add(sprite),this.morph.position.set(0,0,0),this.morph.renderOrder=1e4,sprite.scale.set(size[0],size[1],size[2]),sprite.userData=this};/**
|
|
379
460
|
* Set the position of the marker.
|
|
380
461
|
*
|
|
381
462
|
* @param {Number} x - x coordinate to be set.
|
|
@@ -400,27 +481,19 @@ this.updateVisual=(min,max)=>{var scale=1,opacity=1,porportion=0;min!==max&&(por
|
|
|
400
481
|
* @class
|
|
401
482
|
* @author Alan Wu
|
|
402
483
|
* @return {Marker}
|
|
403
|
-
*/Marker.prototype=Object.create(__webpack_require__(
|
|
484
|
+
*/Marker.prototype=Object.create(__webpack_require__(7).ZincObject.prototype),exports.Marker=Marker;
|
|
404
485
|
|
|
405
486
|
/***/ }),
|
|
406
|
-
/*
|
|
487
|
+
/* 10 */
|
|
407
488
|
/***/ (function(module, exports) {
|
|
408
489
|
|
|
409
490
|
module.exports = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxOC4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzY1IDU2MCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMzY1IDU2MCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8Zz4NCgk8cGF0aCBmaWxsPSIjMDA1OTc0IiBkPSJNMTgyLjksNTUxLjdjMCwwLjEsMC4yLDAuMywwLjIsMC4zUzM1OC4zLDI4MywzNTguMywxOTQuNmMwLTEzMC4xLTg4LjgtMTg2LjctMTc1LjQtMTg2LjkNCgkJQzk2LjMsNy45LDcuNSw2NC41LDcuNSwxOTQuNmMwLDg4LjQsMTc1LjMsMzU3LjQsMTc1LjMsMzU3LjRTMTgyLjksNTUxLjcsMTgyLjksNTUxLjd6IE0xMjIuMiwxODcuMmMwLTMzLjYsMjcuMi02MC44LDYwLjgtNjAuOA0KCQljMzMuNiwwLDYwLjgsMjcuMiw2MC44LDYwLjhTMjE2LjUsMjQ4LDE4Mi45LDI0OEMxNDkuNCwyNDgsMTIyLjIsMjIwLjgsMTIyLjIsMTg3LjJ6Ii8+DQo8L2c+DQo8L3N2Zz4NCg=="
|
|
410
491
|
|
|
411
492
|
/***/ }),
|
|
412
|
-
/*
|
|
413
|
-
/***/ (function(module, exports) {
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* Provide additional shaders to render time dependent color.
|
|
417
|
-
*/exports.augmentMorphColor=function(){return function(shader){shader.vertexShader=shader.vertexShader.replace("#include <color_pars_vertex>",["varying vec3 vColor;","attribute vec3 morphColor0;","attribute vec3 morphColor1;"].join("\n")),shader.vertexShader=shader.vertexShader.replace("#include <color_vertex>",["vColor.xyz = color.xyz;","#ifdef USE_MORPHTARGETS","vColor = morphColor0 * morphTargetInfluences[ 0 ];","vColor += morphColor1 * morphTargetInfluences[ 1 ];","#endif"].join("\n"))}};
|
|
418
|
-
|
|
419
|
-
/***/ }),
|
|
420
|
-
/* 10 */
|
|
493
|
+
/* 11 */
|
|
421
494
|
/***/ (function(module, exports, __webpack_require__) {
|
|
422
495
|
|
|
423
|
-
var THREE=__webpack_require__(3),Glyph=function(geometry,materialIn,idIn,glyphsetIn){__webpack_require__(
|
|
496
|
+
var THREE=__webpack_require__(3),Glyph=function(geometry,materialIn,idIn,glyphsetIn){__webpack_require__(7).ZincObject.call(this);var material;materialIn&&(material=materialIn.clone(),material.vertexColors=THREE.FaceColors);this.id=idIn;var label=void 0,labelString=void 0,group=new THREE.Group;/**
|
|
424
497
|
* Create a glyph using mesh
|
|
425
498
|
* @param {THREE.Mesh} meshIn - Mesh to create the glyph from
|
|
426
499
|
*
|
|
@@ -461,7 +534,7 @@ var THREE=__webpack_require__(3),Glyph=function(geometry,materialIn,idIn,glyphse
|
|
|
461
534
|
* @param {THREE.Color} color - Colour to be set.
|
|
462
535
|
*/ /**
|
|
463
536
|
* Clear and free its memory.
|
|
464
|
-
*/this.isGlyph=!0,this.fromMesh=meshIn=>!!(meshIn&&meshIn.isMesh)&&(this.morph=meshIn.clone(),this.morph.userData=this,group.add(this.morph),!0),geometry&&material&&this.fromMesh(new THREE.Mesh(geometry,material)),this.getGlyphset=function(){return glyphsetIn},this.setLabel=text=>{text&&("string"==typeof text||text instanceof String)&&(labelString=text,this.morph&&(this.morph.name=text)),label&&this.showLabel()},this.showLabel=colour=>{if(label&&(position=label.getPosition(),group.remove(label.getSprite()),label.dispose(),label=void 0),labelString&&("string"==typeof labelString||labelString instanceof String)){var _position=[0,0,0];label=new(__webpack_require__(
|
|
537
|
+
*/this.isGlyph=!0,this.fromMesh=meshIn=>!!(meshIn&&meshIn.isMesh)&&(this.morph=meshIn.clone(),this.morph.userData=this,group.add(this.morph),!0),geometry&&material&&this.fromMesh(new THREE.Mesh(geometry,material)),this.getGlyphset=function(){return glyphsetIn},this.setLabel=text=>{text&&("string"==typeof text||text instanceof String)&&(labelString=text,this.morph&&(this.morph.name=text)),label&&this.showLabel()},this.showLabel=colour=>{if(label&&(position=label.getPosition(),group.remove(label.getSprite()),label.dispose(),label=void 0),labelString&&("string"==typeof labelString||labelString instanceof String)){var _position=[0,0,0];label=new(__webpack_require__(12).Label)(labelString,colour),label.setPosition(_position[0],_position[1],_position[2]),group.add(label.getSprite())}},this.getGroup=()=>group,this.getLabel=()=>labelString,this.getMesh=()=>this.morph,this.setTransformation=(position,axis1,axis2,axis3)=>{this.morph&&(this.morph.matrix.elements[0]=axis1[0],this.morph.matrix.elements[1]=axis1[1],this.morph.matrix.elements[2]=axis1[2],this.morph.matrix.elements[3]=0,this.morph.matrix.elements[4]=axis2[0],this.morph.matrix.elements[5]=axis2[1],this.morph.matrix.elements[6]=axis2[2],this.morph.matrix.elements[7]=0,this.morph.matrix.elements[8]=axis3[0],this.morph.matrix.elements[9]=axis3[1],this.morph.matrix.elements[10]=axis3[2],this.morph.matrix.elements[11]=0,this.morph.matrix.elements[12]=position[0],this.morph.matrix.elements[13]=position[1],this.morph.matrix.elements[14]=position[2],this.morph.matrix.elements[15]=1,this.morph.matrixAutoUpdate=!1),label&&label.setPosition(position[0],position[1],position[2])},this.setColour=color=>{label&&label.setColour(color),this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.color=colour),this.geometry.colorsNeedUpdate=!0},this.dispose=()=>{this.material&&this.material.dispose(),this.morph=void 0}};/**
|
|
465
538
|
* Zinc representation of glyph graphic, it contains the colours,
|
|
466
539
|
* geometry and transformation of the glyph.
|
|
467
540
|
*
|
|
@@ -472,13 +545,13 @@ var THREE=__webpack_require__(3),Glyph=function(geometry,materialIn,idIn,glyphse
|
|
|
472
545
|
* @class
|
|
473
546
|
* @author Alan Wu
|
|
474
547
|
* @return {Glyph}
|
|
475
|
-
*/Glyph.prototype=Object.create(__webpack_require__(
|
|
548
|
+
*/Glyph.prototype=Object.create(__webpack_require__(7).ZincObject.prototype),exports.Glyph=Glyph;
|
|
476
549
|
|
|
477
550
|
/***/ }),
|
|
478
|
-
/*
|
|
551
|
+
/* 12 */
|
|
479
552
|
/***/ (function(module, exports, __webpack_require__) {
|
|
480
553
|
|
|
481
|
-
var SpriteText=__webpack_require__(
|
|
554
|
+
var SpriteText=__webpack_require__(13).default;/**
|
|
482
555
|
* Bitmap labels, this is used with {@link Glyph} to
|
|
483
556
|
* provide labels.
|
|
484
557
|
*
|
|
@@ -520,19 +593,19 @@ var SpriteText=__webpack_require__(12).default;/**
|
|
|
520
593
|
*/sprite=colour?new SpriteText(text,.015,colour.getStyle()):new SpriteText(text,.015),sprite.material.sizeAttenuation=!1,sprite.center.x=-.05,sprite.center.y=0,this.getPosition=()=>sprite?[sprite.position.x,sprite.position.y,sprite.position.z]:[0,0,0],this.setPosition=(x,y,z)=>{sprite&&sprite.position.set(x,y,z)},this.setColour=colour=>{sprite.color=colour.getStyle()},this.setScale=scaling=>{sprite&&0<scaling&&sprite.scale.set(scaling,scaling,1)},this.dispose=()=>{sprite.dispose()},this.getSprite=()=>sprite,this.getString=()=>text};
|
|
521
594
|
|
|
522
595
|
/***/ }),
|
|
523
|
-
/*
|
|
596
|
+
/* 13 */
|
|
524
597
|
/***/ (function(module, exports) {
|
|
525
598
|
|
|
526
599
|
module.exports = require("three-spritetext");
|
|
527
600
|
|
|
528
601
|
/***/ }),
|
|
529
|
-
/*
|
|
602
|
+
/* 14 */
|
|
530
603
|
/***/ (function(module, exports, __webpack_require__) {
|
|
531
604
|
|
|
532
|
-
function _readOnlyError(name){throw new Error("\""+name+"\" is read-only")}var THREE=__webpack_require__(3),JSONLoader=__webpack_require__(
|
|
605
|
+
function _readOnlyError(name){throw new Error("\""+name+"\" is read-only")}var THREE=__webpack_require__(3),JSONLoader=__webpack_require__(15).JSONLoader,Glyphset=function(){__webpack_require__(7).ZincObject.call(this);var glyphList=[],axis1s=void 0,axis2s=void 0,axis3s=void 0,positions=void 0,scales=void 0,colors=void 0,labels=void 0,numberOfTimeSteps=0,numberOfVertices=0,baseSize=[0,0,0],offset=[0,0,0],scaleFactors=[0,0,0],repeat_mode="NONE";this.ready=!1;var morphColours=!1,morphVertices=!1;this.isGlyphset=!0;for(var _transformMatrix=new THREE.Matrix4,_bot_colour=new THREE.Color,_top_colour=new THREE.Color,_boundingBox1=new THREE.Box3,_boundingBox2=new THREE.Box3,_boundingBox3=new THREE.Box3,_points=[],_current_positions=[],_current_axis1s=[],_current_axis2s=[],_current_axis3s=[],_current_scales=[],_current_colors=[],_glyph_axis_array=[],i=0;8>i;i++)_points[i]=new THREE.Vector3;/**
|
|
533
606
|
* Get the {@link Three.Group} containing all of the glyphs' meshes.
|
|
534
607
|
* @returns {Three.Group}
|
|
535
|
-
*/this.getGroup=()=>this.morph,this.load=(glyphsetData,glyphURL,finishCallback,isInline,displayLabels)=>{axis1s=glyphsetData.axis1,axis2s=glyphsetData.axis2,axis3s=glyphsetData.axis3,positions=glyphsetData.positions,scales=glyphsetData.scale,colors=glyphsetData.colors,labels=glyphsetData.label,morphColours=glyphsetData.metadata.MorphColours,morphVertices=glyphsetData.metadata.MorphVertices,numberOfTimeSteps=glyphsetData.metadata.number_of_time_steps,repeat_mode=glyphsetData.metadata.repeat_mode,numberOfVertices=glyphsetData.metadata.number_of_vertices,"AXES_2D"==repeat_mode||"MIRROR"==repeat_mode?numberOfVertices*=2:"AXES_3D"==repeat_mode&&(numberOfVertices*=3),baseSize=glyphsetData.metadata.base_size,offset=glyphsetData.metadata.offset,scaleFactors=glyphsetData.metadata.scale_factors;var loader=new JSONLoader;
|
|
608
|
+
*/this.getGroup=()=>this.morph,this.load=(glyphsetData,glyphURL,finishCallback,isInline,displayLabels)=>{axis1s=glyphsetData.axis1,axis2s=glyphsetData.axis2,axis3s=glyphsetData.axis3,positions=glyphsetData.positions,scales=glyphsetData.scale,colors=glyphsetData.colors,labels=glyphsetData.label,morphColours=glyphsetData.metadata.MorphColours,morphVertices=glyphsetData.metadata.MorphVertices,numberOfTimeSteps=glyphsetData.metadata.number_of_time_steps,repeat_mode=glyphsetData.metadata.repeat_mode,numberOfVertices=glyphsetData.metadata.number_of_vertices,"AXES_2D"==repeat_mode||"MIRROR"==repeat_mode?numberOfVertices*=2:"AXES_3D"==repeat_mode&&(numberOfVertices*=3),baseSize=glyphsetData.metadata.base_size,offset=glyphsetData.metadata.offset,scaleFactors=glyphsetData.metadata.scale_factors;var loader=new JSONLoader;this.geometry=new THREE.BufferGeometry;var instancedMesh=new THREE.InstancedMesh(this.geometry,void 0,numberOfVertices);if(this.setMorph(instancedMesh),isInline){var object=loader.parse(glyphURL);meshloader(finishCallback,displayLabels)(object.geometry,object.materials),object.geometry.dispose()}else loader.crossOrigin="Anonymous",loader.load(glyphURL,meshloader(finishCallback,displayLabels))};/**
|
|
536
609
|
* Calculate the actual transformation value that can be applied
|
|
537
610
|
* to the transformation matrix.
|
|
538
611
|
*
|
|
@@ -547,12 +620,12 @@ function _readOnlyError(name){throw new Error("\""+name+"\" is read-only")}var T
|
|
|
547
620
|
* Create the glyphs in the glyphset.
|
|
548
621
|
*
|
|
549
622
|
* @param {Boolean} displayLabels -Flag to determine either the labels should be display or not.
|
|
550
|
-
*/var createGlyphs=displayLabels=>{if(labels!=null&&displayLabels)for(var glyph,_i6=0;_i6<numberOfVertices;_i6++)glyph=new(__webpack_require__(
|
|
623
|
+
*/var createGlyphs=displayLabels=>{if(labels!=null&&displayLabels)for(var glyph,_i6=0;_i6<numberOfVertices;_i6++)glyph=new(__webpack_require__(11).Glyph)(void 0,void 0,_i6,this),null!=labels&&null!=labels[_i6]&&glyph.setLabel(labels[_i6]),0<numberOfTimeSteps&&glyph.setFrustumCulled(!1),glyphList[_i6]=glyph,this.morph.add(glyph.getGroup());//Update the transformation of the glyphs.
|
|
551
624
|
labels!=null&&displayLabels&&this.showLabel(this.morph.material?this.morph.material.color:void 0),updateGlyphsetTransformation(positions[0],axis1s[0],axis2s[0],axis3s[0],scales[0]),colors!=null&&updateGlyphsetHexColors(colors[0]),this.ready=!0,this.boundingBoxUpdateRequired=!0};/**
|
|
552
625
|
* Add a custom {@link Glyph} to this {@link Glyphset}.
|
|
553
626
|
*
|
|
554
627
|
* @param {Glyph} Glyph to be added.
|
|
555
|
-
*/this.addCustomGlyph=glyph=>{glyph.isGlyph&&glyphList.push(glyph),this.ready=!0,this.boundingBoxUpdateRequired=!0},this.addMeshAsGlyph=(mesh,id)=>{if(mesh.isMesh){var glyph=new(__webpack_require__(
|
|
628
|
+
*/this.addCustomGlyph=glyph=>{glyph.isGlyph&&glyphList.push(glyph),this.ready=!0,this.boundingBoxUpdateRequired=!0},this.addMeshAsGlyph=(mesh,id)=>{if(mesh.isMesh){var glyph=new(__webpack_require__(11).Glyph)(void 0,void 0,id,this);return glyph.fromMesh(mesh),glyphList.push(glyph),this.morph.add(glyph.getGroup()),this.ready=!0,this.boundingBoxUpdateRequired=!0,glyph}},this.forEachGlyph=callbackFunction=>{for(var _i7=0;_i7<glyphList.length;_i7++)callbackFunction(glyphList[_i7])};var meshloader=(finishCallback,displayLabels)=>(geometry,materials)=>{var tempGeometry=geometry.toBufferGeometry();this.geometry.copy(tempGeometry),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox(),tempGeometry.dispose(),materials&&materials[0]&&(this.morph.material=materials[0]),createGlyphs(displayLabels),this.morph.name=this.groupName,this.morph.userData=this,this.setMorph(this.morph),geometry.dispose(),null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(this)};/**
|
|
556
629
|
* Get the index of the closest vertex to centroid.
|
|
557
630
|
*/ /**
|
|
558
631
|
* Get the closest vertex to centroid.
|
|
@@ -576,20 +649,20 @@ labels!=null&&displayLabels&&this.showLabel(this.morph.material?this.morph.mater
|
|
|
576
649
|
* Clear this glyphset and its list of glyphs which will release them from the memory.
|
|
577
650
|
*/ /**
|
|
578
651
|
* Update the glyphsets if required the render.
|
|
579
|
-
*/this.getClosestVertexIndex=function(){var closestIndex=-1;if(this.morph&&this.ready){
|
|
652
|
+
*/this.getClosestVertexIndex=function(){var closestIndex=-1;if(this.morph&&this.ready){this.getBoundingBox().getCenter(this._v1);for(var current_index,current_positions=positions[0],numberOfPositions=current_positions.length/3,distance=-1,currentDistance=0,_i8=0;_i8<numberOfPositions;_i8++)current_index=3*_i8,this._v2.set(current_positions[current_index],current_positions[current_index+1],current_positions[current_index+2]),currentDistance=this._v1.distanceTo(this._v2),-1==distance?(distance=currentDistance,closestIndex=_i8):distance>currentDistance&&(distance=currentDistance,closestIndex=_i8)}return closestIndex},this.getClosestVertex=function(){if(-1==this.closestVertexIndex&&(this.closestVertexIndex=this.getClosestVertexIndex()),0<=this.closestVertexIndex&&this.morph)/*
|
|
580
653
|
if (glyphList && glyphList[this.closestVertexIndex]) {
|
|
581
654
|
glyphList[this.closestVertexIndex].getBoundingBox().getCenter(position);
|
|
582
655
|
}
|
|
583
|
-
*/{var position=new THREE.Vector3;return this.morph.getMatrixAt(this.closestVertexIndex,_transformMatrix),position.setFromMatrixPosition(_transformMatrix),position}},this.getBoundingBox=()=>{if(this.morph&&this.ready&&this.morph.visible){if(this.boundingBoxUpdateRequired){_boundingBox1.setFromBufferAttribute(this.morph.geometry.attributes.position);for(var _i9=0;_i9<numberOfVertices;_i9++)this.morph.getMatrixAt(_i9,_transformMatrix),_boundingBox2.copy(_boundingBox1).applyMatrix4(_transformMatrix),0==_i9?_boundingBox3.copy(_boundingBox2):_boundingBox3.union(_boundingBox2);if(_boundingBox3)this.cachedBoundingBox.copy(_boundingBox3),this.morph.updateWorldMatrix(),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1;else return}return this.cachedBoundingBox}},this.setMorphTime=time=>{this.inbuildTime=time>this.duration?this.duration:0>time?0:time,(morphColours||morphVertices)&&(updateMorphGlyphsets(),morphVertices&&(this.markerUpdateRequired=!0))},this.isTimeVarying=()=>!!(0<numberOfTimeSteps&&(morphColours||morphVertices)),this.getCurrentTime=()=>this.inbuildTime,this.dispose=()=>{for(var _i10=glyphList.length-1;0<=_i10;_i10--)glyphList[_i10].dispose();this.geometry&&this.geometry.dispose(),this.morph&&this.morph.material.dispose(),axis1s=void 0,axis2s=void 0,axis3s=void 0,positions=void 0,scales=void 0,colors=void 0,this.ready=!1,this.groupName=void 0},this.render=(delta,playAnimation,options)=>{if(!0==playAnimation){var targetTime=this.inbuildTime+delta;targetTime>this.duration&&(targetTime-=this.duration),this.inbuildTime=targetTime,(morphColours||morphVertices)&&updateMorphGlyphsets()}this.updateMarker(playAnimation,options)}};Glyphset.prototype=Object.create(__webpack_require__(
|
|
656
|
+
*/{var position=new THREE.Vector3;return this.morph.getMatrixAt(this.closestVertexIndex,_transformMatrix),position.setFromMatrixPosition(_transformMatrix),position}},this.getBoundingBox=()=>{if(this.morph&&this.ready&&this.morph.visible){if(this.boundingBoxUpdateRequired){_boundingBox1.setFromBufferAttribute(this.morph.geometry.attributes.position);for(var _i9=0;_i9<numberOfVertices;_i9++)this.morph.getMatrixAt(_i9,_transformMatrix),_boundingBox2.copy(_boundingBox1).applyMatrix4(_transformMatrix),0==_i9?_boundingBox3.copy(_boundingBox2):_boundingBox3.union(_boundingBox2);if(_boundingBox3)this.cachedBoundingBox.copy(_boundingBox3),this.morph.updateWorldMatrix(),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1;else return}return this.cachedBoundingBox}},this.setMorphTime=time=>{this.inbuildTime=time>this.duration?this.duration:0>time?0:time,(morphColours||morphVertices)&&(updateMorphGlyphsets(),morphVertices&&(this.markerUpdateRequired=!0))},this.isTimeVarying=()=>!!(0<numberOfTimeSteps&&(morphColours||morphVertices)),this.getCurrentTime=()=>this.inbuildTime,this.dispose=()=>{for(var _i10=glyphList.length-1;0<=_i10;_i10--)glyphList[_i10].dispose();this.geometry&&this.geometry.dispose(),this.morph&&this.morph.material.dispose(),axis1s=void 0,axis2s=void 0,axis3s=void 0,positions=void 0,scales=void 0,colors=void 0,this.ready=!1,this.groupName=void 0},this.render=(delta,playAnimation,options)=>{if(!0==playAnimation){var targetTime=this.inbuildTime+delta;targetTime>this.duration&&(targetTime-=this.duration),this.inbuildTime=targetTime,(morphColours||morphVertices)&&updateMorphGlyphsets()}this.updateMarker(playAnimation,options)}};Glyphset.prototype=Object.create(__webpack_require__(7).ZincObject.prototype),exports.Glyphset=Glyphset;
|
|
584
657
|
|
|
585
658
|
/***/ }),
|
|
586
|
-
/*
|
|
659
|
+
/* 15 */
|
|
587
660
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
588
661
|
|
|
589
662
|
"use strict";
|
|
590
663
|
__webpack_require__.r(__webpack_exports__);
|
|
591
664
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JSONLoader", function() { return JSONLoader; });
|
|
592
|
-
var THREE=__webpack_require__(3),Loader=__webpack_require__(
|
|
665
|
+
var THREE=__webpack_require__(3),Loader=__webpack_require__(16).Loader,LoaderUtils=THREE.LoaderUtils,AnimationClip=THREE.AnimationClip,Vector3=THREE.Vector3,Vector4=THREE.Vector4,Color=THREE.Color,Vector2=THREE.Vector2,Face3=__webpack_require__(5).Face3,Geometry=__webpack_require__(5).Geometry,FileLoader=THREE.FileLoader,DefaultLoadingManager=THREE.DefaultLoadingManager,VideoHandler=__webpack_require__(17).VideoHandler;/**
|
|
593
666
|
* @author mrdoob / http://mrdoob.com/
|
|
594
667
|
* @author alteredq / http://alteredqualia.com/
|
|
595
668
|
*/function JSONLoader(manager){"boolean"==typeof manager&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),manager=void 0),this.manager=manager===void 0?DefaultLoadingManager:manager,this.withCredentials=!1,this.paramsString=""}Object.assign(JSONLoader.prototype,{load:function load(url,onLoad,onProgress,onError){var scope=this,texturePath=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:LoaderUtils.extractUrlBase(url),loader=new FileLoader(this.manager),params=url.split("?");this.paramsString=2===url.length?paramsStrings[1]:"",loader.setWithCredentials(this.withCredentials),loader.load(url,function(text){var json=JSON.parse(text),metadata=json.metadata;if(metadata!==void 0){var type=metadata.type;if(type!==void 0&&"object"===type.toLowerCase())return void console.error("THREE.JSONLoader: "+url+" should be loaded with THREE.ObjectLoader instead.")}if(scope&&scope.parse){var object=scope.parse(json,texturePath);onLoad(object.geometry,object.materials)}},onProgress,onError)},setTexturePath:function setTexturePath(value){this.texturePath=value},parse:function(){function parseModel(json,geometry){function isBitSet(value,position){return value&1<<position}var i,j,fi,offset,zLength,colorIndex,normalIndex,uvIndex,materialIndex,type,isQuad,hasMaterial,hasFaceVertexUv,hasFaceNormal,hasFaceVertexNormal,hasFaceColor,hasFaceVertexColor,vertex,face,faceA,faceB,hex,normal,uvLayer,uv,u,v,faces=json.faces,vertices=json.vertices,normals=json.normals,colors=json.colors,scale=json.scale,nUvLayers=0;if(void 0!==json.uvs){// disregard empty arrays
|
|
@@ -600,7 +673,7 @@ if(geometry.morphTargets){// TODO: Figure out what an appropraite FPS is for mor
|
|
|
600
673
|
var morphAnimationClips=AnimationClip.CreateClipsFromMorphTargetSequences(geometry.morphTargets,10);outputAnimations=outputAnimations.concat(morphAnimationClips)}0<outputAnimations.length&&(geometry.animations=outputAnimations)}return function(json,texturePath){void 0!==json.data&&(json=json.data),json.scale=void 0===json.scale?1:1/json.scale;var geometry=new Geometry;if(geometry.morphColors=[],parseModel(json,geometry),parseSkin(json,geometry),parseMorphing(json,geometry),parseAnimations(json,geometry),geometry.computeFaceNormals(),geometry.computeBoundingSphere(),void 0===json.materials||0===json.materials.length)return{geometry:geometry};var materials=Loader.prototype.initMaterials(json.materials,texturePath,"Anonymous");if(json.materials[0].video){var fullPath=texturePath+json.materials[0].video;this.paramsString&&(fullPath+="?".concat(this.paramsString));var videoHandler=new VideoHandler(fullPath);geometry._video=videoHandler}return materials&&0<materials.length&&(materials[0].side=json.materials[0].singleSided?THREE.FrontSide:json.materials[0].flipSided?THREE.BackSide:THREE.DoubleSide,json.materials[0].specularCoef&&(materials[0].shininess=Math.floor(json.materials[0].specularCoef/3))),{geometry:geometry,materials:materials}}}()});
|
|
601
674
|
|
|
602
675
|
/***/ }),
|
|
603
|
-
/*
|
|
676
|
+
/* 16 */
|
|
604
677
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
605
678
|
|
|
606
679
|
"use strict";
|
|
@@ -615,7 +688,7 @@ var THREE=__webpack_require__(3);/**
|
|
|
615
688
|
var textures={},json={uuid:three__WEBPACK_IMPORTED_MODULE_0__["MathUtils"].generateUUID(),type:"MeshLambertMaterial"};for(var name in m){var value=m[name];switch(name){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":json.name=value;break;case"blending":json.blending=BlendingMode[value];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",name,"is no longer supported.");break;case"colorDiffuse":json.color=color.fromArray(value).getHex();break;case"colorSpecular":json.specular=color.fromArray(value).getHex();break;case"colorEmissive":json.emissive=color.fromArray(value).getHex();break;case"specularCoef":json.shininess=value;break;case"shading":"basic"===value.toLowerCase()&&(json.type="MeshBasicMaterial"),"phong"===value.toLowerCase()&&(json.type="MeshPhongMaterial"),"standard"===value.toLowerCase()&&(json.type="MeshStandardMaterial");break;case"mapDiffuse":json.map=loadTexture(value,m.mapDiffuseRepeat,m.mapDiffuseOffset,m.mapDiffuseWrap,m.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":json.emissiveMap=loadTexture(value,m.mapEmissiveRepeat,m.mapEmissiveOffset,m.mapEmissiveWrap,m.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":json.lightMap=loadTexture(value,m.mapLightRepeat,m.mapLightOffset,m.mapLightWrap,m.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":json.aoMap=loadTexture(value,m.mapAORepeat,m.mapAOOffset,m.mapAOWrap,m.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":json.bumpMap=loadTexture(value,m.mapBumpRepeat,m.mapBumpOffset,m.mapBumpWrap,m.mapBumpAnisotropy);break;case"mapBumpScale":json.bumpScale=value;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":json.normalMap=loadTexture(value,m.mapNormalRepeat,m.mapNormalOffset,m.mapNormalWrap,m.mapNormalAnisotropy);break;case"mapNormalFactor":json.normalScale=value;break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":json.specularMap=loadTexture(value,m.mapSpecularRepeat,m.mapSpecularOffset,m.mapSpecularWrap,m.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":json.metalnessMap=loadTexture(value,m.mapMetalnessRepeat,m.mapMetalnessOffset,m.mapMetalnessWrap,m.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":json.roughnessMap=loadTexture(value,m.mapRoughnessRepeat,m.mapRoughnessOffset,m.mapRoughnessWrap,m.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":json.alphaMap=loadTexture(value,m.mapAlphaRepeat,m.mapAlphaOffset,m.mapAlphaWrap,m.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":json.side=three__WEBPACK_IMPORTED_MODULE_0__["BackSide"];break;case"doubleSided":json.side=three__WEBPACK_IMPORTED_MODULE_0__["DoubleSide"];break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),json.opacity=value;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":json[name]=value;break;case"vertexColors":!0===value&&(json.vertexColors=three__WEBPACK_IMPORTED_MODULE_0__["VertexColors"]),"face"===value&&(json.vertexColors=three__WEBPACK_IMPORTED_MODULE_0__["FaceColors"]);break;default:console.error("THREE.Loader.createMaterial: Unsupported",name,value);}}return"MeshBasicMaterial"===json.type&&delete json.emissive,"MeshPhongMaterial"!==json.type&&delete json.specular,1>json.opacity&&(json.transparent=!0),materialLoader.setTextures(textures),materialLoader.parse(json)}}()});
|
|
616
689
|
|
|
617
690
|
/***/ }),
|
|
618
|
-
/*
|
|
691
|
+
/* 17 */
|
|
619
692
|
/***/ (function(module, exports, __webpack_require__) {
|
|
620
693
|
|
|
621
694
|
var THREE=__webpack_require__(3);/**
|
|
@@ -632,10 +705,10 @@ this.setMorphTime=function(time,duration){var actualTime=time/duration*_this.vid
|
|
|
632
705
|
return!!(_this.video&&3<=_this.video.readyState)},function initialise(){document&&(_this.video=document.createElement("video"),_this.video.crossOrigin="anonymous",_this.video.src=srcIn,_this.video.load(),_this.video.loop=!0)}()};
|
|
633
706
|
|
|
634
707
|
/***/ }),
|
|
635
|
-
/*
|
|
708
|
+
/* 18 */
|
|
636
709
|
/***/ (function(module, exports, __webpack_require__) {
|
|
637
710
|
|
|
638
|
-
var THREE=__webpack_require__(3),Points=__webpack_require__(
|
|
711
|
+
var THREE=__webpack_require__(3),Points=__webpack_require__(19).Points,toBufferGeometry=__webpack_require__(4).toBufferGeometry,Pointset=function(){__webpack_require__(7).ZincObject.call(this),this.isPointset=!0;/** Shape of the points is created using the function below */var getCircularTexture=()=>{var image=new Image;image.src=__webpack_require__(20);var texture=new THREE.Texture;return texture.image=image,texture.needsUpdate=!0,texture};/**
|
|
639
712
|
* Create the pointsets using geometry and material.
|
|
640
713
|
*
|
|
641
714
|
* @param {THREE.Geomtry} geometryIn - Geometry of points to be rendered.
|
|
@@ -654,10 +727,10 @@ var THREE=__webpack_require__(3),Points=__webpack_require__(18).Points,Pointset=
|
|
|
654
727
|
*
|
|
655
728
|
* @param {Boolean} flag - Determin either size attenuation
|
|
656
729
|
* should be on or off.
|
|
657
|
-
*/this.createMesh=(geometryIn,materialIn,options)=>{if(geometryIn&&materialIn){var geometry=
|
|
730
|
+
*/this.createMesh=(geometryIn,materialIn,options)=>{if(geometryIn&&materialIn){var geometry=toBufferGeometry(geometryIn,options),texture=getCircularTexture();materialIn.map=texture;var point=new Points(geometry,materialIn);this.setMesh(point,options.localTimeEnabled,options.localMorphColour)}},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)}};Pointset.prototype=Object.create(__webpack_require__(7).ZincObject.prototype),exports.Pointset=Pointset;
|
|
658
731
|
|
|
659
732
|
/***/ }),
|
|
660
|
-
/*
|
|
733
|
+
/* 19 */
|
|
661
734
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
662
735
|
|
|
663
736
|
"use strict";
|
|
@@ -669,16 +742,16 @@ var _inverseMatrix=/*@__PURE__*/new three__WEBPACK_IMPORTED_MODULE_0__["Matrix4"
|
|
|
669
742
|
}updateMorphTargets(){var geometry=this.geometry;if(geometry.isBufferGeometry){var morphAttributes=geometry.morphAttributes,keys=Object.keys(morphAttributes);if(0<keys.length){var morphAttribute=morphAttributes[keys[0]];if(morphAttribute!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var name,m=0,ml=morphAttribute.length;m<ml;m++)name=morphAttribute[m].name||m+"",this.morphTargetInfluences.push(0),this.morphTargetDictionary[name]=m}}}else{var morphTargets=geometry.morphTargets;morphTargets!==void 0&&0<morphTargets.length&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}Points.prototype.isPoints=!0;function testPoint(point,index,localThresholdSq,matrixWorld,raycaster,intersects,object){var rayPointDistanceSq=_ray.distanceSqToPoint(point);if(rayPointDistanceSq<localThresholdSq){var intersectPoint=new three__WEBPACK_IMPORTED_MODULE_0__["Vector3"];_ray.closestPointToPoint(point,intersectPoint),intersectPoint.applyMatrix4(matrixWorld);var distance=raycaster.ray.origin.distanceTo(intersectPoint);if(distance<raycaster.near||distance>raycaster.far)return;intersects.push({distance:distance,distanceToRay:Math.sqrt(rayPointDistanceSq),point:intersectPoint,index:index,face:null,object:object})}}function calculatePosition(object,position,morphPosition,a){_position.fromBufferAttribute(position,a);var morphInfluences=object.morphTargetInfluences;if(object.material.morphTargets&&morphPosition&&morphInfluences){_morphA.set(0,0,0);for(var i=0,il=morphPosition.length;i<il;i++){var influence=morphInfluences[i],morphAttribute=morphPosition[i];0===influence||(_tempA.fromBufferAttribute(morphAttribute,a),_morphA.addScaledVector(_tempA.sub(_position),influence))}_position.add(_morphA)}}
|
|
670
743
|
|
|
671
744
|
/***/ }),
|
|
672
|
-
/*
|
|
745
|
+
/* 20 */
|
|
673
746
|
/***/ (function(module, exports) {
|
|
674
747
|
|
|
675
748
|
module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg=="
|
|
676
749
|
|
|
677
750
|
/***/ }),
|
|
678
|
-
/*
|
|
751
|
+
/* 21 */
|
|
679
752
|
/***/ (function(module, exports, __webpack_require__) {
|
|
680
753
|
|
|
681
|
-
var THREE=__webpack_require__(3),Lines=function(){/**
|
|
754
|
+
var THREE=__webpack_require__(3),toBufferGeometry=__webpack_require__(4).toBufferGeometry,Lines=function(){/**
|
|
682
755
|
* Create the line segements using geometry and material.
|
|
683
756
|
*
|
|
684
757
|
* @param {THREE.Geomtry} geometryIn - Geometry of lines to be rendered.
|
|
@@ -692,31 +765,23 @@ var THREE=__webpack_require__(3),Lines=function(){/**
|
|
|
692
765
|
* Set the width for the lines.
|
|
693
766
|
*
|
|
694
767
|
* @param {Number} width - Width of the lines.
|
|
695
|
-
*/__webpack_require__(
|
|
696
|
-
* Provides an object which stores lines.
|
|
697
|
-
* This is created when a valid json file containing lines is read into a {@link Zinc.Scene}
|
|
698
|
-
* object.
|
|
699
|
-
*
|
|
700
|
-
* @class
|
|
701
|
-
* @author Alan Wu
|
|
702
|
-
* @return {Lines}
|
|
703
|
-
*/Lines.prototype=Object.create(__webpack_require__(4).ZincObject.prototype),exports.Lines=Lines;
|
|
768
|
+
*/__webpack_require__(7).ZincObject.call(this),this.isLines=!0,this.createLineSegment=(geometryIn,materialIn,options)=>{if(geometryIn&&materialIn){var geometry=toBufferGeometry(geometryIn,options);options.localMorphColour&&geometry.morphAttributes.color&&(materialIn.onBeforeCompile=__webpack_require__(6).augmentMorphColor());var line=new(__webpack_require__(22).LineSegments)(geometry,materialIn);this.setMesh(line,options.localTimeEnabled,options.localMorphColour)}},this.setWidth=width=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=width,this.morph.material.needsUpdate=!0)}};Lines.prototype=Object.create(__webpack_require__(7).ZincObject.prototype),exports.Lines=Lines;
|
|
704
769
|
|
|
705
770
|
/***/ }),
|
|
706
|
-
/*
|
|
771
|
+
/* 22 */
|
|
707
772
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
708
773
|
|
|
709
774
|
"use strict";
|
|
710
775
|
__webpack_require__.r(__webpack_exports__);
|
|
711
776
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LineSegments", function() { return LineSegments; });
|
|
712
|
-
/* harmony import */ var _Line_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
|
|
777
|
+
/* harmony import */ var _Line_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23);
|
|
713
778
|
/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3);
|
|
714
779
|
/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__);
|
|
715
780
|
var _start=/*@__PURE__*/new three__WEBPACK_IMPORTED_MODULE_1__["Vector3"],_end=/*@__PURE__*/new three__WEBPACK_IMPORTED_MODULE_1__["Vector3"];class LineSegments extends _Line_js__WEBPACK_IMPORTED_MODULE_0__["Line"]{constructor(geometry,material){super(geometry,material),this.type="LineSegments"}computeLineDistances(){var geometry=this.geometry;if(!geometry.isBufferGeometry)geometry.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");else// we assume non-indexed geometry
|
|
716
781
|
if(null===geometry.index){for(var positionAttribute=geometry.attributes.position,lineDistances=[],i=0,l=positionAttribute.count;i<l;i+=2)_start.fromBufferAttribute(positionAttribute,i),_end.fromBufferAttribute(positionAttribute,i+1),lineDistances[i]=0==i?0:lineDistances[i-1],lineDistances[i+1]=lineDistances[i]+_start.distanceTo(_end);geometry.setAttribute("lineDistance",new three__WEBPACK_IMPORTED_MODULE_1__["Float32BufferAttribute"](lineDistances,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}LineSegments.prototype.isLineSegments=!0;
|
|
717
782
|
|
|
718
783
|
/***/ }),
|
|
719
|
-
/*
|
|
784
|
+
/* 23 */
|
|
720
785
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
721
786
|
|
|
722
787
|
"use strict";
|
|
@@ -735,7 +800,7 @@ point:interSegment.clone().applyMatrix4(this.matrixWorld),index:_i,face:null,fac
|
|
|
735
800
|
}updateMorphTargets(){var geometry=this.geometry;if(geometry.isBufferGeometry){var morphAttributes=geometry.morphAttributes,keys=Object.keys(morphAttributes);if(0<keys.length){var morphAttribute=morphAttributes[keys[0]];if(morphAttribute!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var name,m=0,ml=morphAttribute.length;m<ml;m++)name=morphAttribute[m].name||m+"",this.morphTargetInfluences.push(0),this.morphTargetDictionary[name]=m}}}else{var morphTargets=geometry.morphTargets;morphTargets!==void 0&&0<morphTargets.length&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function calculatePosition(vStart,vEnd,object,position,morphPosition,a,b){vStart.fromBufferAttribute(position,a),vEnd.fromBufferAttribute(position,b);var morphInfluences=object.morphTargetInfluences;if(object.material.morphTargets&&morphPosition&&morphInfluences){_morphA.set(0,0,0),_morphB.set(0,0,0);for(var i=0,il=morphPosition.length;i<il;i++){var influence=morphInfluences[i],morphAttribute=morphPosition[i];0===influence||(_tempA.fromBufferAttribute(morphAttribute,a),_tempB.fromBufferAttribute(morphAttribute,b),_morphA.addScaledVector(_tempA.sub(vStart),influence),_morphB.addScaledVector(_tempB.sub(vEnd),influence))}vStart.add(_morphA),vEnd.add(_morphB)}}Line.prototype.isLine=!0;
|
|
736
801
|
|
|
737
802
|
/***/ }),
|
|
738
|
-
/*
|
|
803
|
+
/* 24 */
|
|
739
804
|
/***/ (function(module, exports, __webpack_require__) {
|
|
740
805
|
|
|
741
806
|
function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}var gen=fn.apply(self,args);_next(void 0)})}}var THREE=__webpack_require__(3),TextureArray=function(){/**
|
|
@@ -756,17 +821,17 @@ function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var inf
|
|
|
756
821
|
* @param {Object} options.uniforms - Containing the data to be passed into the shaders.
|
|
757
822
|
* @param {String} options.glslVersion - Version of glsl used for compile this shader.
|
|
758
823
|
*
|
|
759
|
-
*/__webpack_require__(
|
|
824
|
+
*/__webpack_require__(25).Texture.call(this),this.isTextureArray=!0,this.loadFromImages=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(srcArrays){var w=1,h=1,d=0;if(srcArrays&&srcArrays.length){this.isLoading=!0;var image=new Image;image.crossOrigin="Anonymous";for(var data,canvas=document.createElement("canvas"),length=0,dataStacks=Array(srcArrays.length),i=0;i<srcArrays.length;i++)data=yield this.imageToUint8Array(image,srcArrays[i],canvas),data&&data.array&&(w=data.width,h=data.height,dataStacks[d]=data.array,length+=dataStacks[d].length,d++);var fullArray=new Uint8Array(length);length=0,dataStacks.forEach(data=>{fullArray.set(data,length),length+=data.length}),this.impl=new THREE.DataTexture2DArray(fullArray,w,h,d),this.size={width:w,height:h,depth:d},this.isLoading=!1}});return function(){return _ref.apply(this,arguments)}}(),this.getMaterial=function(options){if(this.impl){var material;if(!options)material=new THREE.MeshBasicMaterial({color:new THREE.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:THREE.DoubleSide});else if(options.vs&&options.fs){var transparent=!0;options.transparent&&(transparent=options.transparent);var side=THREE.FrontSide;options.side&&(side=options.side),material=new THREE.ShaderMaterial({transparent,uniforms:options.uniforms,vertexShader:options.vs,fragmentShader:options.fs,side}),options.glslVersion&&(material.glslVersion=options.glslVersion)}if(material)return material.needsUpdate=!0,material}}};/**
|
|
760
825
|
* Texture array object for holding array of images into
|
|
761
826
|
* texures unit that can be used by other texture primitives.
|
|
762
827
|
*
|
|
763
828
|
* @class
|
|
764
829
|
* @author Alan Wu
|
|
765
830
|
* @return {TextureArray}
|
|
766
|
-
*/TextureArray.prototype=Object.create(__webpack_require__(
|
|
831
|
+
*/TextureArray.prototype=Object.create(__webpack_require__(25).Texture.prototype),exports.TextureArray=TextureArray;
|
|
767
832
|
|
|
768
833
|
/***/ }),
|
|
769
|
-
/*
|
|
834
|
+
/* 25 */
|
|
770
835
|
/***/ (function(module, exports, __webpack_require__) {
|
|
771
836
|
|
|
772
837
|
function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}var gen=fn.apply(self,args);_next(void 0)})}}var THREE=__webpack_require__(3),Texture=function(){this.isTexture=!0,this.impl=void 0,this.isLoading=!1,this.size={width:1,height:1,depth:0}};/**
|
|
@@ -810,10 +875,10 @@ function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var inf
|
|
|
810
875
|
*/Texture.prototype.loadImage=function(img,src){return new Promise((resolve,reject)=>{img.onload=()=>resolve(img),img.onerror=reject,img.src=src})},Texture.prototype.imageToUint8Array=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(img,src,canvas){yield this.loadImage(img,src),canvas.width=img.width,canvas.height=img.height;var ctx=canvas.getContext("2d");return ctx.drawImage(img,0,0),{array:new Uint8Array(ctx.getImageData(0,0,canvas.width,canvas.height).data.buffer),width:canvas.width,height:canvas.height}});return function(){return _ref.apply(this,arguments)}}(),Texture.prototype.loadFromImages=/*#__PURE__*/function(){var _ref2=_asyncToGenerator(function*(){});return function(){return _ref2.apply(this,arguments)}}(),Texture.prototype.isReady=function(){return!(!this.impl||this.isLoading)},Texture.prototype.getMaterial=function(){if(this.impl)return new THREE.MeshBasicMaterial({color:new THREE.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:THREE.DoubleSide})},exports.Texture=Texture;
|
|
811
876
|
|
|
812
877
|
/***/ }),
|
|
813
|
-
/*
|
|
878
|
+
/* 26 */
|
|
814
879
|
/***/ (function(module, exports, __webpack_require__) {
|
|
815
880
|
|
|
816
|
-
var THREE=__webpack_require__(3),shader=__webpack_require__(
|
|
881
|
+
var THREE=__webpack_require__(3),shader=__webpack_require__(27),TextureSlides=function(textureIn){__webpack_require__(28).TexturePrimitive.call(this,textureIn),this.isTextureSlides=!0;var textureSettings=[],idTextureMap={};this.setMorph(new THREE.Group),this.morph.userData=this;/**
|
|
817
882
|
@typedef SLIDE_SETTINGS
|
|
818
883
|
@type {Set}
|
|
819
884
|
@property {String} direction - the value must be x, y or z, specify the
|
|
@@ -868,31 +933,31 @@ var THREE=__webpack_require__(3),shader=__webpack_require__(26),TextureSlides=fu
|
|
|
868
933
|
* transformation to calculate the position of the box.
|
|
869
934
|
*
|
|
870
935
|
* @return {THREE.Box3}.
|
|
871
|
-
*/this.createSlides=slideSettings=>{slideSettings.forEach(slide=>this.createSlide(slide))},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},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__(
|
|
936
|
+
*/this.createSlides=slideSettings=>{slideSettings.forEach(slide=>this.createSlide(slide))},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},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__(28).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__(28).TexturePrimitive.prototype),exports.TextureSlides=TextureSlides;
|
|
872
937
|
|
|
873
938
|
/***/ }),
|
|
874
|
-
/*
|
|
939
|
+
/* 27 */
|
|
875
940
|
/***/ (function(module, exports, __webpack_require__) {
|
|
876
941
|
|
|
877
942
|
var THREE=__webpack_require__(3),glslVersion=THREE.GLSL3,fs="\nprecision highp float;\nprecision highp int;\nprecision highp sampler2DArray;\n\nuniform sampler2DArray diffuse;\nin vec3 vUw;\n\nout vec4 outColor;\n\nvoid main() {\n\n vec4 color = texture( diffuse, vUw );\n\n // lighten a bit\n outColor = vec4( color.rgb + .2, 1.0 );\n\n}\n",vs="\nout vec3 vUw;\nuniform float depth;\nuniform vec3 slide;\nuniform int direction;\n\nvoid main() {\n\n vec3 slidePos = position.xyz;\n\n if (direction == 1)\n slidePos = vec3(slide.x, position.x, position.y);\n if (direction == 2)\n slidePos = vec3(position.x, slide.y, position.y);\n if (direction == 3)\n slidePos = vec3(position.x, position.y, slide.z);\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( slidePos, 1.0 );\n\n vUw.xyz = vec3(slidePos.x, slidePos.y, slidePos.z * depth);\n\n}\n",getUniforms=function(){return{diffuse:{value:void 0},depth:{value:1},slide:{value:new THREE.Vector3(0,0,1)},direction:{value:1}}};exports.fs=fs,exports.vs=vs,exports.glslVersion=glslVersion,exports.getUniforms=getUniforms;
|
|
878
943
|
|
|
879
944
|
/***/ }),
|
|
880
|
-
/*
|
|
945
|
+
/* 28 */
|
|
881
946
|
/***/ (function(module, exports, __webpack_require__) {
|
|
882
947
|
|
|
883
|
-
var THREE=__webpack_require__(3),TexturePrimitive=function(textureIn){__webpack_require__(
|
|
948
|
+
var THREE=__webpack_require__(3),TexturePrimitive=function(textureIn){__webpack_require__(7).ZincObject.call(this),this.isTexturePrimitive=!0,this.texture=textureIn};/**
|
|
884
949
|
* Provides a base class object which stores textures and rendering object.
|
|
885
950
|
*
|
|
886
951
|
* @class
|
|
887
952
|
* @author Alan Wu
|
|
888
953
|
* @return {TexturePrimitive}
|
|
889
|
-
*/TexturePrimitive.prototype=Object.create(__webpack_require__(
|
|
954
|
+
*/TexturePrimitive.prototype=Object.create(__webpack_require__(7).ZincObject.prototype),exports.TexturePrimitive=TexturePrimitive;
|
|
890
955
|
|
|
891
956
|
/***/ }),
|
|
892
|
-
/*
|
|
957
|
+
/* 29 */
|
|
893
958
|
/***/ (function(module, exports, __webpack_require__) {
|
|
894
959
|
|
|
895
|
-
var THREE=__webpack_require__(3),ResizeSensor=__webpack_require__(
|
|
960
|
+
var THREE=__webpack_require__(3),ResizeSensor=__webpack_require__(30);/**
|
|
896
961
|
* Create a Zinc 3D renderer in the container provided.
|
|
897
962
|
* The primary function of a Zinc 3D renderer is to display the current
|
|
898
963
|
* scene (@link Scene} set to the renderer and each scene may contain as
|
|
@@ -904,7 +969,7 @@ var THREE=__webpack_require__(3),ResizeSensor=__webpack_require__(29);/**
|
|
|
904
969
|
* @author Alan Wu
|
|
905
970
|
* @return {Renderer}
|
|
906
971
|
*/exports.Renderer=function(containerIn){var container=containerIn,renderer=void 0,currentScene=void 0,clock=new THREE.Clock(!1);this.playAnimation=!0;/* default animation update rate, rate is 1000 and duration
|
|
907
|
-
is default to 6000, 6s to finish a full animation */var playRate=1e3,preRenderCallbackFunctions=[],preRenderCallbackFunctions_id=0,postRenderCallbackFunctions=[],postRenderCallbackFunctions_id=0,animated_id=void 0,cameraOrtho=void 0,sceneOrtho=void 0,logoSprite=void 0,sceneMap=[],additionalActiveScenes=[],scenesGroup=new THREE.Group,canvas=void 0,sensor=void 0,isRendering=!1,_this=this,currentSize=[0,0],currentOffset=[0,0];this.getDrawingWidth=()=>{if(container)return container.clientWidth;return canvas?"undefined"==typeof canvas.clientWidth?Math.round(canvas.width):Math.round(canvas.clientWidth):0},this.getDrawingHeight=()=>{if(container)return container.clientHeight;return canvas?"undefined"==typeof canvas.clientHeight?Math.round(canvas.height):Math.round(canvas.clientHeight):0},this.onWindowResize=()=>{currentScene.onWindowResize();var width=this.getDrawingWidth(),height=this.getDrawingHeight();if(renderer!=null){var localRect;container?(localRect=container.getBoundingClientRect(),renderer.setSize(width,height)):canvas&&("undefined"==typeof canvas.getBoundingClientRect?renderer.setSize(width,height,!1):(localRect=canvas.getBoundingClientRect(),canvas.width=width,canvas.height=height,renderer.setSize(width,height,!1))),localRect&&(currentOffset[0]=localRect.left,currentOffset[1]=localRect.top);var target=new THREE.Vector2;renderer.getSize(target),currentSize[0]=target.x,currentSize[1]=target.y}},this.initialiseVisualisation=parameters=>{if(parameters=parameters||{},void 0===parameters.antialias){var onMobile=!1;try{/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(onMobile=!0)}catch(err){onMobile=!1}parameters.antialias=!onMobile}parameters.canvas&&(container=void 0,canvas=parameters.canvas),renderer=new THREE.WebGLRenderer(parameters),void 0!==container&&container.appendChild(renderer.domElement),renderer.setClearColor(16777215,1),canvas&&canvas.style&&(canvas.style.height="100%",canvas.style.width="100%"),renderer.autoClear=!1;var scene=this.createScene("default");this.setCurrentScene(scene)},this.getCurrentScene=()=>currentScene,this.setCurrentScene=sceneIn=>{if(sceneIn){this.removeActiveScene(sceneIn);var oldScene=currentScene;currentScene=sceneIn,oldScene&&oldScene.setInteractiveControlEnable(!1),currentScene.setInteractiveControlEnable(!0),currentScene.setAdditionalScenesGroup(scenesGroup),this.onWindowResize()}},this.getSceneByName=name=>sceneMap[name],this.createScene=name=>{if(null==sceneMap[name]){var new_scene;return new_scene=canvas?new(__webpack_require__(
|
|
972
|
+
is default to 6000, 6s to finish a full animation */var playRate=1e3,preRenderCallbackFunctions=[],preRenderCallbackFunctions_id=0,postRenderCallbackFunctions=[],postRenderCallbackFunctions_id=0,animated_id=void 0,cameraOrtho=void 0,sceneOrtho=void 0,logoSprite=void 0,sceneMap=[],additionalActiveScenes=[],scenesGroup=new THREE.Group,canvas=void 0,sensor=void 0,isRendering=!1,_this=this,currentSize=[0,0],currentOffset=[0,0];this.getDrawingWidth=()=>{if(container)return container.clientWidth;return canvas?"undefined"==typeof canvas.clientWidth?Math.round(canvas.width):Math.round(canvas.clientWidth):0},this.getDrawingHeight=()=>{if(container)return container.clientHeight;return canvas?"undefined"==typeof canvas.clientHeight?Math.round(canvas.height):Math.round(canvas.clientHeight):0},this.onWindowResize=()=>{currentScene.onWindowResize();var width=this.getDrawingWidth(),height=this.getDrawingHeight();if(renderer!=null){var localRect;container?(localRect=container.getBoundingClientRect(),renderer.setSize(width,height)):canvas&&("undefined"==typeof canvas.getBoundingClientRect?renderer.setSize(width,height,!1):(localRect=canvas.getBoundingClientRect(),canvas.width=width,canvas.height=height,renderer.setSize(width,height,!1))),localRect&&(currentOffset[0]=localRect.left,currentOffset[1]=localRect.top);var target=new THREE.Vector2;renderer.getSize(target),currentSize[0]=target.x,currentSize[1]=target.y}},this.initialiseVisualisation=parameters=>{if(parameters=parameters||{},void 0===parameters.antialias){var onMobile=!1;try{/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(onMobile=!0)}catch(err){onMobile=!1}parameters.antialias=!onMobile}parameters.canvas&&(container=void 0,canvas=parameters.canvas),renderer=new THREE.WebGLRenderer(parameters),void 0!==container&&container.appendChild(renderer.domElement),renderer.setClearColor(16777215,1),canvas&&canvas.style&&(canvas.style.height="100%",canvas.style.width="100%"),renderer.autoClear=!1;var scene=this.createScene("default");this.setCurrentScene(scene)},this.getCurrentScene=()=>currentScene,this.setCurrentScene=sceneIn=>{if(sceneIn){this.removeActiveScene(sceneIn);var oldScene=currentScene;currentScene=sceneIn,oldScene&&oldScene.setInteractiveControlEnable(!1),currentScene.setInteractiveControlEnable(!0),currentScene.setAdditionalScenesGroup(scenesGroup),this.onWindowResize()}},this.getSceneByName=name=>sceneMap[name],this.createScene=name=>{if(null==sceneMap[name]){var new_scene;return new_scene=canvas?new(__webpack_require__(31).Scene)(canvas,renderer):new(__webpack_require__(31).Scene)(container,renderer),sceneMap[name]=new_scene,new_scene.sceneName=name,new_scene}};this.resetView=()=>{currentScene.resetView()},this.viewAll=()=>{if(currentScene){var boundingBox=currentScene.getBoundingBox();if(boundingBox){for(i=0;i<additionalActiveScenes.length;i++){var boundingBox2=additionalActiveScenes[i].getBoundingBox();boundingBox2&&boundingBox.union(boundingBox2)}currentScene.viewAllWithBoundingBox(boundingBox)}}},this.loadModelsURL=(urls,colours,opacities,timeEnabled,morphColour,finishCallback)=>{currentScene.loadModelsURL(urls,colours,opacities,timeEnabled,morphColour,finishCallback)};this.loadViewURL=url=>{currentScene.loadViewURL(url)},this.loadFromViewURL=(jsonFilePrefix,finishCallback)=>{currentScene.loadFromViewURL(jsonFilePrefix,finishCallback)},this.updateDirectionalLight=()=>{currentScene.updateDirectionalLight()};var runAnimation=()=>{isRendering?(animated_id=requestAnimationFrame(runAnimation),this.render()):(cancelAnimationFrame(animated_id),animated_id=void 0)};/**
|
|
908
973
|
* Stop the animation and renderer to get into the render loop.
|
|
909
974
|
*/this.stopAnimate=()=>{isRendering&&(clock.stop(),isRendering=!1)},this.animate=()=>{isRendering||(clock.start(),isRendering=!0,runAnimation())};Date.now();/**
|
|
910
975
|
* Add a callback function which will be called everytime before the renderer renders its scene.
|
|
@@ -942,16 +1007,16 @@ var THREE=__webpack_require__(3),ResizeSensor=__webpack_require__(29);/**
|
|
|
942
1007
|
*/this.addLogo=()=>{logoSprite=new THREE.Sprite;THREE.ImageUtils.loadTexture("images/abi_big_logo_transparent_small.png",void 0,createHUDSprites(logoSprite))},this.render=()=>{sensor||(container?0<container.clientWidth&&0<container.clientHeight&&(sensor=new ResizeSensor(container,this.onWindowResize)):canvas&&0<canvas.width&&0<canvas.height&&(sensor=new ResizeSensor(canvas,this.onWindowResize)));var delta=clock.getDelta();for(currentScene.renderGeometries(playRate,delta,this.playAnimation),i=0;i<additionalActiveScenes.length;i++){var sceneItem=additionalActiveScenes[i];sceneItem.renderGeometries(playRate,delta,this.playAnimation)}for(key in null!=cameraOrtho&&null!=sceneOrtho&&(renderer.clearDepth(),renderer.render(sceneOrtho,cameraOrtho)),preRenderCallbackFunctions)preRenderCallbackFunctions.hasOwnProperty(key)&&preRenderCallbackFunctions[key].call();for(key in currentScene.render(renderer),postRenderCallbackFunctions)postRenderCallbackFunctions.hasOwnProperty(key)&&postRenderCallbackFunctions[key].call()},this.getThreeJSRenderer=()=>renderer,this.isSceneActive=sceneIn=>{if(currentScene===sceneIn)return!0;for(i=0;i<additionalActiveScenes.length;i++){var sceneItem=additionalActiveScenes[i];if(sceneItem===sceneIn)return!0}return!1},this.addActiveScene=additionalScene=>{this.isSceneActive(additionalScene)||(additionalActiveScenes.push(additionalScene),scenesGroup.add(additionalScene.getThreeJSScene()))},this.removeActiveScene=additionalScene=>{for(i=0;i<additionalActiveScenes.length;i++){var sceneItem=additionalActiveScenes[i];if(sceneItem===additionalScene)return additionalActiveScenes.splice(i,1),void scenesGroup.remove(additionalScene.getThreeJSScene())}},this.clearAllActiveScene=()=>{for(var _i=0;_i<additionalActiveScenes.length;_i++)scenesGroup.remove(additionalActiveScenes[_i].getThreeJSScene());additionalActiveScenes.splice(0,additionalActiveScenes.length)},this.dispose=()=>{for(var _key in isRendering&&cancelAnimationFrame(animated_id),sceneMap)sceneMap.hasOwnProperty(_key)&&sceneMap[_key].clearAll();sceneMap=[],additionalActiveScenes=[],scenesGroup=new THREE.Group,this.stopAnimate(),preRenderCallbackFunctions=[],preRenderCallbackFunctions_id=0,cameraOrtho=void 0,sceneOrtho=void 0,logoSprite=void 0;var scene=this.createScene("default");this.setCurrentScene(scene),sensor=void 0},this.transitionScene=(endingScene,duration)=>{if(currentScene){var currentCamera=currentScene.getZincCameraControls(),boundingBox=endingScene.getBoundingBox();if(boundingBox){var radius=boundingBox.min.distanceTo(boundingBox.max)/2,centreX=(boundingBox.min.x+boundingBox.max.x)/2,centreY=(boundingBox.min.y+boundingBox.max.y)/2,centreZ=(boundingBox.min.z+boundingBox.max.z)/2,endingViewport=currentCamera.getViewportFromCentreAndRadius(centreX,centreY,centreZ,radius,40,radius*4),startingViewport=currentCamera.getCurrentViewport();currentCamera.cameraTransition(startingViewport,endingViewport,duration),currentCamera.enableCameraTransition()}}},this.isWebGL2=()=>!!renderer&&renderer.capabilities.isWebGL2};
|
|
943
1008
|
|
|
944
1009
|
/***/ }),
|
|
945
|
-
/*
|
|
1010
|
+
/* 30 */
|
|
946
1011
|
/***/ (function(module, exports) {
|
|
947
1012
|
|
|
948
1013
|
module.exports = require("css-element-queries/src/ResizeSensor");
|
|
949
1014
|
|
|
950
1015
|
/***/ }),
|
|
951
|
-
/*
|
|
1016
|
+
/* 31 */
|
|
952
1017
|
/***/ (function(module, exports, __webpack_require__) {
|
|
953
1018
|
|
|
954
|
-
var THREE=__webpack_require__(3),SceneLoader=__webpack_require__(
|
|
1019
|
+
var THREE=__webpack_require__(3),SceneLoader=__webpack_require__(32).SceneLoader,SceneExporter=__webpack_require__(38).SceneExporter,Viewport=__webpack_require__(40).Viewport,uniqueiId=0,getUniqueId=function(){return"sc"+uniqueiId++},defaultMetadata=function(){return{Duration:"6 secs",OriginalDuration:"-",TimeStamps:{}}},defaultDuration=6e3;/**
|
|
955
1020
|
* A Scene contains {@link Region},and
|
|
956
1021
|
* {@link CameraControls} which controls the viewport and additional features.
|
|
957
1022
|
* It is the main object used for controlling what is and what is not displayed
|
|
@@ -961,10 +1026,10 @@ var THREE=__webpack_require__(3),SceneLoader=__webpack_require__(31).SceneLoader
|
|
|
961
1026
|
* @param {Object} containerIn - Container to create the renderer on.
|
|
962
1027
|
* @author Alan Wu
|
|
963
1028
|
* @return {Scene}
|
|
964
|
-
*/exports.Scene=function(containerIn,rendererIn){var container=containerIn,videoHandler=void 0,sceneLoader=new SceneLoader(this),minimap=void 0,scene=new THREE.Scene,rootRegion=new(__webpack_require__(
|
|
965
|
-
var setupCamera=()=>{this.camera=new THREE.PerspectiveCamera(40,getDrawingWidth()/getDrawingHeight(),0,10),this.ambient=new THREE.AmbientLight(16777215,.2),scene.add(this.ambient),this.directionalLight=new THREE.DirectionalLight(16777215,.8),scene.add(this.directionalLight),zincCameraControls=new(__webpack_require__(
|
|
1029
|
+
*/exports.Scene=function(containerIn,rendererIn){var container=containerIn,videoHandler=void 0,sceneLoader=new SceneLoader(this),minimap=void 0,scene=new THREE.Scene,rootRegion=new(__webpack_require__(41).Region);scene.add(rootRegion.getGroup()),this.directionalLight=void 0,this.ambient=void 0,this.camera=void 0;var duration=6e3,zincCameraControls=void 0;this.sceneName=void 0;var stereoEffectFlag=!1,stereoEffect=void 0;this.autoClearFlag=!0,this.displayMarkers=!1,this.displayMinimap=!1,this.minimapScissor={x_offset:16,y_offset:16,width:128,height:128,align:"top-left",updateRequired:!0};var scissor={x:0,y:0},metadata=defaultMetadata(),_markerTarget=new THREE.Vector2,pickableObjectsList=[];this.forcePickableObjectsUpdate=!1,this.uuid=getUniqueId();var getDrawingWidth=()=>container?"undefined"==typeof container.clientWidth?container.width:container.clientWidth:0,getDrawingHeight=()=>container?"undefined"==typeof container.clientHeight?container.height:container.clientHeight:0;this.getDownloadProgress=()=>sceneLoader.getDownloadProgress(),this.onWindowResize=()=>{this.camera.aspect=getDrawingWidth()/getDrawingHeight(),this.camera.updateProjectionMatrix(),this.minimapScissor.updateRequired=!0,zincCameraControls.onResize()},this.resetView=()=>{this.onWindowResize(),zincCameraControls.resetView()},this.changeZoomByScrollRateUnit=unit=>{zincCameraControls.changeZoomByScrollRateUnit(unit)};//Setup the camera for this scene, it also initialise the lighting
|
|
1030
|
+
var setupCamera=()=>{this.camera=new THREE.PerspectiveCamera(40,getDrawingWidth()/getDrawingHeight(),0,10),this.ambient=new THREE.AmbientLight(16777215,.2),scene.add(this.ambient),this.directionalLight=new THREE.DirectionalLight(16777215,.8),scene.add(this.directionalLight),zincCameraControls=new(__webpack_require__(40).CameraControls)(this.camera,rendererIn.domElement,rendererIn,this),zincCameraControls.setDirectionalLight(this.directionalLight),zincCameraControls.resetView(),minimap=new(__webpack_require__(42).Minimap)(this)};setupCamera(),this.loadView=settings=>{var viewPort=new Viewport;return viewPort.setFromObject(settings),zincCameraControls.setCurrentCameraSettings(viewPort),!0},this.setupMultipleViews=(defaultView,entries)=>{for(var[name,settings]of Object.entries(entries)){var viewport=new Viewport;viewport.setFromObject(settings),zincCameraControls.addViewport(name,viewport)}zincCameraControls.setDefaultViewport(defaultView)},this.getBoundingBox=()=>rootRegion.getBoundingBox(!0),this.viewAllWithBoundingBox=boundingBox=>{if(boundingBox){// enlarge radius to keep image within edge of window
|
|
966
1031
|
var radius=boundingBox.min.distanceTo(boundingBox.max)/2,centreX=(boundingBox.min.x+boundingBox.max.x)/2,centreY=(boundingBox.min.y+boundingBox.max.y)/2,centreZ=(boundingBox.min.z+boundingBox.max.z)/2,viewport=zincCameraControls.getViewportFromCentreAndRadius(centreX,centreY,centreZ,radius,40,radius*4);zincCameraControls.setCurrentCameraSettings(viewport)}},this.viewAll=()=>{var boundingBox=this.getBoundingBox();this.viewAllWithBoundingBox(boundingBox)},this.forEachGeometry=callbackFunction=>{rootRegion.forEachGeometry(callbackFunction,!0)},this.forEachGlyphset=callbackFunction=>{rootRegion.forEachGlyphset(callbackFunction,!0)},this.forEachPointset=callbackFunction=>{rootRegion.forEachPointset(callbackFunction,!0)},this.forEachLine=callbackFunction=>{rootRegion.forEachLine(callbackFunction,!0)},this.findGeometriesWithGroupName=GroupName=>rootRegion.findGeometriesWithGroupName(GroupName,!0),this.findPointsetsWithGroupName=GroupName=>rootRegion.findPointsetsWithGroupName(GroupName,!0),this.findGlyphsetsWithGroupName=GroupName=>rootRegion.findGlyphsetsWithGroupName(GroupName,!0),this.findLinesWithGroupName=GroupName=>rootRegion.findLinesWithGroupName(GroupName,!0),this.findObjectsWithGroupName=GroupName=>rootRegion.findObjectsWithGroupName(GroupName,!0),this.findObjectsWithAnatomicalId=anatomicalId=>rootRegion.findObjectsWithAnatomicalId(anatomicalId,!0),this.getBoundingBoxOfZincObjects=objectsArray=>{for(var box,boundingBox=void 0,i=0;i<objectsArray.length;i++)box=objectsArray[i].getBoundingBox(),box&&(boundingBox?boundingBox.union(box):boundingBox=box);return boundingBox},this.vectorToScreenXY=point=>{point.project(this.camera);var width=getDrawingWidth(),height=getDrawingHeight(),widthHalf=width/2,heightHalf=height/2;return point.x=point.x*widthHalf+widthHalf,point.y=-(point.y*heightHalf)+heightHalf,point},this.getObjectsScreenXY=zincObjects=>{if(zincObjects&&0<zincObjects.length){var boundingBox=this.getBoundingBoxOfZincObjects(zincObjects),center=new THREE.Vector3;return boundingBox.getCenter(center),this.vectorToScreenXY(center)}},this.getNamedObjectsScreenXY=name=>{var zincObjects=this.findObjectsWithGroupName(name);return this.getObjectsScreenXY(zincObjects)},this.addZincObject=zincObject=>{zincObject&&(rootRegion.addZincObject(zincObject),zincCameraControls&&zincCameraControls.calculateMaxAllowedDistance(this))},this.loadGlyphsetURL=(metaurl,glyphurl,groupName,finishCallback)=>{sceneLoader.loadGlyphsetURL(rootRegion,metaurl,glyphurl,groupName,finishCallback)},this.loadPointsetURL=(url,timeEnabled,morphColour,groupName,finishCallback)=>{sceneLoader.loadPointsetURL(rootRegion,url,timeEnabled,morphColour,groupName,finishCallback)},this.loadLinesURL=(url,timeEnabled,morphColour,groupName,finishCallback)=>{sceneLoader.loadLinesURL(rootRegion,url,timeEnabled,morphColour,groupName,finishCallback)},this.loadSTL=(url,groupName,finishCallback)=>{sceneLoader.loadSTL(rootRegion,url,groupName,finishCallback)},this.loadOBJ=(url,groupName,finishCallback)=>{sceneLoader.loadOBJ(rootRegion,url,groupName,finishCallback)},this.loadMetadataURL=(url,finishCallback,allCompletedCallback)=>{sceneLoader.loadMetadataURL(rootRegion,url,finishCallback,allCompletedCallback)},this.loadModelsURL=(urls,colours,opacities,timeEnabled,morphColour,finishCallback)=>{sceneLoader.loadModelsURL(rootRegion.urls,colours,opacities,timeEnabled,morphColour,finishCallback)},this.loadViewURL=url=>{sceneLoader.loadViewURL(url)},this.loadFromViewURL=(jsonFilePrefix,finishCallback)=>{sceneLoader.loadFromViewURL(jsonFilePrefix,finishCallback)},this.loadGLTF=(url,finishCallback,options)=>{sceneLoader.loadGLTF(rootRegion,url,finishCallback,options)},this.updateDirectionalLight=()=>{zincCameraControls.updateDirectionalLight()},this.addObject=object=>{scene.add(object)},this.removeObject=object=>{scene.remove(object)},this.getCurrentTime=()=>{if(videoHandler!=null)return videoHandler.getCurrentTime(duration);var time=rootRegion.getCurrentTime();return-1===time?0:time},this.setMorphsTime=time=>{videoHandler!=null&&videoHandler.setMorphTime(time,duration),rootRegion.setMorphTime(time,!0)},this.isTimeVarying=()=>!!(videoHandler&&videoHandler.video&&!videoHandler.video.error)||rootRegion.isTimeVarying(),this.renderGeometries=(playRate,delta,playAnimation)=>{// Let video dictates the progress if one is present
|
|
967
|
-
var options={camera:zincCameraControls,displayMarkers:this.displayMarkers,markerDepths:[]};if(!videoHandler)0==sceneLoader.toBeDownloaded?(zincCameraControls.update(delta),rootRegion.renderGeometries(playRate,delta,playAnimation,options,!0)):zincCameraControls.update(0);else if(videoHandler.isReadyToPlay()){playAnimation?videoHandler.video.play():videoHandler.video.pause();var currentTime=videoHandler.video.currentTime/videoHandler.getVideoDuration()*duration;0==sceneLoader.toBeDownloaded?(zincCameraControls.setTime(currentTime),zincCameraControls.update(0),rootRegion.setMorphTime(currentTime,!0),rootRegion.renderGeometries(0,0,playAnimation,void 0,!0)):zincCameraControls.update(0)}else myPlayRate=0},this.getThreeJSScene=()=>scene,this.setVideoHandler=videoHandlerIn=>{videoHandler||(videoHandler=videoHandlerIn)},this.setAdditionalScenesGroup=scenesGroup=>{scene.add(scenesGroup)};var getWindowsPosition=(align,x_offset,y_offset,width,height,renderer_width,renderer_height)=>{var x=0,y=0;return y=align.includes("top")?renderer_height-height-y_offset:align.includes("bottom")?y_offset:Math.floor((renderer_height-height)/2),x=align.includes("left")?x_offset:align.includes("right")?renderer_width-x_offset-width:Math.floor((renderer_width-width)/2),{x:x,y:y}},renderMinimap=renderer=>{!0===this.displayMinimap&&(renderer.setScissorTest(!0),renderer.getSize(_markerTarget),this.minimapScissor.updateRequired&&(scissor=getWindowsPosition(this.minimapScissor.align,this.minimapScissor.x_offset,this.minimapScissor.y_offset,this.minimapScissor.width,this.minimapScissor.height,_markerTarget.x,_markerTarget.y),this.minimapScissor.updateRequired=!1),renderer.setScissor(scissor.x,scissor.y,this.minimapScissor.width,this.minimapScissor.height),renderer.setViewport(scissor.x,scissor.y,this.minimapScissor.width,this.minimapScissor.height),minimap.updateCamera(),scene.add(minimap.mask),renderer.render(scene,minimap.camera),scene.remove(minimap.mask),renderer.setScissorTest(!1),renderer.setViewport(0,0,_markerTarget.x,_markerTarget.y))};this.render=renderer=>{this.autoClearFlag&&renderer.clear(),stereoEffectFlag&&stereoEffect?stereoEffect.render(scene,this.camera):(renderer.render(scene,this.camera),renderMinimap(renderer))},this.setInteractiveControlEnable=flag=>{!0==flag?zincCameraControls.enable():zincCameraControls.disable()},this.getZincCameraControls=()=>zincCameraControls,this.getThreeJSScene=()=>scene,this.setDuration=durationIn=>{rootRegion.setDuration(durationIn),duration=durationIn,zincCameraControls.setPathDuration(durationIn),sceneLoader.duration=durationIn},this.getDuration=()=>duration,this.setStereoEffectEnable=stereoFlag=>{!0!=stereoFlag||stereoEffect||(stereoEffect=new __webpack_require__(
|
|
1032
|
+
var options={camera:zincCameraControls,displayMarkers:this.displayMarkers,markerDepths:[]};if(!videoHandler)0==sceneLoader.toBeDownloaded?(zincCameraControls.update(delta),rootRegion.renderGeometries(playRate,delta,playAnimation,zincCameraControls,options,!0)):zincCameraControls.update(0);else if(videoHandler.isReadyToPlay()){playAnimation?videoHandler.video.play():videoHandler.video.pause();var currentTime=videoHandler.video.currentTime/videoHandler.getVideoDuration()*duration;0==sceneLoader.toBeDownloaded?(zincCameraControls.setTime(currentTime),zincCameraControls.update(0),rootRegion.setMorphTime(currentTime,!0),rootRegion.renderGeometries(0,0,playAnimation,zincCameraControls,void 0,!0)):zincCameraControls.update(0)}else myPlayRate=0},this.getThreeJSScene=()=>scene,this.setVideoHandler=videoHandlerIn=>{videoHandler||(videoHandler=videoHandlerIn)},this.setAdditionalScenesGroup=scenesGroup=>{scene.add(scenesGroup)};var getWindowsPosition=(align,x_offset,y_offset,width,height,renderer_width,renderer_height)=>{var x=0,y=0;return y=align.includes("top")?renderer_height-height-y_offset:align.includes("bottom")?y_offset:Math.floor((renderer_height-height)/2),x=align.includes("left")?x_offset:align.includes("right")?renderer_width-x_offset-width:Math.floor((renderer_width-width)/2),{x:x,y:y}},renderMinimap=renderer=>{!0===this.displayMinimap&&(renderer.setScissorTest(!0),renderer.getSize(_markerTarget),this.minimapScissor.updateRequired&&(scissor=getWindowsPosition(this.minimapScissor.align,this.minimapScissor.x_offset,this.minimapScissor.y_offset,this.minimapScissor.width,this.minimapScissor.height,_markerTarget.x,_markerTarget.y),this.minimapScissor.updateRequired=!1),renderer.setScissor(scissor.x,scissor.y,this.minimapScissor.width,this.minimapScissor.height),renderer.setViewport(scissor.x,scissor.y,this.minimapScissor.width,this.minimapScissor.height),minimap.updateCamera(),scene.add(minimap.mask),renderer.render(scene,minimap.camera),scene.remove(minimap.mask),renderer.setScissorTest(!1),renderer.setViewport(0,0,_markerTarget.x,_markerTarget.y))};this.render=renderer=>{this.autoClearFlag&&renderer.clear(),stereoEffectFlag&&stereoEffect?stereoEffect.render(scene,this.camera):(renderer.render(scene,this.camera),renderMinimap(renderer))},this.setInteractiveControlEnable=flag=>{!0==flag?zincCameraControls.enable():zincCameraControls.disable()},this.getZincCameraControls=()=>zincCameraControls,this.getThreeJSScene=()=>scene,this.setDuration=durationIn=>{rootRegion.setDuration(durationIn),duration=durationIn,zincCameraControls.setPathDuration(durationIn),sceneLoader.duration=durationIn},this.getDuration=()=>duration,this.setStereoEffectEnable=stereoFlag=>{!0!=stereoFlag||stereoEffect||(stereoEffect=new __webpack_require__(40).StereoEffect(rendererIn)),rendererIn.setSize(getDrawingWidth(),getDrawingHeight()),this.camera.updateProjectionMatrix(),stereoEffectFlag=stereoFlag},this.objectIsInScene=zincObject=>rootRegion.objectIsInRegion(zincObject,!0),this.alignBoundingBoxToCameraView=(boundingBox,transitionTime)=>{if(boundingBox){var center=new THREE.Vector3;boundingBox.getCenter(center);var viewport=this.getZincCameraControls().getCurrentViewport(),target=new THREE.Vector3(viewport.targetPosition[0],viewport.targetPosition[1],viewport.targetPosition[2]),eyePosition=new THREE.Vector3(viewport.eyePosition[0],viewport.eyePosition[1],viewport.eyePosition[2]),upVector=new THREE.Vector3(viewport.upVector[0],viewport.upVector[1],viewport.upVector[2]),newVec1=new THREE.Vector3,newVec2=new THREE.Vector3;newVec1.subVectors(target,eyePosition).normalize(),newVec2.subVectors(target,center).normalize();var newVec3=new THREE.Vector3;newVec3.crossVectors(newVec1,newVec2);var angle=newVec1.angleTo(newVec2);0<transitionTime?(this.getZincCameraControls().rotateCameraTransition(newVec3,angle,transitionTime),this.getZincCameraControls().enableCameraTransition()):this.getZincCameraControls().rotateAboutLookAtpoint(newVec3,angle)}},this.alignObjectToCameraView=(zincObject,transitionTime)=>{if(this.objectIsInScene(zincObject)){var boundingBox=zincObject.getBoundingBox();this.alignBoundingBoxToCameraView(boundingBox,transitionTime)}},this.setCameraTargetToObject=zincObject=>{if(this.objectIsInScene(zincObject)){var center=new THREE.Vector3,boundingBox=zincObject.getBoundingBox(),viewport=this.getZincCameraControls().getCurrentViewport();boundingBox.getCenter(center);var target=new THREE.Vector3(viewport.targetPosition[0],viewport.targetPosition[1],viewport.targetPosition[2]),eyePosition=new THREE.Vector3(viewport.eyePosition[0],viewport.eyePosition[1],viewport.eyePosition[2]),newVec1=new THREE.Vector3,newVec2=new THREE.Vector3;newVec1.subVectors(eyePosition,target),newVec2.addVectors(center,newVec1),viewport.eyePosition[0]=newVec2.x,viewport.eyePosition[1]=newVec2.y,viewport.eyePosition[2]=newVec2.z,viewport.targetPosition[0]=center.x,viewport.targetPosition[1]=center.y,viewport.targetPosition[2]=center.z,this.getZincCameraControls().setCurrentCameraSettings(viewport)}},this.isStereoEffectEnable=()=>stereoEffectFlag,this.removeZincObject=zincObject=>{rootRegion.removeZincObject(zincObject),zincCameraControls&&zincCameraControls.calculateMaxAllowedDistance(this)},this.updatePickableThreeJSObjects=()=>{pickableObjectsList.splice(0,pickableObjectsList.length),rootRegion.getPickableThreeJSObjects(pickableObjectsList,!0),this.forcePickableObjectsUpdate=!1},this.getPickableThreeJSObjects=()=>((this.forcePickableObjectsUpdate||rootRegion.checkPickableUpdateRequred(!0))&&this.updatePickableThreeJSObjects(),pickableObjectsList),this.getNormalisedMinimapCoordinates=(renderer,event)=>{if(this.displayMinimap){var target=new THREE.Vector2;renderer.getSize(target);var offsetY=target.y-event.clientY;if(scissor.x+this.minimapScissor.width>event.clientX&&event.clientX>scissor.x&&scissor.y+this.minimapScissor.height>offsetY&&offsetY>scissor.y){var x=2*((event.clientX-scissor.x)/this.minimapScissor.width)-1,y=2*((offsetY-scissor.y)/this.minimapScissor.height)-1;return{x:x,y:y}}}},this.getMinimapDiffFromNormalised=(x,y)=>minimap?minimap.getDiffFromNormalised(x,y):void 0,this.isWebGL2=()=>rendererIn.isWebGL2(),this.clearAll=()=>{rootRegion.clear(!0),sceneLoader.toBeDwonloaded=0,zincCameraControls&&zincCameraControls.calculateMaxAllowedDistance(this)},this.addMetadataTimeStamp=(key,time)=>{metadata.TimeStamps[key]=convertDurationObjectTomSec(time)},this.getMetadataTag=key=>metadata[key],this.getMetadata=()=>metadata,this.setMetadataTag=(key,value)=>{metadata[key]=value},this.removeMetadataTag=key=>{delete metadata[key]},this.resetMetadata=()=>{metadata=defaultMetadata()},this.resetDuration=()=>{this.setDuration(defaultDuration)};// Turn the object into a readable string {years: years,months: months,
|
|
968
1033
|
// weeks: weeks, days: days, hours: hours, mins: mins, secs: secs }
|
|
969
1034
|
var convertDurationObjectToString=duration=>[...(duration.years?["".concat(duration.years,"years")]:[]),...(duration.months?["".concat(duration.months,"months")]:[]),...(duration.weeks?["".concat(duration.weeks,"weeks")]:[]),...(duration.days?["".concat(duration.days,"days")]:[]),...(duration.hours?["".concat(duration.hours,"hours")]:[]),...(duration.mins?["".concat(duration.mins,"mins")]:[]),...(duration.secs?["".concat(duration.secs,"secs")]:[])].join(" "),convertDurationObjectTomSec=duration=>duration.years?31536e6*duration.years:0+duration.months?2592e6*duration.months:0+duration.weeks?6048e5*duration.weeks:0+duration.days?864e5*duration.days:0+duration.hours?36e5*duration.hours:0+duration.mins?6e4*duration.mins:0+duration.secs?1e3*duration.secs:0;// Turn the object into a number representing milliesecond {years: years,months: months,
|
|
970
1035
|
// weeks: weeks, days: days, hours: hours, mins: mins, secs: secs }
|
|
@@ -989,10 +1054,10 @@ var convertDurationObjectToString=duration=>[...(duration.years?["".concat(durat
|
|
|
989
1054
|
*/this.setDurationFromObject=duration=>{var string=convertDurationObjectToString(duration),millisec=convertDurationObjectTomSec(duration);this.setMetadataTag("Duration",string),this.setDuration(millisec)},this.setOriginalDurationFromObject=duration=>{var string=convertDurationObjectToString(duration);this.setMetadataTag("OriginalDuration",string)},this.exportGLTF=binary=>{var exporter=new SceneExporter(this);return exporter.exportGLTF(binary)},this.getRootRegion=()=>rootRegion};
|
|
990
1055
|
|
|
991
1056
|
/***/ }),
|
|
992
|
-
/*
|
|
1057
|
+
/* 32 */
|
|
993
1058
|
/***/ (function(module, exports, __webpack_require__) {
|
|
994
1059
|
|
|
995
|
-
var THREE=__webpack_require__(3),resolveURL=__webpack_require__(
|
|
1060
|
+
var THREE=__webpack_require__(3),resolveURL=__webpack_require__(4).resolveURL,STLLoader=__webpack_require__(33).STLLoader,OBJLoader=__webpack_require__(34).OBJLoader,PrimitivesLoader=__webpack_require__(35).PrimitivesLoader,createNewURL=(target,reference)=>{var newURL=new URL(target,reference).href;//Make sure the target url does not contain parameters
|
|
996
1061
|
if(target&&2>target.split("?").length){var paramsStrings=reference.split("?");//There are parameters, add them to the target
|
|
997
1062
|
2===paramsStrings.length&&(newURL=newURL+"?"+paramsStrings[1])}return newURL};/**
|
|
998
1063
|
* A helper class to help with reading / importing primitives and
|
|
@@ -1006,8 +1071,8 @@ if(target&&2>target.split("?").length){var paramsStrings=reference.split("?");//
|
|
|
1006
1071
|
fetch(newURL).then(response=>response.json()).then(data=>resolve({key:key,data:data})).catch(data=>reject(data))})))};for(var[key,value]of Object.entries(views.Entries))_loop(key,value);Promise.all(promises).then(values=>{var entries={};values.forEach(entry=>{entries[entry.key]=entry.data}),scene.setupMultipleViews(defaultView,entries);var zincCameraControls=scene.getZincCameraControls();zincCameraControls&&zincCameraControls.setCurrentViewport(defaultView),viewLoaded=!0})}};/**
|
|
1007
1072
|
* Load the viewport from an external location provided by the url.
|
|
1008
1073
|
* @param {String} URL - address to the file containing viewport information.
|
|
1009
|
-
*/this.loadViewURL=(url,finishCallback)=>{this.toBeDownloaded+=1;var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=()=>{if(4==xmlhttp.readyState)if(200==xmlhttp.status){var viewData=JSON.parse(xmlhttp.responseText);scene.setupMultipleViews("default",{default:viewData}),scene.resetView(),viewLoaded=!0,--this.toBeDownloaded,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback()}else this.onError()},requestURL=resolveURL(url),xmlhttp.open("GET",requestURL,!0),xmlhttp.send()},this.loadModelsURL=(region,urls,colours,opacities,timeEnabled,morphColour,finishCallback)=>{var number=urls.length;this.toBeDownloaded+=number;for(var _i=0;_i<number;_i++){var filename=urls[_i],colour=__webpack_require__(0).defaultMaterialColor,opacity=__webpack_require__(0).defaultOpacity;colours!=null&&colours[_i]!=null&&(colour=!!colours[_i]),opacities!=null&&opacities[_i]!=null&&(opacity=opacities[_i]);var localTimeEnabled=0;timeEnabled!=null&&timeEnabled[_i]!=null&&(localTimeEnabled=!!timeEnabled[_i]);var localMorphColour=0;morphColour!=null&&morphColour[_i]!=null&&(localMorphColour=!!morphColour[_i]),primitivesLoader.load(resolveURL(filename),meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,finishCallback),this.onProgress(_i),this.onError(finishCallback))}},this.loadFromViewURL=(targetRegion,jsonFilePrefix,finishCallback)=>{var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=()=>{if(4==xmlhttp.readyState&&200==xmlhttp.status){var viewData=JSON.parse(xmlhttp.responseText);scene.loadView(viewData);for(var filename,urls=[],_i2=0;_i2<viewData.numberOfResources;_i2++)filename=jsonFilePrefix+"_"+(_i2+1)+".json",urls.push(filename);this.loadModelsURL(targetRegion,urls,viewData.colour,viewData.opacity,viewData.timeEnabled,viewData.morphColour,finishCallback)}},requestURL=resolveURL(jsonFilePrefix+"_view.json"),xmlhttp.open("GET",requestURL,!0),xmlhttp.send()};//Internal loader for a regular zinc geometry.
|
|
1010
|
-
var linesloader=(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback)=>(geometry,materials)=>{var newLines=new(__webpack_require__(
|
|
1074
|
+
*/this.loadViewURL=(url,finishCallback)=>{this.toBeDownloaded+=1;var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=()=>{if(4==xmlhttp.readyState)if(200==xmlhttp.status){var viewData=JSON.parse(xmlhttp.responseText);scene.setupMultipleViews("default",{default:viewData}),scene.resetView(),viewLoaded=!0,--this.toBeDownloaded,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback()}else this.onError()},requestURL=resolveURL(url),xmlhttp.open("GET",requestURL,!0),xmlhttp.send()},this.loadModelsURL=(region,urls,colours,opacities,timeEnabled,morphColour,finishCallback)=>{var number=urls.length;this.toBeDownloaded+=number;for(var _i=0;_i<number;_i++){var filename=urls[_i],colour=__webpack_require__(0).defaultMaterialColor,opacity=__webpack_require__(0).defaultOpacity;colours!=null&&colours[_i]!=null&&(colour=!!colours[_i]),opacities!=null&&opacities[_i]!=null&&(opacity=opacities[_i]);var localTimeEnabled=0;timeEnabled!=null&&timeEnabled[_i]!=null&&(localTimeEnabled=!!timeEnabled[_i]);var localMorphColour=0;morphColour!=null&&morphColour[_i]!=null&&(localMorphColour=!!morphColour[_i]),primitivesLoader.load(resolveURL(filename),meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,void 0,finishCallback),this.onProgress(_i),this.onError(finishCallback))}},this.loadFromViewURL=(targetRegion,jsonFilePrefix,finishCallback)=>{var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=()=>{if(4==xmlhttp.readyState&&200==xmlhttp.status){var viewData=JSON.parse(xmlhttp.responseText);scene.loadView(viewData);for(var filename,urls=[],_i2=0;_i2<viewData.numberOfResources;_i2++)filename=jsonFilePrefix+"_"+(_i2+1)+".json",urls.push(filename);this.loadModelsURL(targetRegion,urls,viewData.colour,viewData.opacity,viewData.timeEnabled,viewData.morphColour,finishCallback)}},requestURL=resolveURL(jsonFilePrefix+"_view.json"),xmlhttp.open("GET",requestURL,!0),xmlhttp.send()};//Internal loader for a regular zinc geometry.
|
|
1075
|
+
var linesloader=(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback)=>(geometry,materials)=>{var newLines=new(__webpack_require__(21).Lines),material=void 0;materials&&materials[0]&&(material=new THREE.LineBasicMaterial({color:materials[0].color.clone()}),1>materials[0].opacity&&(material.transparent=!0),material.opacity=materials[0].opacity,material.morphTargets=localTimeEnabled,material.vertexColors=materials[0].vertexColors);var options={};options.localTimeEnabled=localTimeEnabled,options.localMorphColour=localMorphColour,newLines&&(newLines.createLineSegment(geometry,material,options),newLines.setName(groupName),newLines.anatomicalId=anatomicalId,newLines.setRenderOrder=renderOrder,region.addZincObject(newLines),newLines.setDuration(scene.getDuration())),--this.toBeDownloaded,geometry.dispose(),null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newLines)};/**
|
|
1011
1076
|
* Load lines into this scene object.
|
|
1012
1077
|
*
|
|
1013
1078
|
* @param {String} metaurl - Provide informations such as transformations, colours
|
|
@@ -1017,9 +1082,8 @@ var linesloader=(region,localTimeEnabled,localMorphColour,groupName,anatomicalId
|
|
|
1017
1082
|
* @param {STRING} groupName - name to assign the pointset's groupname to.
|
|
1018
1083
|
* @param {Function} finishCallback - Callback function which will be called
|
|
1019
1084
|
* once the glyphset is succssfully load in.
|
|
1020
|
-
*/this.loadLinesURL=(region,url,timeEnabled,morphColour,groupName,finishCallback,options)=>{var localTimeEnabled=0;this.toBeDownloaded+=1;var isInline=!!(options&&options.isInline)&&options.isInline,anatomicalId=options&&options.anatomicalId?options.anatomicalId:void 0,renderOrder=options&&options.renderOrder?options.renderOrder:void 0;null!=timeEnabled&&(localTimeEnabled=!!timeEnabled);var localMorphColour=0;if(null!=morphColour&&(localMorphColour=!!morphColour),isInline){var object=primitivesLoader.parse(url);linesloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback)(object.geometry,object.materials)}else primitivesLoader.load(url,linesloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback),this.onProgress(i),this.onError(finishCallback))};var loadGlyphset=(region,glyphsetData,glyphurl,groupName,finishCallback,options)=>{var isInline=options&&options.isInline?options.isInline:void 0,anatomicalId=options&&options.anatomicalId?options.anatomicalId:void 0,displayLabels=options&&options.displayLabels?options.displayLabels:void 0,renderOrder=options&&options.renderOrder?options.renderOrder:void 0,newGlyphset=new(__webpack_require__(
|
|
1021
|
-
this.loadSTL=(region,url,groupName,finishCallback)=>{this.toBeDownloaded+=1;var colour=__webpack_require__(0).defaultMaterialColor,opacity=__webpack_require__(0).defaultOpacity,loader=new STLLoader;loader.crossOrigin="Anonymous",loader.load(resolveURL(url),meshloader(region,colour,opacity,!1,!1,groupName,void 0,void 0,finishCallback))},this.loadOBJ=(region,url,groupName,finishCallback)=>{this.toBeDownloaded+=1;var colour=__webpack_require__(0).defaultMaterialColor,opacity=__webpack_require__(0).defaultOpacity,loader=new OBJLoader;loader.crossOrigin="Anonymous",loader.load(resolveURL(url),meshloader(region,colour,opacity,!1,!1,groupName,void 0,void 0,finishCallback))}
|
|
1022
|
-
var objloader=(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,finishCallback)=>object=>{this.toBeDownloaded--,object.traverse(child=>{if(child instanceof THREE.Mesh){var zincGeometry=addMeshToZincGeometry(child,localTimeEnabled,localMorphColour);region.addZincObject(zincGeometry),zincGeometry.morph&&(zincGeometry.morph.name=groupName),zincGeometry.groupName=groupName,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(zincGeometry)}})},loadSurfaceURL=(region,url,timeEnabled,morphColour,groupName,finishCallback,options)=>{this.toBeDownloaded+=1;var colour=__webpack_require__(0).defaultMaterialColor,opacity=__webpack_require__(0).defaultOpacity,localTimeEnabled=0,isInline=!!(options&&options.isInline)&&options.isInline,fileFormat=options&&options.fileFormat?options.fileFormat:void 0,anatomicalId=options&&options.anatomicalId?options.anatomicalId:void 0,renderOrder=options&&options.renderOrder?options.renderOrder:void 0;timeEnabled!=null&&(localTimeEnabled=!!timeEnabled);var localMorphColour=0;morphColour!=null&&(localMorphColour=!!morphColour);var loader=primitivesLoader;if(fileFormat!==void 0)if("STL"==fileFormat)loader=new STLLoader;else if("OBJ"==fileFormat)return loader=new OBJLoader,loader.crossOrigin="Anonymous",void loader.load(url,objloader(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,anatomicalId,finishCallback),this.onProgress(i),this.onError);if(isInline){var object=primitivesLoader.parse(url);meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback)(object.geometry,object.materials)}else loader.crossOrigin="Anonymous",primitivesLoader.load(url,meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback),this.onProgress(i),this.onError(finishCallback))},metaFinishCallback=function(numberOfDownloaded,finishCallback,allCompletedCallback){var downloadedItem=0;return zincObject=>{if(++downloadedItem,zincObject&&null!=finishCallback&&"function"==typeof finishCallback){finishCallback(zincObject);var zincCameraControls=scene.getZincCameraControls();zincCameraControls&&zincCameraControls.calculateMaxAllowedDistance(scene)}downloadedItem==numberOfDownloaded&&(!1===viewLoaded&&scene.viewAll(),null!=allCompletedCallback&&"function"==typeof allCompletedCallback&&allCompletedCallback())}};/**
|
|
1085
|
+
*/this.loadLinesURL=(region,url,timeEnabled,morphColour,groupName,finishCallback,options)=>{var localTimeEnabled=0;this.toBeDownloaded+=1;var isInline=!!(options&&options.isInline)&&options.isInline,anatomicalId=options&&options.anatomicalId?options.anatomicalId:void 0,renderOrder=options&&options.renderOrder?options.renderOrder:void 0;null!=timeEnabled&&(localTimeEnabled=!!timeEnabled);var localMorphColour=0;if(null!=morphColour&&(localMorphColour=!!morphColour),isInline){var object=primitivesLoader.parse(url);linesloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback)(object.geometry,object.materials)}else primitivesLoader.load(url,linesloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback),this.onProgress(i),this.onError(finishCallback))};var loadGlyphset=(region,glyphsetData,glyphurl,groupName,finishCallback,options)=>{var isInline=options&&options.isInline?options.isInline:void 0,anatomicalId=options&&options.anatomicalId?options.anatomicalId:void 0,displayLabels=options&&options.displayLabels?options.displayLabels:void 0,renderOrder=options&&options.renderOrder?options.renderOrder:void 0,newGlyphset=new(__webpack_require__(14).Glyphset);newGlyphset.setDuration(scene.getDuration()),newGlyphset.groupName=groupName;var myCallback=()=>{--this.toBeDownloaded,finishCallback!=null&&"function"==typeof finishCallback&&finishCallback(newGlyphset)};++this.toBeDownloaded,isInline?newGlyphset.load(glyphsetData,glyphurl,myCallback,isInline,displayLabels):newGlyphset.load(glyphsetData,resolveURL(glyphurl),myCallback,isInline,displayLabels),newGlyphset.anatomicalId=anatomicalId,newGlyphset.setRenderOrder(renderOrder),region.addZincObject(newGlyphset)},onLoadGlyphsetReady=(region,xmlhttp,glyphurl,groupName,finishCallback,options)=>()=>{if(4==xmlhttp.readyState&&200==xmlhttp.status){var glyphsetData=JSON.parse(xmlhttp.responseText);loadGlyphset(region,glyphsetData,glyphurl,groupName,finishCallback,options)}},pointsetloader=(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback)=>(geometry,materials)=>{var newPointset=new(__webpack_require__(18).Pointset),material=new THREE.PointsMaterial({alphaTest:.5,size:10,sizeAttenuation:!1});materials&&materials[0]&&(1>materials[0].opacity&&(material.transparent=!0),material.opacity=materials[0].opacity,material.color=materials[0].color,material.morphTargets=localTimeEnabled,material.vertexColors=materials[0].vertexColors);var options={};options.localTimeEnabled=localTimeEnabled,options.localMorphColour=localMorphColour,newPointset&&(newPointset.createMesh(geometry,material,options),newPointset.setName(groupName),region.addZincObject(newPointset),newPointset.setDuration(scene.getDuration()),newPointset.setRenderOrder(renderOrder)),geometry.dispose(),--this.toBeDownloaded,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newPointset)};//Load a glyphset into this scene.
|
|
1086
|
+
this.loadSTL=(region,url,groupName,finishCallback)=>{this.toBeDownloaded+=1;var colour=__webpack_require__(0).defaultMaterialColor,opacity=__webpack_require__(0).defaultOpacity,loader=new STLLoader;loader.crossOrigin="Anonymous",loader.load(resolveURL(url),meshloader(region,colour,opacity,!1,!1,groupName,void 0,void 0,void 0,finishCallback))},this.loadOBJ=(region,url,groupName,finishCallback)=>{this.toBeDownloaded+=1;var colour=__webpack_require__(0).defaultMaterialColor,opacity=__webpack_require__(0).defaultOpacity,loader=new OBJLoader;loader.crossOrigin="Anonymous",loader.load(resolveURL(url),meshloader(region,colour,opacity,!1,!1,groupName,void 0,void 0,void 0,finishCallback))};/**
|
|
1023
1087
|
* Load a geometry into this scene, this is a subsequent called from
|
|
1024
1088
|
* {@link Zinc.Scene#loadMetadataURL}, although it can be used to read
|
|
1025
1089
|
* in geometry into the scene externally.
|
|
@@ -1031,13 +1095,15 @@ var objloader=(region,colour,opacity,localTimeEnabled,localMorphColour,groupName
|
|
|
1031
1095
|
* @param {STRING} fileFormat - name supported formats are STL, OBJ and JSON.
|
|
1032
1096
|
* @param {Function} finishCallback - Callback function which will be called
|
|
1033
1097
|
* once the geometry is succssfully loaded in.
|
|
1034
|
-
*/
|
|
1035
|
-
|
|
1098
|
+
*/var loadSurfaceURL=(region,url,timeEnabled,morphColour,groupName,finishCallback,options)=>{this.toBeDownloaded+=1;var colour=__webpack_require__(0).defaultMaterialColor,opacity=__webpack_require__(0).defaultOpacity,localTimeEnabled=0,isInline=!!(options&&options.isInline)&&options.isInline,fileFormat=options&&options.fileFormat?options.fileFormat:void 0,anatomicalId=options&&options.anatomicalId?options.anatomicalId:void 0,renderOrder=options&&options.renderOrder?options.renderOrder:void 0;timeEnabled!=null&&(localTimeEnabled=!!timeEnabled);var localMorphColour=0;morphColour!=null&&(localMorphColour=!!morphColour);var loader=primitivesLoader;if(fileFormat!==void 0)if("STL"==fileFormat)loader=new STLLoader;else if("OBJ"==fileFormat)return loader=new OBJLoader,loader.crossOrigin="Anonymous",void loader.load(url,meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,options,finishCallback),this.onProgress(i),this.onError);if(isInline){var object=primitivesLoader.parse(url);meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,options,finishCallback)(object.geometry,object.materials)}else loader.crossOrigin="Anonymous",primitivesLoader.load(url,meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,options,finishCallback),this.onProgress(i),this.onError(finishCallback))},metaFinishCallback=function(numberOfDownloaded,finishCallback,allCompletedCallback){var downloadedItem=0;return zincObject=>{if(++downloadedItem,zincObject&&null!=finishCallback&&"function"==typeof finishCallback){finishCallback(zincObject);var zincCameraControls=scene.getZincCameraControls();zincCameraControls&&zincCameraControls.calculateMaxAllowedDistance(scene)}downloadedItem==numberOfDownloaded&&(!1===viewLoaded&&scene.viewAll(),null!=allCompletedCallback&&"function"==typeof allCompletedCallback&&allCompletedCallback())}};//Object to keep track of number of items downloaded and when all items are downloaded
|
|
1099
|
+
//allCompletedCallback is called
|
|
1100
|
+
this.loadPointsetURL=(region,url,timeEnabled,morphColour,groupName,finishCallback,options)=>{var localTimeEnabled=0;this.toBeDownloaded+=1,timeEnabled!=null&&(localTimeEnabled=!!timeEnabled);var localMorphColour=0;morphColour!=null&&(localMorphColour=!!morphColour);var isInline=!!(options&&options.isInline)&&options.isInline,anatomicalId=options&&options.anatomicalId?options.anatomicalId:void 0,renderOrder=options&&options.renderOrder?options.renderOrder:void 0;if(isInline){var object=primitivesLoader.parse(url);pointsetloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback)(object.geometry,object.materials)}else primitivesLoader.load(url,pointsetloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback),this.onProgress(i),this.onError(finishCallback))},this.loadGlyphsetURL=(region,metaurl,glyphurl,groupName,finishCallback,options)=>{var isInline=!!(options&&options.isInline)&&options.isInline;if(isInline)loadGlyphset(region,metaurl,glyphurl,groupName,finishCallback,options);else{var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=onLoadGlyphsetReady(region,xmlhttp,glyphurl,groupName,finishCallback,options),xmlhttp.open("GET",resolveURL(metaurl),!0),xmlhttp.send()}},createZincGeometry=(region,geometryIn,colour,opacity,localTimeEnabled,localMorphColour,finishCallback,materialIn,groupName)=>{var newGeometry=new(__webpack_require__(2).Geometry);return newGeometry.createMesh(geometryIn,materialIn,{colour:colour,opacity:opacity,localTimeEnabled:localTimeEnabled,localMorphColour:localMorphColour}),newGeometry.getMorph()?(newGeometry.setName(groupName),region&®ion.addZincObject(newGeometry),newGeometry.setDuration(scene.getDuration()),null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newGeometry),newGeometry.videoHandler&&scene.setVideoHandler(newGeometry.videoHandler),newGeometry):void 0};//Internal loader for a regular zinc geometry.
|
|
1101
|
+
var meshloader=(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,options,finishCallback)=>(geometry,materials)=>{var material;materials&&materials[0]&&(material=materials[0]);var zincGeometry=createZincGeometry(region,geometry,colour,opacity,localTimeEnabled,localMorphColour,void 0,material,groupName,renderOrder);if(zincGeometry.anatomicalId=anatomicalId,zincGeometry.setRenderOrder(renderOrder),console.log(options),options.lod&&options.lod.levels)for(var[key,value]of Object.entries(options.lod.levels))zincGeometry.addLOD(primitivesLoader,key,value.URL,options.lod.preload);--this.toBeDownloaded,geometry.dispose(),null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(zincGeometry)},parseDuration=durationString=>{var regex=/P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/,[,years,months,weeks,days,hours,mins,secs]=durationString.match(regex);return{years:years,months:months,weeks:weeks,days:days,hours:hours,mins:mins,secs:secs}};//Turn ISO 8601 duration string into an array.
|
|
1036
1102
|
this.loadSettings=item=>{if(item){//duration uses the ISO 8601 standard - PnYnMnDTnHnMnS
|
|
1037
1103
|
if(item.Duration){var duration=parseDuration(item.Duration);scene.setDurationFromObject(duration)}if(item.OriginalDuration){var _duration=parseDuration(item.OriginalDuration);scene.setOriginalDurationFromObject(_duration)}if(item.TimeStamps)for(var key in item.TimeStamps){var time=parseDuration(item.TimeStamps[key]);scene.addMetadataTimeStamp(key,time)}}};//Function to process each of the graphical metadata item except for view and
|
|
1038
1104
|
//settings.
|
|
1039
|
-
var readPrimitivesItem=(region,referenceURL,item,order,finishCallback)=>{if(item){var _newURL=void 0,isInline=!1;item.URL?(_newURL=item.URL,referenceURL&&(_newURL=createNewURL(item.URL,referenceURL))):item.Inline&&(_newURL=item.Inline.URL,isInline=!0);var groupName=item.GroupName;(groupName===void 0||""===groupName)&&(groupName="_Unnamed");var options={isInline:isInline,fileFormat:item.FileFormat,anatomicalId:item.AnatomicalId,compression:item.compression,renderOrder:order};switch(item.Type){case"Surfaces":loadSurfaceURL(region,_newURL,item.MorphVertices,item.MorphColours,groupName,finishCallback,options);break;case"Glyph":var newGeometryURL;isInline?newGeometryURL=item.Inline.GlyphGeometriesURL:(newGeometryURL=item.GlyphGeometriesURL,newGeometryURL=createNewURL(item.GlyphGeometriesURL,referenceURL)),item.DisplayLabels&&(options.displayLabels=!0),this.loadGlyphsetURL(region,_newURL,newGeometryURL,groupName,finishCallback,options);break;case"Points":this.loadPointsetURL(region,_newURL,item.MorphVertices,item.MorphColours,groupName,finishCallback,options);break;case"Lines":this.loadLinesURL(region,_newURL,item.MorphVertices,item.MorphColours,groupName,finishCallback,options);break;default:}}},readViewAndSettingsItem=(referenceURL,item,finishCallback)=>{if(item){var _newURL2=void 0,isInline=!1;switch(item.URL?(_newURL2=item.URL,referenceURL&&(_newURL2=createNewURL(item.URL,referenceURL))):item.Inline&&(_newURL2=item.Inline.URL,isInline=!0),item.Type){case"View":isInline?(scene.setupMultipleViews("default",{default:_newURL2}),viewLoaded=!0,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback()):this.loadViewURL(_newURL2,finishCallback);break;case"Settings":this.loadSettings(item);break;default:}}};//Function to read the view item first
|
|
1040
|
-
this.loadGLTF=(region,url,finishCallback,options)=>{var GLTFToZincJSLoader=new(__webpack_require__(
|
|
1105
|
+
var readPrimitivesItem=(region,referenceURL,item,order,finishCallback)=>{if(item){var _newURL=void 0,isInline=!1;item.URL?(_newURL=item.URL,referenceURL&&(_newURL=createNewURL(item.URL,referenceURL))):item.Inline&&(_newURL=item.Inline.URL,isInline=!0);var lod={};if(item.LOD&&item.LOD.Levels){lod.preload=!!item.LOD.Preload,lod.levels={};for(var[key,value]of Object.entries(item.LOD.Levels))lod.levels[key]={},lod.levels[key].URL=createNewURL(value.URL,referenceURL)}var groupName=item.GroupName;(groupName===void 0||""===groupName)&&(groupName="_Unnamed");var options={isInline:isInline,fileFormat:item.FileFormat,anatomicalId:item.AnatomicalId,compression:item.compression,lod:lod,renderOrder:order};switch(item.Type){case"Surfaces":loadSurfaceURL(region,_newURL,item.MorphVertices,item.MorphColours,groupName,finishCallback,options);break;case"Glyph":var newGeometryURL;isInline?newGeometryURL=item.Inline.GlyphGeometriesURL:(newGeometryURL=item.GlyphGeometriesURL,newGeometryURL=createNewURL(item.GlyphGeometriesURL,referenceURL)),item.DisplayLabels&&(options.displayLabels=!0),this.loadGlyphsetURL(region,_newURL,newGeometryURL,groupName,finishCallback,options);break;case"Points":this.loadPointsetURL(region,_newURL,item.MorphVertices,item.MorphColours,groupName,finishCallback,options);break;case"Lines":this.loadLinesURL(region,_newURL,item.MorphVertices,item.MorphColours,groupName,finishCallback,options);break;default:}}},readViewAndSettingsItem=(referenceURL,item,finishCallback)=>{if(item){var _newURL2=void 0,isInline=!1;switch(item.URL?(_newURL2=item.URL,referenceURL&&(_newURL2=createNewURL(item.URL,referenceURL))):item.Inline&&(_newURL2=item.Inline.URL,isInline=!0),item.Type){case"View":isInline?(scene.setupMultipleViews("default",{default:_newURL2}),viewLoaded=!0,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback()):this.loadViewURL(_newURL2,finishCallback);break;case"Settings":this.loadSettings(item);break;default:}}};//Function to read the view item first
|
|
1106
|
+
this.loadGLTF=(region,url,finishCallback,options)=>{var GLTFToZincJSLoader=new(__webpack_require__(36).GLTFToZincJSLoader);GLTFToZincJSLoader.load(scene,region,url,finishCallback,options)};var loadRegions=(currentRegion,referenceURL,regions,callback)=>{if(regions.Primitives&®ions.Primitives.forEach(primitive=>{var order=1;primitive.Order&&(order=primitive.Order),readPrimitivesItem(currentRegion,referenceURL,primitive,order,callback)}),regions.Transformation&¤tRegion.setTransformation(regions.Transformation),regions.Children)for(var[regionName,value]of Object.entries(regions.Children)){var childRegion=currentRegion.findOrCreateChildFromPath(regionName);childRegion&&loadRegions(childRegion,referenceURL,value,callback)}},getNumberOfDownloadsInArray=(array,includeViews)=>{if(Array.isArray(array)){for(var count=0,_i3=0;_i3<array.length;_i3++)array[_i3].Type&&(includeViews&&"View"===array[_i3].Type||"Surfaces"===array[_i3].Type||"Glyph"===array[_i3].Type||"Points"===array[_i3].Type||"Lines"===array[_i3].Type)&&count++;return count}return 0},getNumberOfObjectsInRegions=regionJson=>{var counts=regionJson.Primitives?getNumberOfDownloadsInArray(regionJson.Primitives,!1):0;return regionJson.Children&&Object.values(regionJson.Children).forEach(childRegion=>{counts+=getNumberOfObjectsInRegions(childRegion)}),counts},getNumberOfObjects=metadata=>{if(Array.isArray(metadata))return getNumberOfDownloadsInArray(metadata,!0);return"object"==typeof metadata&&null!==metadata&&"2.0"===metadata.Version?getNumberOfObjectsInRegions(metadata.Regions):void 0},readVersionOneRegionPath=(region,referenceURL,item,order,callback)=>{var targetRegion=region;//Render order is set to i * 2 to account for front and back rendering
|
|
1041
1107
|
item.RegionPath&&""!==item.RegionPath&&(targetRegion=region.findOrCreateChildFromPath(item.RegionPath)),readPrimitivesItem(targetRegion,referenceURL,item,2*order,callback)},loadVersionOne=(targetRegion,metadata,referenceURL,finishCallback,allCompletedCallback)=>{// Prioritise the view file and settings before loading anything else
|
|
1042
1108
|
for(var numberOfObjects=getNumberOfObjects(metadata),callback=new metaFinishCallback(numberOfObjects,finishCallback,allCompletedCallback),_i4=0;_i4<metadata.length;_i4++)readViewAndSettingsItem(referenceURL,metadata[_i4],callback);for(var _i5=0;_i5<metadata.length;_i5++)readVersionOneRegionPath(targetRegion,referenceURL,metadata[_i5],_i5,callback)},loadVersionTwo=(targetRegion,metadata,referenceURL,finishCallback,allCompletedCallback)=>{var numberOfObjects=getNumberOfObjects(metadata),callback=new metaFinishCallback(numberOfObjects,finishCallback,allCompletedCallback);// view file does not receive callback
|
|
1043
1109
|
metadata.Settings&&this.loadSettings(metadata.Settings),metadata.Views&&loadMultipleViews(referenceURL,metadata.Views,referenceURL),metadata.Regions&&loadRegions(targetRegion,referenceURL,metadata.Regions,callback)};/**
|
|
@@ -1050,7 +1116,7 @@ metadata.Settings&&this.loadSettings(metadata.Settings),metadata.Views&&loadMult
|
|
|
1050
1116
|
*/this.loadMetadataURL=(targetRegion,url,finishCallback,allCompletedCallback)=>{var xmlhttp=new XMLHttpRequest,requestURL=resolveURL(url);xmlhttp.onreadystatechange=()=>{if(4==xmlhttp.readyState&&200==xmlhttp.status){scene.resetMetadata(),scene.resetDuration(),viewLoaded=!1;var referenceURL=xmlhttp.responseURL;referenceURL===void 0&&(referenceURL=new URL(requestURL).href);var metadata=JSON.parse(xmlhttp.responseText);Array.isArray(metadata)?loadVersionOne(targetRegion,metadata,referenceURL,finishCallback,allCompletedCallback):"object"==typeof metadata&&null!==metadata&&"2.0"==metadata.Version&&loadVersionTwo(targetRegion,metadata,referenceURL,finishCallback,allCompletedCallback)}},xmlhttp.open("GET",requestURL,!0),xmlhttp.send()}};
|
|
1051
1117
|
|
|
1052
1118
|
/***/ }),
|
|
1053
|
-
/*
|
|
1119
|
+
/* 33 */
|
|
1054
1120
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1055
1121
|
|
|
1056
1122
|
"use strict";
|
|
@@ -1125,7 +1191,7 @@ for(var r,g,b,colors,defaultR,defaultG,defaultB,alpha,reader=new DataView(data),
|
|
|
1125
1191
|
1!==normalCountPerFace&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+faceCounter),3!=vertexCountPerFace&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+faceCounter),faceCounter++}var start=startVertex,count=endVertex-startVertex;geometry.addGroup(start,count,groupCount),groupCount++}return geometry.setAttribute("position",new three__WEBPACK_IMPORTED_MODULE_0__["Float32BufferAttribute"](vertices,3)),geometry.setAttribute("normal",new three__WEBPACK_IMPORTED_MODULE_0__["Float32BufferAttribute"](normals,3)),geometry}(function(buffer){return"string"==typeof buffer?buffer:three__WEBPACK_IMPORTED_MODULE_0__["LoaderUtils"].decodeText(new Uint8Array(buffer))}(data))}}
|
|
1126
1192
|
|
|
1127
1193
|
/***/ }),
|
|
1128
|
-
/*
|
|
1194
|
+
/* 34 */
|
|
1129
1195
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1130
1196
|
|
|
1131
1197
|
"use strict";
|
|
@@ -1188,34 +1254,34 @@ var mesh=void 0;if(1<createdMaterials.length){for(var _sourceMaterial,_mi=0,_miL
|
|
|
1188
1254
|
if(0<state.vertices.length){var _material2=new three__WEBPACK_IMPORTED_MODULE_0__["PointsMaterial"]({size:1,sizeAttenuation:!1}),_buffergeometry=new three__WEBPACK_IMPORTED_MODULE_0__["BufferGeometry"];_buffergeometry.setAttribute("position",new three__WEBPACK_IMPORTED_MODULE_0__["Float32BufferAttribute"](state.vertices,3)),0<state.colors.length&&void 0!==state.colors[0]&&(_buffergeometry.setAttribute("color",new three__WEBPACK_IMPORTED_MODULE_0__["Float32BufferAttribute"](state.colors,3)),_material2.vertexColors=!0);var points=new three__WEBPACK_IMPORTED_MODULE_0__["Points"](_buffergeometry,_material2);container.add(points)}return container}}
|
|
1189
1255
|
|
|
1190
1256
|
/***/ }),
|
|
1191
|
-
/*
|
|
1257
|
+
/* 35 */
|
|
1192
1258
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1193
1259
|
|
|
1194
|
-
var JSONLoader=__webpack_require__(
|
|
1260
|
+
var JSONLoader=__webpack_require__(15).JSONLoader;exports.PrimitivesLoader=function(){var concurrentDownloads=0;this.crossOrigin="Anonymous";var loader=new JSONLoader,waitingList=[];this.load=(url,onLoad,onProgress,onError)=>{if(20>concurrentDownloads){++concurrentDownloads,loader.crossOrigin=this.crossOrigin;var onLoadCallback=new onFinally(onLoad,this),onErrorCallback=new onFinally(onError,this);loader.load(url,onLoadCallback,onProgress,onErrorCallback)}else waitingList.push({url,onLoad,onProgress,onError})},this.loadFromWaitingList=()=>{var item=waitingList.shift();item&&this.load(item.url,item.onLoad,item.onProgress,item.onError)};var onFinally=function(callback,loader){return function(){--concurrentDownloads,callback&&callback(...arguments),loader.loadFromWaitingList()}};this.parse=data=>loader.parse(data)};
|
|
1195
1261
|
|
|
1196
1262
|
/***/ }),
|
|
1197
|
-
/*
|
|
1263
|
+
/* 36 */
|
|
1198
1264
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1199
1265
|
|
|
1200
|
-
var THREE=__webpack_require__(3),GLTFLoader=__webpack_require__(
|
|
1266
|
+
var THREE=__webpack_require__(3),GLTFLoader=__webpack_require__(37).GLTFLoader,GLTFToZincJSLoader=function(){var _this=this;/**
|
|
1201
1267
|
* Load GLTF into this scene object.
|
|
1202
1268
|
*
|
|
1203
1269
|
* @param {String} url - URL to the GLTF file
|
|
1204
1270
|
* @param {Function} finishCallback - Callback function which will be called
|
|
1205
1271
|
* once the glyphset is succssfully load in.
|
|
1206
|
-
*/this.parseGLTFObjects=(object,region,depth,finishCallback)=>{var childRegion=region;if(0!==depth)if("Object3D"!==object.type){var zincGeometry;if("Mesh"===object.type?zincGeometry=new(__webpack_require__(2).Geometry):"LineSegments"===object.type?zincGeometry=new(__webpack_require__(
|
|
1272
|
+
*/this.parseGLTFObjects=(object,region,depth,finishCallback)=>{var childRegion=region;if(0!==depth)if("Object3D"!==object.type){var zincGeometry;if("Mesh"===object.type?zincGeometry=new(__webpack_require__(2).Geometry):"LineSegments"===object.type?zincGeometry=new(__webpack_require__(21).Lines):"Points"===object.type&&(zincGeometry=new(__webpack_require__(18).Pointset)),zincGeometry){var localTimeEnabled=!1,localMorphColour=!1;object.geometry&&object.geometry.morphAttributes&&(localTimeEnabled=!!object.geometry.morphAttributes.position,localMorphColour=!!object.geometry.morphAttributes.color),zincGeometry.setMesh(object.clone(),localTimeEnabled,localMorphColour),region.addZincObject(zincGeometry);var morph=zincGeometry.getMorph();zincGeometry.groupName=morph.name,morph.matrixAutoUpdate=!0,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(zincGeometry)}}else if(""!==object.name&&(region&&(childRegion=region.findOrCreateChildFromPath(object.name)),childRegion)){var group=childRegion.getGroup();group.position.copy(object.position),group.rotation.copy(object.rotation),group.quaternion.copy(object.quaternion),group.matrixAutoUpdate=!0}depth++,object.children.forEach(child=>{_this.parseGLTFObjects(child,childRegion,depth,finishCallback)})},this.setCamera=scene=>{scene.viewAll();var cameraControls=scene.getZincCameraControls(),viewport=cameraControls.getCurrentViewport();cameraControls.addViewport("default",viewport),cameraControls.setDefaultViewport("default")},this.load=(scene,region,url,finishCallback,allCompletedCallback)=>{var path=url.substring(0,url.lastIndexOf("/")+1),filename=url.substring(url.lastIndexOf("/")+1,url.length),loader=new GLTFLoader().setPath(path);loader.load(filename,function(gltf){console.log(gltf),_this.parseGLTFObjects(gltf.scene,region,0,finishCallback),_this.setCamera(scene),allCompletedCallback!=null&&"function"==typeof allCompletedCallback&&allCompletedCallback()})}};exports.GLTFToZincJSLoader=GLTFToZincJSLoader;
|
|
1207
1273
|
|
|
1208
1274
|
/***/ }),
|
|
1209
|
-
/*
|
|
1275
|
+
/* 37 */
|
|
1210
1276
|
/***/ (function(module, exports) {
|
|
1211
1277
|
|
|
1212
1278
|
module.exports = require("three/examples/jsm/loaders/GLTFLoader");
|
|
1213
1279
|
|
|
1214
1280
|
/***/ }),
|
|
1215
|
-
/*
|
|
1281
|
+
/* 38 */
|
|
1216
1282
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1217
1283
|
|
|
1218
|
-
var GLTFExporter=__webpack_require__(
|
|
1284
|
+
var GLTFExporter=__webpack_require__(39).GLTFExporter,SceneExporter=function(sceneIn){var scene=sceneIn;this.exportGLTF=binary=>{var rootRegion=scene.getRootRegion(),zincObjects=rootRegion.getAllObjects(!0),animations=[];zincObjects.forEach(zincObject=>{zincObject.animationClip&&animations.push({clip:zincObject.animationClip[0],mesh:zincObject.getMorph()})});var exporter=new GLTFExporter,options={binary,animations};return new Promise(resolve=>{exporter.parse(scene.getThreeJSScene(),function(gltf){resolve(gltf)},options)})}};/**
|
|
1219
1285
|
* Provides an object which uses for exporting the scene
|
|
1220
1286
|
*
|
|
1221
1287
|
* @class
|
|
@@ -1224,7 +1290,7 @@ var GLTFExporter=__webpack_require__(38).GLTFExporter,SceneExporter=function(sce
|
|
|
1224
1290
|
*/exports.SceneExporter=SceneExporter;
|
|
1225
1291
|
|
|
1226
1292
|
/***/ }),
|
|
1227
|
-
/*
|
|
1293
|
+
/* 39 */
|
|
1228
1294
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1229
1295
|
|
|
1230
1296
|
"use strict";
|
|
@@ -1457,10 +1523,10 @@ for(var _j2=0;_j2<mergedTrack.times.length;_j2++)mergedTrack.values[_j2*targetCo
|
|
|
1457
1523
|
for(var keyframeIndex,_j3=0;_j3<sourceTrack.times.length;_j3++)keyframeIndex=this.insertKeyframe(mergedTrack,sourceTrack.times[_j3]),mergedTrack.values[keyframeIndex*targetCount+targetIndex]=sourceTrack.values[_j3]}return clip.tracks=tracks,clip}};
|
|
1458
1524
|
|
|
1459
1525
|
/***/ }),
|
|
1460
|
-
/*
|
|
1526
|
+
/* 40 */
|
|
1461
1527
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1462
1528
|
|
|
1463
|
-
var THREE=__webpack_require__(3),resolveURL=__webpack_require__(
|
|
1529
|
+
var THREE=__webpack_require__(3),resolveURL=__webpack_require__(4).resolveURL,Viewport=function(){this.nearPlane=.168248,this.farPlane=6.82906,this.eyePosition=[.5,-2.86496,.5],this.targetPosition=[.5,.5,.5],this.upVector=[0,0,1];var _this=this;this.setFromObject=(_ref)=>{var{nearPlane,farPlane,eyePosition,targetPosition,upVector}=_ref;_this.nearPlane=nearPlane,_this.farPlane=farPlane,_this.eyePosition=eyePosition,_this.targetPosition=targetPosition,_this.upVector=upVector}},CameraControls=function(object,domElement,renderer,scene){var MODE={NONE:-1,DEFAULT:0,PATH:1,SMOOTH_CAMERA_TRANSITION:2,AUTO_TUMBLE:3,ROTATE_TRANSITION:4,MINIMAP:5,SYNC_CONTROL:6},STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM:4,TOUCH_PAN:5,SCROLL:6},ROTATE_DIRECTION={NONE:-1,FREE:1,HORIZONTAL:2,VERTICAL:3},CLICK_ACTION={};/**
|
|
1464
1530
|
* Actions states.
|
|
1465
1531
|
* Available states are NONE, ROTATE, ZOOM, PAN, TOUCH_ROTATE, TOUCH_ZOOM, TOUCH_PAN and SCROLL.
|
|
1466
1532
|
* @property {Object}
|
|
@@ -1626,7 +1692,7 @@ setObjectQuaternion(scope.object,alpha,beta,gamma,orient)}},this.dispose=functio
|
|
|
1626
1692
|
this.setCurrentCameraSettings=(cameraIn,defaultViewportIn)=>{camera=cameraIn.clone(),targetCamera=cameraIn,defaultViewport=defaultViewportIn,camera.near=defaultViewport.nearPlane,defaultViewport.farPlane&&(camera.far=defaultViewport.farPlane),defaultViewport.eyePosition&&camera.position.set(defaultViewport.eyePosition[0],defaultViewport.eyePosition[1],defaultViewport.eyePosition[2]),defaultViewport.upVector&&camera.up.set(defaultViewport.upVector[0],defaultViewport.upVector[1],defaultViewport.upVector[2]),defaultViewport.targetPosition&&(camera.target=new THREE.Vector3(defaultViewport.targetPosition[0],defaultViewport.targetPosition[1],defaultViewport.targetPosition[2]),camera.lookAt(camera.target)),camera.updateProjectionMatrix(),position.copy(camera.position).project(camera),target.copy(camera.target).project(camera)},this.getCurrentPosition=()=>(target.copy(targetCamera.target).project(camera),[target.x,target.y]),this.zoom=delta=>{var zoom=Math.max(targetCamera.zoom-.002*delta,1);targetCamera.zoom=zoom,targetCamera.updateProjectionMatrix()},this.zoomToBox=(box,zoom)=>{box.getCenter(v1),v1.project(camera),this.setCenterZoom([v1.x,v1.y],zoom)},this.getPanZoom=()=>({target:this.getCurrentPosition(),zoom:targetCamera.zoom}),this.setCenterZoom=(center,zoom)=>{v1.set(center[0],center[1],target.z).unproject(camera),v2.copy(v1).sub(targetCamera.target),targetCamera.target.copy(v1),targetCamera.lookAt(targetCamera.target),targetCamera.position.add(v2),targetCamera.zoom=zoom,targetCamera.updateProjectionMatrix()},this.setEventCallback=callback=>{(callback===void 0||"function"==typeof callback)&&(eventCallback=callback)},this.triggerCallback=()=>{eventCallback!==void 0&&"function"==typeof eventCallback&&eventCallback()}};exports.Viewport=Viewport,exports.CameraControls=CameraControls,exports.SmoothCameraTransition=SmoothCameraTransition,exports.RotateCameraTransition=RotateCameraTransition,exports.RayCaster=RayCaster,exports.CameraAutoTumble=CameraAutoTumble,exports.StereoEffect=StereoEffect,exports.NDCCameraControl=NDCCameraControl;
|
|
1627
1693
|
|
|
1628
1694
|
/***/ }),
|
|
1629
|
-
/*
|
|
1695
|
+
/* 41 */
|
|
1630
1696
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1631
1697
|
|
|
1632
1698
|
var{Group,Matrix4}=__webpack_require__(3),uniqueiId=0,getUniqueId=function(){return"re"+uniqueiId++},Region=function(parentIn){var parent=parentIn,group=new Group;group.matrixAutoUpdate=!1,group.userData=this;var children=[],name="",zincObjects=[],tMatrix=new Matrix4,duration=3e3;/**
|
|
@@ -1869,12 +1935,12 @@ var{Group,Matrix4}=__webpack_require__(3),uniqueiId=0,getUniqueId=function(){ret
|
|
|
1869
1935
|
*/ /**
|
|
1870
1936
|
* Update geometries and glyphsets based on the calculated time.
|
|
1871
1937
|
* @private
|
|
1872
|
-
*/tMatrix.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this.pickableUpdateRequired=!0,this.isRegion=!0,this.uuid=getUniqueId(),this.hideAllPrimitives=()=>{children.forEach(child=>child.hideAllPrimitives()),zincObjects.forEach(zincObject=>zincObject.setVisibility(!1))},this.showAllPrimitives=()=>{children.forEach(child=>child.showAllPrimitives()),zincObjects.forEach(zincObject=>zincObject.setVisibility(!0))},this.setVisibility=flag=>{group.visible=flag},this.getVisibility=()=>group.visible,this.getGroup=()=>group,this.setTransformation=transformation=>{tMatrix.set(...transformation),group.matrix.copy(tMatrix),group.updateMatrixWorld()},this.setName=nameIn=>{nameIn&&""!==nameIn&&(name=nameIn)},this.getName=()=>name,this.getParent=()=>parent,this.getFullSeparatedPath=()=>{var paths=[];if(""!==name){paths.push(name);for(var parentName,p=parent;p!==void 0;)parentName=p.getName(),""!==parentName&&paths.unshift(parentName),p=p.getParent()}return paths},this.getFullPath=()=>{var paths=this.getFullSeparatedPath();if(0<paths.length){var fullPath=paths.shift();return paths.forEach(path=>{fullPath=fullPath.concat("/",path)}),fullPath}return""},this.createChild=nameIn=>{var childRegion=new Region(this);return childRegion.setName(nameIn),children.push(childRegion),group.add(childRegion.getGroup()),childRegion},this.getChildWithName=childName=>{if(childName)for(var lowerChildName=childName.toLowerCase(),i=0;i<children.length;i++)if(children[i].getName().toLowerCase()===lowerChildName)return children[i]},this.findChildFromSeparatedPath=pathArray=>{if(pathArray&&0<pathArray.length&&""===pathArray[0]&&pathArray.shift(),pathArray&&0<pathArray.length){var childRegion=this.getChildWithName(pathArray[0]);return childRegion?(pathArray.shift(),childRegion.findChildFromSeparatedPath(pathArray)):void 0}return this},this.findChildFromPath=path=>{var pathArray=path.split("/");return this.findChildFromSeparatedPath(pathArray)},this.createChildFromSeparatedPath=pathArray=>{if(0<pathArray.length&&""===pathArray[0]&&pathArray.shift(),0<pathArray.length){var childRegion=this.getChildWithName(pathArray[0]);return childRegion||(childRegion=this.createChild(pathArray[0])),pathArray.shift(),childRegion.createChildFromSeparatedPath(pathArray)}return this},this.createChildFromPath=path=>{var pathArray=path.split("/");return this.createChildFromSeparatedPath(pathArray)},this.findOrCreateChildFromPath=path=>{var childRegion=this.findChildFromPath(path);return childRegion||(childRegion=this.createChildFromPath(path)),childRegion},this.addZincObject=zincObject=>{zincObject&&(zincObject.setRegion(this),group.add(zincObject.
|
|
1938
|
+
*/tMatrix.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this.pickableUpdateRequired=!0,this.isRegion=!0,this.uuid=getUniqueId(),this.hideAllPrimitives=()=>{children.forEach(child=>child.hideAllPrimitives()),zincObjects.forEach(zincObject=>zincObject.setVisibility(!1))},this.showAllPrimitives=()=>{children.forEach(child=>child.showAllPrimitives()),zincObjects.forEach(zincObject=>zincObject.setVisibility(!0))},this.setVisibility=flag=>{group.visible=flag},this.getVisibility=()=>group.visible,this.getGroup=()=>group,this.setTransformation=transformation=>{tMatrix.set(...transformation),group.matrix.copy(tMatrix),group.updateMatrixWorld()},this.setName=nameIn=>{nameIn&&""!==nameIn&&(name=nameIn)},this.getName=()=>name,this.getParent=()=>parent,this.getFullSeparatedPath=()=>{var paths=[];if(""!==name){paths.push(name);for(var parentName,p=parent;p!==void 0;)parentName=p.getName(),""!==parentName&&paths.unshift(parentName),p=p.getParent()}return paths},this.getFullPath=()=>{var paths=this.getFullSeparatedPath();if(0<paths.length){var fullPath=paths.shift();return paths.forEach(path=>{fullPath=fullPath.concat("/",path)}),fullPath}return""},this.createChild=nameIn=>{var childRegion=new Region(this);return childRegion.setName(nameIn),children.push(childRegion),group.add(childRegion.getGroup()),childRegion},this.getChildWithName=childName=>{if(childName)for(var lowerChildName=childName.toLowerCase(),i=0;i<children.length;i++)if(children[i].getName().toLowerCase()===lowerChildName)return children[i]},this.findChildFromSeparatedPath=pathArray=>{if(pathArray&&0<pathArray.length&&""===pathArray[0]&&pathArray.shift(),pathArray&&0<pathArray.length){var childRegion=this.getChildWithName(pathArray[0]);return childRegion?(pathArray.shift(),childRegion.findChildFromSeparatedPath(pathArray)):void 0}return this},this.findChildFromPath=path=>{var pathArray=path.split("/");return this.findChildFromSeparatedPath(pathArray)},this.createChildFromSeparatedPath=pathArray=>{if(0<pathArray.length&&""===pathArray[0]&&pathArray.shift(),0<pathArray.length){var childRegion=this.getChildWithName(pathArray[0]);return childRegion||(childRegion=this.createChild(pathArray[0])),pathArray.shift(),childRegion.createChildFromSeparatedPath(pathArray)}return this},this.createChildFromPath=path=>{var pathArray=path.split("/");return this.createChildFromSeparatedPath(pathArray)},this.findOrCreateChildFromPath=path=>{var childRegion=this.findChildFromPath(path);return childRegion||(childRegion=this.createChildFromPath(path)),childRegion},this.addZincObject=zincObject=>{zincObject&&(zincObject.setRegion(this),group.add(zincObject.getGroup()),zincObjects.push(zincObject),this.pickableUpdateRequired=!0)},this.removeZincObject=zincObject=>{for(var i=0;i<zincObjects.length;i++)if(zincObject===zincObjects[i])return group.remove(zincObject.getGroup()),zincObjects.splice(i,1),void zincObject.dispose()},this.checkPickableUpdateRequred=transverse=>{if(this.pickableUpdateRequired)return!0;if(transverse)for(var flag=!1,i=0;i<children.length;i++)if(flag=children[i].checkPickableUpdateRequred(transverse),flag)return!0;return!1},this.getPickableThreeJSObjects=(objectsList,transverse)=>(zincObjects.forEach(zincObject=>{if(zincObject.getGroup()&&zincObject.getGroup().visible){var marker=zincObject.marker;marker&&marker.isEnabled()&&objectsList.push(marker.getMorph()),objectsList.push(zincObject.getGroup())}}),transverse&&children.forEach(childRegion=>{childRegion.getPickableThreeJSObjects(objectsList,transverse)}),this.pickableUpdateRequired=!1,objectsList),this.setDuration=durationIn=>{duration=durationIn,zincObjects.forEach(zincObject=>zincObject.setDuration(durationIn)),children.forEach(childRegion=>childRegion.setDuration(durationIn))},this.getDuration=()=>duration,this.getBoundingBox=transverse=>{var boundingBox1,boundingBox2;return zincObjects.forEach(zincObject=>{boundingBox2=zincObject.getBoundingBox(),boundingBox2&&(null==boundingBox1?boundingBox1=boundingBox2.clone():boundingBox1.union(boundingBox2))}),transverse&&children.forEach(childRegion=>{boundingBox2=childRegion.getBoundingBox(transverse),boundingBox2&&(null==boundingBox1?boundingBox1=boundingBox2.clone():boundingBox1.union(boundingBox2))}),boundingBox1},this.clear=transverse=>{transverse&&children.forEach(childRegion=>childRegion.clear(transverse)),zincObjects.forEach(zincObject=>{group.remove(zincObject.getMorph()),zincObject.dispose()}),children=[],zincObjects=[]},this.objectIsInRegion=(zincObject,transverse)=>{for(var i=0;i<zincObjects.length;i++)if(zincObject===zincObjects[i])return!0;if(transverse)for(var _i=0;_i<children.length;_i++)if(children[_i].objectIsInRegion(zincObject,transverse))return!0;return!1},this.forEachGeometry=(callbackFunction,transverse)=>{zincObjects.forEach(zincObject=>{zincObject.isGeometry&&callbackFunction(zincObject)}),transverse&&children.forEach(childRegion=>childRegion.forEachGeometry(callbackFunction,transverse))},this.forEachGlyphset=(callbackFunction,transverse)=>{zincObjects.forEach(zincObject=>{zincObject.isGlyphset&&callbackFunction(zincObject)}),transverse&&children.forEach(childRegion=>childRegion.forEachGlyphset(callbackFunction,transverse))},this.forEachPointset=(callbackFunction,transverse)=>{zincObjects.forEach(zincObject=>{zincObject.isPointset&&callbackFunction(zincObject)}),transverse&&children.forEach(childRegion=>childRegion.forEachPointset(callbackFunction,transverse))},this.forEachLine=(callbackFunction,transverse)=>{zincObjects.forEach(zincObject=>{zincObject.isLines&&callbackFunction(zincObject)}),transverse&&children.forEach(childRegion=>childRegion.forEachLine(callbackFunction,transverse))},this.findObjectsWithAnatomicalId=(anatomicalId,transverse)=>(zincObjects.forEach(zincObject=>{zincObject.anatomicalId===anatomicalId&&objectsArray.push(zincObject)}),transverse&&children.forEach(childRegion=>{var childObjects=childRegion.findObjectsWithAnatomicalId(anatomicalId,transverse);objectsArray.push(...childObjects)}),objectsArray),this.findObjectsWithGroupName=(groupName,transverse)=>{var objectsArray=[];return zincObjects.forEach(zincObject=>{var lowerObjectName=zincObject.groupName?zincObject.groupName.toLowerCase():zincObject.groupName,lowerGroupName=groupName?groupName.toLowerCase():groupName;lowerObjectName===lowerGroupName&&objectsArray.push(zincObject)}),transverse&&children.forEach(childRegion=>{var childObjects=childRegion.findObjectsWithGroupName(groupName,transverse);objectsArray.push(...childObjects)}),objectsArray},this.findGeometriesWithGroupName=(groupName,transverse)=>{var primitivesArray=this.findObjectsWithGroupName(groupName,transverse),geometriesArray=primitivesArray.filter(primitive=>primitive.isGeometry);return geometriesArray},this.findPointsetsWithGroupName=(groupName,transverse)=>{var primitivesArray=this.findObjectsWithGroupName(groupName,transverse),pointsetsArray=primitivesArray.filter(primitive=>primitive.isPointset);return pointsetsArray},this.findGlyphsetsWithGroupName=(groupName,transverse)=>{var primitivesArray=this.findObjectsWithGroupName(groupName,transverse),glyphsetsArray=primitivesArray.filter(primitive=>primitive.isGlyphset);return glyphsetsArray},this.findLinesWithGroupName=(groupName,transverse)=>{var primitivesArray=this.findObjectsWithGroupName(groupName,transverse),linesArray=primitivesArray.filter(primitive=>primitive.isLines);return linesArray},this.getAllObjects=transverse=>{var objectsArray=[...zincObjects];return transverse&&children.forEach(childRegion=>{var childObjects=childRegion.getAllObjects(transverse);objectsArray.push(...childObjects)}),objectsArray},this.getChildRegions=transverse=>{var objectsArray=[...children];return transverse&&children.forEach(childRegion=>{var childObjects=childRegion.getChildRegions(transverse);objectsArray.push(...childObjects)}),objectsArray},this.getCurrentTime=()=>{if(zincObjects[0]!=null)return zincObjects[0].getCurrentTime();for(var time,i=0;i<children.length;i++)if(time=children[i].getCurrentTime(),-1!==time)return time;return-1},this.setMorphTime=(time,transverse)=>{zincObjects.forEach(zincObject=>{zincObject.setMorphTime(time)}),transverse&&children.forEach(childRegion=>{childRegion.setMorphTime(time)})},this.isTimeVarying=()=>{for(var i=0;i<zincObjects.length;i++)if(zincObjects[i].isTimeVarying())return!0;for(var _i2=0;_i2<children.length;_i2++)if(children[_i2].isTimeVarying())return!0;return!1},this.renderGeometries=(playRate,delta,playAnimation,cameraControls,options,transverse)=>{// Let video dictates the progress if one is present
|
|
1873
1939
|
var allObjects=this.getAllObjects(transverse);//process markers visibility and size
|
|
1874
|
-
if(allObjects.forEach(zincObject=>{zincObject.render(playRate*delta,playAnimation,options)}),options&&options.displayMarkers&&!1===playAnimation&&0<options.markerDepths.length){var min=Math.min(...options.markerDepths),max=Math.max(...options.markerDepths);allObjects.forEach(zincObject=>{zincObject.processMarkerVisual(min,max,options)})}}};exports.Region=Region;
|
|
1940
|
+
if(allObjects.forEach(zincObject=>{zincObject.render(playRate*delta,playAnimation,cameraControls,options)}),options&&options.displayMarkers&&!1===playAnimation&&0<options.markerDepths.length){var min=Math.min(...options.markerDepths),max=Math.max(...options.markerDepths);allObjects.forEach(zincObject=>{zincObject.processMarkerVisual(min,max,options)})}}};exports.Region=Region;
|
|
1875
1941
|
|
|
1876
1942
|
/***/ }),
|
|
1877
|
-
/*
|
|
1943
|
+
/* 42 */
|
|
1878
1944
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1879
1945
|
|
|
1880
1946
|
var THREE=__webpack_require__(3);/**
|
|
@@ -1888,14 +1954,14 @@ var THREE=__webpack_require__(3);/**
|
|
|
1888
1954
|
var diameter=boundingBox.min.distanceTo(boundingBox.max),radius=diameter/2,centreX=(boundingBox.min.x+boundingBox.max.x)/2,centreY=(boundingBox.min.y+boundingBox.max.y)/2,centreZ=(boundingBox.min.z+boundingBox.max.z)/2,viewport=cameraControl.getViewportFromCentreAndRadius(centreX,centreY,centreZ,radius,40,radius*4);setCurrentCameraSettings(diameter,viewport)}}};
|
|
1889
1955
|
|
|
1890
1956
|
/***/ }),
|
|
1891
|
-
/*
|
|
1957
|
+
/* 43 */
|
|
1892
1958
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1893
1959
|
|
|
1894
|
-
var THREE=__webpack_require__(3),ThreeBSP=__webpack_require__(
|
|
1895
|
-
var host;hostIn&&hostIn.isGeometry&&(host=hostIn);var core=void 0,worker=void 0,onProgress=!1,myResolve=void 0,createGeometryFromJSON=json=>{var material=host.
|
|
1960
|
+
var THREE=__webpack_require__(3),ThreeBSP=__webpack_require__(44)(THREE),Geometry=__webpack_require__(2).Geometry,work=__webpack_require__(45),Promise=__webpack_require__(46).default,JSONLoader=THREE.BufferGeometryLoader,GeometryCSG=function(hostIn){//ZincGeoemtry of the main geometry
|
|
1961
|
+
var host;hostIn&&hostIn.isGeometry&&(host=hostIn);var core=void 0,worker=void 0,onProgress=!1,myResolve=void 0,createGeometryFromJSON=json=>{var material=host.getMorph().material.clone();material.morphTargets=!1;var newGeometry=new Geometry,JSONParser=new JSONLoader,geometry=JSONParser.parse(json),mesh=new THREE.Mesh(geometry.geometry,material);return newGeometry.geometry=mesh.geometry,mesh.userData=newGeometry,newGeometry.setMorph(mesh),newGeometry},workerEventHandler=ev=>{switch(ev.data.action){case"message":console.log(ev.data.message);break;case"result":var csg=new GeometryCSG(createGeometryFromJSON(ev.data.object));myResolve&&myResolve(csg),myResolve=void 0,onProgress=!1;break;default:throw"Cannot handle specified action.";}},initialise=hostIn=>{if(void 0!==work&&(worker=work(/*require.resolve*/(47))),!worker)core=new(__webpack_require__(48).GeometryCSGInternal)(hostIn);else if(hostIn&&hostIn.isGeometry){var mesh=hostIn.getMorph(),json=mesh.geometry.clone().applyMatrix(mesh.matrix).toJSON();worker.addEventListener("message",function(ev){workerEventHandler(ev)}),worker.postMessage({action:"initialise",object:json})}};this.getHostGeometry=()=>{var tempCSG=new ThreeBSP(host.getMorph());return new createZincGeometry(tempCSG)},this.getGeometry=()=>host;var createZincGeometry=csgMesh=>{var material=host.getMorph().material.clone();material.morphTargets=!1;var newMesh=csgMesh.toMesh(material),newGeometry=new Geometry;return newGeometry.geometry=newMesh.geometry,newMesh.userData=newGeometry,newGeometry.setMorph(newMesh),newGeometry};this.setCSG=CSG=>{core.setCSG(CSG)};var sendToWork=(guestGeometry,action,resolve,reject)=>{if(!onProgress){var mesh=guestGeometry.getMorph(),json=mesh.geometry.clone().applyMatrix(mesh.matrix).toJSON();myResolve=resolve,onProgress=!0,worker.postMessage({action:action,object:json})}else reject("On progress")};this.intersect=guestGeometry=>new Promise((resolve,reject)=>{if(worker)sendToWork(guestGeometry,"intersect",resolve,reject);else{var result=core.intersect(guestGeometry),newCSG=new GeometryCSG(createZincGeometry(result));newCSG.setCSG(result),resolve(newCSG)}}),this.subtract=guestGeometry=>new Promise((resolve,reject)=>{if(worker)sendToWork(guestGeometry,"intersect",resolve,reject);else{var result=core.subtract(guestGeometry),newCSG=new GeometryCSG(createZincGeometry(result));newCSG.setCSG(result),resolve(newCSG)}}),this.union=guestGeometry=>new Promise((resolve,reject)=>{if(worker)sendToWork(guestGeometry,"intersect",resolve,reject);else{var result=core.union(guestGeometry),newCSG=new GeometryCSG(createZincGeometry(result));newCSG.setCSG(result),resolve(newCSG)}}),this.terminateWorker=()=>{worker&&worker.terminate()},initialise(hostIn)};exports.GeometryCSG=GeometryCSG;
|
|
1896
1962
|
|
|
1897
1963
|
/***/ }),
|
|
1898
|
-
/*
|
|
1964
|
+
/* 44 */
|
|
1899
1965
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1900
1966
|
|
|
1901
1967
|
"use strict";
|
|
@@ -1904,35 +1970,35 @@ var i,_length_i,face,vertex,faceVertexUvs,uvs,polygon,polygons=[];if(geometry.is
|
|
|
1904
1970
|
var x=this.x,y=this.y,z=this.z,e=m.elements;return this.x=e[0]*x+e[4]*y+e[8]*z+e[12],this.y=e[1]*x+e[5]*y+e[9]*z+e[13],this.z=e[2]*x+e[6]*y+e[10]*z+e[14],this},ThreeBSP.Node=function(polygons){var i,polygon_count,front=[],back=[];if(this.polygons=[],this.front=this.back=void 0,polygons instanceof Array&&0!==polygons.length){for(this.divider=polygons[0].clone(),i=0,polygon_count=polygons.length;i<polygon_count;i++)this.divider.splitPolygon(polygons[i],this.polygons,this.polygons,front,back);0<front.length&&(this.front=new ThreeBSP.Node(front)),0<back.length&&(this.back=new ThreeBSP.Node(back))}},ThreeBSP.Node.isConvex=function(polygons){var i,j;for(i=0;i<polygons.length;i++)for(j=0;j<polygons.length;j++)if(i!==j&&polygons[i].classifySide(polygons[j])!==BACK)return!1;return!0},ThreeBSP.Node.prototype.build=function(polygons){var i,polygon_count,front=[],back=[];for(this.divider||(this.divider=polygons[0].clone()),i=0,polygon_count=polygons.length;i<polygon_count;i++)this.divider.splitPolygon(polygons[i],this.polygons,this.polygons,front,back);0<front.length&&(!this.front&&(this.front=new ThreeBSP.Node),this.front.build(front)),0<back.length&&(!this.back&&(this.back=new ThreeBSP.Node),this.back.build(back))},ThreeBSP.Node.prototype.allPolygons=function(){var polygons=this.polygons.slice();return this.front&&(polygons=polygons.concat(this.front.allPolygons())),this.back&&(polygons=polygons.concat(this.back.allPolygons())),polygons},ThreeBSP.Node.prototype.clone=function(){var node=new ThreeBSP.Node;return node.divider=this.divider.clone(),node.polygons=this.polygons.map(function(polygon){return polygon.clone()}),node.front=this.front&&this.front.clone(),node.back=this.back&&this.back.clone(),node},ThreeBSP.Node.prototype.invert=function(){var i,polygon_count,temp;for(i=0,polygon_count=this.polygons.length;i<polygon_count;i++)this.polygons[i].flip();return this.divider.flip(),this.front&&this.front.invert(),this.back&&this.back.invert(),temp=this.front,this.front=this.back,this.back=temp,this},ThreeBSP.Node.prototype.clipPolygons=function(polygons){var i,polygon_count,front,back;if(!this.divider)return polygons.slice();for(front=[],back=[],(i=0,polygon_count=polygons.length);i<polygon_count;i++)this.divider.splitPolygon(polygons[i],front,back,front,back);return this.front&&(front=this.front.clipPolygons(front)),back=this.back?this.back.clipPolygons(back):[],front.concat(back)},ThreeBSP.Node.prototype.clipTo=function(node){this.polygons=node.clipPolygons(this.polygons),this.front&&this.front.clipTo(node),this.back&&this.back.clipTo(node)},ThreeBSP};
|
|
1905
1971
|
|
|
1906
1972
|
/***/ }),
|
|
1907
|
-
/*
|
|
1973
|
+
/* 45 */
|
|
1908
1974
|
/***/ (function(module, exports) {
|
|
1909
1975
|
|
|
1910
1976
|
module.exports = require("webworkify-webpack");
|
|
1911
1977
|
|
|
1912
1978
|
/***/ }),
|
|
1913
|
-
/*
|
|
1979
|
+
/* 46 */
|
|
1914
1980
|
/***/ (function(module, exports) {
|
|
1915
1981
|
|
|
1916
1982
|
module.exports = require("promise-polyfill");
|
|
1917
1983
|
|
|
1918
1984
|
/***/ }),
|
|
1919
|
-
/*
|
|
1985
|
+
/* 47 */
|
|
1920
1986
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1921
1987
|
|
|
1922
|
-
var Geometry=__webpack_require__(2).Geometry,THREE=__webpack_require__(3),JSONLoader=THREE.BufferGeometryLoader;module.exports=function(self){var core=void 0,geometryFromJSON=function(object){var JSONParser=new JSONLoader,geometry=JSONParser.parse(object),material=new THREE.MeshPhongMaterial,mesh=new THREE.Mesh(geometry.geometry,material),host=new Geometry;return host.
|
|
1988
|
+
var Geometry=__webpack_require__(2).Geometry,THREE=__webpack_require__(3),JSONLoader=THREE.BufferGeometryLoader;module.exports=function(self){var core=void 0,geometryFromJSON=function(object){var JSONParser=new JSONLoader,geometry=JSONParser.parse(object),material=new THREE.MeshPhongMaterial,mesh=new THREE.Mesh(geometry.geometry,material),host=new Geometry;return host.setMorph(mesh),host},initialise=function(object){var host=geometryFromJSON(object);core=new(__webpack_require__(48).GeometryCSGInternal)(host),self.postMessage({action:"message",message:"Initialised"})},intersect=function(object){if(core){var guest=geometryFromJSON(object),result=core.intersect(guest),json=result.toBufferGeometry().toJSON();self.postMessage({action:"result",object:json})}},subtract=function(object){if(core){var guest=geometryFromJSON(object),result=core.subtract(guest),json=result.toBufferGeometry().toJSON();self.postMessage({action:"result",object:json})}},union=function(object){if(core){var guest=geometryFromJSON(object),result=core.union(guest),json=result.toBufferGeometry().toJSON();self.postMessage({action:"result",object:json})}};self.addEventListener("message",function(ev){switch(ev.data.action){case"initialise":initialise(ev.data.object);break;case"intersect":intersect(ev.data.object);break;case"subtract":subtract(ev.data.object);break;case"union":union(ev.data.object);break;default:throw"Cannot handle specified action.";}})};
|
|
1923
1989
|
|
|
1924
1990
|
/***/ }),
|
|
1925
|
-
/*
|
|
1991
|
+
/* 48 */
|
|
1926
1992
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1927
1993
|
|
|
1928
|
-
var THREE=__webpack_require__(3),ThreeBSP=__webpack_require__(
|
|
1994
|
+
var THREE=__webpack_require__(3),ThreeBSP=__webpack_require__(44)(THREE),Geometry=__webpack_require__(2).Geometry,GeometryCSG=__webpack_require__(43).GeometryCSG,GeometryCSGInternal=function(hostIn){//ZincGeoemtry of the main geometry
|
|
1929
1995
|
var host;hostIn&&hostIn.isGeometry&&(host=hostIn);var hostCSG;this.setGeometry=hostIn=>{hostIn&&hostIn.isGeometry&&(host=hostIn),hostCSG=void 0},this.setCSG=csg=>{hostCSG=csg};var prepareCSG=guestGeometry=>{if(host&&host.morph&&guestGeometry&&guestGeometry.morph){hostCSG===void 0&&(hostCSG=new ThreeBSP(host.morph));var guestCSG=new ThreeBSP(guestGeometry.morph);return guestCSG}};this.intersect=guestGeometry=>{var guestCSG=prepareCSG(guestGeometry);return hostCSG&&guestCSG?hostCSG.intersect(guestCSG):void 0},this.subtract=guestGeometry=>{var guestCSG=prepareCSG(guestGeometry);return hostCSG&&guestCSG?hostCSG.subtract(guestCSG):void 0},this.union=guestGeometry=>{var guestCSG=prepareCSG(guestGeometry);return hostCSG&&guestCSG?hostCSG.union(guestCSG):void 0}};exports.GeometryCSGInternal=GeometryCSGInternal;
|
|
1930
1996
|
|
|
1931
1997
|
/***/ }),
|
|
1932
|
-
/*
|
|
1998
|
+
/* 49 */
|
|
1933
1999
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1934
2000
|
|
|
1935
|
-
var THREE=__webpack_require__(3),ThreeBSP=__webpack_require__(
|
|
2001
|
+
var THREE=__webpack_require__(3),ThreeBSP=__webpack_require__(44)(THREE),Glyphset=__webpack_require__(14).Glyphset,GlyphsetCSG=function(hostIn){var host;hostIn&&hostIn.isGlyphset&&(host=hostIn);var hostCSGs=[];this.setGlyphset=hostIn=>{hostIn&&hostIn.isGlyphset&&(host=hostIn),hostCSG=void 0},this.getGlyphset=()=>host;var prepareCSGForGlyphs=()=>glyph=>{var mesh=glyph.getMesh(),label=glyph.getLabel();if(mesh){var csg=new ThreeBSP(mesh.geometry.clone().applyMatrix(mesh.matrix)),store=[];store.csg=csg,store.label=label,mesh.material&&(store.material=mesh.material.clone()),hostCSGs.push(store)}},prepareCSG=guestGeometry=>{if(host&&guestGeometry&&guestGeometry.getMorph()){0==hostCSGs.length&&host.forEachGlyph(prepareCSGForGlyphs());var guestCSG=new ThreeBSP(guestGeometry.getMorph());return guestCSG}};this.intersect=guestGeometry=>{var guestCSG=prepareCSG(guestGeometry);if(0<hostCSGs.length&&guestCSG){for(var glyphset=new(__webpack_require__(14).Glyphset),i=0;i<hostCSGs.length;i++){var _hostCSG=hostCSGs[i],intersect=_hostCSG.csg.intersect(guestCSG),mesh=intersect.toMesh();if(mesh&&mesh.geometry&&0<mesh.geometry.vertices.length){_hostCSG.material&&(mesh.material=_hostCSG.material,mesh.material.side=THREE.DoubleSide,mesh.material.clippingPlanes=null);var glyph=glyphset.addMeshAsGlyph(mesh,i+1);glyph.setLabel(_hostCSG.label)}}var newCSG=new GlyphsetCSG(glyphset);return newCSG}}};exports.GlyphsetCSG=GlyphsetCSG;
|
|
1936
2002
|
|
|
1937
2003
|
/***/ })
|
|
1938
2004
|
/******/ ]);
|