@abi-software/scaffoldvuer 0.1.57 → 0.1.58

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/package-lock.json CHANGED
@@ -11976,9 +11976,9 @@
11976
11976
  "dev": true
11977
11977
  },
11978
11978
  "promise-polyfill": {
11979
- "version": "8.2.3",
11980
- "resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-8.2.3.tgz",
11981
- "integrity": "sha512-Og0+jCRQetV84U8wVjMNccfGCnMQ9mGs9Hv78QFe+pSDD3gWTpz0y+1QCuxy5d/vBFuZ3iwP2eycAkvqIMPmWg=="
11979
+ "version": "8.3.0",
11980
+ "resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-8.3.0.tgz",
11981
+ "integrity": "sha512-H5oELycFml5yto/atYqmjyigJoAo3+OXwolYiH7OfQuYlAqhxNvTfiNMbV9hsC6Yp83yE5r2KTVmtrG6R9i6Pg=="
11982
11982
  },
11983
11983
  "prompts": {
11984
11984
  "version": "2.4.2",
@@ -15380,9 +15380,9 @@
15380
15380
  "integrity": "sha512-OSPPKcGvFSiGkG3jFrwwC76PBV/ZSrGxpBbg28bW8s9GU8r/y2spNGtEXHEb/CVqo0Ctf5Lx2rVaxQZB6OasaA=="
15381
15381
  },
15382
15382
  "three-spritetext": {
15383
- "version": "1.6.5",
15384
- "resolved": "https://registry.npmjs.org/three-spritetext/-/three-spritetext-1.6.5.tgz",
15385
- "integrity": "sha512-ttA1ce3tJz6OFojLGY3VjtqF9johetq50TztYcPFWqdEUrwPmej5XXcHahVyQGd88FHRDzJmW2rW3zSifUsdYA=="
15383
+ "version": "1.8.0",
15384
+ "resolved": "https://registry.npmjs.org/three-spritetext/-/three-spritetext-1.8.0.tgz",
15385
+ "integrity": "sha512-ehiATMfR1guCk+knjCxDWp2zikxRbxQaKXJyjXwuZKqjIbKtsCh7BQ00JHaESjzaXXhG5LJV7rXTJ78M/EYWyQ=="
15386
15386
  },
15387
15387
  "throttle-debounce": {
15388
15388
  "version": "1.1.0",
@@ -17813,9 +17813,9 @@
17813
17813
  }
17814
17814
  },
