参考 mat3()

mat3()

此 API 是实验性的

其行为可能在 p5.js 的未来版本中发生变化。

Creates a 3x3 matrix inside a p5.strands shader callback.

mat3() is the same function as transform2D(), named the way it is in GLSL.

Passing a 4x4 matrix to mat3() keeps only its upper-left 3x3 block, which drops the move part of a 3D transform and leaves the rotation and scale. That block is what lighting calculations need, so this is a handy way to turn a transform3D() into a matrix for surface directions.

Note: mat3() can only be used inside a p5.strands shader callback.

示例

语法

mat3(values1, values2, ..., valuesn)

参数

values1, ..., valuesn
Number: nothing for the identity matrix, one number, one matrix, 3 column vectors, or 9 values in column-major order.

返回值

a 3x3 matrix.

相关参考