<!-- SAGA2 · part 20 -->
setIndex( accessor );

			} );
			pending.push( accessor );

		}

		assignExtrasToUserData( geometry, primitiveDef );
		computeBounds( geometry, primitiveDef, parser );
		return Promise.all( pending ).then( function () {

			return primitiveDef.targets !== undefined ? addMorphTargets( geometry, primitiveDef.targets, parser ) : geometry;

		} );

	}
	/**
 * @param {BufferGeometry} geometry
 * @param {Number} drawMode
 * @return {BufferGeometry}
 */


	function toTrianglesDrawMode( geometry, drawMode ) {

		let index = geometry.getIndex(); // generate index if not present

		if ( index === null ) {

			const indices = [];
			const position = geometry.getAttribute( 'position' );

			if ( position !== undefined ) {

				for ( let i = 0; i < position.count; i ++ ) {

					indices.push( i );

				}

				geometry.setIndex( indices );
				index = geometry.getIndex();

			} else {

				console.error( 'THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.' );
				return geometry;

			}

		} //


		const numberOfTriangles = index.count - 2;
		const newIndices = [];

		if ( drawMode === THREE.TriangleFanDrawMode ) {

			// gl.TRIANGLE_FAN
			for ( let i = 1; i <= numberOfTriangles; i ++ ) {

				newIndices.push( index.getX( 0 ) );
				newIndices.push( index.getX( i ) );
				newIndices.push( index.getX( i + 1 ) );

			}

		} else {

			// gl.TRIANGLE_STRIP
			for ( let i = 0; i < numberOfTriangles; i ++ ) {

				if ( i % 2 === 0 ) {

					newIndices.push( index.getX( i ) );
					newIndices.push( index.getX( i + 1 ) );
					newIndices.push( index.getX( i + 2 ) );

				} else {

					newIndices.push( index.getX( i + 2 ) );
					newIndices.push( index.getX( i + 1 ) );
					newIndices.push( index.getX( i ) );

				}

			}

		}

		if ( newIndices.length / 3 !== numberOfTriangles ) {

			console.error( 'THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.' );

		} // build final geometry


		const newGeometry = geometry.clone();
		newGeometry.setIndex( newIndices );
		return newGeometry;

	}

	THREE.GLTFLoader = GLTFLoader;

} )();


===== FILE: public/saga2/avatar-backup-v68.js =====
// AVATAR BACKUP — v68 — 2026-10-04
// Full buildAvatar() with all measures
// Preserved at King's order

function buildAvatar(){
  if(avatarGrp) return;
  avatarGrp = new THREE.Group();

  // ===== INTAGLIO MATERIALS =====
  var lnCyan = new THREE.LineBasicMaterial({color:0x77eeff, transparent:true, opacity:0.6, blending:THREE.AdditiveBlending});
  var lnGold = new THREE.LineBasicMaterial({color:0xffd766, transparent:true, opacity:0.9, blending:THREE.AdditiveBlending});
  var lnDim = new THREE.LineBasicMaterial({color:0x3388aa, transparent:true, opacity:0.5, blending:THREE.AdditiveBlending});
  var lnWhite = new THREE.LineBasicMaterial({color:0xccf6ff, transparent:true, opacity:0.7, blending:THREE.AdditiveBlending});
  avatarGrp.userData.lineMats = [lnCyan, lnGold, lnDim, lnWhite];
  var lnSteel = new THREE.LineBasicMaterial({color:0xaaccdd, transparent:true, opacity:1.0});
  var lnChrome = new THREE.LineBasicMaterial({color:0xffffff, transparent:true, opacity:1.0});
  var lnBlack = new THREE.LineBasicMaterial({color:0x222233, transparent:true, opacity:1.0});
  function drawDark(pts, mat, parent){
    for(var w=0; w<16; w++){
      var ox=(Math.random()-0.5)*0.3, oy=(Math.random()-0.5)*0.3;
      var ptw = pts.map(function(p){ return new THREE.Vector3(p.x+ox, p.y+oy, p.z); });
      (parent||avatarGrp).add(new THREE.Line(new THREE.BufferGeometry().setFromPoints(ptw), mat));
    }
  }
  function draw(pts, mat, parent){
    // 20-WAY — twenty lines, micro-offsets, blended into pure light
    for(var w=0; w<8; w++){
      var ox = (Math.random()-0.5)*0.6, oy = (Math.random()-0.5)*0.6, oz = (Math.random()-0.5)*0.2;
      var ptw = pts.map(function(p){ return new THREE.Vector3(p.x+ox, p.y+oy, p.z+oz); });
      var gw = new THREE.BufferGeometry().setFromPoints(ptw);
      (parent||avatarGrp).add(new THREE.Line(gw, mat||lnCyan));
    }
  }

  // ===== HEAD — contour lines on ellipsoid (rx=5.7, ry=6.94, rz=6.08) =====
  var headGrp = new THREE.Group();
  function headPt(theta, phi, out){
    var r = 1.02+(out||0);
    return new THREE.Vector3(
      5.7*r*Math.sin(theta)*Math.cos(phi),
      6.94*r*Math.sin(phi),
      6.08*r*Math.cos(theta)*Math.cos(phi)
    );
  }
  // FACE SURFACE — dense, surface-like
  for(var fs=0; fs<24; fs++){
    var fpts=[], fy = 6-fs*0.7;
    for(var fi=0;fi<=24;fi++){ var fan=fi/24*Math.PI*2;
      var ffr = 4.5+Math.sin(fs*0.5)*0.25;
      fpts.push(new THREE.Vector3(Math.cos(fan)*ffr, fy, 2+Math.sin(fan)*ffr*0.85));
    }
    draw(fpts, fs%6===0?lnGold:lnCyan, headGrp);
  }
  // DOME - smooth latitudinal dome (full 360)
  for(var f=0; f<22; f++){
    var fp = 0.15+f*0.055, pts=[];
    for(var a=-Math.PI; a<=Math.PI; a+=0.15) pts.push(headPt(a, fp, 0.015));
    draw(pts, f>16?lnGold:(f<6?lnDim:lnCyan), headGrp);
  }
  /