vendor/GLTFExporter.js
function createNormalizedNormalAttribute(normal) {
      if (cachedData.attributes.has(normal)) {
        return cachedData.attributes.get(normal);
      }

      var attribute = normal.clone();

      var v = new THREE.Vector3();

      for (var i = 0, il = attribute.count; i < il; i++) {
        v.fromArray(attribute.array, i * 3);

        if (v.x === 0 && v.y === 0 && v.z === 0) {
          // if values can't be normalized set (1, 0, 0)
          v.setX(1.0);
        } else {
          v.normalize();
        }

        v.toArray(attribute.array, i * 3);
      }

      cachedData.attributes.set(normal, attribute);

      return attribute;
    }
function createNormalizedNormalAttribute(normal) {
      if (cachedData.attributes.has(normal)) {
        return cachedData.attributes.get(normal);
      }

      var attribute = normal.clone();

      var v = new THREE.Vector3();

      for (var i = 0, il = attribute.count; i < il; i++) {
        v.fromArray(attribute.array, i * 3);

        if (v.x === 0 && v.y === 0 && v.z === 0) {
          // if values can't be normalized set (1, 0, 0)
          v.setX(1.0);
        } else {
          v.normalize();
        }

        v.toArray(attribute.array, i * 3);
      }

      cachedData.attributes.set(normal, attribute);

      return attribute;
    }
function createNormalizedNormalAttribute ( normal ) { if ( cachedData . attributes . has ( normal ) ) { return cachedData . attributes . get ( normal ) ; } var attribute = normal . clone ( ) ; var v = new THREE . Vector3 ( ) ; for ( var i = 0 , il = attribute . count ; i < il ; i ++ ) { v . fromArray ( attribute . array , i * 3 ) ; if ( v . x === 0 && v . y === 0 && v . z === 0 ) { // if values can't be normalized set (1, 0, 0) v . setX ( 1.0 ) ; } else { v . normalize ( ) ; } v . toArray ( attribute . array , i * 3 ) ; } cachedData . attributes . set ( normal , attribute ) ; return attribute ; }
Creates normalized normal buffer attribute.

@param {THREE.BufferAttribute} normal
@returns {THREE.BufferAttribute}
Creates normalized normal buffer attribute .