L3D - The Starts of a 3D Lib
Re: L3D - The Starts of a 3D Lib
Yeah, is this project still on? I'm interested.
Re: L3D - The Starts of a 3D Lib
Yes yes yes...waratte wrote:Yeah, is this project still on? I'm interested.
I'm just growing bored of trying to load .obj files.
I'l get to it though.
Re: L3D - The Starts of a 3D Lib
Alright, so I reversed the order of which the points were fed to the drawPolygon function and nothing changed (Figures ).
So, I'm wondering, how can I sort a table by a specific place. For instance, in this case, I want to sort the Indices by there vertices Z coordinate. As far as I'm aware, table.sort won't be capable of handling this.
Is there an easier way then iterating through the table until I find the correct order? (I'm sure this would be pretty slow too...)
So, I'm wondering, how can I sort a table by a specific place. For instance, in this case, I want to sort the Indices by there vertices Z coordinate. As far as I'm aware, table.sort won't be capable of handling this.
Is there an easier way then iterating through the table until I find the correct order? (I'm sure this would be pretty slow too...)
- substitute541
- Party member
- Posts: 484
- Joined: Fri Aug 24, 2012 9:04 am
- Location: Southern Leyte, Visayas, Philippines
- Contact:
Re: L3D - The Starts of a 3D Lib
table.sort(vertTable, function(A,B) return A.z > B.z end)10$man wrote:Alright, so I reversed the order of which the points were fed to the drawPolygon function and nothing changed (Figures ).
So, I'm wondering, how can I sort a table by a specific place. For instance, in this case, I want to sort the Indices by there vertices Z coordinate. As far as I'm aware, table.sort won't be capable of handling this.
Is there an easier way then iterating through the table until I find the correct order? (I'm sure this would be pretty slow too...)
Currently designing themes for WordPress.
Sometimes lurks around the forum.
Sometimes lurks around the forum.
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: L3D - The Starts of a 3D Lib
You'll have to use table.sort, providing a comparison function.10$man wrote:Is there an easier way then iterating through the table until I find the correct order? (I'm sure this would be pretty slow too...)
Substitute is totally right, here. I'll just point out that this way, items in the table will be sorted in decreasing z-index.substitute541 wrote:table.sort(vertTable, function(A,B) return A.z > B.z end)
If you want them to be sorted in increasing z-index order, change the comparison function.
substitute541 wrote:table.sort(vertTable, function(A,B) return A.z < B.z end)
Re: L3D - The Starts of a 3D Lib
Wow... I don't know what I never thought of using table.sort like that
Thanks
I'l try this out and see what happens.
Thanks
I'l try this out and see what happens.
Re: L3D - The Starts of a 3D Lib
i love how my laptop is pure shit and the cubes from heaven keeps at 90fps, that is amazing
u wot m8
Re: L3D - The Starts of a 3D Lib
Awesomerokit boy wrote:i love how my laptop is pure shit and the cubes from heaven keeps at 90fps, that is amazing
Glad to hear that! I guess I'm doing something right.
On my computer it goes about 40 fps, and this is a desktop...
I think mainly the problem is my video card is terrible.
Also, as far as table.sort goes, It's not working particularly well, but I am gonna keep trying.
- substitute541
- Party member
- Posts: 484
- Joined: Fri Aug 24, 2012 9:04 am
- Location: Southern Leyte, Visayas, Philippines
- Contact:
Re: L3D - The Starts of a 3D Lib
... Not to be an advertiser but, please try to read my Love3D Library, specifically the z-sorting functions. There are lots of ways to do it.10$man wrote:Awesomerokit boy wrote:i love how my laptop is pure shit and the cubes from heaven keeps at 90fps, that is amazing
Glad to hear that! I guess I'm doing something right.
On my computer it goes about 40 fps, and this is a desktop...
I think mainly the problem is my video card is terrible.
Also, as far as table.sort goes, It's not working particularly well, but I am gonna keep trying.
Currently designing themes for WordPress.
Sometimes lurks around the forum.
Sometimes lurks around the forum.
Re: L3D - The Starts of a 3D Lib
Surprised that you order your triangles using the 'left-hand' rule.
Though most implimentations use the 'right_hand' rule???
To get the lighting to work correctly, I had to use 'left-hand' point order - see attached.
Though most implimentations use the 'right_hand' rule???
To get the lighting to work correctly, I had to use 'left-hand' point order - see attached.
- Attachments
-
- test7_m.love
- Just added another object to Present3D.lua
- (4.16 KiB) Downloaded 240 times
Who is online
Users browsing this forum: No registered users and 2 guests