Class Foliage

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

public final class Foliage extends Object
Plants that move in the wind. The sway is a vertex offset that grows with height above the model's origin, so put each plant's origin at its root. Gusts roll across the scene in world space, so neighbours move together.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    FLOAT alpha below which a pixel of the texture is cut away.
    static final String
    VEC3 colour at the root of a blade of grass.
    static final String
    FLOAT sways per second.
    static final String
    FLOAT how far a point one unit above the root bends, world units.
    static final String
    VEC3 colour at its tip.
    static final String
    VEC2 the direction the wind blows, in world x/z.
  • Method Summary

    Modifier and Type
    Method
    Description
    Grass blades: a root to tip gradient along the texture's v (0 at the root), wind, and a sheen toward the sun.
    Leaf cards: wind sway, the texture's alpha cut out, and sunlight glowing through leaves seen against the sun.
    Wind sway alone; the surface keeps its own colour and texture.

    Methods inherited from class Object

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

  • Method Details

    • wind

      public static ShaderMaterial wind()

      Wind sway alone; the surface keeps its own colour and texture.

      Returns

      a new shader material

    • leaves

      public static ShaderMaterial leaves()

      Leaf cards: wind sway, the texture's alpha cut out, and sunlight glowing through leaves seen against the sun.

      Returns

      a new shader material

    • grass

      public static ShaderMaterial grass()

      Grass blades: a root to tip gradient along the texture's v (0 at the root), wind, and a sheen toward the sun. Pair with instancing or a field of crossed quads.

      Returns

      a new shader material