(bind-func xtm_make_model
(lambda (name:String* verts:float* num_verts:i64 r g b)
(let ((mesh:XTMMesh* (alloc))
(node:XTMModel* (alloc))
(transmat:float* (alloc 16))
(vbostride:i32 14) ;; 4d+3d+3d+4d
(vbodata:float* null)
(shininess:float 1.0)
(opacity:float 1.0)
(diffuse:float* (alloc 4))
(ambient:float* (alloc 4))
(specular:float* (alloc 4))
(emissive:float* (alloc 4))
(vao (VAO))
(vbo:VBO* (xtm_build_mesh_vbo vao verts num_verts)))
(pfill! ambient 0.0 0.0 0.0 1.0)
(pfill! diffuse r g b 1.0)
(pfill! specular 1.0 1.0 1.0 1.0)
(pfill! emissive 0.0 0.0 0.0 1.0)
;; null is for no texture
(tfill! mesh vbo null diffuse ambient specular emissive shininess opacity GL_TRIANGLES num_verts vao name)
(fill_identity_matrix transmat)
(tfill! node name transmat null 0 null 1 mesh)
node)))