mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2024-11-22 05:42:59 +05:30
Fixed TEXtureBatchDescriptor
This commit is contained in:
parent
62841adcb9
commit
b30359aabc
@ -240,24 +240,12 @@ devil1geo = Devil1GEO_FN.in_dll(libc, "DEVIL1GEO")
|
||||
|
||||
class PLDHeader:
|
||||
def __init__(self, filedata = None):
|
||||
# self.offsets = []
|
||||
# if filedata:
|
||||
# h = PldHeader()
|
||||
# devil1pld.getheader(ctypes.byref(h), filedata)
|
||||
# self.offsets = h.offsets[:h.numOffset]
|
||||
# self.offsets.append(len(filedata))
|
||||
# Store C Struct in order to call C functions
|
||||
self.cstruct = PldHeader()
|
||||
if filedata:
|
||||
devil1pld.getheader(ctypes.byref(self.cstruct), filedata)
|
||||
self.eof = len(filedata)
|
||||
|
||||
# def __str__(self):
|
||||
# output = "numOffset: %s" % str(len(self.offsets))
|
||||
# for offset in self.offsets:
|
||||
# output += "\n\t" + str(hex(offset))
|
||||
# return output
|
||||
|
||||
def show(self):
|
||||
devil1pld.printheader(ctypes.byref(self.cstruct))
|
||||
return
|
||||
@ -290,27 +278,26 @@ class TEXturePack:
|
||||
|
||||
class TEXtureBatchDescriptor:
|
||||
def __init__(self, i, filedata):
|
||||
self.cstruct = TextureBatchDescriptor()
|
||||
ptrofptr = ctypes.byref(ctypes.byref(self.cstruct))
|
||||
if filedata():
|
||||
self.cstruct = ctypes.pointer(TextureBatchDescriptor())
|
||||
ptrofptr = ctypes.byref(self.cstruct)
|
||||
if filedata:
|
||||
devil1tex.getbatchdesc(ptrofptr, i, filedata, len(filedata))
|
||||
return
|
||||
|
||||
def show(self):
|
||||
ptr = ctypes.byref(self.cstruct)
|
||||
devil1tex.printbatchdesc(ptr)
|
||||
def show(self):
|
||||
devil1tex.printbatchdesc(self.cstruct)
|
||||
|
||||
def getbatchidx(self):
|
||||
return self.cstruct.batchIdx
|
||||
def getbatchidx(self):
|
||||
return self.cstruct.contents.batchIdx
|
||||
|
||||
def gethash(self):
|
||||
return self.cstruct.hash
|
||||
def gethash(self):
|
||||
return self.cstruct.contents.hash
|
||||
|
||||
def gettexno(self):
|
||||
return self.cstruct.texNumber
|
||||
def gettexno(self):
|
||||
return self.cstruct.contents.texNumber
|
||||
|
||||
def gettexturesize(self):
|
||||
return self.cstruct.textureSize
|
||||
def gettexturesize(self):
|
||||
return self.cstruct.contents.textureSize
|
||||
|
||||
class TEXtures:
|
||||
def __init__(self, i, batchdescriptor, filedata):
|
||||
@ -328,10 +315,11 @@ if __name__ == "__main__":
|
||||
data = f.read()
|
||||
devil1pld.getheader(ctypes.byref(pldheader), data)
|
||||
devil1pld.printheader(ctypes.byref(pldheader))
|
||||
for offset in pldheader.getoffsets():
|
||||
print(hex(offset))
|
||||
# for offset in pldheader.getoffsets():
|
||||
# print(hex(offset))
|
||||
|
||||
def textest(devil1tex, texheader):
|
||||
print("texture test")
|
||||
with open("pl01.pld_1.txp", "rb") as f:
|
||||
data = f.read()
|
||||
# texheader = ctypes.cast(data, ctypes.POINTER(TexturePack))
|
||||
@ -342,8 +330,11 @@ if __name__ == "__main__":
|
||||
bd = ctypes.pointer(batchdesc)
|
||||
print("\nbatch descriptor:")
|
||||
devil1tex.getbatchdesc(ctypes.byref(bd), 1, data, len(data))
|
||||
devil1tex.printbatchdesc(bd)
|
||||
print(bd.contents.textureSize)
|
||||
|
||||
def geotest(devil1geo, geoheader):
|
||||
print("geo test")
|
||||
with open("pl00.pld_0", "rb") as f:
|
||||
data = f.read()
|
||||
# geoheader = ctypes.cast(data, ctypes.POINTER(Header))
|
||||
@ -389,7 +380,11 @@ if __name__ == "__main__":
|
||||
txp.show()
|
||||
print(txp.getbatchno())
|
||||
print(txp.getfirstbatchoffset())
|
||||
tbd = TEXtureBatchDescriptor(1, data)
|
||||
tbd.show()
|
||||
print(tbd.gettexturesize())
|
||||
|
||||
#---------------------------------------+
|
||||
# main()
|
||||
main()
|
||||
mainx()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user