pmndrs / three-stdlib

📚 Stand-alone library of threejs examples designed to run without transpilation in node & browser
https://npmjs.com/three-stdlib
MIT License
704 stars 117 forks source link

Line color not working #337

Closed Methuselah96 closed 8 months ago

Methuselah96 commented 8 months ago

Problem description:

Setting the color of a Line seems to no longer work with drei, presumably caused by https://github.com/pmndrs/three-stdlib/pull/335 either directly or indirectly.

Relevant code:

import { Vector3 } from 'three'
import { Canvas } from '@react-three/fiber'
import { Line, OrbitControls } from '@react-three/drei'
import { GeometryUtils } from 'three-stdlib'

const points = GeometryUtils.hilbert3D(new Vector3(0), 5).map((p) => [p.x, p.y, p.z])

function BasicLine() {
  return <Line points={points} color="red" lineWidth={3} />
}

export default function App() {
  return (
    <Canvas>
      <ambientLight intensity={Math.PI / 2} />
      <spotLight position={[10, 10, 10]} angle={0.15} penumbra={1} decay={0} intensity={Math.PI} />
      <pointLight position={[-10, -10, -10]} decay={0} intensity={Math.PI} />
      <BasicLine />
      <OrbitControls />
    </Canvas>
  )
}

CodeSandbox

Suggested solution:

?

CodyJasonBennett commented 8 months ago

Likely multiplied by 0 (or initial values) when vertex colors aren't specified.

github-actions[bot] commented 8 months ago

:tada: This issue has been resolved in version 2.29.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: