applyMatrix4 method

dynamic applyMatrix4(
  1. dynamic matrix
)

Implementation

applyMatrix4(matrix) {
  var normalMatrix = new THREE.Matrix3().getNormalMatrix(matrix);

  for (var i = 0, il = this.vertices.length; i < il; i++) {
    var vertex = this.vertices[i];
    vertex.applyMatrix4(matrix);
  }

  for (var i = 0, il = this.faces.length; i < il; i++) {
    var face = this.faces[i];
    face.normal.applyMatrix3(normalMatrix).normalize();

    for (var j = 0, jl = face.vertexNormals.length; j < jl; j++) {
      face.vertexNormals[j].applyMatrix3(normalMatrix).normalize();
    }
  }

  if (this.boundingBox != null) {
    this.computeBoundingBox();
  }

  if (this.boundingSphere != null) {
    this.computeBoundingSphere();
  }

  this.verticesNeedUpdate = true;
  this.normalsNeedUpdate = true;

  return this;
}