提交 14fc1647 编写于 作者: T Thomas Thron

WebGLRenderer.readRenderTargetPixels: add parameter to select active cube face...

WebGLRenderer.readRenderTargetPixels: add parameter to select active cube face from WebGLRenderTargetCube
上级 c1e55c26
......@@ -394,11 +394,11 @@
<h3>[method:null resetGLState]( )</h3>
<p>Reset the GL state to default. Called internally if the WebGL context is lost.</p>
<h3>[method:null readRenderTargetPixels]( [param:WebGLRenderTarget renderTarget], [param:Float x], [param:Float y], [param:Float width], [param:Float height], [param:TypedArray buffer] )</h3>
<h3>[method:null readRenderTargetPixels]( [param:WebGLRenderTarget renderTarget], [param:Float x], [param:Float y], [param:Float width], [param:Float height], [param:TypedArray buffer], [param:Integer activeCubeFaceIndex] )</h3>
<p>buffer - Uint8Array is the only destination type supported in all cases, other types are renderTarget and platform dependent. See [link:https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.12 WebGL spec] for details.</p>
<p>Reads the pixel data from the renderTarget into the buffer you pass in. This is a wrapper around [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/readPixels WebGLRenderingContext.readPixels]().</p>
<p>See the [example:webgl_interactive_cubes_gpu interactive / cubes / gpu] example.
</p>
<p>See the [example:webgl_interactive_cubes_gpu interactive / cubes / gpu] example.</p>
<p>For reading out a [page:WebGLRenderTargetCube WebGLRenderTargetCube] use the optional parameter activeCubeFaceIndex to determine which face should be read.</p>
<h3>[method:null render]( [param:Scene scene], [param:Camera camera] )</h3>
......
......@@ -379,7 +379,8 @@ export class WebGLRenderer implements Renderer {
y: number,
width: number,
height: number,
buffer: any
buffer: any,
activeCubeFaceIndex?: number
): void;
/**
......
......@@ -2501,7 +2501,7 @@ function WebGLRenderer( parameters ) {
};
this.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer ) {
this.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {
if ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {
......@@ -2512,6 +2512,12 @@ function WebGLRenderer( parameters ) {
var framebuffer = properties.get( renderTarget ).__webglFramebuffer;
if ( activeCubeFaceIndex != undefined ) {
framebuffer = framebuffer[ activeCubeFaceIndex ];
}
if ( framebuffer ) {
var restore = false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册