com.io7m.jcanephora.core

## Interface JCGLArrayObjectBuilderType

-     public interface JCGLArrayObjectBuilderType

  A mutable builder for configuring array objects.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `Optional<JCGLArrayVertexAttributeType>` | `getAttributeAt(int index)`
    `int` | `getMaximumVertexAttributes()`
    `void` | `reset()` Clear all and any configured parameters specified so far.
    `default void` | `setAttributeFloatingPoint(int index, JCGLArrayBufferUsableType a, int elements, JCGLScalarType type, int stride, long offset, boolean normalized)`
    `void` | `setAttributeFloatingPointWithDivisor(int index, JCGLArrayBufferUsableType a, int elements, JCGLScalarType type, int stride, long offset, boolean normalized, int divisor)` Configure the attribute `index` to retrieve data from `a`.
    `default void` | `setAttributeIntegral(int index, JCGLArrayBufferUsableType a, int elements, JCGLScalarIntegralType type, int stride, long offset)`
    `void` | `setAttributeIntegralWithDivisor(int index, JCGLArrayBufferUsableType a, int elements, JCGLScalarIntegralType type, int stride, long offset, int divisor)` Configure the attribute `index` to retrieve data from `a`.
    `void` | `setIndexBuffer(JCGLIndexBufferUsableType i)` Set the index buffer that will be bound by default.
    `void` | `setNoIndexBuffer()` Indicate that no index buffer will be bound by default.
    `void` | `setStrictChecking(boolean enabled)` Enable or disable strict checking for the builder.

