Created
September 23, 2015 02:50
-
-
Save Aeva/205e30eb9630fbaf685e to your computer and use it in GitHub Desktop.
parsing some data from jta 3D model in python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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