Skip to content

Commit e55915b

Browse files
committed
update VR helper
1 parent 1830ea8 commit e55915b

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/helpers/helpers.slice.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,8 @@ export default class HelpersSlice extends HelpersMaterialMixin( THREE.Object3D )
337337

338338
updateIntensitySettingsUniforms() {
339339

340+
// compensate for the offset to only pass > 0 values to shaders
341+
// models > models.stack.js : _packTo8Bits
340342
let offset = 0;
341343
if( this._stack._minMax[0] < 0 ){
342344

src/helpers/helpers.volumerendering.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ export default class HelpersVolumeRendering extends HelpersMaterialMixin( THREE.
5050

5151
_prepareMaterial(){
5252

53+
// compensate for the offset to only pass > 0 values to shaders
54+
// models > models.stack.js : _packTo8Bits
55+
let offset = 0;
56+
if( this._stack._minMax[0] < 0 ){
57+
58+
offset = this._stack._minMax[0];
59+
60+
}
61+
5362
// uniforms
5463
this._uniforms = ShadersUniform.uniforms();
5564
this._uniforms.uWorldBBox.value = this._stack.worldBoundingBox();
@@ -60,7 +69,7 @@ export default class HelpersVolumeRendering extends HelpersMaterialMixin( THREE.
6069
this._uniforms.uPixelType.value = this._stack.pixelType;
6170
this._uniforms.uBitsAllocated.value = this._stack.bitsAllocated;
6271
this._uniforms.uPackedPerPixel.value = this._stack.packedPerPixel;
63-
this._uniforms.uWindowCenterWidth.value = [this._stack.windowCenter, this._stack.windowWidth * 0.8];
72+
this._uniforms.uWindowCenterWidth.value = [offset + this._stack.windowCenter, this._stack.windowWidth * 0.8];
6473
this._uniforms.uRescaleSlopeIntercept.value = [this._stack.rescaleSlope, this._stack.rescaleIntercept];
6574
this._uniforms.uDataDimensions.value = [this._stack.dimensionsIJK.x,
6675
this._stack.dimensionsIJK.y,

src/models/models.stack.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,6 @@ export default class ModelsStack extends ModelsBase{
507507
}
508508
packed.textureType = THREE.LuminanceFormat;
509509
packed.data = data;
510-
console.log( data );
511510

512511
} else if (bits === 16 && channels === 1) {
513512

0 commit comments

Comments
 (0)