Skip to content

Instantly share code, notes, and snippets.

@nasser
Created October 26, 2014 07:47
Show Gist options
  • Save nasser/f62cbe299983e22a51e5 to your computer and use it in GitHub Desktop.
Save nasser/f62cbe299983e22a51e5 to your computer and use it in GitHub Desktop.
Mesh Generation
(let [m (.mesh (get-component (object-named "mesh") UnityEngine.MeshFilter))]
(set!
(.vertices m)
(into-array [(v 0 0 0)
(v 0 0 1)
(v 0 1 1)
(v 0 1 0)
(v 2 0.5 0.5)
]))
(set!
(.uv m)
(into-array [(UnityEngine.Vector2. 0 0)
(UnityEngine.Vector2. 0 0.5)
(UnityEngine.Vector2. 0.5 0)
(UnityEngine.Vector2. 0 0.75)
(UnityEngine.Vector2. 1 1)
]))
(set!
(.normals m)
(into-array [(v 0 -1 -1)
(v 0 -1 1)
(v 0 1 1)
(v 0 1 -1)
(v 1 0 0)
]))
(set!
(.triangles m)
(into-array System.Int32 [0 1 2
2 3 0
4 1 0
3 2 4
2 1 4
0 3 4
])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment