| 516 | |
| 517 | |
| 518 | class Light: |
| 519 | lights = [] |
| 520 | # [( |
| 521 | # ( |
| 522 | # (z, z, ...), |
| 523 | # (...), |
| 524 | # ... |
| 525 | # ), |
| 526 | # Light, |
| 527 | # ), ...] |
| 528 | shadow_maps = [] |
| 529 | types_lookup = ("parallel", "point", "spot") |
| 530 | # 0 resolution |
| 531 | # 1 z_near |
| 532 | # 2 z_far |
| 533 | # 3 rendering_plane_z |
| 534 | # 4 half resolition |
| 535 | # 5 squared half resolution |
| 536 | shadow_properties = (512, 0.01, 320, 256, 256, 256, 65536) |
| 537 | def __init__(self, position, strength=(1, 1, 1), direction=None, size=60, type=1, shadow=True) -> None: |
| 538 | |
| 539 | if type in (0, 2) and direction is None: |
| 540 | raise Exception("Parallel light source (type 0) requires direction") |
| 541 | if type == 1: |
| 542 | self.dirx = None |
| 543 | self.diry = None |
| 544 | self.dirz = None |
| 545 | self.shadow_map1 = None |
| 546 | self.shadow_map2 = None |
| 547 | self.shadow_map3 = None |
| 548 | self.shadow_map4 = None |
| 549 | self.shadow_map5 = None |
| 550 | self.shadow_map6 = None |
| 551 | self.rotation1 = None |
| 552 | self.rotation2 = None |
| 553 | self.rotation3 = None |
| 554 | self.rotation4 = None |
| 555 | self.rotation5 = None |
| 556 | self.rotation6 = None |
| 557 | self.size = None |
| 558 | elif type == 0: |
| 559 | self.dirx, self.diry, self.dirz = normalize_v3d(direction) |
| 560 | self.dirx_in_cam = None |
| 561 | self.diry_in_cam = None |
| 562 | self.dirz_in_cam = None |
| 563 | self.shadow_map0 = None |
| 564 | self.rotation0 = None |
| 565 | self.size = None |
| 566 | elif type == 2: |
| 567 | self.dirx, self.diry, self.dirz = normalize_v3d(direction) |
| 568 | self.dirx_in_cam = None |
| 569 | self.diry_in_cam = None |
| 570 | self.dirz_in_cam = None |
| 571 | self.shadow_map0 = None |
| 572 | self.rotation0 = None |
| 573 | self.size = size |
| 574 | self.shadow_properties = self.shadow_properties[:3] + (self.shadow_properties[4] / tan(size * pi / 360),) + self.shadow_properties[4:] |
| 575 | self.x, self.y, self.z = position |
nothing calls this directly
no outgoing calls
no test coverage detected