projekt_grafika/cw 2/models/editObj.py

22 lines
415 B
Python
Raw Normal View History

2022-03-08 15:55:51 +01:00
with open("ground2.obj", 'r') as f:
with open("ground2E.obj", 'w') as f2:
c1 = 0
c2 = 0
c3 = 0
for line in f.readlines():
l = line.split()
if l[0] == 'v':
c1 += 1
l[2] = "0.0"
if l[0] == 'vt':
c2 += 1
l[1] = '1.00000'
l[2] = '0.50000'
if l[0] == "vn":
c3 +=1
l[1] = "1.0"
l[2] = "1.0"
l[3] = "1.0"
l = " ".join(l)
f2.write(l + "\n")
print(c1, c2, c3)