Skip to content

Commit af4d061

Browse files
committed
fix(3dTilesLayer): fix transparency for 3dTilesLayer
1 parent 5bf62f2 commit af4d061

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Layer/ReferencingLayerProperties.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
// next step is move these properties to Style class
33
// and hide transparent mechanism
4-
54
function ReferLayerProperties(material, layer) {
65
if (layer && layer.isGeometryLayer) {
76
let transparent = material.transparent;
@@ -16,26 +15,31 @@ function ReferLayerProperties(material, layer) {
1615
get: () => material.layer.opacity,
1716
});
1817
}
18+
1919
if (material.uniforms && material.uniforms.mode != undefined) {
2020
Object.defineProperty(material.uniforms.mode, 'value', {
2121
get: () => material.layer.pntsMode,
2222
});
2323
}
24+
2425
if (material.uniforms && material.uniforms.shape != undefined) {
2526
Object.defineProperty(material.uniforms.shape, 'value', {
2627
get: () => material.layer.pntsShape,
2728
});
2829
}
30+
2931
if (material.uniforms && material.uniforms.sizeMode != undefined) {
3032
Object.defineProperty(material.uniforms.sizeMode, 'value', {
3133
get: () => material.layer.pntsSizeMode,
3234
});
3335
}
36+
3437
if (material.uniforms && material.uniforms.minAttenuatedSize != undefined) {
3538
Object.defineProperty(material.uniforms.minAttenuatedSize, 'value', {
3639
get: () => material.layer.pntsMinAttenuatedSize,
3740
});
3841
}
42+
3943
if (material.uniforms && material.uniforms.maxAttenuatedSize != undefined) {
4044
Object.defineProperty(material.uniforms.maxAttenuatedSize, 'value', {
4145
get: () => material.layer.pntsMaxAttenuatedSize,
@@ -45,11 +49,13 @@ function ReferLayerProperties(material, layer) {
4549
Object.defineProperty(material, 'wireframe', {
4650
get: () => material.layer.wireframe,
4751
});
52+
4853
Object.defineProperty(material, 'transparent', {
4954
get: () => {
50-
if (transparent != material.layer.opacity < 1.0) {
55+
const needTransparency = material.userData.needTransparency?.[material.mode] || material.layer.opacity < 1.0;
56+
if (transparent != needTransparency) {
5157
material.needsUpdate = true;
52-
transparent = material.layer.opacity < 1.0;
58+
transparent = needTransparency;
5359
}
5460
return transparent;
5561
},

0 commit comments

Comments
 (0)