com.io7m.r2.core

## Class R2AmbientOcclusionBufferPool

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

- All Implemented Interfaces:
    R2RenderTargetPoolType<R2AmbientOcclusionBufferDescriptionType,R2AmbientOcclusionBufferUsableType>, R2RenderTargetPoolUsableType<R2AmbientOcclusionBufferDescriptionType,R2AmbientOcclusionBufferUsableType>

      public final class R2AmbientOcclusionBufferPool
      extends Object
      implements R2RenderTargetPoolType<R2AmbientOcclusionBufferDescriptionType,R2AmbientOcclusionBufferUsableType>

  A pool of ambient occlusion buffers, with a configurable soft and hard size.

  Objects within the pool will occasionally be discarded so that the storage size of the pool stays below the soft limit. The size of the pool will never be allowed to grow beyond the hard limit, and attempting to do this will result in exceptions being raised.

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `delete(com.io7m.jcanephora.texture_unit_allocator.JCGLTextureUnitContextParentType c)` Delete the pool.
    `R2AmbientOcclusionBufferUsableType` | `get(com.io7m.jcanephora.texture_unit_allocator.JCGLTextureUnitContextParentType tc, R2AmbientOcclusionBufferDescriptionType desc)` Get a render target from the pool, allocating a new one if necessary.
    `boolean` | `isDeleted()`
    `static R2RenderTargetPoolType<R2AmbientOcclusionBufferDescriptionType,R2AmbientOcclusionBufferUsableType>` | `newPool(com.io7m.jcanephora.core.api.JCGLInterfaceGL33Type g, long soft, long hard)` Construct a new pool with the given size limits.
    `void` | `returnValue(com.io7m.jcanephora.texture_unit_allocator.JCGLTextureUnitContextParentType tc, R2AmbientOcclusionBufferUsableType target)` Return a render target that has previously been fetched via `R2RenderTargetPoolUsableType.get(JCGLTextureUnitContextParentType, R2RenderTargetDescriptionType)`.

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

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

- - ### Method Detail

    - #### newPool

          public static R2RenderTargetPoolType<R2AmbientOcclusionBufferDescriptionType,R2AmbientOcclusionBufferUsableType> newPool(com.io7m.jcanephora.core.api.JCGLInterfaceGL33Type g,
                                                                                                                                   long soft,
                                                                                                                                   long hard)

      Construct a new pool with the given size limits.
      Parameters:
        `g` - An OpenGL interface
        `soft` - The soft limit for the pool in bytes
        `hard` - The hard limit for the pool in bytes
      Returns:
        A new pool

    - #### get

          public R2AmbientOcclusionBufferUsableType get(com.io7m.jcanephora.texture_unit_allocator.JCGLTextureUnitContextParentType tc,
                                                        R2AmbientOcclusionBufferDescriptionType desc)

      Description copied from interface: `R2RenderTargetPoolUsableType`

      Get a render target from the pool, allocating a new one if necessary. The returned render target is guaranteed to be different from any other that has been returned from this call and not yet returned with `R2RenderTargetPoolUsableType.returnValue(JCGLTextureUnitContextParentType, R2RenderTargetUsableType)` .

      Specified by:
        `get` in interface `R2RenderTargetPoolUsableType<R2AmbientOcclusionBufferDescriptionType,R2AmbientOcclusionBufferUsableType>`
      Parameters:
        `tc` - A texture unit context
        `desc` - A render target description
      Returns:
        A (possibly new) render target that must be returned after use
      See Also:
        `R2RenderTargetPoolUsableType.returnValue(JCGLTextureUnitContextParentType, R2RenderTargetUsableType)`

    - #### returnValue

          public void returnValue(com.io7m.jcanephora.texture_unit_allocator.JCGLTextureUnitContextParentType tc,
                                  R2AmbientOcclusionBufferUsableType target)

      Description copied from interface: `R2RenderTargetPoolUsableType`
      Return a render target that has previously been fetched via `R2RenderTargetPoolUsableType.get(JCGLTextureUnitContextParentType, R2RenderTargetDescriptionType)`.
      Specified by:
        `returnValue` in interface `R2RenderTargetPoolUsableType<R2AmbientOcclusionBufferDescriptionType,R2AmbientOcclusionBufferUsableType>`
      Parameters:
        `tc` - A texture unit context
        `target` - A render target

    - #### delete

          public void delete(com.io7m.jcanephora.texture_unit_allocator.JCGLTextureUnitContextParentType c)

      Description copied from interface: `R2RenderTargetPoolType`
      Delete the pool.
      Specified by:
        `delete` in interface `R2RenderTargetPoolType<R2AmbientOcclusionBufferDescriptionType,R2AmbientOcclusionBufferUsableType>`
      Parameters:
        `c` - A texture unit context

    - #### isDeleted

          public boolean isDeleted()

      Specified by:
        `isDeleted` in interface `R2RenderTargetPoolType<R2AmbientOcclusionBufferDescriptionType,R2AmbientOcclusionBufferUsableType>`
      Returns:
        `true` iff the pool is deleted

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