Warm tip: This article is reproduced from serverfault.com, please click

Svelthree

发布于 2020-11-21 21:12:54

I am trying to add edges to a an object using Svelthree.

I know how to add a geometry to a scene using mesh but how do I add lines at the edges of the geometry?

This is from the official REPL (https://svelthree.dev/examples#hello-cube):

 <Scene {sti} let:scene id="scene1" props={{ background: 0xedf2f7 }}>

<PerspectiveCamera {scene} id="cam1" pos={[0, 0, 3]} lookAt={[0, 0, 0]} />
<AmbientLight {scene} intensity={1.25} />
<DirectionalLight {scene} pos={[3, 3, 3]} />

<Mesh
  {scene}
  geometry={cubeGeometry}
  material={cubeMaterial}
  mat={{ roughness: 0.5, metalness: 0.5, color: 0xff3e00 }}
  pos={[0, 0, 0]}
  rot={[0.5, 0.6, 0]}
  scale={[1, 1, 1]} />
Questioner
pac w
Viewed
0
Vatroslav Vrbanic 2020-11-29 06:11:54

I already answered your question on GitHub

Short version:

Currently there is no 'Line'-component available, but with Mesh and Scene instances available, you can basically do anything you want vanilla three style.

See REPL (based on svelthree 'Hello cube')