|
@@ -6107,7 +6107,8 @@ class Object3D extends EventDispatcher {
|
|
|
images: {},
|
|
|
shapes: {},
|
|
|
skeletons: {},
|
|
|
- animations: {}
|
|
|
+ animations: {},
|
|
|
+ nodes: {}
|
|
|
};
|
|
|
output.metadata = {
|
|
|
version: 4.5,
|
|
@@ -6228,6 +6229,7 @@ class Object3D extends EventDispatcher {
|
|
|
const shapes = extractFromCache(meta.shapes);
|
|
|
const skeletons = extractFromCache(meta.skeletons);
|
|
|
const animations = extractFromCache(meta.animations);
|
|
|
+ const nodes = extractFromCache(meta.nodes);
|
|
|
if (geometries.length > 0) output.geometries = geometries;
|
|
|
if (materials.length > 0) output.materials = materials;
|
|
|
if (textures.length > 0) output.textures = textures;
|
|
@@ -6235,6 +6237,7 @@ class Object3D extends EventDispatcher {
|
|
|
if (shapes.length > 0) output.shapes = shapes;
|
|
|
if (skeletons.length > 0) output.skeletons = skeletons;
|
|
|
if (animations.length > 0) output.animations = animations;
|
|
|
+ if (nodes.length > 0) output.nodes = nodes;
|
|
|
}
|
|
|
|
|
|
output.object = object;
|
|
@@ -6664,9 +6667,9 @@ class Material extends EventDispatcher {
|
|
|
}
|
|
|
|
|
|
toJSON(meta) {
|
|
|
- const isRoot = meta === undefined || typeof meta === 'string';
|
|
|
+ const isRootObject = meta === undefined || typeof meta === 'string';
|
|
|
|
|
|
- if (isRoot) {
|
|
|
+ if (isRootObject) {
|
|
|
meta = {
|
|
|
textures: {},
|
|
|
images: {}
|
|
@@ -6823,7 +6826,7 @@ class Material extends EventDispatcher {
|
|
|
return values;
|
|
|
}
|
|
|
|
|
|
- if (isRoot) {
|
|
|
+ if (isRootObject) {
|
|
|
const textures = extractFromCache(meta.textures);
|
|
|
const images = extractFromCache(meta.images);
|
|
|
if (textures.length > 0) data.textures = textures;
|
|
@@ -6907,6 +6910,13 @@ class Material extends EventDispatcher {
|
|
|
|
|
|
Material.prototype.isMaterial = true;
|
|
|
|
|
|
+Material.fromType = function
|
|
|
+ /*type*/
|
|
|
+() {
|
|
|
+ // TODO: Behavior added in Materials.js
|
|
|
+ return null;
|
|
|
+};
|
|
|
+
|
|
|
/**
|
|
|
* parameters = {
|
|
|
* color: <hex>,
|
|
@@ -27128,27 +27138,30 @@ class LineDashedMaterial extends LineBasicMaterial {
|
|
|
|
|
|
LineDashedMaterial.prototype.isLineDashedMaterial = true;
|
|
|
|
|
|
-var Materials = /*#__PURE__*/Object.freeze({
|
|
|
- __proto__: null,
|
|
|
- ShadowMaterial: ShadowMaterial,
|
|
|
- SpriteMaterial: SpriteMaterial,
|
|
|
- RawShaderMaterial: RawShaderMaterial,
|
|
|
- ShaderMaterial: ShaderMaterial,
|
|
|
- PointsMaterial: PointsMaterial,
|
|
|
- MeshPhysicalMaterial: MeshPhysicalMaterial,
|
|
|
- MeshStandardMaterial: MeshStandardMaterial,
|
|
|
- MeshPhongMaterial: MeshPhongMaterial,
|
|
|
- MeshToonMaterial: MeshToonMaterial,
|
|
|
- MeshNormalMaterial: MeshNormalMaterial,
|
|
|
- MeshLambertMaterial: MeshLambertMaterial,
|
|
|
- MeshDepthMaterial: MeshDepthMaterial,
|
|
|
- MeshDistanceMaterial: MeshDistanceMaterial,
|
|
|
- MeshBasicMaterial: MeshBasicMaterial,
|
|
|
- MeshMatcapMaterial: MeshMatcapMaterial,
|
|
|
- LineDashedMaterial: LineDashedMaterial,
|
|
|
- LineBasicMaterial: LineBasicMaterial,
|
|
|
- Material: Material
|
|
|
-});
|
|
|
+const materialLib = {
|
|
|
+ ShadowMaterial,
|
|
|
+ SpriteMaterial,
|
|
|
+ RawShaderMaterial,
|
|
|
+ ShaderMaterial,
|
|
|
+ PointsMaterial,
|
|
|
+ MeshPhysicalMaterial,
|
|
|
+ MeshStandardMaterial,
|
|
|
+ MeshPhongMaterial,
|
|
|
+ MeshToonMaterial,
|
|
|
+ MeshNormalMaterial,
|
|
|
+ MeshLambertMaterial,
|
|
|
+ MeshDepthMaterial,
|
|
|
+ MeshDistanceMaterial,
|
|
|
+ MeshBasicMaterial,
|
|
|
+ MeshMatcapMaterial,
|
|
|
+ LineDashedMaterial,
|
|
|
+ LineBasicMaterial,
|
|
|
+ Material
|
|
|
+};
|
|
|
+
|
|
|
+Material.fromType = function (type) {
|
|
|
+ return new materialLib[type]();
|
|
|
+};
|
|
|
|
|
|
const AnimationUtils = {
|
|
|
// same as Array.prototype.slice, but also works on typed arrays
|
|
@@ -29739,7 +29752,7 @@ class MaterialLoader extends Loader {
|
|
|
return textures[name];
|
|
|
}
|
|
|
|
|
|
- const material = new Materials[json.type]();
|
|
|
+ const material = Material.fromType(json.type);
|
|
|
if (json.uuid !== undefined) material.uuid = json.uuid;
|
|
|
if (json.name !== undefined) material.name = json.name;
|
|
|
if (json.color !== undefined && material.color !== undefined) material.color.setHex(json.color);
|