Sfoglia il codice sorgente

address feedback on PR #28654 (#29190)

* address feedback

* update screenshot
Hunter Larco 1 anno fa
parent
commit
4c62a13237

BIN
examples/screenshots/webgl_texture2darray_layerupdate.jpg


+ 12 - 3
examples/webgl_texture2darray_layerupdate.html

@@ -141,9 +141,9 @@
 				};
 
 				const gui = new GUI();
-				gui.add(formData, 'srcLayer', 0, spiritedaway.image.depth - 1, 1);
-				gui.add(formData, 'destLayer', 0, textureArray.image.depth - 1, 1);
-				gui.add(formData, 'transfer');
+				gui.add( formData, 'srcLayer', 0, spiritedaway.image.depth - 1, 1 );
+				gui.add( formData, 'destLayer', 0, textureArray.image.depth - 1, 1 );
+				gui.add( formData, 'transfer' );
 
 				/// Setup the scene.
 
@@ -173,6 +173,15 @@
 
 				window.addEventListener( 'resize', onWindowResize );
 
+				// Initialize the texture array by first rendering the spirited away
+				// frames in order.
+
+				textureArray.mipmaps[ 0 ].data.set(
+					spiritedaway.mipmaps[ 0 ].data.subarray( 0, textureArray.mipmaps[ 0 ].data.length )
+				);
+				textureArray.needsUpdate = true;
+				renderer.render( scene, camera );
+
 			}
 
 			function onWindowResize() {

粤ICP备19079148号