|
@@ -32,6 +32,7 @@
|
|
|
import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
|
|
import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
|
|
|
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
|
|
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
|
|
|
import { HDRLoader } from 'three/addons/loaders/HDRLoader.js';
|
|
import { HDRLoader } from 'three/addons/loaders/HDRLoader.js';
|
|
|
|
|
+ import WebGPU from 'three/addons/capabilities/WebGPU.js';
|
|
|
|
|
|
|
|
let renderer, scene, camera, controls;
|
|
let renderer, scene, camera, controls;
|
|
|
|
|
|
|
@@ -67,6 +68,14 @@
|
|
|
sheenColor: 0xffffff // sRGB
|
|
sheenColor: 0xffffff // sRGB
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ if ( WebGPU.isAvailable() === false ) {
|
|
|
|
|
+
|
|
|
|
|
+ document.body.appendChild( WebGPU.getErrorMessage() );
|
|
|
|
|
+
|
|
|
|
|
+ throw new Error( 'No WebGPU support' );
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
init();
|
|
init();
|
|
|
|
|
|
|
|
async function init() {
|
|
async function init() {
|
|
@@ -106,11 +115,19 @@
|
|
|
gui.add( params, 'wind', 0, 5, 0.1 );
|
|
gui.add( params, 'wind', 0, 5, 0.1 );
|
|
|
|
|
|
|
|
const materialFolder = gui.addFolder( 'material' );
|
|
const materialFolder = gui.addFolder( 'material' );
|
|
|
- materialFolder.addColor( API, 'color' ).onChange( function ( color ) { clothMaterial.color.setHex( color ); } );
|
|
|
|
|
|
|
+ materialFolder.addColor( API, 'color' ).onChange( function ( color ) {
|
|
|
|
|
+
|
|
|
|
|
+ clothMaterial.color.setHex( color );
|
|
|
|
|
+
|
|
|
|
|
+ } );
|
|
|
materialFolder.add( clothMaterial, 'roughness', 0.0, 1, 0.01 );
|
|
materialFolder.add( clothMaterial, 'roughness', 0.0, 1, 0.01 );
|
|
|
materialFolder.add( clothMaterial, 'sheen', 0.0, 1, 0.01 );
|
|
materialFolder.add( clothMaterial, 'sheen', 0.0, 1, 0.01 );
|
|
|
materialFolder.add( clothMaterial, 'sheenRoughness', 0.0, 1, 0.01 );
|
|
materialFolder.add( clothMaterial, 'sheenRoughness', 0.0, 1, 0.01 );
|
|
|
- materialFolder.addColor( API, 'sheenColor' ).onChange( function ( color ) { clothMaterial.sheenColor.setHex( color ); } );
|
|
|
|
|
|
|
+ materialFolder.addColor( API, 'sheenColor' ).onChange( function ( color ) {
|
|
|
|
|
+
|
|
|
|
|
+ clothMaterial.sheenColor.setHex( color );
|
|
|
|
|
+
|
|
|
|
|
+ } );
|
|
|
|
|
|
|
|
window.addEventListener( 'resize', onWindowResize );
|
|
window.addEventListener( 'resize', onWindowResize );
|
|
|
|
|
|