- - ### Method Detail

    - #### getAttributeAt

          Optional<JCGLArrayVertexAttributeType> getAttributeAt(int index)

      Parameters:
        `index` - The attribute index in the range `[0, getMaximumVertexAttributes() - 1]`
      Returns:
        The attribute at the given index, if any

    - #### getMaximumVertexAttributes

          int getMaximumVertexAttributes()

      Returns:
        The supported maximum number of vertex attributes. Must be `>= 16`.

    - #### setAttributeFloatingPointWithDivisor

          void setAttributeFloatingPointWithDivisor(int index,
                                                    JCGLArrayBufferUsableType a,
                                                    int elements,
                                                    JCGLScalarType type,
                                                    int stride,
                                                    long offset,
                                                    boolean normalized,
                                                    int divisor)
                                             throws JCGLExceptionDeleted,
                                                    JCGLExceptionAttributeAlreadyAssigned

      Configure the attribute `index` to retrieve data from `a`.

      The data is assumed to be `elements` values of type `type`, occuring every `stride` bytes in the buffer, starting at `offset`. The data will be converted to floating point values when delivered to a shading program. If `normalized == true`, then values of integral types will be treated as normalized fixed-point values when the conversion takes place. Otherwise, they will be directly converted to floating point (so, for example, an unsigned byte value of `255` will become `255.0` as opposed to the `1.0` value it would become if treated as normalized fixed-point).

      As a concrete example, if an buffer contains vertices with the following type:

           struct vertex {
             vec3 position;
             vec2 uv;
             vec3 normal;
           }

      Attribute `0`, the `position` field, has an initial offset of `0`, and has `3` elements of type `JCGLScalarType.TYPE_FLOAT`.

      Attribute `1`, the `uv` field, has an initial offset of `3 * (sizeof float) == 3 * 4 == 12` bytes, and has `2` elements of type `JCGLScalarType.TYPE_FLOAT`.

      Attribute `2`, the `normal` field, has an initial offset of `(3 + 2) * (sizeof float) == 5 * 4 == 20` bytes, and has `3` elements of type `JCGLScalarType.TYPE_FLOAT`.

      If the `vertex` type has no padding, then the `stride` value is equal to the size of the type, which is `(3 + 2 + 3) * (sizeof float) == 8 * 4 == 32` bytes.

      The divisor specifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives in a single draw call. If `divisor` is zero, the attribute at slot index​ advances once per vertex. If `divisor` is non-zero, the attribute advances once per `divisor` instances of the set(s) of vertices being rendered.

      Parameters:
        `index` - The attribute
        `a` - The array buffer
        `elements` - The number of elements
        `type` - The type of elements
        `offset` - The offset from the start of the buffer
        `stride` - The number of bytes to step forward at each vertex
        `normalized` - `true` iff the data should be treated as normalized fixed-point values when converting to floating point
        `divisor` - The attribute divisor
      Throws:
        `JCGLExceptionDeleted` - Iff the array buffer has already been deleted
        `JCGLExceptionAttributeAlreadyAssigned` - Iff strict checking is enabled and the given attribute has already been assigned

    - #### setAttributeFloatingPoint

          default void setAttributeFloatingPoint(int index,
                                                 JCGLArrayBufferUsableType a,
                                                 int elements,
                                                 JCGLScalarType type,
                                                 int stride,
                                                 long offset,
                                                 boolean normalized)
                                          throws JCGLExceptionDeleted,
                                                 JCGLExceptionAttributeAlreadyAssigned

      Parameters:
        `index` - The attribute
        `a` - The array buffer
        `elements` - The number of elements
        `type` - The type of elements
        `offset` - The offset from the start of the buffer
        `stride` - The number of bytes to step forward at each vertex
        `normalized` - `true` iff the data should be treated as normalized fixed-point values when converting to floating point
      Throws:
        `JCGLExceptionAttributeAlreadyAssigned` - Iff strict checking is enabled and the given attribute has already been assigned
        `JCGLExceptionDeleted` - Iff the array buffer has already been deleted
      See Also:
        `setAttributeFloatingPointWithDivisor(int, JCGLArrayBufferUsableType, int, JCGLScalarType, int, long, boolean, int)`

    - #### setAttributeIntegralWithDivisor

          void setAttributeIntegralWithDivisor(int index,
                                               JCGLArrayBufferUsableType a,
                                               int elements,
                                               JCGLScalarIntegralType type,
                                               int stride,
                                               long offset,
                                               int divisor)
                                        throws JCGLExceptionDeleted,
                                               JCGLExceptionAttributeAlreadyAssigned

      Configure the attribute `index` to retrieve data from `a`.

      The data is assumed to be `elements` values of type `type`, occuring every `stride` bytes in the buffer, starting at `offset`.

      The data is assumed to be of an integral type and will not be converted to floating-point prior to being delivered to a shading program.

      Parameters:
        `index` - The attribute
        `a` - The array buffer
        `elements` - The number of elements
        `type` - The type of elements
        `offset` - The offset from the start of the buffer
        `stride` - The number of bytes to step forward at each vertex
        `divisor` - The attribute divisor
      Throws:
        `JCGLExceptionAttributeAlreadyAssigned` - Iff strict checking is enabled and the given attribute has already been assigned
        `JCGLExceptionDeleted` - Iff the array buffer has already been deleted
      See Also:
        `setAttributeFloatingPoint(int, JCGLArrayBufferUsableType, int, JCGLScalarType, int, long, boolean)`

    - #### setAttributeIntegral

          default void setAttributeIntegral(int index,
                                            JCGLArrayBufferUsableType a,
                                            int elements,
                                            JCGLScalarIntegralType type,
                                            int stride,
                                            long offset)
                                     throws JCGLExceptionDeleted,
                                            JCGLExceptionAttributeAlreadyAssigned

      Parameters:
        `index` - The attribute
        `a` - The array buffer
        `elements` - The number of elements
        `type` - The type of elements
        `offset` - The offset from the start of the buffer
        `stride` - The number of bytes to step forward at each vertex
      Throws:
        `JCGLExceptionAttributeAlreadyAssigned` - Iff strict checking is enabled and the given attribute has already been assigned
        `JCGLExceptionDeleted` - Iff the array buffer has already been deleted
      See Also:
        `setAttributeIntegralWithDivisor(int, JCGLArrayBufferUsableType, int, JCGLScalarIntegralType, int, long, int)`

    - #### setStrictChecking

          void setStrictChecking(boolean enabled)

      Enable or disable strict checking for the builder. If strict checking is enabled, then attempts to assign already-assigned attributes will fail.
      Parameters:
        `enabled` - `true` iff strict checking should be enabled

    - #### setIndexBuffer

          void setIndexBuffer(JCGLIndexBufferUsableType i)
                       throws JCGLExceptionDeleted

      Set the index buffer that will be bound by default.

      Parameters:
        `i` - The index buffer
      Throws:
        `JCGLExceptionDeleted` - Iff the index buffer has already been deleted

    - #### setNoIndexBuffer

          void setNoIndexBuffer()

      Indicate that no index buffer will be bound by default.

    - #### reset

          void reset()

      Clear all and any configured parameters specified so far.

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