Explorar o código

Docs: Improve `WebGLRenderer` page. (#26961)

Michael Herzog hai 1 ano
pai
achega
c93a459039

+ 10 - 0
docs/api/ar/renderers/WebGLRenderer.html

@@ -356,6 +356,16 @@
 		يجمع جميع المواد في المشهد مع الكاميرا. هذا مفيد لـ
 		تجميع الشادرات قبل العرض الأول.
 		</p>
+
+		<h3>
+			[method:Promise compileAsync]( [param:Object3D scene], [param:Camera camera] )
+		</h3>
+		<p>
+			Async version of [page:WebGLRenderer.compile .compile](). The method returns a Promise that resolves when the 
+			given 3D object or scene can be rendered without unnecessary stalling due to shader compilation.<br /><br />
+			
+			This method makes use of the *KHR_parallel_shader_compile* WebGL extension.
+		</p>
 		 
 		<h3>
 		[method:undefined copyFramebufferToTexture]( [param:Vector2 position], [param:FramebufferTexture texture], [param:Number level] )

+ 11 - 2
docs/api/en/renderers/WebGLRenderer.html

@@ -351,8 +351,17 @@ document.body.appendChild( renderer.domElement );
 			[method:undefined compile]( [param:Object3D scene], [param:Camera camera] )
 		</h3>
 		<p>
-			Compiles all materials in the scene with the camera. This is useful to
-			precompile shaders before the first rendering.
+			Compiles all materials in the scene with the camera. This is useful to precompile shaders before the first rendering.
+		</p>
+
+		<h3>
+			[method:Promise compileAsync]( [param:Object3D scene], [param:Camera camera] )
+		</h3>
+		<p>
+			Async version of [page:WebGLRenderer.compile .compile](). The method returns a Promise that resolves when the 
+			given 3D object or scene can be rendered without unnecessary stalling due to shader compilation.<br /><br />
+			
+			This method makes use of the *KHR_parallel_shader_compile* WebGL extension.
 		</p>
 
 		<h3>

+ 7 - 0
docs/api/it/renderers/WebGLRenderer.html

@@ -310,6 +310,13 @@
 		<h3>[method:undefined compile]( [param:Object3D scene], [param:Camera camera] )</h3>
 		<p>Compila tutti i materiali nella scena con la telecamera. Questo è utile per precompilare le ombre prima del primo rendering.</p>
 
+		<h3>[method:Promise compileAsync]( [param:Object3D scene], [param:Camera camera] )</h3>
+		<p>
+			Async version of [page:WebGLRenderer.compile .compile](). The method returns a Promise that resolves when the 
+			given 3D object or scene can be rendered without unnecessary stalling due to shader compilation.<br /><br />
+			This method makes use of the *KHR_parallel_shader_compile* WebGL extension.
+		</p>
+
 		<h3>[method:undefined copyFramebufferToTexture]( [param:Vector2 position], [param:FramebufferTexture texture], [param:Number level] )</h3>
 		<p>
 			Copia i pixel dal WebGLFramebuffer corrente in una texture 2D. Abilita l'accesso a 

+ 8 - 0
docs/api/zh/renderers/WebGLRenderer.html

@@ -271,6 +271,14 @@
 		<h3>[method:undefined compile]( [param:Object3D scene], [param:Camera camera] )</h3>
 		<p>使用相机编译场景中的所有材质。这对于在首次渲染之前预编译着色器很有用。</p>
 
+		<h3>[method:Promise compileAsync]( [param:Object3D scene], [param:Camera camera] )</h3>
+		<p>
+			Async version of [page:WebGLRenderer.compile .compile](). The method returns a Promise that resolves when the 
+			given 3D object or scene can be rendered without unnecessary stalling due to shader compilation.<br /><br />
+			
+			This method makes use of the *KHR_parallel_shader_compile* WebGL extension.
+		</p>
+
 		<h3>[method:undefined copyFramebufferToTexture]( [param:Vector2 position], [param:FramebufferTexture texture], [param:Number level] )</h3>
 		<p>将当前WebGLFramebuffer中的像素复制到2D纹理中。可访问[link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/copyTexImage2D WebGLRenderingContext.copyTexImage2D].</p>
 

+ 0 - 4
examples/webgl_loader_gltf.html

@@ -63,10 +63,6 @@
 						const loader = new GLTFLoader().setPath( 'models/gltf/DamagedHelmet/glTF/' );
 						loader.load( 'DamagedHelmet.gltf', async function ( gltf ) {
 
-							// Calling compileAsync returns a promise that resolves when gltf.scene can be added
-							// to scene without unnecessary stalling on shader compilation. This helps the page
-							// stay responsive during startup.
-
 							await renderer.compileAsync( gltf.scene, camera );
 
 							scene.add( gltf.scene );

+ 0 - 4
examples/webgl_loader_gltf_transmission.html

@@ -70,10 +70,6 @@
 								mixer = new THREE.AnimationMixer( gltf.scene );
 								mixer.clipAction( gltf.animations[ 0 ] ).play();
 
-								// Calling compileAsync returns a promise that resolves when gltf.scene can be added
-								// to scene without unnecessary stalling on shader compilation. This helps the page
-								// stay responsive during startup.
-
 								await renderer.compileAsync( gltf.scene, camera );
 
 								scene.add( gltf.scene );