Warning: Undefined array key "translationlc" in /usr/www/users/fabook/_diggets/doc/v2/lib/plugins/translation/action.php on line 237
Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/fabook/_diggets/doc/v2/lib/plugins/translation/action.php:237) in /usr/www/users/fabook/_diggets/doc/v2/inc/Action/Export.php on line 104
Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/fabook/_diggets/doc/v2/lib/plugins/translation/action.php:237) in /usr/www/users/fabook/_diggets/doc/v2/inc/Action/Export.php on line 104
Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/fabook/_diggets/doc/v2/lib/plugins/translation/action.php:237) in /usr/www/users/fabook/_diggets/doc/v2/inc/Action/Export.php on line 104
====== Layered Material (TGorillaLayeredMaterialSource) ======
The **TGorillaLayeredMaterialSource** is a container of multiple sub materials.
It works like a stack, where one material is rendered above another.
The following schema visualizes this idea:
{{ ::doc-g3d-layeredmat.png?nolink&600 |}}
**It is important that those sub materials do not clear the context, otherwise it will produce unexpected behaviour!**
If the materials collection is empty, Gorilla3D will render the complete buffer with black color.
To setup sub-materials, simply add those to the material collection:
var LLayMat : TGorillaLayeredMaterialSource;
LSubMat1 : TGorillaNormalMapMaterialSource;
LSubMat2 : TGorillaPhongMaterialSource;
LSubMatEntry : TGorillaLayeredMaterialItem;
[...]
// create the layered material source
LLayMat := TGorillaLayeredMaterialSource.Create(FGorilla);
LLayMat.Parent := FGorilla;
// create sub-material #1
LSubMat1 := TGorillaNormalMapMaterialSource.Create(FGorilla);
LSubMat1.Parent := FGorilla;
// add sub-material #1
LSubMatEntry := LLayMat.Materials.Add();
LSubMatEntry.Material := LSubMat1;
// create sub-material #2
LSubMat2 := TGorillaPhongMaterialSource.Create(FGorilla);
LSubMat2.Parent := FGorilla;
// add sub-material #2
LSubMatEntry := LLayMat.Materials.Add();
LSubMatEntry.Material := LSubMat2;