Package icyllis.arc3d.engine

# Class VertexInputLayout.Attribute

java.lang.Object
icyllis.arc3d.engine.VertexInputLayout.Attribute

Enclosing class:
  `VertexInputLayout`

@Immutable public static class VertexInputLayout.Attribute extends Object
Describes a vertex or instance attribute.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `OFFSET_ALIGNMENT`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Attribute(String name, byte srcType, byte dstType)`
  Makes an attribute whose offset will be implicitly determined by the types and ordering of an array attributes.
  `Attribute(String name, byte srcType, byte dstType, int offset)`
  Makes an attribute with an explicit offset.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static int`
  `alignOffset(int offset)`
  It must be N-aligned for all types, where N is sizeof(float).
  `final ShaderVar`
  `asShaderVar()`
  `final byte`
  `dstType()`
  `final int`
  `locations()`
  `final String`
  `name()`
  `final int`
  `offset()`
  Returns the offset if attributes were specified with explicit offsets.
  `final int`
  `size()`
  `final byte`
  `srcType()`
  `final int`
  `stride()`

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

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

- ## Field Details

  - ### OFFSET_ALIGNMENT

    public static final int OFFSET_ALIGNMENT
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### Attribute

    public Attribute(@Nonnull String name, byte srcType, byte dstType)
    Makes an attribute whose offset will be implicitly determined by the types and ordering of an array attributes.
    Parameters:
      `name` - the attrib name, cannot be null or empty
      `srcType` - the data type in vertex buffer, see `Engine.VertexAttribType`
      `dstType` - the data type in vertex shader, see `SLDataType`

  - ### Attribute

    public Attribute(@Nonnull String name, byte srcType, byte dstType, int offset)
    Makes an attribute with an explicit offset.
    Parameters:
      `name` - the attrib name, UpperCamelCase, cannot be null or empty
      `srcType` - the data type in vertex buffer, see `Engine.VertexAttribType`
      `dstType` - the data type in vertex shader, see `SLDataType`
      `offset` - N-aligned offset

- ## Method Details

  - ### alignOffset

    public static int alignOffset(int offset)
    It must be N-aligned for all types, where N is sizeof(float).

  - ### name

    public final String name()

  - ### srcType

    public final byte srcType()
    Returns:
      the data type in vertex buffer, see `Engine.VertexAttribType`

  - ### dstType

    public final byte dstType()
    Returns:
      the data type in vertex shader, see `SLDataType`

  - ### offset

    public final int offset()
    Returns the offset if attributes were specified with explicit offsets. Otherwise, offsets (and total vertex stride) are implicitly determined from attribute order and types. See `IMPLICIT_OFFSET`.

  - ### size

    public final int size()
    Returns:
      the size of the source data in bytes

  - ### locations

    public final int locations()
    Returns:
      the number of locations

  - ### stride

    public final int stride()
    Returns:
      the total size for this attribute in bytes

  - ### asShaderVar

    @Nonnull public final ShaderVar asShaderVar()