lume / three-meshline

Mesh-based replacement for `THREE.Line` to allow lines thicker than 1 pixel and other features.
https://docs.lume.io/three-meshline/
MIT License
42 stars 4 forks source link

Problem instantiating MeshLineMaterial in TS #14

Open Matheos96 opened 7 months ago

Matheos96 commented 7 months ago

Hi!

We are considering switching to this MeshLine fork as it seems to be the best maintained one of the lot.

I am having a bit trouble getting the package to work though, in particular instantiating the MeshLine Material...

TypeScript is giving me the following error

image

I looked at the demo code and surely I don't need to give ALL properties of the options object??? Earlier we used the https://github.com/pmndrs/meshline fork where the options seen in the screenshot was enough (and sizeAttenuation was a number rather than boolean).

I tried running, despite the warning, but I get the following error in the console

THREE.WebGLProgram: Shader Error 0 - VALIDATE_STATUS false Program Info Log: Vertex shader is not compiled. VERTEX ERROR: 0:155: 'isPerspectiveMatrix

Any ideas what I am doing wrong? Thanks!

Matheos96 commented 7 months ago

The
THREE.WebGLProgram: Shader Error 0 - VALIDATE_STATUS false Program Info Log: Vertex shader is not compiled. VERTEX ERROR: 0:155: 'isPerspectiveMatrix
error should be resolved with the merge of the linked PR (if I am correct).

The Typescript issue was "solved" by simply using the as operator like this... I am not too familiar with TS lol...

new MeshLineMaterial({
            color: new THREE.Color(color), 
            lineWidth: 10,
            sizeAttenuation: false,
            resolution: resolutionReference,
} as THREE.ShaderMaterialParameters & MeshLineMaterial

I don't think the two issues were related. The TS one was a misunderstanding / TS incompitability "issue" whereas the shader thing may actually be something worth fixing as per the PR