X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=blobdiff_plain;ds=sidebyside;f=Primitives.lua;fp=Primitives.lua;h=c13966be230c0d4eb89bd3eee180010531a04f2f;hb=46c0ad2326b3d4edae71c00b6f4fcecb5eff4e07;hp=aafa7cbfa02bfc6fdb538114e76ecf154c95f98c;hpb=46c1311e546ae5cefc4f596ed13476c649f12f66;p=raymarcher.git diff --git a/Primitives.lua b/Primitives.lua index aafa7cb..c13966b 100644 --- a/Primitives.lua +++ b/Primitives.lua @@ -17,9 +17,18 @@ local function make_plane(centre, normal, texture) end end +local function make_pipe(centre, radius, axis, texture) + return function(p) + return {dist = V.norm(V.cross(p-centre, axis)) - radius, + texture = texture} + end +end + + Primitives = { make_sphere = make_sphere, - make_plane = make_plane + make_plane = make_plane, + make_pipe = make_pipe } return Primitives