You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
94 lines
2.5 KiB
HTML
94 lines
2.5 KiB
HTML
2 months ago
|
<!DOCTYPE html>
|
||
|
<html lang="zh">
|
||
|
<head>
|
||
|
<meta charset="utf-8" />
|
||
|
<base href="../../../" />
|
||
|
<script src="page.js"></script>
|
||
|
<link type="text/css" rel="stylesheet" href="page.css" />
|
||
|
</head>
|
||
|
<body>
|
||
|
[page:Texture] →
|
||
|
|
||
|
<h1>帧缓冲纹理([name])</h1>
|
||
|
|
||
|
<p class="desc">
|
||
|
这个类只能与 [page:WebGLRenderer.copyFramebufferToTexture]() 结合使用。
|
||
|
</p>
|
||
|
|
||
|
<code>
|
||
|
const pixelRatio = window.devicePixelRatio;
|
||
|
const textureSize = 128 * pixelRatio;
|
||
|
|
||
|
// instantiate a framebuffer texture
|
||
|
const frameTexture = new FramebufferTexture( textureSize, textureSize );
|
||
|
|
||
|
// calculate start position for copying part of the frame data
|
||
|
const vector = new Vector2();
|
||
|
vector.x = ( window.innerWidth * pixelRatio / 2 ) - ( textureSize / 2 );
|
||
|
vector.y = ( window.innerHeight * pixelRatio / 2 ) - ( textureSize / 2 );
|
||
|
|
||
|
// render the scene
|
||
|
renderer.clear();
|
||
|
renderer.render( scene, camera );
|
||
|
|
||
|
// copy part of the rendered frame into the framebuffer texture
|
||
|
renderer.copyFramebufferToTexture( frameTexture, vector );
|
||
|
</code>
|
||
|
|
||
|
<h2>例子</h2>
|
||
|
|
||
|
<p>[example:webgl_framebuffer_texture]</p>
|
||
|
|
||
|
<h2>构造函数</h2>
|
||
|
<h3>[name]( [param:Number width], [param:Number height] )</h3>
|
||
|
<p>
|
||
|
[page:Number width] -- 纹理的宽度<br />
|
||
|
|
||
|
[page:Number height] -- 纹理的高度<br /><br />
|
||
|
|
||
|
</p>
|
||
|
|
||
|
|
||
|
<h2>属性</h2>
|
||
|
|
||
|
<p>共有属性请参见其基类 [page:Texture Texture] </p>
|
||
|
|
||
|
<h3>[property:Boolean generateMipmaps]</h3>
|
||
|
<p>是否为 [name] 生成 mipmaps ,默认为`false`</p>
|
||
|
|
||
|
<h3>[property:Boolean isFramebufferTexture]</h3>
|
||
|
<p>只读,检查给定对象是否为 [name] 类型</p>
|
||
|
|
||
|
<h3>[property:number magFilter]</h3>
|
||
|
<p>
|
||
|
纹理元素覆盖多个像素时如何对纹理进行采样。默认值为 [page:Textures THREE.NearestFilter] ,它使用最接近的纹理元素。
|
||
|
<br /><br />
|
||
|
|
||
|
更多细节详见 [page:Textures texture constants]
|
||
|
</p>
|
||
|
|
||
|
<h3>[property:number minFilter]</h3>
|
||
|
<p>
|
||
|
纹理元素覆盖少于一个像素时如何对纹理进行采样。默认值为 [page:Textures THREE.NearestFilter] ,它使用最近的纹理元素。
|
||
|
<br /><br />
|
||
|
|
||
|
更多细节详见 [page:Textures texture constants]
|
||
|
</p>
|
||
|
|
||
|
<h3>[property:Boolean needsUpdate]</h3>
|
||
|
|
||
|
<p>默认为 `true` ,这是加载 canvas 数据所必需的</p>
|
||
|
|
||
|
<h2>方法</h2>
|
||
|
|
||
|
<p>共有方法请参见其基类 [page:Texture Texture] </p>
|
||
|
|
||
|
|
||
|
<h2>源代码</h2>
|
||
|
|
||
|
<p>
|
||
|
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
|
||
|
</p>
|
||
|
</body>
|
||
|
</html>
|