Class Foliage
java.lang.Object
com.codename1.gpu.shaders.Foliage
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
FieldsModifier and TypeFieldDescriptionstatic final StringFLOATalpha below which a pixel of the texture is cut away.static final StringVEC3colour at the root of a blade of grass.static final StringFLOATsways per second.static final StringFLOAThow far a point one unit above the root bends, world units.static final StringVEC3colour at its tip.static final StringVEC2the direction the wind blows, in worldx/z. -
Method Summary
Modifier and TypeMethodDescriptionstatic ShaderMaterialgrass()Grass blades: a root to tip gradient along the texture's v (0 at the root), wind, and a sheen toward the sun.static ShaderMaterialleaves()Leaf cards: wind sway, the texture's alpha cut out, and sunlight glowing through leaves seen against the sun.static ShaderMaterialwind()Wind sway alone; the surface keeps its own colour and texture.
-
Field Details
-
WIND
-
STRENGTH
FLOAThow far a point one unit above the root bends, world units.- See Also:
-
SPEED
-
CUTOFF
FLOATalpha below which a pixel of the texture is cut away.- See Also:
-
ROOT
-
TIP
-
-
Method Details
-
wind
Wind sway alone; the surface keeps its own colour and texture.
Returns
a new shader material
-
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
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
-