我想用es导入“ furniture.js”文件中的“ render3D.js”导出默认功能。我导入了函数“ render3D”,但出现错误,例如render3D不起作用。
我必须在render3D函数中传递参数。我该怎么办?
render3D.js
import GLTFLoader from 'three-gltf-loader';
import * as Three from 'three';
import {ObjectLoader} from "three";
let cachedModelJson = null;
export default function(modelPath) {
const loader = new GLTFLoader();
let lod = new Three.LOD();
loader.load(modelPath, function (gltf) {
let meshArr = [];
let matArr = [];
var mergedGeo = new Three.Geometry();
return Promise.resolve(lod);
}
furniture.js
import path from 'path';
import React from 'react';
import render2D from './render-utils/render2D.js';
import render3D from './render-utils/render3D.js';
const data = {
Zuo100703: {
name: "chair",
prototype: "items",
info: {
title: "California Corner Chair",
tag: ['furnishing', 'chair', 'zuomod', 'cotton linen'],
description: "California Corner Chair",
image: require("./items/zuomod/chair-100703/chair.jpg"),
rsModel: "scenes/sofa.mi"
},
properties: {
altitude: {
label: "Altitude",
type: "length-measure",
defaultValue: {
length: 0
}
}
},
render2D: render2D,
render3D: render3D(require("./items/zuomod/chair-100703/100703.gltf"))
}
}
export default data;