lib/renderer/multipass/debug.js
function drawPass (bindings, passIndex, passCount, outputFBO) {
  var { debugFBO, gl, canvas, shader, quad, resolution, scale, offset } = bindings
  var { uniforms } = shader
  var { width, height } = canvas

  debugFBO.bind()
  shader.bind()

  // update shader
  var resizeResolutionX = width / passCount * (1 - MARGIN * 2)
  var resizeResolutionY = height / passCount * (1 - MARGIN * 2)
  resolution[0] = width
  resolution[1] = height
  scale[0] = width / resizeResolutionX
  scale[1] = height / resizeResolutionY
  var scissorOffsetX = width * passIndex / passCount + width / passCount * MARGIN
  var scissorOffsetY = (height / 2) - (resizeResolutionY / 2)
  offset[0] = scissorOffsetX / width
  offset[1] = scissorOffsetY / height
  uniforms.uOffset = offset
  uniforms.uResolution = resolution
  uniforms.uScale = scale
  uniforms.uInput = outputFBO.color[0].bind(0)

  // set scissor
  gl.enable(gl.SCISSOR_TEST)
  gl.scissor(
    // coordinate of lower left of box, moving up and to the right
    scissorOffsetX,
    scissorOffsetY,
    resizeResolutionX,
    resizeResolutionY
  )

  // clear first, then draw on it
  gl.clearColor(0,0,0,1)
  gl.clear(gl.COLOR_BUFFER_BIT)
  gl.disable(gl.DEPTH_TEST)
  RenderScreen(gl)

  // reset state
  gl.bindFramebuffer(gl.FRAMEBUFFER, null)
  gl.disable(gl.SCISSOR_TEST)
  gl.enable(gl.DEPTH_TEST)
  gl.scissor(0, 0, width, height)
}
function drawPass (bindings, passIndex, passCount, outputFBO) {
  var { debugFBO, gl, canvas, shader, quad, resolution, scale, offset } = bindings
  var { uniforms } = shader
  var { width, height } = canvas

  debugFBO.bind()
  shader.bind()

  // update shader
  var resizeResolutionX = width / passCount * (1 - MARGIN * 2)
  var resizeResolutionY = height / passCount * (1 - MARGIN * 2)
  resolution[0] = width
  resolution[1] = height
  scale[0] = width / resizeResolutionX
  scale[1] = height / resizeResolutionY
  var scissorOffsetX = width * passIndex / passCount + width / passCount * MARGIN
  var scissorOffsetY = (height / 2) - (resizeResolutionY / 2)
  offset[0] = scissorOffsetX / width
  offset[1] = scissorOffsetY / height
  uniforms.uOffset = offset
  uniforms.uResolution = resolution
  uniforms.uScale = scale
  uniforms.uInput = outputFBO.color[0].bind(0)

  // set scissor
  gl.enable(gl.SCISSOR_TEST)
  gl.scissor(
    // coordinate of lower left of box, moving up and to the right
    scissorOffsetX,
    scissorOffsetY,
    resizeResolutionX,
    resizeResolutionY
  )

  // clear first, then draw on it
  gl.clearColor(0,0,0,1)
  gl.clear(gl.COLOR_BUFFER_BIT)
  gl.disable(gl.DEPTH_TEST)
  RenderScreen(gl)

  // reset state
  gl.bindFramebuffer(gl.FRAMEBUFFER, null)
  gl.disable(gl.SCISSOR_TEST)
  gl.enable(gl.DEPTH_TEST)
  gl.scissor(0, 0, width, height)
}
function drawPass ( bindings , passIndex , passCount , outputFBO ) { var { debugFBO , gl , canvas , shader , quad , resolution , scale , offset } = bindings var { uniforms } = shader var { width , height } = canvas debugFBO . bind ( ) shader . bind ( ) // update shader var resizeResolutionX = width / passCount * ( 1 - MARGIN * 2 ) var resizeResolutionY = height / passCount * ( 1 - MARGIN * 2 ) resolution [ 0 ] = width resolution [ 1 ] = height scale [ 0 ] = width / resizeResolutionX scale [ 1 ] = height / resizeResolutionY var scissorOffsetX = width * passIndex / passCount + width / passCount * MARGIN var scissorOffsetY = ( height / 2 ) - ( resizeResolutionY / 2 ) offset [ 0 ] = scissorOffsetX / width offset [ 1 ] = scissorOffsetY / height uniforms . uOffset = offset uniforms . uResolution = resolution uniforms . uScale = scale uniforms . uInput = outputFBO . color [ 0 ] . bind ( 0 ) // set scissor gl . enable ( gl . SCISSOR_TEST ) gl . scissor ( // coordinate of lower left of box, moving up and to the right scissorOffsetX , scissorOffsetY , resizeResolutionX , resizeResolutionY ) // clear first, then draw on it gl . clearColor ( 0 , 0 , 0 , 1 ) gl . clear ( gl . COLOR_BUFFER_BIT ) gl . disable ( gl . DEPTH_TEST ) RenderScreen ( gl ) // reset state gl . bindFramebuffer ( gl . FRAMEBUFFER , null ) gl . disable ( gl . SCISSOR_TEST ) gl . enable ( gl . DEPTH_TEST ) gl . scissor ( 0 , 0 , width , height ) }
Draw a small thumbnail image of the output
Draw a small thumbnail image of the output