Zed.lua (3d library)

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
alesan99
Prole
Posts: 41
Joined: Sun Feb 09, 2014 3:13 am
Contact:

Zed.lua (3d library)

Post by alesan99 » Fri May 16, 2014 10:35 pm

So I've been making 3d in love since I've seen hugobdesigner's 3d thread.
At first I didn't really wan't to make a 3d lib because people would think I'm crazy for trying to make 3d in a 2d engine instead of using a 3d engine but after I saw oysi's thread I know people like 3d.
So yea, hope you like it.
BIG THANKS TO http://petercollingridge.appspot.com/3D-tutorial
For LOVE 0.9.0/0.9.1
Guide
Here is how to make a simple cube

Code: Select all

function love.load()
   zed = require("zed")
   cube = zed.newCube(0, 0, 0, 50)
   zed.rotateFormX(cube, -.5)
   zed.rotateFormY(cube, -.5)
end

function love.draw()
   love.graphics.translate(love.window.getWidth()/2, love.window.getHeight()/2)
   zed.drawForm(cube, {faces = true, shadows = true})
end
I don't have time to write descriptions for every function.
  • zed.setPointColor(r, g, b, a)
    zed.setEdgeColor(r, g, b, a)
    zed.newCube(x, y, z, facesize)
    zed.newRectangularPrism(x, y, z, width, height, depth)
    zed.newForm(nodes, edges, faces, facecolors)
    zed.setFaceColors(obj, colors)
    zed.setFaceColor(obj, face, color)
    zed.setLightVector(x, y, z)
    zed.getLightVector()
    zed.setCamera(x, y, z)
    zed.getCamera()
    zed.setFOV(fov)
    zed.getFOV()
    zed.drawForm(obj, tasks)
    zed.getNodes(obj)
    zed.getEdges(obj)
    zed.getFaces(obj)
    zed.rotateFormX(obj, theta)
    zed.rotateFormY(obj, theta)
    zed.rotateFormZ(obj, theta)
    zed.rotateForm(obj, thetax, thetay, thetaz)
    zed.getFormRotation(obj)
    zed.translateForm(obj, x, y, z)


Examples
Image
Image
3d 3d Rectangular Prism (cross eye 3d)
Coming soon: simple 3d Physics

Download
I really don't want to cause trouble with licenses so I'll make it simple.
You can edit and/or use it only if you give me and http://petercollingridge.appspot.com/3D-tutorial credit
Download

there's still a lot to do.
I'll add more set and get functions and a drawObjects function (It draws the objects that are in front first)
It's usable, but it doesn't have enough function for a full game.
I would like some tips to make my library better, so if you think something could be improved tell me

Enjoy :nyu:

User avatar
Jasoco
Inner party member
Posts: 3651
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Zed.lua (3d library)

Post by Jasoco » Sat May 17, 2014 2:58 am

Everyone's doing 3D these days.

In fact, I wanted to do 3D in a 2D engine because people would think I'm crazy. If people didn't think crazy when they shouldn't have, we never would have gotten Star Fox or Donkey Kong Country.

More 3D! More 3D!

LuaWeaver
Party member
Posts: 183
Joined: Wed Mar 02, 2011 11:15 pm
Location: Ohio, USA

Re: Zed.lua (3d library)

Post by LuaWeaver » Sat May 17, 2014 6:38 pm

I can't do the cross-eyed thing... I'm supposed to cross my eyes until the dots line up in the center, right?

Also, awesome! Thanks for linking that tutorial.
"your actions cause me to infer your ego is the size of three houses" -finley

jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

Re: Zed.lua (3d library)

Post by jjmafiae » Sat May 17, 2014 7:53 pm

Jasoco wrote:Everyone's doing 3D these days.
im not, am I a traitor?

User avatar
alesan99
Prole
Posts: 41
Joined: Sun Feb 09, 2014 3:13 am
Contact:

Re: Zed.lua (3d library)

Post by alesan99 » Sat May 17, 2014 9:16 pm

LuaWeaver wrote:I can't do the cross-eyed thing... I'm supposed to cross my eyes until the dots line up in the center, right?

Also, awesome! Thanks for linking that tutorial.
Yeah you have to cross your eyes until you only see one dot. If the 3d looks inverted just edit the code so the box rotations are flipped.

thank you!

User avatar
Jasoco
Inner party member
Posts: 3651
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Zed.lua (3d library)

Post by Jasoco » Sun May 18, 2014 3:34 am

jjmafiae wrote:im not, am I a traitor?
Yes.

Wait, you never did a 3D project here? I can't keep track as they keep popping up so fast.

User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Zed.lua (3d library)

Post by Robin » Sun May 18, 2014 9:13 am

I think he did. A three-dimensional parade, wasn't it?
Help us help you: attach a .love.

jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

Re: Zed.lua (3d library)

Post by jjmafiae » Sun May 18, 2014 11:12 am

Well it wasn't real 3D but a 3D like perspective or something.

User avatar
alesan99
Prole
Posts: 41
Joined: Sun Feb 09, 2014 3:13 am
Contact:

Re: Zed.lua (3d library)

Post by alesan99 » Thu May 22, 2014 9:43 pm

Fixed a minor mistake.
Redownload if you're using the library.

User avatar
yetneverdone
Party member
Posts: 366
Joined: Sat Sep 24, 2016 11:20 am
Contact:

Re: Zed.lua (3d library)

Post by yetneverdone » Thu Mar 23, 2017 12:33 pm

Bump. Is this library not active anymore?

Post Reply

Who is online

Users browsing this forum: No registered users and 31 guests