Babylon.js-PathTracing-Renderer icon indicating copy to clipboard operation
Babylon.js-PathTracing-Renderer copied to clipboard

Extract shaderstore into separate file

Open jelster opened this issue 3 years ago • 1 comments

Moved the shader declarations into their own file, loaded into the context via a script tag in the HTML document. Because this isn't a context where ES6 modules or require are present, this seemed to be the simplest way to get it to work.

This will allow the shaders to be loaded by themselves into the PG using the appropriate URL, as a side-note

jelster avatar May 08 '21 20:05 jelster

The correct URL to reference this (e.g., the PR) version of the shaderstore in PG - https://raw.githubusercontent.com/erichlof/Babylon.js-PathTracing-Renderer/258c640319d07147b98486d5cc985855bfa3b044/js/shaderstore-import.js

Reference in the PG like this:

const url = "https://raw.githubusercontent.com/erichlof/Babylon.js-PathTracing-Renderer/258c640319d07147b98486d5cc985855bfa3b044/js/shaderstore-import.js";
var s = document.createElement("script");
s.src = url;
document.head.appendChild(s);

Then, make sure scene creation logic dependent upon it runs after the script loads, use

s.onload = function() { // scene init logic here }

jelster avatar May 08 '21 20:05 jelster