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)
| 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. |