VertexNormalsHelper constructor

VertexNormalsHelper(
  1. Object3D object, [
  2. double size = 1,
  3. int color = 0xff0000
])

object -- object for which to render vertex normals.

size -- (optional) length of the arrows. Default is 1.

color -- (optional) hex color of the arrows. Default is 0xff0000.

Implementation

factory VertexNormalsHelper(Object3D object, [double size = 1, int color = 0xff0000]) {
  final geometry = BufferGeometry();

  final nNormals = object.geometry?.attributes["normal"].count;
  final positions = Float32BufferAttribute.fromList(Float32List(nNormals * 2 * 3), 3, false);

  geometry.setAttributeFromString('position', positions);

  final vnh = VertexNormalsHelper.create(geometry, LineBasicMaterial.fromMap({"color": color, "toneMapped": false}));

  vnh.object = object;
  vnh.size = size;
  vnh.type = 'VertexNormalsHelper';

  //

  vnh.matrixAutoUpdate = false;

  vnh.update();

  return vnh;
}