Class Surface

java.lang.Object
com.codename1.gpu.shaders.Surface

public final class Surface extends Object
Man made and natural surfaces for Material.Type.PBR. Patterns are laid out by Shading.boxUv, in world units, so they need no UVs and stay the same size on every mesh; SCALE sets repeats per unit.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    FLOAT how much of the second layer shows, 0 to 1.
    static final String
    VEC3 the main colour: paint, wood, stone or tint.
    static final String
    VEC3 the second colour: bare metal, rust, grain or flakes.
    static final int
    The most paint splats paintSplats keeps.
    static final String
    FLOAT opacity of glass and ice facing the camera.
    static final String
    FLOAT pattern repeats per world unit.
  • Method Summary

    Modifier and Type
    Method
    Description
    Car paint: a glossy coat over a metallic base with sparkling flakes.
    Cast concrete: mottled grey, pores and darker stains low down.
    Woven cloth: a fine cross weave and a soft sheen at grazing angles.
    Clear glass: see through facing the camera, mirror-like at the edges.
    ice()
    Ice: blue translucent depths, frosted cracks and a cold rim.
    Painted metal worn through to bare steel in patches: containers, hulls, railings.
    Paint splats on any surface: up to MAX_SPLATS blobs with ragged edges and drips, glossier than what they cover.
    Rust eating into metal: orange-brown blotches, rough where rusted.
    static void
    setSplat(ShaderMaterial splats, int index, float x, float y, float z, float radius, int rgb)
    Places or clears a splat of a paintSplats material.
    Wood planks along the texture's u: grain lines, knots and a board pattern.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • paintedMetal

      public static ShaderMaterial paintedMetal()

      Painted metal worn through to bare steel in patches: containers, hulls, railings. COLOR is the paint, COLOR2 the metal, AMOUNT the wear.

      Returns

      a new shader material

    • rust

      public static ShaderMaterial rust()

      Rust eating into metal: orange-brown blotches, rough where rusted. COLOR is the metal, COLOR2 the rust, AMOUNT how far it has spread.

      Returns

      a new shader material

    • wood

      public static ShaderMaterial wood()

      Wood planks along the texture's u: grain lines, knots and a board pattern. Uses the mesh's UVs so the grain follows each plank. COLOR is the light wood, COLOR2 the dark grain, SCALE boards per unit of v.

      Returns

      a new shader material

    • concrete

      public static ShaderMaterial concrete()

      Cast concrete: mottled grey, pores and darker stains low down.

      Returns

      a new shader material

    • glass

      public static ShaderMaterial glass()

      Clear glass: see through facing the camera, mirror-like at the edges. Use an alpha blended render state. COLOR tints it.

      Returns

      a new shader material

    • ice

      public static ShaderMaterial ice()

      Ice: blue translucent depths, frosted cracks and a cold rim. Use an alpha blended render state for thin ice, opaque for blocks.

      Returns

      a new shader material

    • fabric

      public static ShaderMaterial fabric()

      Woven cloth: a fine cross weave and a soft sheen at grazing angles. Uses the mesh's UVs.

      Returns

      a new shader material

    • carPaint

      public static ShaderMaterial carPaint()

      Car paint: a glossy coat over a metallic base with sparkling flakes. COLOR is the paint, COLOR2 the flake colour.

      Returns

      a new shader material

    • paintSplats

      public static ShaderMaterial paintSplats()

      Paint splats on any surface: up to MAX_SPLATS blobs with ragged edges and drips, glossier than what they cover. Place them with setSplat; the surface underneath keeps its own colour and texture.

      Returns

      a new shader material

    • setSplat

      public static void setSplat(ShaderMaterial splats, int index, float x, float y, float z, float radius, int rgb)

      Places or clears a splat of a paintSplats material.

      Parameters
      • splats: a material from paintSplats

      • index: 0 to MAX_SPLATS - 1; reuse the oldest when full

      • x: world centre

      • y: world centre

      • z: world centre

      • radius: world radius, 0 to clear the slot

      • rgb: paint colour as 0xRRGGBB