Reference getCameraInputs()

getCameraInputs()

Registers a callback to adjust vertex properties after the model has been transformed by the camera, but before projection, in the vertex shader. This hook can be used inside baseColorShader().modify() and similar shader modify() calls to create effects that depend on the camera's view. The callback receives an object with the following properties:

  • position: a three-component vector representing the position after camera transformation.
  • normal: a three-component vector representing the normal after camera transformation.
  • texCoord: a two-component vector representing the texture coordinates.
  • color: a four-component vector representing the color of the vertex (red, green, blue, alpha).

Return the modified object to update the vertex.

This hook is available in:

Examples

Syntax

getCameraInputs(callback)

Parameters

callback
Function: A callback function which receives the vertex object and should return it after making any changes.
Notice any errors or typos? Please let us know. Please feel free to edit src/strands/p5.strands.js and open a pull request!

Related References