Package arc.graphics

Class VertexAttribute

java.lang.Object
arc.graphics.VertexAttribute

public final class VertexAttribute extends Object
A single vertex attribute defined by its number of components and its shader alias. The number of components defines how many components the attribute has. The alias defines to which shader attribute this attribute should bind. The alias is used by a Mesh when drawing with a Shader.
  • Field Details

    • position

      public static final VertexAttribute position
    • position3

      public static final VertexAttribute position3
    • texCoords

      public static final VertexAttribute texCoords
    • normal

      public static final VertexAttribute normal
    • color

      public static final VertexAttribute color
    • mixColor

      public static final VertexAttribute mixColor
    • components

      public final int components
      the number of components this attribute has
    • normalized

      public final boolean normalized
      For fixed types, whether the values are normalized to either -1f and +1f (signed) or 0f and +1f (unsigned)
    • type

      public final int type
      the OpenGL type of each component, e.g. GL20.GL_FLOAT or GL20.GL_UNSIGNED_BYTE
    • alias

      public final String alias
      the alias for the attribute used in a Shader
    • size

      public final int size
      the size (in bytes) of this attribute
  • Constructor Details

    • VertexAttribute

      public VertexAttribute(int components, String alias)
      Constructs a new VertexAttribute. The GL data type is automatically selected based on the usage.
      Parameters:
      components - the number of components of this attribute, must be between 1 and 4.
      alias - the alias used in a shader for this attribute. Can be changed after construction.
    • VertexAttribute

      public VertexAttribute(int components, int type, boolean normalized, String alias)
      Constructs a new VertexAttribute.
      Parameters:
      components - the number of components of this attribute, must be between 1 and 4.
      type - the OpenGL type of each component, e.g. GL20.GL_FLOAT or GL20.GL_UNSIGNED_BYTE. Since Mesh stores vertex data in 32bit floats, the total size of this attribute (type size times number of components) must be a multiple of four bytes.
      normalized - For fixed types, whether the values are normalized to either -1f and +1f (signed) or 0f and +1f (unsigned)
      alias - The alias used in a shader for this attribute. Can be changed after construction.