bindSurface method

void bindSurface(
  1. Surface surface
)

Bind a surface.

Implementation

void bindSurface(Surface surface) {
  _renderPass.clearBindings();
  if (surface.material != null) {
    bindMaterial(surface.material!);
  }

  _renderPass.bindVertexBuffer(
    gpu.BufferView(
      surface.resource!,
      offsetInBytes: 0,
      lengthInBytes: surface.verticesBytes,
    ),
    surface.vertexCount,
  );

  _renderPass.bindIndexBuffer(
    gpu.BufferView(
      surface.resource!,
      offsetInBytes: surface.verticesBytes,
      lengthInBytes: surface.indicesBytes,
    ),
    gpu.IndexType.int16,
    surface.indexCount,
  );

  _renderPass.draw();
}