<commit_before><!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<base href="../../" />
		<script src="list.js"></script>
		<script src="page.js"></script>
		<link type="text/css" rel="stylesheet" href="page.css" />
	</head>
	<body>
		[page:Loader] &rarr;
		<h1>[name]</h1>

		<p class="desc"> A loader for <em>glTF 2.0</em> resources. <br /><br />
		[link:https://www.khronos.org/gltf glTF] (GL Transmission Format) is an
		[link:https://github.com/KhronosGroup/glTF/tree/master/specification/2.0 open format specification]
		for efficient delivery and loading of 3D content. Assets may be provided either in JSON (.gltf)
		or binary (.glb) format. External files store textures (.jpg, .png) and additional binary
		data (.bin). A glTF asset may deliver one or more scenes, including meshes, materials,
		textures, skins, skeletons, morph targets, animations, lights, and/or cameras.
		</p>

		<h2>Extensions</h2>

		<p>
			GLTFLoader supports the following
			[link:https://github.com/KhronosGroup/glTF/tree/master/extensions/ glTF 2.0 extensions]:
		</p>

		<ul>
			<li>KHR_draco_mesh_compression</li>
			<li>KHR_materials_pbrSpecularGlossiness</li>
			<li>KHR_materials_unlit</li>
			<li>KHR_lights_punctual (experimental)</li>
		</ul>

		<h2>Example</h2>

		<code>
		// Instantiate a loader
		var loader = new THREE.GLTFLoader();

		// Optional: Provide a DRACOLoader instance to decode compressed mesh data
		THREE.DRACOLoader.setDecoderPath( '/examples/js/libs/draco' );
		loader.setDRACOLoader( new THREE.DRACOLoader() );

		// Load a glTF resource
		loader.load(
			// resource URL
			'models/gltf/duck/duck.gltf',
			// called when the resource is loaded
			function ( gltf ) {

				scene.add( gltf.scene );

				gltf.animations; // Array&lt;THREE.AnimationClip&gt;
				gltf.scene; // THREE.Scene
				gltf.scenes; // Array&lt;THREE.Scene&gt;
				gltf.cameras; // Array&lt;THREE.Camera&gt;
				gltf.asset; // Object

			},
			// called while loading is progressing
			function ( xhr ) {

				console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );

			},
			// called when loading has errors
			function ( error ) {

				console.log( 'An error happened' );

			}
		);
		</code>

		[example:webgl_loader_gltf]

		<h2>Browser compatibility</h2>

		<p>GLTFLoader relies on ES6 [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise Promises],
		which are not supported in IE11. To use the loader in IE11, you must
		[link:https://github.com/stefanpenner/es6-promise include a polyfill]
		providing a Promise replacement.</p>

		<h2>Textures</h2>
		
		<p>Textures containing color information material.{map,emissiveMap,specularMap} always use the sRGB colorspace
		in glTF, while vertex colors and material.{color,emissive,specular} values use linear colorspace. In a
		typical rendering workflow, textures are converted to linear colorspace by the renderer, lighting calculations
		are made, then final output is converted back to sRGB and displayed on screen. Unless post-processing in linear
		colorspace is needed, always configure [page:WebGLRenderer] as follows when using glTF:</p>
			
		<code>
		renderer.gammaOutput = true;
		renderer.gammaFactor = 2.2;
		</code>
		
		<p>GLTFLoader will automatically configure textures referenced from a .gltf or .glb file correctly, with the
		assumption that the renderer is set up as shown above. When loading textures externally (e.g., using
		[page:TextureLoader]) and applying them to a glTF model, colorspace and orientation must be given:</p>
		
		<code>
		// If texture is used for color information, set colorspace.
		texture.encoding = THREE.sRGBEncoding;
		// UVs use the convention that (0, 0) corresponds to the upper left corner of a texture.
		texture.flipY = false;
		</code>		
		
		<h2>Custom extensions</h2>

		<p>
			Metadata from unknown extensions is preserved as “.userData.gltfExtensions” on Object3D, Scene, and Material instances,
			or attached to the response “gltf” object. Example:
		</p>

		<code>
		loader.load('foo.gltf', function ( gltf ) {

			var scene = gltf.scene;

			var mesh = scene.children[ 3 ];

			var fooExtension = mesh.userData.gltfExtensions.EXT_foo;

			gltf.parser.getDependency( 'bufferView', fooExtension.bufferView )
				.then( function ( fooBuffer ) { ... } );

		} );
		</code><commit_msg>GLTFLoader: Formatting is hard.<commit_after><!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<base href="../../" />
		<script src="list.js"></script>
		<script src="page.js"></script>
		<link type="text/css" rel="stylesheet" href="page.css" />
	</head>
	<body>
		[page:Loader] &rarr;
		<h1>[name]</h1>

		<p class="desc"> A loader for <em>glTF 2.0</em> resources. <br /><br />
		[link:https://www.khronos.org/gltf glTF] (GL Transmission Format) is an
		[link:https://github.com/KhronosGroup/glTF/tree/master/specification/2.0 open format specification]
		for efficient delivery and loading of 3D content. Assets may be provided either in JSON (.gltf)
		or binary (.glb) format. External files store textures (.jpg, .png) and additional binary
		data (.bin). A glTF asset may deliver one or more scenes, including meshes, materials,
		textures, skins, skeletons, morph targets, animations, lights, and/or cameras.
		</p>

		<h2>Extensions</h2>

		<p>
			GLTFLoader supports the following
			[link:https://github.com/KhronosGroup/glTF/tree/master/extensions/ glTF 2.0 extensions]:
		</p>

		<ul>
			<li>KHR_draco_mesh_compression</li>
			<li>KHR_materials_pbrSpecularGlossiness</li>
			<li>KHR_materials_unlit</li>
			<li>KHR_lights_punctual (experimental)</li>
		</ul>

		<h2>Example</h2>

		<code>
		// Instantiate a loader
		var loader = new THREE.GLTFLoader();

		// Optional: Provide a DRACOLoader instance to decode compressed mesh data
		THREE.DRACOLoader.setDecoderPath( '/examples/js/libs/draco' );
		loader.setDRACOLoader( new THREE.DRACOLoader() );

		// Load a glTF resource
		loader.load(
			// resource URL
			'models/gltf/duck/duck.gltf',
			// called when the resource is loaded
			function ( gltf ) {

				scene.add( gltf.scene );

				gltf.animations; // Array&lt;THREE.AnimationClip&gt;
				gltf.scene; // THREE.Scene
				gltf.scenes; // Array&lt;THREE.Scene&gt;
				gltf.cameras; // Array&lt;THREE.Camera&gt;
				gltf.asset; // Object

			},
			// called while loading is progressing
			function ( xhr ) {

				console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );

			},
			// called when loading has errors
			function ( error ) {

				console.log( 'An error happened' );

			}
		);
		</code>

		[example:webgl_loader_gltf]

		<h2>Browser compatibility</h2>

		<p>GLTFLoader relies on ES6 [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise Promises],
		which are not supported in IE11. To use the loader in IE11, you must
		[link:https://github.com/stefanpenner/es6-promise include a polyfill]
		providing a Promise replacement.</p>

		<h2>Textures</h2>
		
		<p>Textures containing color information (.map, .emissiveMap, and .specularMap) always use sRGB colorspace in
		glTF, while vertex colors and material properties (.color, .emissive, .specular) use linear colorspace. In a
		typical rendering workflow, textures are converted to linear colorspace by the renderer, lighting calculations
		are made, then final output is converted back to sRGB and displayed on screen. Unless you need post-processing
		in linear colorspace, always configure [page:WebGLRenderer] as follows when using glTF:</p>
			
		<code>
		renderer.gammaOutput = true;
		renderer.gammaFactor = 2.2;
		</code>
		
		<p>GLTFLoader will automatically configure textures referenced from a .gltf or .glb file correctly, with the
		assumption that the renderer is set up as shown above. When loading textures externally (e.g., using
		[page:TextureLoader]) and applying them to a glTF model, colorspace and orientation must be given:</p>
		
		<code>
		// If texture is used for color information, set colorspace.
		texture.encoding = THREE.sRGBEncoding;

		// UVs use the convention that (0, 0) corresponds to the upper left corner of a texture.
		texture.flipY = false;
		</code>		
		
		<h2>Custom extensions</h2>

		<p>
			Metadata from unknown extensions is preserved as “.userData.gltfExtensions” on Object3D, Scene, and Material instances,
			or attached to the response “gltf” object. Example:
		</p>

		<code>
		loader.load('foo.gltf', function ( gltf ) {

			var scene = gltf.scene;

			var mesh = scene.children[ 3 ];

			var fooExtension = mesh.userData.gltfExtensions.EXT_foo;

			gltf.parser.getDependency( 'bufferView', fooExtension.bufferView )
				.then( function ( fooBuffer ) { ... } );

		} );
		</code>
{'fraction_non_alphanumeric': 0.12398490220748026, 'fraction_numerical': 0.008006405124099279, 'mean_word_length': 3.575614861329147, 'pattern_counts': {'":': 0, '<': 119, '<?xml version=': 0, '>': 119, 'https://': 10, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3730939', 'n_tokens_mistral': 3295, 'n_tokens_neox': 2831, 'n_words': 841}