Browse Source

Possible interface to lib3ddevil1 added

pull/1/head
surkeh 1 year ago
parent
commit
abc7c3c5cf
1 changed files with 7 additions and 48 deletions
  1. 7
    48
      daedevil1.py

+ 7
- 48
daedevil1.py View File

@@ -9,56 +9,15 @@ if __name__ == "__main__":

devil1 = lib.lib3ddevil1.bindings.py3devil1

def pldtest(devil1pld, pldheader):
with open("pl01.pld", "rb") as f:
data = f.read()
devil1pld.getheader(ctypes.byref(pldheader), data)
devil1pld.printheader(ctypes.byref(pldheader))

def textest(devil1tex, texheader):
with open("pl01.pld_1.txp", "rb") as f:
data = f.read()
texheader = ctypes.cast(data, ctypes.POINTER(devil1.TexturePack))
devil1tex.printheader(texheader)

def geotest(devil1geo, geoheader):
with open("pl01.pld_0", "rb") as f:
data = f.read()
geoheader = ctypes.cast(data, ctypes.POINTER(devil1.Header))
devil1geo.printheader(geoheader)


def main():

# Iterate through pld, convert to .dae
sharedlib='./lib/lib3ddevil1/lib3ddevil1.so'
libc = ctypes.cdll.LoadLibrary(sharedlib)
if (not libc):
print("Couldn't load %s" % sharedlib)
return 1
print("OK\n")
pld="pl01.pld"
devil1.getpld(pld, sharedlib)
DEVIL1PLD = devil1.Devil1PLD_FN.in_dll(libc, "DEVIL1PLD")
pldh = devil1.PldHeader()
pldtest(DEVIL1PLD, pldh)
print()

DEVIL1TEX = devil1.Devil1TEX_FN.in_dll(libc, "DEVIL1TEX")
texh = devil1.TexturePack()
textest(DEVIL1TEX, texh)
print()

DEVIL1GEO = devil1.Devil1GEO_FN.in_dll(libc, "DEVIL1GEO")
geoh = devil1.Header()
geotest(DEVIL1GEO, geoh)
print()

mesh = collada.Collada()

with open("pl01.pld_0", "rb") as f:
data = f.read()
geoheader = ctypes.cast(data, ctypes.POINTER(devil1.Header))
# Create pld, interface tbd
#devil1.createpld(...)

#for meshNo in range(0, geoh.contents.numMesh):
#meshheader = ctypes.cast(data, ctypes.POINTER(devil1.
#for batchNo in range(0,

main()
main()

Loading…
Cancel
Save