groverburger / g3d

Simple and easy 3D engine for LÖVE.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

custom vertex format help

giovifav opened this issue · comments

hello,
i need some help to create a new model from vertices
i'm making a map generator based on perlin noise and i want to create a custom model/mesh for ground. the generator return a table with a list of 3d point like {x, height, y}.
i have tried to feed the function g3d.newModel with that table and a texture but seem no working correctly.
there is a right way that i'm ignore?
sorry if the question seem silly, i'm a noob!
thanks!

Screenshot from 2021-05-31 18-49-29

edit:
I just dig into the source and i just realize the use of love mesh. Now my question seem more odd.
So, for every vertex i need to build a table like this { x, y, z, texturex, texturey, normalx, normaly, normalz} ?
edit2:
still have problems i think i'm using the wrong normal vector :(
Immagine

commented

This does not appear to be a problem with g3d itself, so I'm closing this issue.

From the bit of code you showed, you seem to be adding one point to the mesh for each x, z coordinate. However, you must understand that meshes are created from triangles and your mesh must be built with that in mind. It does not seem like you need a custom vertex format for what you want, as that refers to a different concept. I hope that helps! If you want more help, try asking this question on the love2d forums.