MCPcopy Create free account
hub / github.com/ICE27182/Python-3D-renderer / __init__

Method __init__

pyrender.py:537–582  ·  view source on GitHub ↗
(self, position, strength=(1, 1, 1), direction=None, size=60, type=1, shadow=True)

Source from the content-addressed store, hash-verified

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
576 self.r, self.g, self.b = strength
577 self.type = type
578 self.hidden = False
579 self.shadow = shadow
580 self.x_in_cam = None
581 self.y_in_cam = None
582 self.z_in_cam = None
583
584
585 def __str__(self):

Callers

nothing calls this directly

Calls 1

normalize_v3dFunction · 0.85

Tested by

no test coverage detected