MCPcopy Create free account
hub / github.com/BerkeleyAutomation/meshrender / DirectionalLight

Class DirectionalLight

meshrender/light.py:51–80  ·  view source on GitHub ↗

A far-away light with a given direction.

Source from the content-addressed store, hash-verified

49
50
51class DirectionalLight(Light):
52 """A far-away light with a given direction.
53 """
54
55 def __init__(self, direction, color, strength):
56 """Initialize a directional light with the given direction, color, and strength.
57
58 Parameters
59 ----------
60 direction : (3,) float
61 A unit vector indicating the direction of the light.
62 color : (3,) float
63 The RGB color of the light in (0,1).
64 strength : float
65 The strength of the light.
66 """
67 self._direction = direction
68 if np.linalg.norm(direction) > 0:
69 self._direction = direction / np.linalg.norm(direction)
70 super(DirectionalLight, self).__init__(color, strength)
71
72 @property
73 def direction(self):
74 """(3,) float: A unit vector indicating the direction of the light.
75 """
76 return self._direction
77
78 @direction.setter
79 def direction(self, d):
80 self._direction = d
81
82class PointLight(Light):
83 """A nearby point light source that shines in all directions.

Callers 3

test_viewer.pyFile · 0.90
_renderMethod · 0.85
_get_raymond_lightsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected