com.io7m.r2.core

## Interface R2SceneOpaquesConsumerType

-     public interface R2SceneOpaquesConsumerType

  The type of consumers of opaque scene instances.

  Instances are batched in a manner that is intended to require the minimum number of state changes for rendering, based upon the relative cost of state changes.

  In NVIDIA's Beyond Porting slides, the relative cost of rendering state changes are given:

  - Render target changes - 60,000/second
  - Program bindings - 300,000/second
  - ROP
  - Texture bindings - 1,500,000/second
  - Vertex format
  - UBO bindings
  - Vertex bindings
  - Uniform updates - 10,000,000/second

  It is beneficial, for example, to organize instances such that shaders are changed less frequently than array objects, etc.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `onFinish()` Called when rendering of instances is finished.
    `void` | `onFinishGroup(int group)` Called when rendering of a group is finished.
    `<M> void` | `onInstanceBatched(R2MaterialOpaqueBatchedType<M> material, R2InstanceBatchedType i)` Called when a batched instance should be rendered.
    `<M> void` | `onInstanceBatchedMaterialFinish(R2MaterialOpaqueBatchedType<M> material)` Called after the current set of batched instances have finished rendering with the current material.
    `<M> void` | `onInstanceBatchedMaterialStart(R2MaterialOpaqueBatchedType<M> material)` Called when new material settings should be assigned, for batched instances.
    `<M> void` | `onInstanceBatchedShaderFinish(R2ShaderInstanceBatchedUsableType<M> s)` Called when the current shader should be deactivated.
    `<M> void` | `onInstanceBatchedShaderStart(R2ShaderInstanceBatchedUsableType<M> s)` Called when a new shader should be activated in order to start rendering batched instances.
    `void` | `onInstanceBatchedUpdate(R2InstanceBatchedType i)` Called when a batched instance should upload batch data to the GPU.
    `<M> void` | `onInstanceBillboarded(R2MaterialOpaqueBillboardedType<M> material, R2InstanceBillboardedType i)` Called when a batched instance should be rendered.
    `<M> void` | `onInstanceBillboardedMaterialFinish(R2MaterialOpaqueBillboardedType<M> material)` Called after the current set of batched instances have finished rendering with the current material.
    `<M> void` | `onInstanceBillboardedMaterialStart(R2MaterialOpaqueBillboardedType<M> material)` Called when new material settings should be assigned, for batched instances.
    `<M> void` | `onInstanceBillboardedShaderFinish(R2ShaderInstanceBillboardedUsableType<M> s)` Called when the current shader should be deactivated.
    `<M> void` | `onInstanceBillboardedShaderStart(R2ShaderInstanceBillboardedUsableType<M> s)` Called when a new shader should be activated in order to start rendering batched instances.
    `void` | `onInstanceBillboardedUpdate(R2InstanceBillboardedType i)` Called when a batched instance should upload batch data to the GPU.
    `<M> void` | `onInstanceSingle(R2MaterialOpaqueSingleType<M> material, R2InstanceSingleType i)` Called when a single instance should be rendered.
    `void` | `onInstanceSingleArrayStart(R2InstanceSingleType i)` Called when a new array object should be bound, for single instances.
    `<M> void` | `onInstanceSingleMaterialFinish(R2MaterialOpaqueSingleType<M> material)` Called after the current set of single instances have finished rendering with the current material.
    `<M> void` | `onInstanceSingleMaterialStart(R2MaterialOpaqueSingleType<M> material)` Called when new material settings should be assigned, for single instances.
    `<M> void` | `onInstanceSingleShaderFinish(R2ShaderInstanceSingleUsableType<M> s)` Called when the current shader should be deactivated.
    `<M> void` | `onInstanceSingleShaderStart(R2ShaderInstanceSingleUsableType<M> s)` Called when a new shader should be activated in order to start rendering single instances.
    `void` | `onStart()` Called when rendering of instances begins.
    `void` | `onStartGroup(int group)` Called when rendering of a group begins.

