Skip to content

Instantly share code, notes, and snippets.

@Aeva
Created September 23, 2015 02:50
Show Gist options
  • Save Aeva/205e30eb9630fbaf685e to your computer and use it in GitHub Desktop.
Save Aeva/205e30eb9630fbaf685e to your computer and use it in GitHub Desktop.
parsing some data from jta 3D model in python
import json
import numpy
import base64
def open_model(path):
jta = json.load(open(path, "r"))
attrs = []
for attr in jta['attributes']:
v_blob = base64.b64decode(attr['vertices']['position']['data'])
i_blob = base64.b64decode(attr['polygons']['data'])
attrs.append({
'vertices' : numpy.fromstring(v_blob, dtype=numpy.float16),
'indices' : numpy.fromstring(i_blob, dtype=numpy.uint16),
})
return attrs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment