SceneEncoder constructor

SceneEncoder(
  1. RenderPass renderPass,
  2. HostBuffer transientsBuffer,
  3. Camera _camera,
  4. Size dimensions,
  5. Lighting _lighting,
)

Creates an encoder that records into renderPass, allocating transient uniforms from transientsBuffer.

dimensions is the viewport size used to derive the camera's view transform; lighting is the scene's IBL environment and analytic lights, passed to each material's bind. The render pass is configured for the opaque phase (depth writes on, blending off).

Implementation

SceneEncoder(
  gpu.RenderPass renderPass,
  gpu.HostBuffer transientsBuffer,
  this._camera,
  ui.Size dimensions,
  this._lighting,
) : _renderPass = renderPass,
    _transientsBuffer = transientsBuffer {
  _cameraTransform = _camera.getViewTransform(dimensions);
  frustum = Frustum.matrix(_cameraTransform);
  // Matrix sent to the vertex shader; carries the GLES render-to-texture
  // Y-flip (see y_flip.dart). Frustum culling keeps the unflipped one.
  _shaderCameraTransform = applyBackendYFlip(_cameraTransform);

  // Begin the opaque phase.
  _renderPass.setDepthWriteEnable(true);
  _renderPass.setColorBlendEnable(false);
  _renderPass.setDepthCompareOperation(gpu.CompareFunction.lessEqual);
}