If you need to change the material a simple or composite shape is made of, then you need the dress operation.
You only need to specify the original shape and the new material definition:
Most of the times, the scene optimizer can coalesce the new material into the original object definition.
In this scene, we define a macro for grouping three basic shapes with different colors. The macro is the used to create two instances, and a third instance is created and wrapped with a new material:
objects set met(c) = metal(c, 0.03, 0.00, 0.7, 0.3, 5); set little_guy(x, z) = union( cylinder(x, -1.5, z, 1.5, 1, met(royalblue)), cone(x, 1.3, z, 1.5, 1, met(red)), sphere(x, 0.8, z,0.8, met(seashell))); dress( little_guy(0, 0), marble(white, silver, 8)); little_guy(-3, 5.0); little_guy(+3, 2.2); end.
Home | Small Instantiation Language overview | Scenes | Predefined shapes | Transforms | CSG operations | Solid shapes | Surfaces