Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
package com.codename1.gpu.shaders
A library of ready made shaders built on com.codename1.gpu.shader, to
mix and match into a scene: water, terrain, foliage, surfaces, toon
styles, effects, liquids and skies, plus ScenePresets that set the
light, sky and post processing to suit.
Every factory returns an ordinary ShaderMaterial, built only from
public ShaderNode calls, so each one runs on every backend and doubles
as an example to copy and change. Each class names its tunable uniforms
as constants; set them with ShaderMaterial.setUniform at any time, even
every frame, without rebuilding anything.
import com.codename1.gpu.*;
import com.codename1.gpu.shaders.*;
void setUp(GraphicsDevice device) {
ScenePresets.Preset look = ScenePresets.harbourDusk();
look.apply(device);
Mesh sea = Primitives.grid(120f, 160);
Material water = new Material(Material.Type.PBR).setShader(Water.ocean());
Material quay = new Material(Material.Type.PBR).setShader(Surface.concrete());
Material crates = new Material(Material.Type.PBR).setShader(Surface.paintedMetal());
}Types
class Foliage | Plants that move in the wind. |
class Fx | Effects: energy, magic, damage and sci-fi surfaces. |
class Liquid | Glowing and moving liquids, and the light water throws on what lies under it. |
class Noise | Procedural noise built from ShaderNode math, so it runs in either stage on every backend and needs no texture. |
class ScenePresets | Complete looks: a sun, the sky’s light, fog, tone mapping, post effects and a matching Sky dome, tuned to work together. |
class Shading | Small building blocks most surface shaders share: view dependent terms, fades, world space texture coordinates and signed distance shapes. |
class Sky | Sky domes: draw an inside-out sphere (Primitives.sphere(r, 24, 32, true)) around the camera with a Material.Type.UNLIT material and setFogged(false). |
class Surface | Man made and natural surfaces for Material.Type.PBR. |
class Terrain | Ground. |
class Toon | Stylized, non photographic shading. |
class Water | Water surfaces. |