You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update Material type definitions: Add MaterialJSON format
Introduces the MaterialJSON format in Three.js, which extends the Material interface. The new format includes serializable properties such as color, roughness, metallic, map, normalMap, and many more. This change enables better JSON parsing and handling of material configurations for Three.js applications.
Confirmed: Types and interfaces have been updated in Object3D.d.ts and Material.d.ts. The Material class has also been updated to include toJSON methods that return MaterialJSON or MaterialJSONRoot objects based on the provided meta data.
Reference(s):
three-types#1071three-types#1070three-types#426
* Materials describe the appearance of objects. They are defined in a (mostly) renderer-independent way, so you don't have to rewrite materials if you decide to use a different renderer.
@@ -418,7 +592,8 @@ export class Material extends EventDispatcher<{ dispose: {} }> {
418
592
* Convert the material to three.js JSON format.
419
593
* @param meta Object containing metadata such as textures or images for the material.
420
594
*/
421
-
toJSON(meta?: any): any;
595
+
toJSON(): MaterialJSON;
596
+
toJSON(meta: JSONMeta): MaterialJSONRoot;
422
597
423
598
/**
424
599
* Return a new material with the same parameters as this material.
0 commit comments