-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathexample.py
More file actions
17 lines (15 loc) · 826 Bytes
/
example.py
File metadata and controls
17 lines (15 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import os
import DracoPy
with open('testdata_files/bunny.drc', 'rb') as draco_file:
file_content = draco_file.read()
mesh_object = DracoPy.decode_buffer_to_mesh(file_content)
print('number of points in original file: {0}'.format(len(mesh_object.points)))
print('number of faces in original file: {0}'.format(len(mesh_object.faces)))
encoding_test = DracoPy.encode_mesh_to_buffer(mesh_object.points, mesh_object.faces)
with open('bunny_test.drc', 'wb') as test_file:
test_file.write(encoding_test)
with open('testdata_files/bunny_test.drc', 'rb') as test_file:
file_content = test_file.read()
mesh_object = DracoPy.decode_buffer_to_mesh(file_content)
print('number of points in test file: {0}'.format(len(mesh_object.points)))
print('number of faces in test file: {0}'.format(len(mesh_object.faces)))