Advertisement
matrefeytontias

[Axe] Face sorting routine

May 14th, 2013
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. :Lbl SortFaces
  2. :...
  3. :r1→pointer on table of rotated 2-bytes Z of each vertices in the faces
  4. :r2→pointer on faces array
  5. :r3→output area,which contains at least 1 byte for each face
  6. :returns the sorted order in outputArea
  7. :...
  8. :.Z-average of each face
  9. :For(r4,0,{r2-1}-1)
  10. :0→{r4*2+L4→r6}^r
  11. :‾1
  12. :For(4)
  13. :+1→r5
  14. :{{r4*4+r5+r2}*2+r1}^r+{r6}^r→{r6}^r
  15. :r5
  16. :End
  17. :End
  18. :
  19. :.Init sorting
  20. :For(r4,0,{r2-1}-1)
  21. :r4→{r4+r3}
  22. :End
  23. :
  24. :
  25. :.Sort
  26. :While 1
  27. :0→r6
  28. :For(r4,0,4)
  29. :If {{r4+r3}*2+L4}^r<<{{r4+r3+1}*2+L4}^r
  30. :1→r6
  31. :{r4+r3}^r→{r4+r3}^r^r
  32. :End
  33. :End
  34. :End!If r6
  35. :Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement