spite / THREE.MeshLine

Mesh replacement for THREE.Line
MIT License
2.18k stars 380 forks source link

MeshLineMaterial() quietly modifies the parameters object passed to it #70

Closed dwtkns closed 4 years ago

dwtkns commented 5 years ago

If I have some options that I pass to a MeshLineMaterial:

var opts = {
    color: 0xff0000,
    resolution: new THREE.Vector2(width, height),
    opacity: 0.5
}

var material = new MeshLineMaterial(options);

...after creating that material, opts.opacity === undefined.

It looks like these parameter deletions are to blame:

https://github.com/spite/THREE.MeshLine/blob/d15d05c93d45477245bb004ec0bedd9cbd17c181/src/THREE.MeshLine.js#L418-L434

Jeremboo commented 5 years ago

If you want update the opacity, you can do: material.uniforms.opacity.value = 0.5