-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
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
MaterialLoader:createMaterial() for extended Material class #22552
Conversation
How about adding this to const material = Material.fromType( type ); |
This look a bit more complicated to extended using only Material.prototype._fromType = Material.prototype.fromType;
Material.prototype.fromType = ( type ) => {
if ( NodeMaterialLib[ type ] !== undefined ) {
return new NodeMaterialLib[ type ]();
}
return Material.prototype._fromType( type );
} |
@mrdoob I can do like this, if you to prefer: const materialLoader = new MaterialLoader();
// material lib
materialLoader.library = Materials;
materialLoader.parse( json ); |
Current PR: const materialLoader = new NodeMaterialLoader();
materialLoader.parse( json ); |
That doesn't look too bad. How about creating a |
This reverts commit 3f59b22.
The problem is that the three.js/src/loaders/MaterialLoader.js Line 70 in 64f9b32
|
I am developing a version using |
Seems that is not possible |
I will try to mature this then. If we use a |
I am thinking about close this PR because extending the current |
@mrdoob I still have some issue with this, exist some possibilities here that I noticed:
|
Description
The function
MaterialLoader.createMaterial( type )
can be useful to create loader for extended Materials, likeNodeMaterials
.Example:
This contribution is funded by Google via Igalia.