Skip to content

Instantly share code, notes, and snippets.

@RenaudRohlinger
Created January 18, 2021 02:01
Show Gist options
  • Save RenaudRohlinger/ada3c98c5df635ef70b97bd8f4a39660 to your computer and use it in GitHub Desktop.
Save RenaudRohlinger/ada3c98c5df635ef70b97bd8f4a39660 to your computer and use it in GitHub Desktop.
Threejs - Reference the material in the program
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