Package limn.render3d

Record Class Material.Raw

java.lang.Object
java.lang.Record
limn.render3d.Material.Raw
All Implemented Interfaces:
Material
Enclosing interface:
Material

public static record Material.Raw(String vertexSource, String fragmentSource) extends Record implements Material
Custom GLSL. The backend provides the standard uniforms u_mvp (mat4), u_model (mat4) and u_normalMatrix (mat3) and the vertex attributes at their fixed locations (VertexAttribute). Non-portable: opts out of the shader-IR's multi-target guarantees.

A shortcut, not a back door: the pass's Frame and Lights uniform blocks are bound to the built-in PBR program only, so a raw shader cannot see the lights, the shadow map or the environment at all. Reach for it for effects that do not need them.

Color space is part of this contract: the fragment writes into a RenderTarget, whose contents are linear light, premultiplied, scene-referred. Write linear: decode any authored sRGB constant (see ColorSpace) and premultiply by alpha. A raw shader that writes display-referred sRGB has those numbers read as linear light and tonemapped a second time by the composite; nothing detects that, the image is just visibly wrong.

  • Constructor Details

    • Raw

      public Raw(String vertexSource, String fragmentSource)
      Creates an instance of a Raw record class.
      Parameters:
      vertexSource - the value for the vertexSource record component
      fragmentSource - the value for the fragmentSource record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • vertexSource

      public String vertexSource()
      Returns the value of the vertexSource record component.
      Returns:
      the value of the vertexSource record component
    • fragmentSource

      public String fragmentSource()
      Returns the value of the fragmentSource record component.
      Returns:
      the value of the fragmentSource record component