Explorar o código

Examples: Add GUI to USDZ exporter demo. (#26607)

Michael Herzog hai 1 ano
pai
achega
61846eed25
Modificáronse 1 ficheiros con 23 adicións e 0 borrados
  1. 23 0
      examples/misc_exporter_usdz.html

+ 23 - 0
examples/misc_exporter_usdz.html

@@ -57,9 +57,14 @@
 
 			import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
 			import { USDZExporter } from 'three/addons/exporters/USDZExporter.js';
+			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
 
 			let camera, scene, renderer;
 
+			const params = {
+				exportUSDZ: exportUSDZ
+			};
+
 			init();
 			render();
 
@@ -113,6 +118,17 @@
 
 				window.addEventListener( 'resize', onWindowResize );
 
+				const isIOS = /iPad|iPhone|iPod/.test( navigator.userAgent );
+
+				if ( isIOS === false ) {
+
+					const gui = new GUI();
+
+					gui.add( params, 'exportUSDZ' ).name( 'Export USDZ' );
+					gui.open();
+
+				}
+
 			}
 
 			function createSpotShadowMesh() {
@@ -154,6 +170,13 @@
 
 			}
 
+			function exportUSDZ() {
+
+				const link = document.getElementById( 'link' );
+				link.click();
+
+			}
+
 			//
 
 			function render() {