comparison data/ST/make_stage.py @ 120:4300a832f033

Small refactoring and massive performance improvement
author Thibaut Girka <thib@sitedethib.com>
date Thu, 08 Sep 2011 12:46:05 +0200
parents 1ec8be40880f
children 1bc0ad774ed4
comparison
equal deleted inserted replaced
119:fad7b44cebf2 120:4300a832f033
63 # Bounding boxes 63 # Bounding boxes
64 anm_wrapper = AnmWrapper([Animations.read(open('stg1bg.anm', 'rb'))]) 64 anm_wrapper = AnmWrapper([Animations.read(open('stg1bg.anm', 'rb'))])
65 for model in models: 65 for model in models:
66 vertices = [] 66 vertices = []
67 for script_index, ox2, oy2, oz2, width_override, height_override in model.quads: 67 for script_index, ox2, oy2, oz2, width_override, height_override in model.quads:
68 sprite = Sprite() 68 sprite = Sprite(width_override, height_override)
69 anmrunner = ANMRunner(anm_wrapper, script_index, sprite) 69 anmrunner = ANMRunner(anm_wrapper, script_index, sprite)
70 anmrunner.run_frame() 70 anmrunner.run_frame()
71 sprite.update()
72 key, (vertices2, uvs2, colors2) = get_sprite_rendering_data(sprite) 71 key, (vertices2, uvs2, colors2) = get_sprite_rendering_data(sprite)
73 vertices.extend((x + ox2, y + oy2, z + oz2) for x, y, z in vertices2) 72 vertices.extend((x + ox2, y + oy2, z + oz2) for x, y, z in vertices2)
74 xmin, ymin, zmin = min(x for x, y, z in vertices), min(y for x, y, z in vertices), min(z for x, y, z in vertices) 73 xmin, ymin, zmin = min(x for x, y, z in vertices), min(y for x, y, z in vertices), min(z for x, y, z in vertices)
75 xmax, ymax, zmax = max(x for x, y, z in vertices), max(y for x, y, z in vertices), max(z for x, y, z in vertices) 74 xmax, ymax, zmax = max(x for x, y, z in vertices), max(y for x, y, z in vertices), max(z for x, y, z in vertices)
76 model.bounding_box = (xmin, ymin, zmin, xmax - xmin, ymax - ymin, zmax - zmin) 75 model.bounding_box = (xmin, ymin, zmin, xmax - xmin, ymax - ymin, zmax - zmin)