Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Voxel Editor

edited May 2015 in Code Sharing Posts: 31

A voxel editor i made, with it you can make 3d models, like pixel art or minecraft.
Heres the code link
And heres a bootstrap loader...

function setup()
        if s == 200 then local t,m = {},string.len(d)
            for v in string.gmatch(d,"--# %a+") do t[#t+1] = {n = v, s = string.find(d,v)} end
            for i = #t,1,-1 do t[i].e = m m = t[i].s - 1 end
            for k,v in ipairs(t) do saveProjectTab(string.sub(v.n,5),string.sub(d,v.s,v.e)) end close()

If you use a texture with multiple images you can set the texCord range for each image in setup, then it will use those ranges when adding cubes, cycle through with the button next to the colors.

The mesh is saved to globalData using a given name, it removes unecesary data from the mesh.
You can then load it into a project with something like this

    data = loadstring(readGlobalData("Tree"))()
    m = mesh()
    m.vertices = data.vertices
    m.colors = data.colors
    m.texCoords = data.texCoords


  • Posts: 688

    That's really impressive well done (and some great code to learn from as well - thanks) :)

  • Posts: 2,020

    This is awesome. One minor issue I had, is that the left-hand stick sometimes registers input, for a frame or two, when I'm touching elsewhere on the screen.

  • Posts: 31

    Yeah the touches need a bit of work, if i get round to fixing it i will comment the code so its easier to understand, and maybe add a way to load saved models.

  • SimeonSimeon Admin Mod
    Posts: 5,580

    @Jaybob this is wonderful, loved playing with it.

Sign In or Register to comment.