Skip to content

Commit

Permalink
Docs: Improve WebGLRenderer page.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Oct 14, 2023
1 parent e94c7ea commit b77054f
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 10 deletions.
10 changes: 10 additions & 0 deletions docs/api/ar/renderers/WebGLRenderer.html
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,16 @@ <h3>
يجمع جميع المواد في المشهد مع الكاميرا. هذا مفيد لـ
تجميع الشادرات قبل العرض الأول.
</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] )
Expand Down
13 changes: 11 additions & 2 deletions docs/api/en/renderers/WebGLRenderer.html
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,17 @@ <h3>
[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>
Expand Down
7 changes: 7 additions & 0 deletions docs/api/it/renderers/WebGLRenderer.html
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,13 @@ <h3>[method:undefined clearStencil]( )</h3>
<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
Expand Down
8 changes: 8 additions & 0 deletions docs/api/zh/renderers/WebGLRenderer.html
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,14 @@ <h3>[method:undefined clearStencil]( )</h3>
<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>

Expand Down
4 changes: 0 additions & 4 deletions examples/webgl_loader_gltf.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
4 changes: 0 additions & 4 deletions examples/webgl_loader_gltf_transmission.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit b77054f

Please sign in to comment.