copper3d 1.15.6 → 1.15.8
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/README.md +5 -2
- package/dist/Controls/Copper3dTrackballControls.js +37 -49
- package/dist/Controls/Copper3dTrackballControls.js.map +1 -1
- package/dist/Loader/copperDicomLoader.js +0 -2
- package/dist/Loader/copperDicomLoader.js.map +1 -1
- package/dist/Loader/copperNrrdLoader.js +1 -4
- package/dist/Loader/copperNrrdLoader.js.map +1 -1
- package/dist/Renderer/baseRenderer.d.ts +3 -3
- package/dist/Renderer/baseRenderer.js +9 -5
- package/dist/Renderer/baseRenderer.js.map +1 -1
- package/dist/Renderer/copperRenderer.d.ts +2 -2
- package/dist/Renderer/copperRenderer.js +6 -2
- package/dist/Renderer/copperRenderer.js.map +1 -1
- package/dist/Renderer/copperRendererOnDemond.d.ts +2 -2
- package/dist/Renderer/copperRendererOnDemond.js +0 -3
- package/dist/Renderer/copperRendererOnDemond.js.map +1 -1
- package/dist/Scene/baseScene.d.ts +2 -2
- package/dist/Scene/baseScene.js +7 -5
- package/dist/Scene/baseScene.js.map +1 -1
- package/dist/Scene/commonSceneMethod.d.ts +4 -2
- package/dist/Scene/commonSceneMethod.js +13 -8
- package/dist/Scene/commonSceneMethod.js.map +1 -1
- package/dist/Scene/copperScene.d.ts +2 -1
- package/dist/Scene/copperScene.js +5 -11
- package/dist/Scene/copperScene.js.map +1 -1
- package/dist/Utils/convet.js.map +1 -0
- package/dist/Utils/nrrd_tool.js +0 -2
- package/dist/Utils/nrrd_tool.js.map +1 -1
- package/dist/bundle.esm.js +77 -91
- package/dist/bundle.umd.js +77 -91
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/types/Renderer/baseRenderer.d.ts +3 -3
- package/dist/types/Renderer/copperRenderer.d.ts +2 -2
- package/dist/types/Renderer/copperRendererOnDemond.d.ts +2 -2
- package/dist/types/Scene/baseScene.d.ts +2 -2
- package/dist/types/Scene/commonSceneMethod.d.ts +4 -2
- package/dist/types/Scene/copperScene.d.ts +2 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types/types.d.ts +11 -5
- package/dist/types/types.d.ts +11 -5
- package/package.json +1 -1
- package/dist/Controls/Copper3dTrackballControls1.d.ts +0 -45
- package/dist/Controls/Copper3dTrackballControls1.js +0 -531
- package/dist/Controls/Copper3dTrackballControls1.js.map +0 -1
- package/dist/Loader/convet.js.map +0 -1
- package/dist/types/Controls/Copper3dTrackballControls1.d.ts +0 -45
- /package/dist/{Loader → Utils}/convet.d.ts +0 -0
- /package/dist/{Loader → Utils}/convet.js +0 -0
- /package/dist/types/{Loader → Utils}/convet.d.ts +0 -0
package/dist/bundle.esm.js
CHANGED
|
@@ -38582,11 +38582,9 @@ function copperDicomLoader(url, callback) {
|
|
|
38582
38582
|
loader$1.load(url, (arrayBuffer) => {
|
|
38583
38583
|
var dicomFileAsBuffer = new Uint8Array(arrayBuffer);
|
|
38584
38584
|
const dataSet = dicomParser.parseDicom(dicomFileAsBuffer);
|
|
38585
|
-
// console.log(dataSet1);
|
|
38586
38585
|
// const dataSet = dicomParser.parseDicom(dicomFileAsBuffer, {
|
|
38587
38586
|
// vrCallback(tag) {
|
|
38588
38587
|
// const formatted = `(${tag.substring(1, 5)},${tag.substring(5, 9)})`;
|
|
38589
|
-
// // console.log(!!TAG_DICT[formatted] ? TAG_DICT[formatted].vr : undefined);
|
|
38590
38588
|
// return !!TAG_DICT[formatted] ? TAG_DICT[formatted].vr : undefined;
|
|
38591
38589
|
// },
|
|
38592
38590
|
// });
|
|
@@ -44094,7 +44092,6 @@ function copperNrrdTexture3dLoader(url, scene, container, callback) {
|
|
|
44094
44092
|
// 获取边界框的尺寸
|
|
44095
44093
|
const size_ = new Vector3();
|
|
44096
44094
|
boundingBox.getSize(size_);
|
|
44097
|
-
console.log(size_);
|
|
44098
44095
|
scene.add(mesh);
|
|
44099
44096
|
const gui = new GUI$1();
|
|
44100
44097
|
gui.add(volconfig, "clim1_g", -500, 500, 1).onChange((value) => {
|
|
@@ -44163,7 +44160,6 @@ function getWholeSlices(nrrdSlices, scene, gui, controls) {
|
|
|
44163
44160
|
// nrrdSlices.z.index = i;
|
|
44164
44161
|
// nrrdSlices.z.repaint(nrrdSlices.z);
|
|
44165
44162
|
// nrrdSlices.z.mesh.position.set(0, 0, 0.5);
|
|
44166
|
-
// console.log(nrrdSlices.z.mesh);
|
|
44167
44163
|
// }, 100);
|
|
44168
44164
|
// }
|
|
44169
44165
|
let up = true;
|
|
@@ -44208,7 +44204,6 @@ function getWholeSlices(nrrdSlices, scene, gui, controls) {
|
|
|
44208
44204
|
// }
|
|
44209
44205
|
// if (slicesX[index]) {
|
|
44210
44206
|
// controls.enabled = false;
|
|
44211
|
-
// console.log(slicesX[index]);
|
|
44212
44207
|
// slicesX[index].visible = false;
|
|
44213
44208
|
// // ? (slicesX[index].visible = false)
|
|
44214
44209
|
// // : (slicesX[index].visible = true);
|
|
@@ -45244,7 +45239,7 @@ class Copper3dTrackballControls extends EventDispatcher {
|
|
|
45244
45239
|
this.maxDistance = Infinity;
|
|
45245
45240
|
this.minZoom = 0;
|
|
45246
45241
|
this.maxZoom = Infinity;
|
|
45247
|
-
this.keys = ["KeyA"
|
|
45242
|
+
this.keys = ["KeyA" /*A*/, "KeyS" /*S*/, "KeyD" /*D*/];
|
|
45248
45243
|
this.mouseButtons = {
|
|
45249
45244
|
LEFT: MOUSE.ROTATE,
|
|
45250
45245
|
MIDDLE: MOUSE.DOLLY,
|
|
@@ -45262,11 +45257,10 @@ class Copper3dTrackballControls extends EventDispatcher {
|
|
|
45262
45257
|
this.position0 = this.object.position.clone();
|
|
45263
45258
|
this.up0 = this.object.up.clone();
|
|
45264
45259
|
this.zoom0 = this.object.zoom;
|
|
45265
|
-
//
|
|
45260
|
+
// methods
|
|
45266
45261
|
this.handleResize = function () {
|
|
45267
45262
|
const box = scope.domElement.getBoundingClientRect();
|
|
45268
|
-
// adjustments come from similar code in the jquery
|
|
45269
|
-
// get root element
|
|
45263
|
+
// adjustments come from similar code in the jquery offset() function
|
|
45270
45264
|
const d = scope.domElement.ownerDocument.documentElement;
|
|
45271
45265
|
scope.screen.left = box.left + window.pageXOffset - d.clientLeft;
|
|
45272
45266
|
scope.screen.top = box.top + window.pageYOffset - d.clientTop;
|
|
@@ -45281,18 +45275,11 @@ class Copper3dTrackballControls extends EventDispatcher {
|
|
|
45281
45275
|
};
|
|
45282
45276
|
})();
|
|
45283
45277
|
const getMouseOnCircle = (function () {
|
|
45284
|
-
/**
|
|
45285
|
-
* convert screen coordinates to threejs coordinates ratio
|
|
45286
|
-
*/
|
|
45287
45278
|
const vector = new Vector2();
|
|
45288
|
-
return function
|
|
45289
|
-
vector.set(
|
|
45290
|
-
|
|
45291
|
-
|
|
45292
|
-
(scope.screen.width * 0.5),
|
|
45293
|
-
// the height radius of the circle diameter
|
|
45294
|
-
(scope.screen.height + 2 * (scope.screen.top - pageY)) /
|
|
45295
|
-
scope.screen.width //screen.width intentional
|
|
45279
|
+
return function getMouseOnCircle(pageX, pageY) {
|
|
45280
|
+
vector.set((pageX - scope.screen.width * 0.5 - scope.screen.left) /
|
|
45281
|
+
(scope.screen.width * 0.5), (scope.screen.height + 2 * (scope.screen.top - pageY)) /
|
|
45282
|
+
scope.screen.width // screen.width intentional
|
|
45296
45283
|
);
|
|
45297
45284
|
return vector;
|
|
45298
45285
|
};
|
|
@@ -45301,26 +45288,20 @@ class Copper3dTrackballControls extends EventDispatcher {
|
|
|
45301
45288
|
const axis = new Vector3(), quaternion = new Quaternion(), eyeDirection = new Vector3(), objectUpDirection = new Vector3(), objectSidewaysDirection = new Vector3(), moveDirection = new Vector3();
|
|
45302
45289
|
return function rotateCamera() {
|
|
45303
45290
|
moveDirection.set(_moveCurr.x - _movePrev.x, _moveCurr.y - _movePrev.y, 0);
|
|
45304
|
-
// Computes the Euclidean length (straight-line length) from (0, 0, 0) to (x, y, z).
|
|
45305
45291
|
let angle = moveDirection.length();
|
|
45306
45292
|
if (angle) {
|
|
45307
|
-
// .sub Subtracts v from this vector.
|
|
45308
45293
|
_eye.copy(scope.object.position).sub(scope.target);
|
|
45309
|
-
// .normalize() Convert this vector to a unit vector - that is, sets it equal to a vector with the same direction as this one, but length 1.
|
|
45310
45294
|
eyeDirection.copy(_eye).normalize();
|
|
45311
45295
|
objectUpDirection.copy(scope.object.up).normalize();
|
|
45312
|
-
// .crossVectors Sets this vector to cross product of a and b.
|
|
45313
45296
|
objectSidewaysDirection
|
|
45314
45297
|
.crossVectors(objectUpDirection, eyeDirection)
|
|
45315
45298
|
.normalize();
|
|
45316
|
-
// .setLength Set this vector to a vector with the same direction as this one, but length l.
|
|
45317
45299
|
objectUpDirection.setLength(_moveCurr.y - _movePrev.y);
|
|
45318
45300
|
objectSidewaysDirection.setLength(_moveCurr.x - _movePrev.x);
|
|
45319
45301
|
moveDirection.copy(objectUpDirection.add(objectSidewaysDirection));
|
|
45320
45302
|
axis.crossVectors(moveDirection, _eye).normalize();
|
|
45321
45303
|
angle *= scope.rotateSpeed;
|
|
45322
45304
|
quaternion.setFromAxisAngle(axis, angle);
|
|
45323
|
-
// Applies a Quaternion transform to this vector.
|
|
45324
45305
|
_eye.applyQuaternion(quaternion);
|
|
45325
45306
|
scope.object.up.applyQuaternion(quaternion);
|
|
45326
45307
|
_lastAxis.copy(axis);
|
|
@@ -45375,15 +45356,15 @@ class Copper3dTrackballControls extends EventDispatcher {
|
|
|
45375
45356
|
const mouseChange = new Vector2(), objectUp = new Vector3(), pan = new Vector3();
|
|
45376
45357
|
return function panCamera() {
|
|
45377
45358
|
mouseChange.copy(_panEnd).sub(_panStart);
|
|
45378
|
-
// .lengthSq() Computes the squared length of this vector. If you are comparing the lengths of vectors, you should compare the length squared instead as it is slightly more efficient to calculate.
|
|
45379
45359
|
if (mouseChange.lengthSq()) {
|
|
45380
45360
|
if (scope.object.isOrthographicCamera) {
|
|
45381
|
-
const
|
|
45382
|
-
|
|
45383
|
-
|
|
45361
|
+
const scale_x = (scope.object.right -
|
|
45362
|
+
scope.object.left) /
|
|
45363
|
+
scope.object.zoom /
|
|
45384
45364
|
scope.domElement.clientWidth;
|
|
45385
|
-
const scale_y = (
|
|
45386
|
-
|
|
45365
|
+
const scale_y = (scope.object.top -
|
|
45366
|
+
scope.object.bottom) /
|
|
45367
|
+
scope.object.zoom /
|
|
45387
45368
|
scope.domElement.clientWidth;
|
|
45388
45369
|
mouseChange.x *= scale_x;
|
|
45389
45370
|
mouseChange.y *= scale_y;
|
|
@@ -45469,9 +45450,10 @@ class Copper3dTrackballControls extends EventDispatcher {
|
|
|
45469
45450
|
return;
|
|
45470
45451
|
if (_pointers.length === 0) {
|
|
45471
45452
|
scope.domElement.setPointerCapture(event.pointerId);
|
|
45472
|
-
scope.domElement.addEventListener("pointermove", onPointerMove
|
|
45473
|
-
scope.domElement.addEventListener("pointerup", onPointerUp
|
|
45453
|
+
scope.domElement.addEventListener("pointermove", onPointerMove);
|
|
45454
|
+
scope.domElement.addEventListener("pointerup", onPointerUp);
|
|
45474
45455
|
}
|
|
45456
|
+
//
|
|
45475
45457
|
addPointer(event);
|
|
45476
45458
|
if (event.pointerType === "touch") {
|
|
45477
45459
|
onTouchStart(event);
|
|
@@ -45499,11 +45481,12 @@ class Copper3dTrackballControls extends EventDispatcher {
|
|
|
45499
45481
|
else {
|
|
45500
45482
|
onMouseUp();
|
|
45501
45483
|
}
|
|
45484
|
+
//
|
|
45502
45485
|
removePointer(event);
|
|
45503
45486
|
if (_pointers.length === 0) {
|
|
45504
45487
|
scope.domElement.releasePointerCapture(event.pointerId);
|
|
45505
|
-
scope.domElement.removeEventListener("pointermove", onPointerMove
|
|
45506
|
-
scope.domElement.removeEventListener("pointerup", onPointerUp
|
|
45488
|
+
scope.domElement.removeEventListener("pointermove", onPointerMove);
|
|
45489
|
+
scope.domElement.removeEventListener("pointerup", onPointerUp);
|
|
45507
45490
|
}
|
|
45508
45491
|
}
|
|
45509
45492
|
function onPointerCancel(event) {
|
|
@@ -45526,11 +45509,11 @@ class Copper3dTrackballControls extends EventDispatcher {
|
|
|
45526
45509
|
_keyState = STATE.PAN;
|
|
45527
45510
|
}
|
|
45528
45511
|
}
|
|
45529
|
-
function keyup(
|
|
45512
|
+
function keyup() {
|
|
45530
45513
|
if (scope.enabled === false)
|
|
45531
45514
|
return;
|
|
45532
45515
|
_keyState = STATE.NONE;
|
|
45533
|
-
window.addEventListener("keydown", keydown
|
|
45516
|
+
window.addEventListener("keydown", keydown);
|
|
45534
45517
|
}
|
|
45535
45518
|
function onMouseDown(event) {
|
|
45536
45519
|
if (_state === STATE.NONE) {
|
|
@@ -45574,7 +45557,7 @@ class Copper3dTrackballControls extends EventDispatcher {
|
|
|
45574
45557
|
_panEnd.copy(getMouseOnScreen(event.pageX, event.pageY));
|
|
45575
45558
|
}
|
|
45576
45559
|
}
|
|
45577
|
-
function onMouseUp(
|
|
45560
|
+
function onMouseUp() {
|
|
45578
45561
|
_state = STATE.NONE;
|
|
45579
45562
|
scope.dispatchEvent(_endEvent$2);
|
|
45580
45563
|
}
|
|
@@ -45708,7 +45691,7 @@ class Copper3dTrackballControls extends EventDispatcher {
|
|
|
45708
45691
|
function removePointer(event) {
|
|
45709
45692
|
delete _pointerPositions[event.pointerId];
|
|
45710
45693
|
for (let i = 0; i < _pointers.length; i++) {
|
|
45711
|
-
if (_pointers[i].pointerId
|
|
45694
|
+
if (_pointers[i].pointerId == event.pointerId) {
|
|
45712
45695
|
_pointers.splice(i, 1);
|
|
45713
45696
|
return;
|
|
45714
45697
|
}
|
|
@@ -45729,21 +45712,21 @@ class Copper3dTrackballControls extends EventDispatcher {
|
|
|
45729
45712
|
return _pointerPositions[pointer.pointerId];
|
|
45730
45713
|
}
|
|
45731
45714
|
this.dispose = function () {
|
|
45732
|
-
scope.domElement.removeEventListener("contextmenu", contextmenu
|
|
45733
|
-
scope.domElement.removeEventListener("pointerdown", onPointerDown
|
|
45734
|
-
scope.domElement.removeEventListener("pointercancel", onPointerCancel
|
|
45735
|
-
scope.domElement.removeEventListener("wheel", onMouseWheel
|
|
45736
|
-
scope.domElement.removeEventListener("pointermove", onPointerMove
|
|
45737
|
-
scope.domElement.removeEventListener("pointerup", onPointerUp
|
|
45738
|
-
window.removeEventListener("keydown", keydown
|
|
45739
|
-
window.removeEventListener("keyup", keyup
|
|
45715
|
+
scope.domElement.removeEventListener("contextmenu", contextmenu);
|
|
45716
|
+
scope.domElement.removeEventListener("pointerdown", onPointerDown);
|
|
45717
|
+
scope.domElement.removeEventListener("pointercancel", onPointerCancel);
|
|
45718
|
+
scope.domElement.removeEventListener("wheel", onMouseWheel);
|
|
45719
|
+
scope.domElement.removeEventListener("pointermove", onPointerMove);
|
|
45720
|
+
scope.domElement.removeEventListener("pointerup", onPointerUp);
|
|
45721
|
+
window.removeEventListener("keydown", keydown);
|
|
45722
|
+
window.removeEventListener("keyup", keyup);
|
|
45740
45723
|
};
|
|
45741
|
-
this.domElement.addEventListener("contextmenu", contextmenu
|
|
45742
|
-
this.domElement.addEventListener("pointerdown", onPointerDown
|
|
45743
|
-
this.domElement.addEventListener("pointercancel", onPointerCancel
|
|
45724
|
+
this.domElement.addEventListener("contextmenu", contextmenu);
|
|
45725
|
+
this.domElement.addEventListener("pointerdown", onPointerDown);
|
|
45726
|
+
this.domElement.addEventListener("pointercancel", onPointerCancel);
|
|
45744
45727
|
this.domElement.addEventListener("wheel", onMouseWheel, { passive: false });
|
|
45745
|
-
window.addEventListener("keydown", keydown
|
|
45746
|
-
window.addEventListener("keyup", keyup
|
|
45728
|
+
window.addEventListener("keydown", keydown);
|
|
45729
|
+
window.addEventListener("keyup", keyup);
|
|
45747
45730
|
this.handleResize();
|
|
45748
45731
|
// force an update at start
|
|
45749
45732
|
this.update();
|
|
@@ -47002,7 +46985,7 @@ class OrbitControls extends EventDispatcher {
|
|
|
47002
46985
|
}
|
|
47003
46986
|
|
|
47004
46987
|
class commonScene {
|
|
47005
|
-
constructor(container) {
|
|
46988
|
+
constructor(container, opt) {
|
|
47006
46989
|
this.subDiv = null;
|
|
47007
46990
|
this.subScene = new Scene();
|
|
47008
46991
|
this.subCamera = null;
|
|
@@ -47014,7 +46997,16 @@ class commonScene {
|
|
|
47014
46997
|
this.pickableObjects = [];
|
|
47015
46998
|
this.container = container;
|
|
47016
46999
|
this.scene = new Scene();
|
|
47017
|
-
this.
|
|
47000
|
+
this.copperPerspectiveCamera = new PerspectiveCamera(75, container.clientWidth / container.clientHeight, 0.1, 500);
|
|
47001
|
+
const h = 1024;
|
|
47002
|
+
const aspect = window.innerWidth / window.innerHeight;
|
|
47003
|
+
this.copperOrthographicCamera = new OrthographicCamera((-h * aspect) / 2, (h * aspect) / 2, h / 2, -h / 2, 1, 2000);
|
|
47004
|
+
if ((opt === null || opt === void 0 ? void 0 : opt.camera) === "orthographic") {
|
|
47005
|
+
this.camera = this.copperOrthographicCamera;
|
|
47006
|
+
}
|
|
47007
|
+
else {
|
|
47008
|
+
this.camera = this.copperPerspectiveCamera;
|
|
47009
|
+
}
|
|
47018
47010
|
this.controls = new Copper3dTrackballControls(this.camera, this.container);
|
|
47019
47011
|
this.controls.dispose();
|
|
47020
47012
|
this.preRenderCallbackFunctions = {
|
|
@@ -47215,9 +47207,7 @@ class commonScene {
|
|
|
47215
47207
|
}
|
|
47216
47208
|
loadNrrdTexture3d(url, callback) {
|
|
47217
47209
|
// const h = 512; // frustum height
|
|
47218
|
-
|
|
47219
|
-
const aspect = window.innerWidth / window.innerHeight;
|
|
47220
|
-
this.camera = new OrthographicCamera((-h * aspect) / 2, (h * aspect) / 2, h / 2, -h / 2, 1, 2000);
|
|
47210
|
+
this.camera.updateProjectionMatrix();
|
|
47221
47211
|
this.camera.position.set(0, 0, 1280);
|
|
47222
47212
|
this.camera.up.set(0, 0, 1);
|
|
47223
47213
|
this.camera.updateProjectionMatrix();
|
|
@@ -47238,9 +47228,7 @@ class commonScene {
|
|
|
47238
47228
|
this.scene.add(obj);
|
|
47239
47229
|
!!callback && callback(obj);
|
|
47240
47230
|
}, // called when loading is in progresses
|
|
47241
|
-
(xhr) => {
|
|
47242
|
-
// console.log((xhr.loaded / xhr.total) * 100 + "% loaded");
|
|
47243
|
-
},
|
|
47231
|
+
(xhr) => { },
|
|
47244
47232
|
// called when loading has errors
|
|
47245
47233
|
(error) => {
|
|
47246
47234
|
console.log("An error happened");
|
|
@@ -47250,8 +47238,8 @@ class commonScene {
|
|
|
47250
47238
|
|
|
47251
47239
|
const IS_IOS = isIOS();
|
|
47252
47240
|
class baseScene extends commonScene {
|
|
47253
|
-
constructor(container, renderer,
|
|
47254
|
-
super(container);
|
|
47241
|
+
constructor(container, renderer, opt) {
|
|
47242
|
+
super(container, opt);
|
|
47255
47243
|
// scene: THREE.Scene;
|
|
47256
47244
|
// camera: THREE.PerspectiveCamera;
|
|
47257
47245
|
this.sceneName = "";
|
|
@@ -47265,18 +47253,19 @@ class baseScene extends commonScene {
|
|
|
47265
47253
|
this.lights = [];
|
|
47266
47254
|
this.onWindowResize = () => {
|
|
47267
47255
|
var _a;
|
|
47268
|
-
console.log("adaa");
|
|
47269
47256
|
this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
|
|
47270
47257
|
this.onRenderCameraChange();
|
|
47271
47258
|
(_a = this.vignette) === null || _a === void 0 ? void 0 : _a.style({
|
|
47272
47259
|
aspect: this.camera.aspect,
|
|
47273
47260
|
});
|
|
47261
|
+
if (this.controls instanceof Copper3dTrackballControls)
|
|
47262
|
+
this.controls.handleResize();
|
|
47274
47263
|
this.renderer.setSize(this.container.clientWidth, this.container.clientHeight);
|
|
47275
47264
|
};
|
|
47276
47265
|
this.renderer = renderer;
|
|
47277
47266
|
this.ambientLight = new AmbientLight(0x202020, 0.3);
|
|
47278
47267
|
this.directionalLight = new DirectionalLight(0xffffff, 0.3);
|
|
47279
|
-
if (!alpha) {
|
|
47268
|
+
if (!(opt === null || opt === void 0 ? void 0 : opt.alpha)) {
|
|
47280
47269
|
this.vignette = createBackground({
|
|
47281
47270
|
aspect: this.container.clientWidth / this.container.clientHeight,
|
|
47282
47271
|
grainScale: IS_IOS ? 0 : 0.001,
|
|
@@ -47291,7 +47280,7 @@ class baseScene extends commonScene {
|
|
|
47291
47280
|
init() {
|
|
47292
47281
|
this.copperControl.setCameraViewPoint();
|
|
47293
47282
|
this.camera.position.z = 2;
|
|
47294
|
-
this.scene.add(this.camera);
|
|
47283
|
+
// this.scene.add(this.camera);
|
|
47295
47284
|
this.renderer.setSize(this.container.clientWidth, this.container.clientHeight);
|
|
47296
47285
|
this.addLights();
|
|
47297
47286
|
}
|
|
@@ -48101,10 +48090,14 @@ class baseRenderer {
|
|
|
48101
48090
|
this.pmremGenerator.compileEquirectangularShader();
|
|
48102
48091
|
this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
|
|
48103
48092
|
if (!!((_b = this.options) === null || _b === void 0 ? void 0 : _b.alpha)) {
|
|
48104
|
-
this.currentScene = new baseScene(this.container, this.renderer,
|
|
48093
|
+
this.currentScene = new baseScene(this.container, this.renderer, {
|
|
48094
|
+
alpha: true,
|
|
48095
|
+
});
|
|
48105
48096
|
}
|
|
48106
48097
|
else {
|
|
48107
|
-
this.currentScene = new baseScene(this.container, this.renderer,
|
|
48098
|
+
this.currentScene = new baseScene(this.container, this.renderer, {
|
|
48099
|
+
alpha: false,
|
|
48100
|
+
});
|
|
48108
48101
|
}
|
|
48109
48102
|
this.currentScene.sceneName = "default";
|
|
48110
48103
|
!!this.currentScene.vignette &&
|
|
@@ -48189,11 +48182,11 @@ class baseRenderer {
|
|
|
48189
48182
|
bgColor1Ctrl.onChange(() => this.currentScene.updateBackground(this.state.bgColor1, this.state.bgColor2));
|
|
48190
48183
|
bgColor2Ctrl.onChange(() => this.currentScene.updateBackground(this.state.bgColor1, this.state.bgColor2));
|
|
48191
48184
|
// camera
|
|
48192
|
-
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.
|
|
48185
|
+
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.cameraGui) {
|
|
48193
48186
|
this.cameraFolder = gui.addFolder("Camera");
|
|
48194
48187
|
}
|
|
48195
48188
|
// Performance
|
|
48196
|
-
if ((_b = this.options) === null || _b === void 0 ? void 0 : _b.
|
|
48189
|
+
if ((_b = this.options) === null || _b === void 0 ? void 0 : _b.performanceGui) {
|
|
48197
48190
|
const perfFolder = gui.addFolder("Performance");
|
|
48198
48191
|
const perfLi = document.createElement("li");
|
|
48199
48192
|
this.stats.dom.style.position = "static";
|
|
@@ -48202,7 +48195,7 @@ class baseRenderer {
|
|
|
48202
48195
|
perfFolder.__ul.appendChild(perfLi);
|
|
48203
48196
|
}
|
|
48204
48197
|
// lights
|
|
48205
|
-
if ((_c = this.options) === null || _c === void 0 ? void 0 : _c.
|
|
48198
|
+
if ((_c = this.options) === null || _c === void 0 ? void 0 : _c.lightGui) {
|
|
48206
48199
|
const lightFolder = gui.addFolder("LightsFolder");
|
|
48207
48200
|
[
|
|
48208
48201
|
lightFolder.add(this.state, "addLights").listen(),
|
|
@@ -56247,11 +56240,8 @@ class TrackballControls extends EventDispatcher {
|
|
|
56247
56240
|
}
|
|
56248
56241
|
|
|
56249
56242
|
class copperScene extends baseScene {
|
|
56250
|
-
|
|
56251
|
-
|
|
56252
|
-
// private sort: boolean = true; //default ascending order
|
|
56253
|
-
constructor(container, renderer, controls, alpha) {
|
|
56254
|
-
super(container, renderer, alpha);
|
|
56243
|
+
constructor(container, renderer, opt) {
|
|
56244
|
+
super(container, renderer, opt);
|
|
56255
56245
|
this.clock = new Clock();
|
|
56256
56246
|
// isHalfed: boolean = false;
|
|
56257
56247
|
this.mixer = null;
|
|
@@ -56259,12 +56249,11 @@ class copperScene extends baseScene {
|
|
|
56259
56249
|
this.modelReady = false;
|
|
56260
56250
|
// rayster pick
|
|
56261
56251
|
// texture2d
|
|
56262
|
-
// private depthStep: number = 0.4;
|
|
56263
56252
|
this.texture2dMesh = null;
|
|
56264
|
-
if (controls === "trackball") {
|
|
56253
|
+
if ((opt === null || opt === void 0 ? void 0 : opt.controls) === "trackball") {
|
|
56265
56254
|
this.controls = new TrackballControls(this.camera, this.renderer.domElement);
|
|
56266
56255
|
}
|
|
56267
|
-
else if (controls === "orbit") {
|
|
56256
|
+
else if ((opt === null || opt === void 0 ? void 0 : opt.controls) === "orbit") {
|
|
56268
56257
|
this.controls = new OrbitControls(this.camera, this.renderer.domElement);
|
|
56269
56258
|
}
|
|
56270
56259
|
else {
|
|
@@ -56507,13 +56496,12 @@ class copperScene extends baseScene {
|
|
|
56507
56496
|
}
|
|
56508
56497
|
updateControls(camera) {
|
|
56509
56498
|
this.controls.dispose();
|
|
56510
|
-
this.controls = new
|
|
56499
|
+
this.controls = new Copper3dTrackballControls(camera, this.renderer.domElement);
|
|
56511
56500
|
// this.controls.target.set(64, 64, 128);
|
|
56512
56501
|
this.controls.target.set(0, 0, 0);
|
|
56513
56502
|
this.controls.minZoom = 0.5;
|
|
56514
56503
|
this.controls.maxZoom = 4;
|
|
56515
56504
|
// this.controls.enablePan = false;
|
|
56516
|
-
this.controls.update();
|
|
56517
56505
|
}
|
|
56518
56506
|
onRenderCameraChange() {
|
|
56519
56507
|
const { width, height } = this.container.getBoundingClientRect();
|
|
@@ -56527,7 +56515,6 @@ class copperScene extends baseScene {
|
|
|
56527
56515
|
else {
|
|
56528
56516
|
this.camera.aspect = aspect;
|
|
56529
56517
|
}
|
|
56530
|
-
this.camera.updateProjectionMatrix();
|
|
56531
56518
|
}
|
|
56532
56519
|
render() {
|
|
56533
56520
|
this.controls.update();
|
|
@@ -56575,13 +56562,17 @@ class copperRenderer extends baseRenderer {
|
|
|
56575
56562
|
}
|
|
56576
56563
|
}
|
|
56577
56564
|
createScene(name) {
|
|
56578
|
-
var _a, _b;
|
|
56565
|
+
var _a, _b, _c;
|
|
56579
56566
|
if (this.sceneMap[name] != undefined) {
|
|
56580
56567
|
return undefined;
|
|
56581
56568
|
}
|
|
56582
56569
|
else {
|
|
56583
56570
|
const alpha = !!((_a = this.options) === null || _a === void 0 ? void 0 : _a.alpha);
|
|
56584
|
-
const new_scene = new copperScene(this.container, this.renderer,
|
|
56571
|
+
const new_scene = new copperScene(this.container, this.renderer, {
|
|
56572
|
+
camera: (_b = this.options) === null || _b === void 0 ? void 0 : _b.cameraType,
|
|
56573
|
+
controls: (_c = this.options) === null || _c === void 0 ? void 0 : _c.controls,
|
|
56574
|
+
alpha: alpha,
|
|
56575
|
+
});
|
|
56585
56576
|
new_scene.sceneName = name;
|
|
56586
56577
|
this.updateEnvironment(new_scene.vignette);
|
|
56587
56578
|
this.sceneMap[name] = new_scene;
|
|
@@ -56725,9 +56716,6 @@ class copperRendererOnDemond extends baseRenderer {
|
|
|
56725
56716
|
constructor(container, options) {
|
|
56726
56717
|
super(container, options);
|
|
56727
56718
|
this.sceneMap = {};
|
|
56728
|
-
// addGui(): void {
|
|
56729
|
-
// console.log("hello");
|
|
56730
|
-
// }
|
|
56731
56719
|
this.animate = () => {
|
|
56732
56720
|
this.render();
|
|
56733
56721
|
this.stats.update();
|
|
@@ -67835,8 +67823,6 @@ class nrrd_tools {
|
|
|
67835
67823
|
this.allSlicesArray[0].x.volume.dimensions[1];
|
|
67836
67824
|
this.nrrd_states.nrrd_z_pixel =
|
|
67837
67825
|
this.allSlicesArray[0].x.volume.dimensions[2];
|
|
67838
|
-
console.log("mm", this.nrrd_states.nrrd_x_mm);
|
|
67839
|
-
console.log("pixel", this.nrrd_states.nrrd_x_pixel);
|
|
67840
67826
|
this.nrrd_states.voxelSpacing = this.allSlicesArray[0].x.volume.spacing;
|
|
67841
67827
|
this.nrrd_states.ratios.x = this.allSlicesArray[0].x.volume.spacing[0];
|
|
67842
67828
|
this.nrrd_states.ratios.y = this.allSlicesArray[0].x.volume.spacing[1];
|
|
@@ -69771,7 +69757,7 @@ class nrrd_tools {
|
|
|
69771
69757
|
}
|
|
69772
69758
|
|
|
69773
69759
|
// import * as kiwrious from "copper3d_plugin_heart_k";
|
|
69774
|
-
const REVISION = "v1.15.
|
|
69775
|
-
console.log("%cCopper3D Visualisation %cBeta:v1.15.
|
|
69760
|
+
const REVISION = "v1.15.8";
|
|
69761
|
+
console.log("%cCopper3D Visualisation %cBeta:v1.15.8", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
|
|
69776
69762
|
|
|
69777
69763
|
export { CameraViewPoint, Copper3dTrackballControls, REVISION, addBoxHelper, addLabelToScene, configKiwriousHeart, convert3DPostoScreenPos, convertScreenPosto3DPos, copperMScene, copperMSceneRenderer, copperRenderer, copperRendererOnDemond, copperScene, copperSceneOnDemond, createTexture2D_NRRD, fullScreenListenner, kiwrious, loading, nrrd_tools, setHDRFilePath };
|