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

Method add_light

meshrender/scene.py:129–145  ·  view source on GitHub ↗

Adds a named light to the scene. Parameters ---------- name : str An identifier for the light. light : PointLight or DirectionalLight The light source to add.

(self, name, light)

Source from the content-addressed store, hash-verified

127 self.close_renderer()
128
129 def add_light(self, name, light):
130 """Adds a named light to the scene.
131
132 Parameters
133 ----------
134 name : str
135 An identifier for the light.
136 light : PointLight or DirectionalLight
137 The light source to add.
138 """
139 if isinstance(light, AmbientLight):
140 raise ValueError('Set ambient light with set_ambient_light(), not with add_light()')
141 if len(self._lights) == MAX_N_LIGHTS:
142 raise ValueError('The maximum number of lights in a scene is capped at {}'.format(MAX_N_LIGHTS))
143 if not isinstance(light, PointLight) and not isinstance(light, DirectionalLight):
144 raise ValueError('Scene only supports PointLight and DirectionalLight types')
145 self._lights[name] = light
146
147 def remove_light(self, name):
148 """Removes a light from the scene.

Callers 1

test_viewer.pyFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected