Skip to content

Commit

Permalink
Fix for 3D Blending. (#440)
Browse files Browse the repository at this point in the history
* Minimal Fix for 3D Blending.

* Remove culling on layer
  • Loading branch information
ilan-gold authored May 26, 2021
1 parent 4bf947c commit 4a262f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 8 additions & 0 deletions src/layers/VolumeLayer/VolumeLayer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { CompositeLayer, COORDINATE_SYSTEM } from '@deck.gl/core';
import GL from '@luma.gl/constants';
import { TextLayer } from '@deck.gl/layers';
import { Matrix4 } from 'math.gl';
import XR3DLayer from '../XR3DLayer';
Expand Down Expand Up @@ -168,6 +169,13 @@ const VolumeLayer = class extends CompositeLayer {
channelData: { data, width, height, depth },
id: `XR3DLayer-${0}-${height}-${width}-${0}-${resolution}-${id}`,
physicalSizeScalingMatrix,
parameters: {
[GL.CULL_FACE]: true,
[GL.CULL_FACE_MODE]: GL.FRONT,
[GL.DEPTH_TEST]: false,
blendFunc: [GL.SRC_ALPHA, GL.ONE],
blend: true
},
resolutionMatrix,
dtype
});
Expand Down
5 changes: 0 additions & 5 deletions src/layers/XR3DLayer/XR3DLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@ const XR3DLayer = class extends Layer {
this.setState({
model: this._getModel(gl)
});
// Needed to only render the back polygons.
setParameters(gl, {
[GL.CULL_FACE]: true,
[GL.CULL_FACE_MODE]: GL.FRONT
});
// This tells WebGL how to read row data from the texture. For example, the default here is 4 (i.e for RGBA, one byte per channel) so
// each row of data is expected to be a multiple of 4. This setting (i.e 1) allows us to have non-multiple-of-4 row sizes. For example, for 2 byte (16 bit data),
// we could use 2 as the value and it would still work, but 1 also works fine (and is more flexible for 8 bit - 1 byte - textures as well).
Expand Down

0 comments on commit 4a262f8

Please sign in to comment.