babylon-runtime / babylon-runtime.github.io

Source code for _r documentation
https://babylon-runtime.github.io
Apache License 2.0
0 stars 2 forks source link

low priority: explain how to send a texture as js variable into a _r.patch #15

Open Vinc3r opened 4 years ago

Vinc3r commented 4 years ago

just use function(){return texture}:

_r.load.texture("lightmap.jpg", {
    coordinatesIndex: 1
}).then(function (texture) {
    _r.patch([{
        "*name*:material": {
            "lightmapTexture": function(){return texture},
            "useLightmapAsShadowmap": true
        }
    }]);
});
Vinc3r commented 4 years ago

could be described as "multiple way to load & assign a texture", here another example:

_r.patch([{
    "*name*:material": {
        "lightmapTexture": function () {
            return _r.load.texture("lightmap.jpg", {
                coordinatesIndex: 1
            });
        },
        "useLightmapAsShadowmap": true
    }
}]);