mesh files use game space (right-handed, y up): obj/gltf import and export no longer mirror models, per-mesh handedness keeps meshes of old projects as they were, python tools follow (--export-space for the old files)
This commit is contained in:
1 parent
c4fa500198
commit
4a58910fba
26 files changed
+525
-96
No files matched your search
+3
-3
@@ -33,7 +33,7 @@ class ObjW:
|
||||
self.f.append((tex, mat, [base + k for k in range(4)]))
|
||||
|
||||
def box(self, x0, z0, x1, z1, y0, y1, top, side):
|
||||
# coordinates: x0<x1, z0>z1 (negative z = further into the grid)
|
||||
# export space: x0<x1, z0>z1 (negative z = further into the grid); save() writes game space
|
||||
self.quad([(x0, y1, z0), (x1, y1, z0), (x1, y1, z1), (x0, y1, z1)], top)
|
||||
for (ax, az), (bx, bz) in [((x0, z0), (x0, z1)), ((x0, z1), (x1, z1)), ((x1, z1), (x1, z0)), ((x1, z0), (x0, z0))]:
|
||||
# wall from a to b, outside = clockwise
|
||||
@@ -45,12 +45,12 @@ class ObjW:
|
||||
def save(self, path):
|
||||
with open(path, 'w') as fo:
|
||||
for p in self.v:
|
||||
fo.write('v %.4f %.4f %.4f 1 1 1\n' % p)
|
||||
fo.write('v %.4f %.4f %.4f 1 1 1\n' % G.to_file(p))
|
||||
for u, v in self.vt:
|
||||
fo.write('vt %.6f %.6f\n' % (u, 1 - v))
|
||||
for tex, mat, ids in self.f:
|
||||
fo.write(f'g demo_mat{mat:02d}\nusemtl tex_{tex}\n')
|
||||
fo.write('f ' + ' '.join(f'{i + 1}/{i + 1}' for i in ids) + '\n')
|
||||
fo.write('f ' + ' '.join(f'{i + 1}/{i + 1}' for i in G.file_order(ids)) + '\n')
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
Reference in new issue
Block a user