Capítulo 51 de 859

Chapter 51: TeapotGeometry

Core Idea

Tessellates the famous Utah teapot database by Martin Newell into triangles.

The teapot should normally be rendered as a double sided object, since for some patches both sides can be seen, e.g., the gap around the lid and inside the spout.

Segments 'n' determines the number of triangles output. Total triangles = 32_2_n_n - 8_n (degenerates at the top and bottom cusps are deleted).

Code based on SPD software Created for the Udacity course Interactive Rendering

Code Examples

const geometry = new TeapotGeometry( 50, 18 );
const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
const teapot = new THREE.Mesh( geometry, material );
scene.add( teapot );
  • What it demonstrates: Typical usage of TeapotGeometry.

Reference Tables

Constructor

Signature
new TeapotGeometry( size : number, segments : number, bottom : boolean, lid : boolean, body : boolean, fitLid : boolean, blinn : boolean )

Key Takeaways

  1. TeapotGeometry extends: EventDispatcher → BufferGeometry

Connects To