Browse Source

Skeletal structure and submodule added

pull/1/head
surkeh 1 year ago
parent
commit
5fb7ec0c30
5 changed files with 80 additions and 0 deletions
  1. 4
    0
      .gitmodules
  2. 10
    0
      Makefile
  3. 64
    0
      daedevil1.py
  4. 1
    0
      lib/lib3ddevil1
  5. 1
    0
      test/test.py

+ 4
- 0
.gitmodules View File

@@ -0,0 +1,4 @@
[submodule "lib/lib3ddevil1"]
path = lib/lib3ddevil1
url = https://git.teknik.io/scuti/lib3ddevil1.git
branch = feature/pythonbinding

+ 10
- 0
Makefile View File

@@ -0,0 +1,10 @@
lib:
cd lib/lib3ddevil1 && $(MAKE)

init:
pip install -r requirements.txt

test:
py.test tests

.PHONY: lib init test

+ 64
- 0
daedevil1.py View File

@@ -0,0 +1,64 @@
#!/usr/bin/python3
import collada
import ctypes
import numpy
import lib.lib3ddevil1.bindings.py3devil1


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():
sharedlib='./lib/lib3ddevil1/lib3ddevil1.so'
libc = ctypes.cdll.LoadLibrary(sharedlib)
if (not libc):
print("Couldn't load %s" % sharedlib)
return 1
print("OK\n")
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))

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

main()

+ 1
- 0
lib/lib3ddevil1

@@ -0,0 +1 @@
Subproject commit e111ff2e077572ac0bb39baf6a0c2f137d5ff3ee

+ 1
- 0
test/test.py View File

@@ -0,0 +1 @@
#!/usr/bin/python3

Loading…
Cancel
Save