Skip to content

Commit

Permalink
refactor(temp): test ?
Browse files Browse the repository at this point in the history
  • Loading branch information
ftoromanoff committed May 21, 2024
1 parent c6b7710 commit a2e5fa1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Layer/ReferencingLayerProperties.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

// next step is move these properties to Style class
// and hide transparent mechanism

function ReferLayerProperties(material, layer) {
if (layer && layer.isGeometryLayer) {
let transparent = material.transparent;
Expand All @@ -16,26 +15,31 @@ function ReferLayerProperties(material, layer) {
get: () => material.layer.opacity,
});
}

if (material.uniforms && material.uniforms.mode != undefined) {
Object.defineProperty(material.uniforms.mode, 'value', {
get: () => material.layer.pntsMode,
});
}

if (material.uniforms && material.uniforms.shape != undefined) {
Object.defineProperty(material.uniforms.shape, 'value', {
get: () => material.layer.pntsShape,
});
}

if (material.uniforms && material.uniforms.sizeMode != undefined) {
Object.defineProperty(material.uniforms.sizeMode, 'value', {
get: () => material.layer.pntsSizeMode,
});
}

if (material.uniforms && material.uniforms.minAttenuatedSize != undefined) {
Object.defineProperty(material.uniforms.minAttenuatedSize, 'value', {
get: () => material.layer.pntsMinAttenuatedSize,
});
}

if (material.uniforms && material.uniforms.maxAttenuatedSize != undefined) {
Object.defineProperty(material.uniforms.maxAttenuatedSize, 'value', {
get: () => material.layer.pntsMaxAttenuatedSize,
Expand All @@ -45,11 +49,14 @@ function ReferLayerProperties(material, layer) {
Object.defineProperty(material, 'wireframe', {
get: () => material.layer.wireframe,
});

Object.defineProperty(material, 'transparent', {
get: () => {
if (transparent != (material.layer.opacity < 1.0 || transparent)) {
const needTransparency = material.userData.needTransparency?.[material.mode] || material.layer.opacity < 1.0;
console.warn('needTransparency', needTransparency);
if (transparent != needTransparency) {
material.needsUpdate = true;
transparent = (material.layer.opacity < 1.0 || transparent);
transparent = needTransparency;
}
return transparent;
},
Expand Down

0 comments on commit a2e5fa1

Please sign in to comment.