ShadePlugin

ceramic.ShadePlugin (Class)

Runtime integration of shade shaders with the asset system.

Meant to be used as a static extension:

using ceramic.ShadePlugin;

assets.watchDirectory();
assets.watchShadeShaders();

Static Members

shade
watchShadeShaders(assets: Assets): WatchDirectory

Watch the Haxe sources of shade shaders and re-transpile them on the fly when they change, so shader edits show up without rebuilding the whole app.

The list of shaders and their source paths is read from the shade/info.json emitted next to the build output, so this only works on a machine that still has the project sources, and needs the ceramic CLI to be reachable (it is when the app was started through it).

Only the body of a shader function can be reloaded this way: adding or removing a @param, @in or @out also changes generated code that lives in the app binary, and still requires a full rebuild.

Name Type Description
assets Assets The assets instance owning the shaders, already watching a directory
Returns Description
WatchDirectory The WatchDirectory used internally, or null if watching is unavailable

Private Members

shade
assetNameFromShaderInfo(entry: Dynamic): String

Derive the asset name a shader class produces, matching the naming used by Assets.add(Class<shade.Shader>): package parts joined with _, then the class name with a lowercase first char.

Name Type
entry Dynamic
Returns
String

shade
transpileShadeShader(assets: Assets, filePath: String, assetName: String): Void
Name Type
assets Assets
filePath String
assetName String