Home

examples/lighting/content/Lighting2.js

Summary.

Lighting and shading models: Lambert x Phong.

Here, we add a function to take a model created by three.js and extract the data for vertices and normals,
so we can load it directly to the GPU. Edit mainEntrance to select a model and makeCube to set face or vertex normals.
Since:
  • 27/09/2016
Author:
Source:
See:

lib/TeapotGeometry.js

Summary.

Utah teapot.

In the early years of 3D modeling and rendering, Martin Newel created a computer-generated three dimensional teapot. The original "Utah teapot" was actually taller than the famed teapot we see in so many places today. Legend has it that during a demo, using a system with non-square pixels, Jim Blinn scaled the teapot rather than scaling the image. As this dataset became more widely distributed than the original, his edit changed the aspect of teapots in 3D software for years to come.
Since:
  • 07/01/2023
Author:
  • Martin Newell
Source:
See:

lib/basic-objects-IFS.js

Summary.

The functions in this file create models in an IFS (Indexed Face Set) format that can be drawn using gl.drawElements with primitive type gl.TRIANGLES.

Objects have vertex coordinates, normal vectors, and texture coordinates for each vertex, plus a list of indices for the element array buffer.

The return value of each function is an object, model, with properties:
  • model.vertexPositions -- the vertex coordinates;
  • model.vertexNormals -- the normal vectors;
  • model.vertexTextureCoords -- the texture coordinates;
  • model.indices -- the face indices.
The first three properties are of type Float32Array, while model.indices is of type Uint16Array.

This file also defines a variable (not a function) teapotModel, which is a model of the OpenGL teapot in the same format.

Since:
  • 08/01/2014
Author:
Source:
See:

lib/simple-rotator.js

Summary.

The SimpleRotator class implements an ArcBall like interface.

Created by Ken Shoemake in 1992, it is the de facto standard for interactive 3D model manipulation and visualization.

The class defines the following methods for an object of type SimpleRotator:

Since:
  • 22/01/2016
Author:
Source:
See:

lib/teal_book/cuon-matrix.js

lib/teal_book/cuon-utils.js