mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2024-11-25 16:28:57 +05:30
Added init and show for Meshes
This commit is contained in:
parent
49a3c8f0b7
commit
e4aeba9421
@ -333,6 +333,31 @@ class MEShHeader:
|
||||
def show(self):
|
||||
devil1geo.printmeshheader(self.cstruct)
|
||||
|
||||
def getbatchno(self):
|
||||
return self.cstruct.contents.numBatch
|
||||
|
||||
class MEsh:
|
||||
def __init__(self, i, filedata):
|
||||
self.cstruct = Mesh()
|
||||
if filedata:
|
||||
mh = MEShHeader(i, filedata)
|
||||
# allocate memory for the size of batch * number of batches
|
||||
memsize = ctypes.sizeof(Batch) * mh.getbatchno()
|
||||
self.cstruct.b = ctypes.cast(ctypes.create_string_buffer(memsize),
|
||||
ctypes.POINTER(Batch))
|
||||
if not devil1geo.getmesh(ctypes.byref(self.cstruct),
|
||||
i,
|
||||
filedata,
|
||||
len(filedata)):
|
||||
print("failed to get mesh")
|
||||
return
|
||||
|
||||
def show(self):
|
||||
if self.cstruct.b:
|
||||
devil1geo.printbatch(self.cstruct.b)
|
||||
else:
|
||||
print("nothing to show")
|
||||
|
||||
#--------------------------------------+
|
||||
# Regular Python
|
||||
#--------------------------------------+
|
||||
@ -418,7 +443,8 @@ if __name__ == "__main__":
|
||||
gh.show()
|
||||
mh = MEShHeader(3, data)
|
||||
mh.show()
|
||||
|
||||
m = MEsh(0, data)
|
||||
m.show()
|
||||
#---------------------------------------+
|
||||
# main()
|
||||
mainx()
|
||||
|
Loading…
Reference in New Issue
Block a user