com.io7m.r2.core

## Class R2InstanceBatchedDynamic

- java.lang.Object
- - com.io7m.r2.core.R2InstanceBatchedDynamic

- All Implemented Interfaces:
    com.io7m.jcanephora.core.JCGLResourceUsableType, R2DeletableType, R2InstanceBatchedDynamicType, R2InstanceBatchedType, R2InstanceType

      public final class R2InstanceBatchedDynamic
      extends Object
      implements R2InstanceBatchedDynamicType

  The default implementation of the `R2InstanceBatchedDynamicType` interface.

  This implementation manages a fixed size batch of `N` instances. It stores per-instance matrices in a vertex buffer object, and uses an "orphaning" strategy where the entire buffer storage is reallocated and populated on each call to `update(JCGLInterfaceGL33Type, R2TransformContextType)`.

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `com.io7m.jcanephora.core.JCGLArrayObjectType` | `arrayObject()`
    `void` | `delete(com.io7m.jcanephora.core.api.JCGLInterfaceGL33Type g)` Delete the current object.
    `void` | `disableAll()` Disable rendering of all instances
    `void` | `disableInstance(int id)` Disable rendering of the given instance.
    `int` | `enabledCount()`
    `int` | `enableInstance(R2TransformOrthogonalReadableType t)` Enable rendering of an instance with transform `t`
    `long` | `instanceID()`
    `boolean` | `isDeleted()`
    `int` | `maximumSize()`
    `static R2InstanceBatchedDynamicType` | `newBatch(R2IDPoolType pool, com.io7m.jcanephora.core.api.JCGLArrayBuffersType g_ab, com.io7m.jcanephora.core.api.JCGLArrayObjectsType g_ao, com.io7m.jcanephora.core.JCGLArrayObjectUsableType o, int count)` Construct a new batch of instances.
    `int` | `renderCount()`
    `void` | `update(com.io7m.jcanephora.core.api.JCGLInterfaceGL33Type g, R2TransformContextType context)` Update any data required for rendering on the GPU.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### newBatch

          public static R2InstanceBatchedDynamicType newBatch(R2IDPoolType pool,
                                                              com.io7m.jcanephora.core.api.JCGLArrayBuffersType g_ab,
                                                              com.io7m.jcanephora.core.api.JCGLArrayObjectsType g_ao,
                                                              com.io7m.jcanephora.core.JCGLArrayObjectUsableType o,
                                                              int count)

      Construct a new batch of instances.
      Parameters:
        `pool` - The ID pool
        `g_ab` - An array buffer interface
        `g_ao` - An array object interface
        `o` - An existing array object
        `count` - The maximum number of instances in the batch
      Returns:
        A new batch

    - #### maximumSize

          public int maximumSize()

      Specified by:
        `maximumSize` in interface `R2InstanceBatchedDynamicType`
      Returns:
        The maximum number of instances that can be placed into the batch

    - #### enabledCount

          public int enabledCount()

      Specified by:
        `enabledCount` in interface `R2InstanceBatchedDynamicType`
      Returns:
        The current number of enabled instances in the batch

    - #### renderCount

          public int renderCount()

      Specified by:
        `renderCount` in interface `R2InstanceBatchedType`
      Returns:
        The number of instances that will be rendered.

    - #### disableAll

          public void disableAll()

      Description copied from interface: `R2InstanceBatchedDynamicType`
      Disable rendering of all instances
      Specified by:
        `disableAll` in interface `R2InstanceBatchedDynamicType`

    - #### enableInstance

          public int enableInstance(R2TransformOrthogonalReadableType t)

      Description copied from interface: `R2InstanceBatchedDynamicType`
      Enable rendering of an instance with transform `t`
      Specified by:
        `enableInstance` in interface `R2InstanceBatchedDynamicType`
      Parameters:
        `t` - The transform for the instance
      Returns:
        The index of the enabled instance

    - #### disableInstance

          public void disableInstance(int id)

      Description copied from interface: `R2InstanceBatchedDynamicType`
      Disable rendering of the given instance.
      Specified by:
        `disableInstance` in interface `R2InstanceBatchedDynamicType`
      Parameters:
        `id` - The index of the instance

    - #### update

          public void update(com.io7m.jcanephora.core.api.JCGLInterfaceGL33Type g,
                             R2TransformContextType context)

      Description copied from interface: `R2InstanceBatchedType`
      Update any data required for rendering on the GPU.
      Specified by:
        `update` in interface `R2InstanceBatchedType`
      Parameters:
        `g` - An OpenGL interface
        `context` - The transform context

    - #### arrayObject

          public com.io7m.jcanephora.core.JCGLArrayObjectType arrayObject()

      Specified by:
        `arrayObject` in interface `R2InstanceBatchedType`
      Returns:
        The instance array object

    - #### instanceID

          public long instanceID()

      Specified by:
        `instanceID` in interface `R2InstanceType`
      Returns:
        The unique instance ID

    - #### delete

          public void delete(com.io7m.jcanephora.core.api.JCGLInterfaceGL33Type g)
                      throws R2Exception

      Description copied from interface: `R2DeletableType`
      Delete the current object.
      Specified by:
        `delete` in interface `R2DeletableType`
      Parameters:
        `g` - An OpenGL interface
      Throws:
        `R2Exception` - On errors

    - #### isDeleted

          public boolean isDeleted()

      Specified by:
        `isDeleted` in interface `com.io7m.jcanephora.core.JCGLResourceUsableType`

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