You can make a light come from an object by positioning the object and the light in the same place and then defining the object to be the source of the light. Also you must set one of the objects flags. Flags are explained in section 16. The flag FLAGS_NOSHADOW enables the light to come out from the object. Figure 10 shows a room lit with the lightbulb object lightsource in the code below.
//Ambient light LINK(the_scene, PLUS, new_ambient_light(0.4, 0.4, 0.4)); // Add a lightsource point light object the_light = new_point_light(0.6, 0.6, 0.6); vector light_position = {1.5, 0, 2}; LINK(the_scene, PLUS, shift(light_position, the_light)); object bulb = scale(0.2,new_sphere()); LINK(bulb, PLUS, shift(0, 0, 0.15, stretch(0.1, 0.1, 0.2, new_unitcyl()))); bulb = bind(bulb); bulb->lightsource(the_light); bulb->material = yellow; bulb->flags |= FLAGS_NOSHADOW; LINK(the_scene, PLUS, shift(light_position, bind(bulb))); object screw = shift(0, 0, 0.3, stretch(0.11, 0.11, 0.2, new_unitcyl())); screw->material = gold; LINK(the_scene, PLUS, shift(light_position, bind(screw)));
Figure 10: Lightbulb: A Lightsource Object