Created
January 18, 2021 02:01
-
-
Save RenaudRohlinger/ada3c98c5df635ef70b97bd8f4a39660 to your computer and use it in GitHub Desktop.
Threejs - Reference the material in the program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getMUIDIndex = (muid: string) => muid === 'muid' | |
el.material.defines = Object.assign(el.material.defines || {}, { | |
muid: el.material.id | |
}) | |
gl.info.programs?.forEach(program => { | |
const cacheKeySplited = program.cacheKey.split(',') | |
console.log(cacheKeySplited[cacheKeySplited.findIndex(getMUIDIndex) + 1]) // will get the material id in the program | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment