Import current DEMON v0.19 source, assets and development handoff

This commit is contained in:
JariKo
2026-10-28 15:39:06 +02:00
commit 2b9ae06592
347 changed files with 14404 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
from pathlib import Path
import struct,json,numpy as np
b=Path('Demon_v0.19/art/succubus/succubus_v01.glb').read_bytes();n=struct.unpack_from('<I',b,12)[0];j=json.loads(b[20:20+n]);data=b[28+n:]
def arr(idx):
a=j['accessors'][idx];v=j['bufferViews'][a['bufferView']];t={5126:'<f4',5125:'<u4',5123:'<u2',5121:'u1'}[a['componentType']];size={'SCALAR':1,'VEC2':2,'VEC3':3,'VEC4':4,'MAT4':16}[a['type']];return np.frombuffer(data,t,a['count']*size,v.get('byteOffset',0)+a.get('byteOffset',0)).reshape(-1,size)
components={}
for p in j['meshes'][1]['primitives']:
pos=arr(p['attributes']['POSITION']);idx=arr(p['indices']).ravel();uniq,inv=np.unique(np.round(pos,5),axis=0,return_inverse=True);tri=inv[idx].reshape(-1,3);par=np.arange(len(uniq))
def find(x):
while par[x]!=x:par[x]=par[par[x]];x=par[x]
return x
for a,c,d in tri:
r=find(a);s=find(c);t=find(d);par[s]=r;par[t]=r
roots=np.array([find(i) for i in range(len(uniq))]);labels=roots[inv];out=[]
for r in np.unique(labels):
v=pos[labels==r]
if len(v)>15:out.append((len(v),np.round(v.min(axis=0),3).tolist(),np.round(v.max(axis=0),3).tolist()))
components[str(p['material'])]={'labels':labels.tolist(),'components':sorted(out,reverse=True)}
if p['material'] in [3,5,6,10]:print('MAT',p['material'],sorted(out,reverse=True)[:15])
Path('tools/succubus_components.json').write_text(json.dumps(components))