It's an engine, inspired by Noodle Engine, but made for working with surfaces.
It is really easy and fun to use, even my pizza generator 19 lines long :D
I hope you will enjoy it! I don't see a reason to make it closed source, so... Enjoy the source also!
Here is how to use it:
surface("pizza",function() -- your code goes here end) |
That's it!
Here is available API:
- s_mode(m) m - one of [ "add", "sub", "over", "norm" ]; sets how new points will be drawn (height added, overridden and so on)
- s_point(x,y,z,c) (x,y,z) - position, c - color; draws a point
*s_line(x0,y0,z0,x1,y1,z1,c) (x0,y0,z0) - point a, (x1,y1,z1) - point b, c - color; draws a line from point a to point b - s_rect(x0,y0,z0,x1,y1,z1,c) (x0,y0,z0) - point a, (x1,y1,z1) - point b, c - color; draws a rect between point a and point b
- s_rectfill(x0,y0,x1,y1,z1,c) (x0,y0,z0) - point a, (x1,y1,z1) - point b, c - color; draws a filled rect between point a and point b
- s_circ(x,y,z,r,c) (x,y,z) - circle center, r - radius, c - color; draws a circle
- s_circfill(x,y,z,r,c) (x,y,z) - circle center, r - radius, c - color; draws a filled circle
- s_spr(i,x,y,z) i - sprite id, (x,y,z) - sprite position
- light(sharpness) sharpness - how strong is lighting; applies light to the texture
- noisefn(rnd_seed,noise_scale,noise_octaves) rnd_seed - noise random seed, noise_scale - noise "size", noise_octaves - how "different" is noise; returns a noise function with three arguments (x,y,z)
You have free sprite space starting from 128'th sprite (color ramps eat ~6 more sprites), in sprite memory for sprites 0-127 the texture is stored.
[Please log in to post a comment]