""" May it be a light for you in dark places, when all other lights go out.
"""
-import time
-
import pymunk
import pymunk.pygame_util
import pygame.draw
-from .constants import SCREEN_SIZE, LIGHT_CATEGORY, DEBUG
+from .constants import SCREEN_SIZE, LIGHT_CATEGORY
+from .utils import debug_timer
LIGHT_FILTER = pymunk.ShapeFilter(
mask=pymunk.ShapeFilter.ALL_MASKS ^ LIGHT_CATEGORY,
yield pymunk.Vec2d(x, bottom)
+@debug_timer("lights.calculate_ray_polys")
def calculate_ray_polys(space, body, position):
- start_time = time.time()
position = pymunk.Vec2d(position)
vertices = [position]
ray_polys = []
vertices = trial_poly.get_vertices() + [point]
if len(vertices) > 2:
ray_polys.append(pymunk.Poly(body, vertices))
- end_time = time.time()
- if DEBUG:
- print(
- "calculate_ray_polys: %d polys, %g seconds" %
- (len(ray_polys), end_time - start_time))
return ray_polys