Capítulo 614 de 859

Chapter 614: TubePainter

Core Idea

This module can be used to paint tube-like meshes along a sequence of points. This module is used in a XR painter demo.

Key Concepts

  • mesh : Mesh: The "painted" tube mesh. Must be added to the scene.

Code Examples

const painter = new TubePainter();
scene.add( painter.mesh );
  • What it demonstrates: Typical usage of TubePainter.

Reference Tables

Constructor

Signature
new TubePainter()

Properties

PropertyDescription
.mesh : MeshThe "painted" tube mesh. Must be added to the scene.

Methods

MethodDescription
.lineTo( position : Vector3 )Draw a stroke from the current position to the given one. This method extends the tube while drawing with the XR controllers.
.moveTo( position : Vector3 )Moves the current painting position to the given value.
.setColor( color : Color )Sets the color of newly rendered tube segments.
.setSize( size : number )Sets the size of newly rendered tube segments.
.update()Updates the internal geometry buffers so the new painted segments are rendered.

Key Takeaways

  1. Most relevant properties: mesh.
  2. Key methods: lineTo, moveTo, setColor, setSize.

Connects To