render method

dynamic render(
  1. dynamic deltaTime
)

Implementation

render(deltaTime) {
  // deltaTime value is in seconds

  if (deltaTime == null) {
    deltaTime = this.clock.getDelta();
  }

  var currentRenderTarget = this.renderer.getRenderTarget();

  var maskActive = false;

  var pass, i, il = this.passes.length;

  for (i = 0; i < il; i++) {
    pass = this.passes[i];

    if (pass.enabled == false) continue;

    pass.renderToScreen = (this.renderToScreen && this.isLastEnabledPass(i));
    pass.render(this.renderer, this.writeBuffer, this.readBuffer,
        deltaTime: deltaTime, maskActive: maskActive);

    if (pass.needsSwap) {
      if (maskActive) {
        var context = this.renderer.getContext();
        var stencil = this.renderer.state.buffers["stencil"];

        //context.stencilFunc( context.NOTEQUAL, 1, 0xffffffff );
        stencil.setFunc(context.NOTEQUAL, 1, 0xffffffff);

        this.copyPass.render(this.renderer, this.writeBuffer, this.readBuffer,
            deltaTime: deltaTime);

        //context.stencilFunc( context.EQUAL, 1, 0xffffffff );
        stencil.setFunc(context.EQUAL, 1, 0xffffffff);
      }

      this.swapBuffers();
    }

    if (MaskPass != null) {
      if (pass.runtimeType.toString() == "MaskPass") {
        maskActive = true;
      } else if (pass.runtimeType.toString() == "ClearMaskPass") {
        maskActive = false;
      }
    }
  }

  this.renderer.setRenderTarget(currentRenderTarget);
}