From b77054f3f268eec7b9c6c289010ddd619e15c551 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Sat, 14 Oct 2023 11:40:12 +0200 Subject: [PATCH] Docs: Improve `WebGLRenderer` page. --- docs/api/ar/renderers/WebGLRenderer.html | 10 ++++++++++ docs/api/en/renderers/WebGLRenderer.html | 13 +++++++++++-- docs/api/it/renderers/WebGLRenderer.html | 7 +++++++ docs/api/zh/renderers/WebGLRenderer.html | 8 ++++++++ examples/webgl_loader_gltf.html | 4 ---- examples/webgl_loader_gltf_transmission.html | 4 ---- 6 files changed, 36 insertions(+), 10 deletions(-) diff --git a/docs/api/ar/renderers/WebGLRenderer.html b/docs/api/ar/renderers/WebGLRenderer.html index 5cb4a85dbe1078..e5bfdbdef37920 100644 --- a/docs/api/ar/renderers/WebGLRenderer.html +++ b/docs/api/ar/renderers/WebGLRenderer.html @@ -356,6 +356,16 @@

يجمع جميع المواد في المشهد مع الكاميرا. هذا مفيد لـ تجميع الشادرات قبل العرض الأول.

+ +

+ [method:Promise compileAsync]( [param:Object3D scene], [param:Camera camera] ) +

+

+ 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.

+ + This method makes use of the *KHR_parallel_shader_compile* WebGL extension. +

[method:undefined copyFramebufferToTexture]( [param:Vector2 position], [param:FramebufferTexture texture], [param:Number level] ) diff --git a/docs/api/en/renderers/WebGLRenderer.html b/docs/api/en/renderers/WebGLRenderer.html index af0e3db4b01d85..133a73b890e76a 100644 --- a/docs/api/en/renderers/WebGLRenderer.html +++ b/docs/api/en/renderers/WebGLRenderer.html @@ -351,8 +351,17 @@

[method:undefined compile]( [param:Object3D scene], [param:Camera camera] )

- 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. +

+ +

+ [method:Promise compileAsync]( [param:Object3D scene], [param:Camera camera] ) +

+

+ 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.

+ + This method makes use of the *KHR_parallel_shader_compile* WebGL extension.

diff --git a/docs/api/it/renderers/WebGLRenderer.html b/docs/api/it/renderers/WebGLRenderer.html index d58dcb979d5e4a..d8c7ea87ada66b 100644 --- a/docs/api/it/renderers/WebGLRenderer.html +++ b/docs/api/it/renderers/WebGLRenderer.html @@ -310,6 +310,13 @@

[method:undefined clearStencil]( )

[method:undefined compile]( [param:Object3D scene], [param:Camera camera] )

Compila tutti i materiali nella scena con la telecamera. Questo è utile per precompilare le ombre prima del primo rendering.

+

[method:Promise compileAsync]( [param:Object3D scene], [param:Camera camera] )

+

+ 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.

+ This method makes use of the *KHR_parallel_shader_compile* WebGL extension. +

+

[method:undefined copyFramebufferToTexture]( [param:Vector2 position], [param:FramebufferTexture texture], [param:Number level] )

Copia i pixel dal WebGLFramebuffer corrente in una texture 2D. Abilita l'accesso a diff --git a/docs/api/zh/renderers/WebGLRenderer.html b/docs/api/zh/renderers/WebGLRenderer.html index 365c2ff28cafc6..84c12d8423e5db 100644 --- a/docs/api/zh/renderers/WebGLRenderer.html +++ b/docs/api/zh/renderers/WebGLRenderer.html @@ -271,6 +271,14 @@

[method:undefined clearStencil]( )

[method:undefined compile]( [param:Object3D scene], [param:Camera camera] )

使用相机编译场景中的所有材质。这对于在首次渲染之前预编译着色器很有用。

+

[method:Promise compileAsync]( [param:Object3D scene], [param:Camera camera] )

+

+ 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.

+ + This method makes use of the *KHR_parallel_shader_compile* WebGL extension. +

+

[method:undefined copyFramebufferToTexture]( [param:Vector2 position], [param:FramebufferTexture texture], [param:Number level] )

将当前WebGLFramebuffer中的像素复制到2D纹理中。可访问[link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/copyTexImage2D WebGLRenderingContext.copyTexImage2D].

diff --git a/examples/webgl_loader_gltf.html b/examples/webgl_loader_gltf.html index b097d884f6f24c..a7c64f48347102 100644 --- a/examples/webgl_loader_gltf.html +++ b/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 ); diff --git a/examples/webgl_loader_gltf_transmission.html b/examples/webgl_loader_gltf_transmission.html index 64203de5e33e94..9b2e20a2126a72 100644 --- a/examples/webgl_loader_gltf_transmission.html +++ b/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 );