mirror of
https://git.mirrors.martin98.com/https://github.com/google/draco
synced 2025-07-28 22:12:00 +08:00
Removed types from arguments to be compliant with python 2.7
This commit is contained in:
parent
96a1a3c276
commit
d20efa41df
@ -20,6 +20,7 @@ class Drc2PyMesh(ctypes.Structure):
|
|||||||
("uvs_real_num", ctypes.c_uint),
|
("uvs_real_num", ctypes.c_uint),
|
||||||
("uvs", ctypes.POINTER(ctypes.c_float))
|
("uvs", ctypes.POINTER(ctypes.c_float))
|
||||||
]
|
]
|
||||||
|
|
||||||
class DrcMesh:
|
class DrcMesh:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.faces = []
|
self.faces = []
|
||||||
@ -102,12 +103,11 @@ class Draco:
|
|||||||
# Free memory allocated by the lib
|
# Free memory allocated by the lib
|
||||||
self.drc_free(ctypes.byref(mesh_ptr))
|
self.drc_free(ctypes.byref(mesh_ptr))
|
||||||
mesh_ptr = None
|
mesh_ptr = None
|
||||||
return result;
|
return result
|
||||||
|
|
||||||
def encode(self, mesh_data: DrcMesh, file: str):
|
def encode(self, mesh_data, file):
|
||||||
mesh = Drc2PyMesh()
|
mesh = Drc2PyMesh()
|
||||||
|
|
||||||
|
|
||||||
mesh.faces = array_to_ptr(mesh_data.faces, mesh_data.faces_num * 3, ctypes.c_uint)
|
mesh.faces = array_to_ptr(mesh_data.faces, mesh_data.faces_num * 3, ctypes.c_uint)
|
||||||
mesh.faces_num = ctypes.c_uint(mesh_data.faces_num)
|
mesh.faces_num = ctypes.c_uint(mesh_data.faces_num)
|
||||||
mesh.vertices = array_to_ptr(mesh_data.vertices, mesh_data.vertices_num * 3, ctypes.c_float)
|
mesh.vertices = array_to_ptr(mesh_data.vertices, mesh_data.vertices_num * 3, ctypes.c_float)
|
||||||
@ -117,9 +117,7 @@ class Draco:
|
|||||||
mesh.uvs = array_to_ptr(mesh_data.uvs, mesh_data.uvs_num * 3, ctypes.c_float)
|
mesh.uvs = array_to_ptr(mesh_data.uvs, mesh_data.uvs_num * 3, ctypes.c_float)
|
||||||
mesh.uvs_num = ctypes.c_uint(mesh_data.uvs_num)
|
mesh.uvs_num = ctypes.c_uint(mesh_data.uvs_num)
|
||||||
|
|
||||||
|
|
||||||
mesh_ptr = ctypes.byref(mesh)
|
mesh_ptr = ctypes.byref(mesh)
|
||||||
file_ptr = ctypes.c_char_p(file.encode())
|
file_ptr = ctypes.c_char_p(file.encode())
|
||||||
|
|
||||||
self.drc_encode(mesh_ptr, file_ptr)
|
self.drc_encode(mesh_ptr, file_ptr)
|
||||||
#self.string(ctypes.c_char_p(file.encode()))
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user