17815
17815
  "zincjs": {
17816
- "version": "1.0.11",
17817
- "resolved": "https://registry.npmjs.org/zincjs/-/zincjs-1.0.11.tgz",
17818
- "integrity": "sha512-SknkseprKt2kxnsniohhkPQ56WT+9b7Ju1kxynhs83yNE2lcuakphedTRIBHGUUNcRAzw8TCgtfjN52uKFtKzQ==",
17816
+ "version": "1.0.15",
17817
+ "resolved": "https://registry.npmjs.org/zincjs/-/zincjs-1.0.15.tgz",
17818
+ "integrity": "sha512-Csnbvrgin7Ebo9kfFr071KzKDFcoDX03MoBz41h1hq6lG8MHJXjTHLP/EhF5kwbNhThH21rgz718D8rBvwTALA==",
17819
17819
  "requires": {
17820
17820
  "css-element-queries": "^1.2.2",
17821
17821
  "lodash": "^4.17.19",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/scaffoldvuer",
3
- "version": "0.1.57",
3
+ "version": "0.1.58",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,7 +36,7 @@
36
36
  "vue-custom-element": "^3.3.0",
37
37
  "vue-drag-resize": "^1.3.2",
38
38
  "vue-router": "^3.5.1",
39
- "zincjs": "^1.0.11"
39
+ "zincjs": "^1.0.15"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@vue/cli-plugin-babel": "^4.0.0",
package/src/App.vue CHANGED
@@ -26,6 +26,7 @@
26
26
  @scaffold-selected="onSelected"
27
27
  @scaffold-navigated="onNavigated"
28
28
  @timeChanged="updateCurrentTime"
29
+ @zinc-object-added="objectAdded"
29
30
  />
30
31
  </drop-zone>
31
32
  <el-popover
@@ -103,6 +104,18 @@
103
104
  >
104
105
  Capture
105
106
  </el-button>
107
+ <el-button
108
+ size="mini"
109
+ @click="featureTesting()"
110
+ >
111
+ Test 1
112
+ </el-button>
113
+ <el-button
114
+ size="mini"
115
+ @click="featureTesting2()"
116
+ >
117
+ Test 2
118
+ </el-button>
106
119
  </el-row>
107
120
  <el-row :gutter="10">
108
121
  <el-button
@@ -253,6 +266,9 @@ import Vue from "vue";
253
266
  import { Button, Col, Icon, Input, InputNumber, Popover, Row, Switch } from "element-ui";
254
267
  import lang from "element-ui/lib/locale/lang/en";
255
268
  import locale from "element-ui/lib/locale";
269
+ import taShader from "zincjs/src/shaders/textureArray.js"
270
+ import volumeRender from "zincjs/src/shaders/volumeRender.js"
271
+ import volumeTexture from "zincjs/src/shaders/volumeTexture.js"
256
272
 
257
273
  locale.use(lang);
258
274
  Vue.use(Button);
@@ -264,6 +280,111 @@ Vue.use(Popover);
264
280
  Vue.use(Row);
265
281
  Vue.use(Switch);
266
282
 
283
+ let texture_prefix = undefined;
284
+
285
+ const getVolumeRender = (texture) => {
286
+ const myUniforms = volumeRender.getUniforms();
287
+ console.log(myUniforms)
288
+ myUniforms.u_size.value.set(texture.size.width, texture.size.height, texture.size.depth);
289
+ myUniforms.u_data.value = texture.impl;
290
+ const options = {
291
+ fs: volumeRender.fs,
292
+ vs: volumeRender.vs,
293
+ uniforms: myUniforms,
294
+ glslVersion: volumeRender.glslVersion
295
+ };
296
+ return options;
297
+ }
298
+
299
+ const getVolumeTexture = (texture) => {
300
+ const myUniforms = volumeTexture.getUniforms();
301
+ console.log(myUniforms)
302
+ myUniforms.volume_scale.value.set(texture.size.width / texture.size.depth, texture.size.height / texture.size.depth, 1);
303
+ myUniforms.diffuse.value = texture.impl;
304
+ myUniforms.depth.value = texture.size.depth;
305
+ myUniforms.volume_dims.value = [200, 200, 200];
306
+ const options = {
307
+ fs: volumeTexture.fs,
308
+ vs: volumeTexture.vs,
309
+ uniforms: myUniforms,
310
+ glslVersion: volumeTexture.glslVersion
311
+ };
312
+ return options;
313
+ }
314
+
315
+ const getTestShader = (texture) => {
316
+ const myUniforms = taShader.getUniforms();
317
+ myUniforms.depth.value = texture.size.depth;
318
+ myUniforms.diffuse.value = texture.impl;
319
+ const options = {
320
+ fs: taShader.fs,
321
+ vs: taShader.vs,
322
+ uniforms: myUniforms,
323
+ glslVersion: taShader.glslVersion
324
+ };
325
+ console.log(options)
326
+ return options;
327
+ }
328
+
329
+ const getTexture = async (scaffoldModule) => {
330
+ const imgArray = [];
331
+ const texture = new scaffoldModule.Zinc.TextureArray();
332
+ for (let i = 1733; i < 1860; i++) {
333
+ imgArray.push(`${texture_prefix}/foot${i}.jpg`);
334
+ //imgArray.push(`${process.env.VUE_APP_TEXTURE_FOOT_PREFIX}/foot${i}.jpg`);
335
+ }
336
+ await texture.loadFromImages(imgArray);
337
+ return texture;
338
+ }
339
+
340
+ const testVolume = async (scaffoldModule, objects) => {
341
+ if (objects) {
342
+ const texture = await getTexture(scaffoldModule);
343
+ //const options = getTestShader(texture);
344
+ const options = getVolumeTexture(texture);
345
+ const material = texture.getMaterial(options);
346
+ console.log(material, texture, objects);
347
+ objects[0].morph.material = material;
348
+ }
349
+ }
350
+
351
+ const testSlides = async (scaffoldModule) => {
352
+ const texture = await getTexture(scaffoldModule);
353
+ const textureSlides = new scaffoldModule.Zinc.TextureSlides(texture);
354
+ textureSlides.createSlides([
355
+ {
356
+ direction: "y",
357
+ value: 0.1
358
+ },
359
+ {
360
+ direction: "y",
361
+ value: 0.3
362
+ },
363
+ {
364
+ direction: "y",
365
+ value: 0.5
366
+ },
367
+ {
368
+ direction: "y",
369
+ value: 0.7
370
+ },
371
+ {
372
+ direction: "y",
373
+ value: 0.9
374
+ },
375
+ {
376
+ direction: "x",
377
+ value: 0.5
378
+ },
379
+ {
380
+ direction: "z",
381
+ value: 0.5
382
+ },
383
+ ]);
384
+ scaffoldModule.scene.addZincObject(textureSlides);
385
+ }
386
+
387
+
267
388
  export default {
268
389
  name: "App",
269
390
  components: {
@@ -271,6 +392,9 @@ export default {
271
392
  ScaffoldVuer,
272
393
  ModelsTable
273
394
  },
395
+ created: function() {
396
+ texture_prefix = process.env.VUE_APP_TEXTURE_FOOT_PREFIX;
397
+ },
274
398
  data: function() {
275
399
  return {
276
400
  url: undefined,
@@ -300,6 +424,7 @@ export default {
300
424
  pos: [0, 0],
301
425
  format: "metadata",
302
426
  sceneSettings: [],
427
+
303
428
  };
304
429
  },
305
430
  watch: {
@@ -319,6 +444,7 @@ export default {
319
444
  }
320
445
  },
321
446
  mounted: function() {
447
+ this._objects = [];
322
448
  this.selectedCoordinates = this.$refs.scaffold.getDynamicSelectedCoordinates();
323
449
  this.rendererInfo = this.$refs.scaffold.getRendererInfo();
324
450
  },
@@ -348,6 +474,21 @@ export default {
348
474
  hrefElement.remove();
349
475
  })
350
476
  },
477
+ objectAdded: function(zincObject) {
478
+ console.log(zincObject)
479
+ this._objects.push(zincObject);
480
+ },
481
+ featureTesting: async function() {
482
+ //Test texture
483
+ testVolume(this.$refs.scaffold.$module, this._objects);
484
+
485
+
486
+ },
487
+ featureTesting2: async function() {
488
+ //Test texture
489
+ //testVolume(this.$refs.scaffold.$module, this._objects);
490
+ testSlides(this.$refs.scaffold.$module);
491
+ },
351
492
  saveSettings: function() {
352
493
  this.sceneSettings.push(this.$refs.scaffold.getState());
353
494
  },
@@ -411,6 +552,9 @@ export default {
411
552
  this.currentTime = val;
412
553
  },
413
554
  parseQuery: function(query) {
555
+ if (query.url != this.url) {
556
+ this._objects = [];
557
+ }
414
558
  if (query.url) {
415
559
  this.url = query.url;
416
560
  } else {
@@ -564,7 +564,7 @@ export default {
564
564
  let eventNotifier = new EventNotifier();
565
565
  eventNotifier.subscribe(this, this.eventNotifierCallback);
566
566
  this.$module.addNotifier(eventNotifier);
567
- this.$module.addOrganPartAddedCallback(this.organsAdded);
567
+ this.$module.addOrganPartAddedCallback(this.zincObjectAdded);
568
568
  this.$module.initialiseRenderer(this.$refs.display);
569
569
  this.toggleRendering(this.render);
570
570
  this.ro = new ResizeObserver(this.adjustLayout).observe(
@@ -579,10 +579,11 @@ export default {
579
579
  },
580
580
  methods: {
581
581
  /**
582
- * This is called when a new organ is read into the scene.
582
+ * This is called when a new zinc object is read into the scene.
583
583
  */
584
- organsAdded: function() {
584
+ zincObjectAdded: function(zincObject) {
585
585
  this.loading = false;
586
+ this.$emit("zinc-object-added", zincObject);
586
587
  },
587
588
  /**
588
589
  * This is called when Change backgspeedround colour button
@@ -10,8 +10,8 @@ const createRenderer = function () {
10
10
  const localContainer = document.createElement( 'div' );
11
11
  let localRenderer = undefined;;
12
12
  localContainer.style.height = "100%";
13
+ const Zinc = require('zincjs');
13
14
  if (WEBGL.isWebGLAvailable()) {
14
- const Zinc = require('zincjs');
15
15
  localRenderer = new Zinc.Renderer(localContainer, window);
16
16
  Zinc.defaultMaterialColor = 0xFFFF9C;
17
17
  localRenderer.initialiseVisualisation();
@@ -20,7 +20,7 @@ const createRenderer = function () {
20
20
  const warning = WEBGL.getWebGLErrorMessage();
21
21
  localContainer.appendChild(warning);
22
22
  }
23
- return {"renderer":localRenderer, "container":localContainer};
23
+ return {Zinc, "renderer":localRenderer, "container":localContainer};
24
24
  }
25
25
 
26
26
  const RendererModule = function() {
@@ -264,6 +264,7 @@ RendererModule.prototype.getPlayRate = function(value) {
264
264
  RendererModule.prototype.initialiseRenderer = function(displayAreaIn) {
265
265
  if (this.zincRenderer === undefined || this.rendererContainer === undefined) {
266
266
  let returnedValue = createRenderer();
267
+ this.Zinc = returnedValue["Zinc"];
267
268
  this.zincRenderer = returnedValue["renderer"];
268
269
  this.rendererContainer = returnedValue["container"];
269
270
  }