"Cubes"

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

"Cubes"

Post by Nixola »

Hi, since there are many people interested in it I decided to start playing with 3d. Yesterday I coded "What?", today I'm trying to code a cube visualizator. It takes some cubes (two cubes, now) and renders them. I managed to create a program that is able to take some list of 8 points each and turn each of them into a cube, and the camera is able to move on the X, Y and Z axises (? plural of "axis") and turn right and left by 90° (ALMOST buglessly), I'd make turning up an down possible but I'd have to hardcode 12 directions and I don't want to do that, 4 are enough. The problem is, I don't know how to make the camera able to turn if not by 90°... Could someone please help me about this? I tried googling it, but I didn't find anything particulary related...
Attachments
cubes.love
WASD to move along X and Z axises, RF to move up and down, QE to turn left and right. "Don't look directly at the bugs!" - now runs on Linux and Mac
(1.1 KiB) Downloaded 234 times
Last edited by Nixola on Sun Jan 06, 2013 2:41 pm, edited 1 time in total.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
mickeyjm
Party member
Posts: 237
Joined: Thu Dec 29, 2011 11:41 am

Re: "Cubes"

Post by mickeyjm »

Look interesting so far. btw the plural of axis is axes. Im not sure what you mean by turning by not 90°but if you look at my demo i uploade (at the same time you did LOL) I have a rotateable camera if tha is what you mean.

I know what you mean about google though, when I was looking for tutorials on 3 google was obsessed with 3ds max and maya and blener and all the other 3d animation programs :x
Your screen is very zoomed in...
10$man
Citizen
Posts: 77
Joined: Sun Apr 22, 2012 10:40 pm

Re: "Cubes"

Post by 10$man »

Hello!
First of all, good work!

Ok, so when I first started trying to learn how 3d projection worked, I used some websites. I can't find them now, but these ones seem to be good too:
http://www.netmagazine.com/tutorials/bu ... -3d-engine
http://soft.vub.ac.be/~tvcutsem/teachin ... /les7.html
http://www.cubic.org/docs/3dclip.htm

Sure, none of them are relative to Lua, but the idea is the same. Good Luck :)
User avatar
Ubermann
Party member
Posts: 146
Joined: Mon Nov 05, 2012 4:00 pm

Re: "Cubes"

Post by Ubermann »

I got this when trying to run it:

Code: Select all

main.lua:6: attempt to call field '_openConsole' (a nil value)

Traceback

main.lua:6: in main chunk
[C]: in function 'require'
[C]: in function 'xpcall'

I'm running Ubuntu Linux 12.

(? plural of "axis")
Axes. Like axes. Like several items whose singular form is axe. Like the tool you use to kill trees.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: "Cubes"

Post by Nixola »

That function is windows only, it's to run the terminal without having a conf.lua (lazyness... it's an evil beast). I'll change the .love in a moment

P.S: thanks for the 'axis' plural ^^
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
Ubermann
Party member
Posts: 146
Joined: Mon Nov 05, 2012 4:00 pm

Re: "Cubes"

Post by Ubermann »

Nixola wrote:That function is windows only, it's to run the terminal without having a conf.lua (lazyness... it's an evil beast). I'll change the .love in a moment
I edited the code and removed that line.

It works fine. I only would say that using key repeat will be better for moving everything.

Also edited it to make screen 1024.768 instead 800x600

[E] doesn't work for me, or at least I can't see anything to change when pressing it.


And, after pressing [q] several times I got this:
v9o5N.png
v9o5N.png (237.25 KiB) Viewed 272 times

And got this after playing a bit with it:
dYSTJ.png
dYSTJ.png (241.08 KiB) Viewed 272 times

Sorry for the big screens. I'm lazy to edit them now :P
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: "Cubes"

Post by Nixola »

Well, since you edited the code I can't know what line caused the error... I pressed it like 100 times and I didn't get any error though
I don't know why E doesn't work, with the same .love file it works as expected here

About the strange "artifact", it happens when you're inside a cube, I have to code the part that prevents invisible points' rendering
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
xXxMoNkEyMaNxXx
Party member
Posts: 206
Joined: Thu Jan 10, 2013 6:16 am
Location: Canada

Re: "Cubes"

Post by xXxMoNkEyMaNxXx »

Nice job, this gives me an idea of putting a render mode for each surface on my Brick objects in my 3D Rendering Engine :D
Also, how do you get that console open, and what does it do? It seems like a debugging tool, which would be useful.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: "Cubes"

Post by Nixola »

You can open it by setting t.console true in love.conf, you can then print values there by calling print(...)
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
substitute541
Party member
Posts: 484
Joined: Fri Aug 24, 2012 9:04 am
Location: Southern Leyte, Visayas, Philippines
Contact:

Re: "Cubes"

Post by substitute541 »

I thought you already knew the plural of axis. Didn't I said that before in my own 3D engine? Oh and, nice work with that :3 .
Currently designing themes for WordPress.

Sometimes lurks around the forum.
Post Reply

Who is online

Users browsing this forum: No registered users and 48 guests