download
raw
604 Bytes
import { ShaderChunk } from 'three'
/**
* Recursively expands all `#include <xyz>` statements within string of shader code.
* Copied from three's WebGLProgram#parseIncludes for external use.
*
* @param {string} source - The GLSL source code to evaluate
* @return {string} The GLSL code with all includes expanded
*/
export function expandShaderIncludes( source ) {
const pattern = /^[ \t]*#include +<([\w\d./]+)>/gm
function replace(match, include) {
let chunk = ShaderChunk[include]
return chunk ? expandShaderIncludes(chunk) : match
}
return source.replace( pattern, replace )
}

Xet Storage Details

Size:
604 Bytes
·
Xet hash:
063d56e63f3946377ae82c853865b4b03cf4cfc45b24a53648f8a36fb2884796

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.