v1.12.0 is released
We are very happy to announce the release of v1.12.0 (Release Note).
I appreciate all the contributors and all the sponsors. Thank you very much!
The main new feature is a custom shader with a new shading languge Kage. You can write a fragment shader in a Go-flavored language.
package main
// Uniform variables.
var Time float
var Cursor vec2
var ScreenSize vec2
// Fragment is the entry point of the fragment shader.
// Fragment returns the color value for the current position.
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
// You can define variables with a short variable declaration like Go.
lightpos := vec3(Cursor, 50)
lightdir := normalize(lightpos - position.xyz)
normal := normalize(imageSrc1UnsafeAt(texCoord) - 0.5)
ambient := 0.25
diffuse := 0.75 * max(0.0, dot(normal.xyz, lightdir))
// You can treat multiple source images by
// imageSrc[N]At or imageSrc[N]UnsafeAt.
return imageSrc0UnsafeAt(texCoord) * (ambient + diffuse)
}
Enjoy!