Package limn.render3d

Enum Class VertexAttribute

java.lang.Object
java.lang.Enum<VertexAttribute>
limn.render3d.VertexAttribute
All Implemented Interfaces:
Serializable, Comparable<VertexAttribute>, Constable

public enum VertexAttribute extends Enum<VertexAttribute>
A vertex attribute semantic and its component count. The fixed location pairs each attribute with a shader input (layout(location = ...)), so meshes and material shaders agree without per-material wiring.
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Per-vertex tint in linear RGBA (not sRGB), with glTF COLOR_0 semantics, multiplied into the material's base colour, its alpha, and its emissive.
     
    Four per-vertex floats with no fixed meaning, reaching the surface function as v_params.
    Four more of the same, reaching the surface function as v_params1.
     
     
    A second texture coordinate set: glTF TEXCOORD_1.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final int
    Number of float components.
    final int
    Shader input location (matches layout(location = ...)).
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • POSITION

      public static final VertexAttribute POSITION
    • NORMAL

      public static final VertexAttribute NORMAL
    • UV0

      public static final VertexAttribute UV0
    • COLOR

      public static final VertexAttribute COLOR
      Per-vertex tint in linear RGBA (not sRGB), with glTF COLOR_0 semantics, multiplied into the material's base colour, its alpha, and its emissive. Not clamped: a component above 1 is a legitimate over-range tint, and routing it through emissive is what lets one draw call carry a different HDR colour per vertex. A mesh without this attribute shades as if every vertex were opaque white.
    • UV1

      public static final VertexAttribute UV1
      A second texture coordinate set: glTF TEXCOORD_1. Reaches the surface function as v_uv1; the built-in materials ignore it, so it costs a mesh that carries it nothing but the bandwidth.

      What it is for is anything that samples one texture at two places and combines the results: a lightmap beside a detail map, a terrain blend, or the cross-fade between two cells of a sprite sheet. A mesh without it reads (0, 0).

    • PARAMS

      public static final VertexAttribute PARAMS
      Four per-vertex floats with no fixed meaning, reaching the surface function as v_params. The built-in materials never read them.

      This is the custom vertex stream every renderer eventually grows, and it exists because the alternative is worse: an application that needs one more number per vertex otherwise smuggles it through a channel that already means something (a colour component, an unused UV), and every later reader has to know. A mesh without it reads (0, 0, 0, 0), so zero should be the identity of whatever a surface decides these mean.

      Only useful together with Material.Surface: nothing else can read them.

    • PARAMS1

      public static final VertexAttribute PARAMS1
      Four more of the same, reaching the surface function as v_params1.

      A second stream rather than a wider first one, which is the whole decision here. Widening PARAMS to eight floats would cost every mesh that carries it four floats per vertex it does not use, and a vertex attribute is at most four components in the shading languages this compiles to; eight would be two inputs whatever the enum said, so the only question is whether an application can decline the second one. It can, this way.

      It exists because PARAMS's own argument does not stop at four. An application that runs out smuggles the fifth number through a channel that already means something, and every later reader has to know; that is exactly as true of the fifth as it was of the first. A mesh without this reads (0, 0, 0, 0), so zero should again be the identity.

      Reach for PARAMS first and fill it. Two half-used streams cost bandwidth that one full one does not.

  • Field Details

    • location

      public final int location
      Shader input location (matches layout(location = ...)).
    • components

      public final int components
      Number of float components.
  • Method Details

    • values

      public static VertexAttribute[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static VertexAttribute valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null