Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importer doesn't carry material name over Three.js Material #492

Open
EnsarErayAkkaya opened this issue Aug 20, 2024 · 0 comments
Open

Importer doesn't carry material name over Three.js Material #492

EnsarErayAkkaya opened this issue Aug 20, 2024 · 0 comments
Labels

Comments

@EnsarErayAkkaya
Copy link

Hello, I was testing the engine importer in my personal project, and I noticed that while importing models, it doesn't carry over material names to the converted Three.js objects. I needed to show material names in UI so I made following small changes. I think this small improvement can be useful for others as well.

// /engine/threejs/threeconverter.js

CreateThreeFaceMaterial (materialIndex)
{
        //...

      let materialParams = {
	      name : material.name, // add this line to carry material name over three.js object
	      color : baseColor,
	      vertexColors : material.vertexColors,
	      opacity : material.opacity,
	      transparent : material.transparent,
	      alphaTest : material.alphaTest,
	      side : THREE.DoubleSide
        };

        //...
}
// /engine/threejs/threeconverter.js

CreateThreeLineMaterial (materialIndex)
{
      //...
    let materialParams = {
	    name : material.name, // add this line to carry material name over three.js object
	    color : baseColor,
	    opacity : material.opacity
    };
    
    //...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant