The purpose of the module is to create and update path-traced 2D lightmaps. For example, to create interesting dynamic top-down lighting in a 2D game.
lm := lightmap.New(image.Rect(0, 0, 100, 100))
light := lightmap.Light{
RGBA: color.RGBA{255, 214, 170, 255},
Range: 10,
Falloff: 1.1,
}
lm.Trace(20, 25, light, 90) // x, y, light, nRays
lm := lightmap.New(image.Rect(0, 0, 100, 100))
light := lightmap.Light{
RGBA: color.RGBA{255, 214, 170, 255},
Range: 10,
Falloff: 1.1,
}
light.Trace(lm, 20, 25, 90) // lightmap, x, y, nRays
lm := lightmap.New(image.Rect(0, 0, 100, 100))
light := lightmap.Light{
RGBA: color.RGBA{255, 214, 170, 255},
Range: 10,
Falloff: 1.1,
}
lightmap.Trace(lm, 20, 25, light, 90) // lightmap, x, y, light, nRays