Capítulo 556 de 859

Chapter 556: HTMLMesh

Core Idea

This class can be used to render a DOM element onto a canvas and use it as a texture for a plane mesh.

A typical use case for this class is to render the GUI of lil-gui as a texture so it is compatible for VR.

Code Examples

const gui = new GUI( { width: 300 } ); // create lil-gui instance
const mesh = new HTMLMesh( gui.domElement );
scene.add( mesh );
  • What it demonstrates: Typical usage of HTMLMesh.

Reference Tables

Constructor

Signature
new HTMLMesh( dom : HTMLElement )

Methods

MethodDescription
.dispose()Frees the GPU-related resources allocated by this instance and removes all event listeners. Call this method whenever this instance is no longer used in your app.

Key Takeaways

  1. HTMLMesh extends: EventDispatcher → Object3D → Mesh
  2. Key methods: dispose.

Connects To