Skip to content

Commit

Permalink
support shader materials
Browse files Browse the repository at this point in the history
  • Loading branch information
memelotsqui committed Oct 29, 2023
1 parent f96ebd1 commit 1d8f3e1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/library/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ export async function setTextureToChildMeshes(scene, textureFile){

// Load the image as a texture
const texture = await textureLoader.load(textureFile);
console.log(texture)
texture.flipY = false;
texture.needsUpdate = true;

// Traverse through the child meshes in the scene
scene.traverse((object) => {
Expand All @@ -47,8 +45,11 @@ export async function setTextureToChildMeshes(scene, textureFile){
// Assign the texture to the material
for (let i = 0; i < materials.length; i++) {
if (materials[i] instanceof THREE.ShaderMaterial) {
materials[i].uniforms.map = texture
materials[i].uniforms.shadeMultiplyTexture = texture;
if(!materials[i].name.includes("(Outline)")){
console.log(materials[i].name);
materials[i].uniforms.map.value = texture
materials[i].uniforms.shadeMultiplyTexture.value = texture;
}
}
else{
materials[i].map = texture
Expand Down

0 comments on commit 1d8f3e1

Please sign in to comment.