Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class Surface
- Object
- Surface
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.Fields
public static final String COLOR = "srfColor" | VEC3 the main colour: paint, wood, stone or tint. |
public static final String COLOR2 = "srfColor2" | VEC3 the second colour: bare metal, rust, grain or flakes. |
public static final String AMOUNT = "srfAmount" | FLOAT how much of the second layer shows, 0 to 1. |
public static final String SCALE = "srfScale" | FLOAT pattern repeats per world unit. |
public static final String OPACITY = "srfOpacity" | FLOAT opacity of glass and ice facing the camera. |
public static final int MAX_SPLATS = 6 | The most paint splats paintSplats keeps. |
Methods
Inherited methods
Field details
COLOR
public static final String COLOR = "srfColor"VEC3 the main colour: paint, wood, stone or tint.COLOR2
public static final String COLOR2 = "srfColor2"VEC3 the second colour: bare metal, rust, grain or flakes.AMOUNT
public static final String AMOUNT = "srfAmount"FLOAT how much of the second layer shows, 0 to 1.SCALE
public static final String SCALE = "srfScale"FLOAT pattern repeats per world unit.OPACITY
public static final String OPACITY = "srfOpacity"FLOAT opacity of glass and ice facing the camera.MAX_SPLATS
public static final int MAX_SPLATS = 6The most paint splats
paintSplats keeps.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
splatsShaderMaterial- a material from
paintSplats indexint- 0 to
MAX_SPLATS - 1; reuse the oldest when full xfloat- world centre
yfloat- world centre
zfloat- world centre
radiusfloat- world radius, 0 to clear the slot
rgbint- paint colour as
0xRRGGBB