- - ### Method Detail

    - #### onStart

          void onStart()

      Called when rendering of instances begins.

    - #### onStartGroup

          void onStartGroup(int group)

      Called when rendering of a group begins.
      Parameters:
        `group` - The group

    - #### onInstanceBatchedUpdate

          void onInstanceBatchedUpdate(R2InstanceBatchedType i)

      Called when a batched instance should upload batch data to the GPU.
      Parameters:
        `i` - The batched instance

    - #### onInstanceBatchedShaderStart

          <M> void onInstanceBatchedShaderStart(R2ShaderInstanceBatchedUsableType<M> s)

      Called when a new shader should be activated in order to start rendering batched instances.
      Type Parameters:
        `M` - The type of shader parameters
      Parameters:
        `s` - The shader

    - #### onInstanceBatchedMaterialStart

          <M> void onInstanceBatchedMaterialStart(R2MaterialOpaqueBatchedType<M> material)

      Called when new material settings should be assigned, for batched instances.
      Type Parameters:
        `M` - The type of shader parameters
      Parameters:
        `material` - The current material

    - #### onInstanceBatched

          <M> void onInstanceBatched(R2MaterialOpaqueBatchedType<M> material,
                                     R2InstanceBatchedType i)

      Called when a batched instance should be rendered.
      Type Parameters:
        `M` - The type of shader parameters
      Parameters:
        `material` - The current material
        `i` - The current instance

    - #### onInstanceBatchedMaterialFinish

          <M> void onInstanceBatchedMaterialFinish(R2MaterialOpaqueBatchedType<M> material)

      Called after the current set of batched instances have finished rendering with the current material.
      Type Parameters:
        `M` - The type of shader parameters
      Parameters:
        `material` - The current material

    - #### onInstanceBatchedShaderFinish

          <M> void onInstanceBatchedShaderFinish(R2ShaderInstanceBatchedUsableType<M> s)

      Called when the current shader should be deactivated.
      Type Parameters:
        `M` - The type of shader parameters
      Parameters:
        `s` - The shader

    - #### onInstanceBillboardedUpdate

          void onInstanceBillboardedUpdate(R2InstanceBillboardedType i)

      Called when a batched instance should upload batch data to the GPU.
      Parameters:
        `i` - The batched instance

    - #### onInstanceBillboardedShaderStart

          <M> void onInstanceBillboardedShaderStart(R2ShaderInstanceBillboardedUsableType<M> s)

      Called when a new shader should be activated in order to start rendering batched instances.
      Type Parameters:
        `M` - The type of shader parameters
      Parameters:
        `s` - The shader

    - #### onInstanceBillboardedMaterialStart

          <M> void onInstanceBillboardedMaterialStart(R2MaterialOpaqueBillboardedType<M> material)

      Called when new material settings should be assigned, for batched instances.
      Type Parameters:
        `M` - The type of shader parameters
      Parameters:
        `material` - The current material

    - #### onInstanceBillboarded

          <M> void onInstanceBillboarded(R2MaterialOpaqueBillboardedType<M> material,
                                         R2InstanceBillboardedType i)

      Called when a batched instance should be rendered.
      Type Parameters:
        `M` - The type of shader parameters
      Parameters:
        `material` - The current material
        `i` - The current instance

    - #### onInstanceBillboardedMaterialFinish

          <M> void onInstanceBillboardedMaterialFinish(R2MaterialOpaqueBillboardedType<M> material)

      Called after the current set of batched instances have finished rendering with the current material.
      Type Parameters:
        `M` - The type of shader parameters
      Parameters:
        `material` - The current material

    - #### onInstanceBillboardedShaderFinish

          <M> void onInstanceBillboardedShaderFinish(R2ShaderInstanceBillboardedUsableType<M> s)

      Called when the current shader should be deactivated.
      Type Parameters:
        `M` - The type of shader parameters
      Parameters:
        `s` - The shader

    - #### onInstanceSingleShaderStart

          <M> void onInstanceSingleShaderStart(R2ShaderInstanceSingleUsableType<M> s)

      Called when a new shader should be activated in order to start rendering single instances.
      Type Parameters:
        `M` - The type of shader parameters
      Parameters:
        `s` - The shader

    - #### onInstanceSingleMaterialStart

          <M> void onInstanceSingleMaterialStart(R2MaterialOpaqueSingleType<M> material)

      Called when new material settings should be assigned, for single instances.
      Type Parameters:
        `M` - The type of shader parameters
      Parameters:
        `material` - The current material

    - #### onInstanceSingleArrayStart

          void onInstanceSingleArrayStart(R2InstanceSingleType i)

      Called when a new array object should be bound, for single instances.
      Parameters:
        `i` - The current instance

    - #### onInstanceSingle

          <M> void onInstanceSingle(R2MaterialOpaqueSingleType<M> material,
                                    R2InstanceSingleType i)

      Called when a single instance should be rendered.
      Type Parameters:
        `M` - The type of shader parameters
      Parameters:
        `material` - The current material
        `i` - The current instance

    - #### onInstanceSingleMaterialFinish

          <M> void onInstanceSingleMaterialFinish(R2MaterialOpaqueSingleType<M> material)

      Called after the current set of single instances have finished rendering with the current material.
      Type Parameters:
        `M` - The type of shader parameters
      Parameters:
        `material` - The current material

    - #### onInstanceSingleShaderFinish

          <M> void onInstanceSingleShaderFinish(R2ShaderInstanceSingleUsableType<M> s)

      Called when the current shader should be deactivated.
      Type Parameters:
        `M` - The type of shader parameters
      Parameters:
        `s` - The shader

    - #### onFinishGroup

          void onFinishGroup(int group)

      Called when rendering of a group is finished.
      Parameters:
        `group` - The group

    - #### onFinish

          void onFinish()

      Called when rendering of instances is finished.

Copyright © 2016 <code@io7m.com> http://io7m.com