Compare commits
No commits in common. "2f3508ed3a7aff1558b7b4d5baadf72309fc2716" and "b6553db09e0b425e1fcbac76bcae82996c4d3fda" have entirely different histories.
2f3508ed3a
...
b6553db09e
2
engine
2
engine
@ -1 +1 @@
|
|||||||
Subproject commit 1b9ce5410083bd9346aca642de6c8180116987e7
|
Subproject commit 3b21e1610a687edcd91d5fe1c05823c2834928db
|
12
game/game.py
12
game/game.py
@ -269,13 +269,13 @@ def main():
|
|||||||
# for _ in range(10000):
|
# for _ in range(10000):
|
||||||
# current_time = 0 # time.monotonic() - start_time
|
# current_time = 0 # time.monotonic() - start_time
|
||||||
|
|
||||||
# Draw * 9999 : min = 0.14 , max = 0.43 , avg = 0.19 ms
|
# Draw * 9999 : min = 0.13 , max = 0.86 , avg = 0.2 ms
|
||||||
# Draw * 9999 : min = 0.14 , max = 0.35 , avg = 0.19 ms
|
# Draw * 9999 : min = 0.14 , max = 0.75 , avg = 0.2 ms
|
||||||
# Draw * 9999 : min = 0.13 , max = 0.44 , avg = 0.18 ms
|
# Draw * 9999 : min = 0.14 , max = 0.84 , avg = 0.2 ms
|
||||||
|
|
||||||
# Frame * 9999 : min = 0.21 , max = 0.7 , avg = 0.33 ms
|
# Frame * 9999 : min = 0.19 , max = 0.98 , avg = 0.34 ms
|
||||||
# Frame * 9999 : min = 0.2 , max = 0.54 , avg = 0.31 ms
|
# Frame * 9999 : min = 0.21 , max = 0.94 , avg = 0.34 ms
|
||||||
# Frame * 9999 : min = 0.19 , max = 0.6 , avg = 0.29 ms
|
# Frame * 9999 : min = 0.21 , max = 1.0 , avg = 0.34 ms
|
||||||
|
|
||||||
print("Quitting...")
|
print("Quitting...")
|
||||||
del tests_batch
|
del tests_batch
|
||||||
|
@ -192,29 +192,22 @@ class ObjArchive(Archive):
|
|||||||
if name:
|
if name:
|
||||||
assert mesh
|
assert mesh
|
||||||
objects[name] = mesh
|
objects[name] = mesh
|
||||||
|
vertices = set()
|
||||||
vertices = []
|
for mesh in objects.values():
|
||||||
|
vertices |= frozenset(chain.from_iterable(mesh))
|
||||||
|
vertices = tuple(vertices)
|
||||||
indices = []
|
indices = []
|
||||||
models = {}
|
models = {}
|
||||||
for name, mesh in sorted(objects.items()):
|
for name, mesh in sorted(objects.items()):
|
||||||
offset = len(indices)
|
offset = len(indices)
|
||||||
assert offset < 65536
|
assert offset < 65536
|
||||||
mesh_vertices = []
|
indices.extend(map(vertices.index, chain.from_iterable(mesh)))
|
||||||
for vertex in chain.from_iterable(mesh):
|
count = len(indices) - offset
|
||||||
if vertex not in mesh_vertices:
|
|
||||||
mesh_vertices.append(vertex)
|
|
||||||
base_vertex = len(vertices)
|
|
||||||
mesh_indices = list(map(lambda v: mesh_vertices.index(v) + base_vertex, chain.from_iterable(mesh)))
|
|
||||||
assert max(mesh_indices) < 65536
|
|
||||||
count = len(mesh_indices)
|
|
||||||
print(name, ": vertices =", count, "packed =", len(mesh_vertices))
|
|
||||||
assert count % 3 == 0
|
assert count % 3 == 0
|
||||||
count //= 3
|
count //= 3
|
||||||
assert count < 65536
|
assert count < 65536
|
||||||
vertices.extend(mesh_vertices)
|
print(name, ": offset =", offset, "triangles =", count)
|
||||||
indices.extend(mesh_indices)
|
|
||||||
models[name] = (offset, count)
|
models[name] = (offset, count)
|
||||||
|
|
||||||
name = str(objpath.stem)
|
name = str(objpath.stem)
|
||||||
assert name not in self.vertices_db.keys()
|
assert name not in self.vertices_db.keys()
|
||||||
#TODO: move to math
|
#TODO: move to math
|
||||||
|
Loading…
Reference in New Issue
Block a user