source files: [xc]mtl.[ch]
(SEND <mtl> :SET-TO-PRODUCT (list <mtl1> <mtl2> ... ))
This call is used to implement hierarchical displaylist structures in which the color of a leaf is a function of all class-material objects on the path from the displaylist root to the leaf: It is given the ordered list <mtl1> ... of objects on the rootpath, and sets <mtl> appropriately.
In general, each <mtl#> may be set to override those <mtl3> above it on some, all or none of the various material properties, by setting the various :*-WEIGHT properties. A weight of 1.0 means to override the inherited value, a weight of 0.0 means to adopt the inherited value unchanged, intermediate values lead to weighted averages.
For example, when done (assuming only <mtl1> and <mtl2>),
mtl.alpha == mtl1.alpha * (1.0-mtl2.alpha_weight) + + mtl2.alpha * ( mtl2.alpha_weight)
Which is to say, <mtl> will use the :alpha from <mtl2> if :alpha-weight in <mtl2> is 1.0, :alpha from <mtl1> if :alpha-weight in <mtl2> is 0.0, else a weighted average.
Other fields are computed similarly.
With more than two input <mtl#>, the 'product' proceeds pairwise, left to right.
This call is typically used in the :per-frame-hook field for a material in a thinglist:
;; mtl1 mtl2 mtl3 are presumed pre-existing: (setq my-material (:new class-material)) (:set my-material :per-frame-hook (lambda nil (:set-to-product my-material (list mtl1 mtl2 mtl3))) ) (setq my-thing (xg.3d-make-thing-of-triangles :want-vertex-normals t :material my-material ) )
The product list may contain any number of materials, including zero.
Return value is <mtl>.