Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local indList = {
- 1, 1, 1,
- 2, 2, 2,
- 3, 3, 3,
- 4, 4, 4,
- }
- local vertList = {
- 1, 1, 1, 0,
- 2, 2, 2, 0,
- 3, 3, 3, 0,
- 4, 4, 4, 0,
- 5, 5, 5, 0,
- 6, 6, 6, 0,
- 7, 7, 7, 0,
- }
- local function sortVerts(iL,vL) --vL == vertice list, iL == index list
- local vList = {}
- for i = 1, #iL, 3 do --Load a triangle at a time into the vList to draw in the next loop.
- vList[i]= {x= vL[ iL[i] ], y= vL[ iL[i]+1 ], z= vL[ iL[i]+2 ] } --Target vertex1's x/y and z
- vList[i+1]= {x= vL[ iL[i+1] ], y= vL[ iL[i+1]+1 ], z= vL[ iL[i+1]+2 ] } --Target vertex2's x/y and z
- vList[i+2]= {x= vL[ iL[i+2] ], y= vL[ iL[i+2]+1 ], z= vL[ iL[i+2]+2 ] } --Target vertex3's x/y and z
- end
- return vList
- end
- list = sortVerts(indList,vertList)
- for i,val in ipairs(list) do
- print(val.x,val.y,val.z)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement