From 978aa05175a89b195b7af5c5641a2b93511932df Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@63.com> Date: 星期六, 25 十二月 2021 10:34:49 +0800 Subject: [PATCH] # --- static/js/object/StoreConvey.js | 56 +++++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 49 insertions(+), 7 deletions(-) diff --git a/static/js/object/StoreConvey.js b/static/js/object/StoreConvey.js index 4674b0c..908cd44 100644 --- a/static/js/object/StoreConvey.js +++ b/static/js/object/StoreConvey.js @@ -43,15 +43,57 @@ }); } }); - for (let k=0;k<chainList.length;k++) { - let clone = obj.clone(); - clone.position.x = 0 + chainList[k].position.x; - clone.position.y = 0 + chainList[k].position.y; - clone.position.z = 0 + chainList[k].position.z; - that.object.addObject( clone ); - } + chainList.map(item => { + that.object.addObject(customize(obj.clone(), item)); + }) + }); + new THREE.ObjectLoader().load( "../static/model/json/杈婄瓛杈撻�佹満.json", function (obj) { + obj.traverse (function (child) { + if (child instanceof THREE.Mesh) { + child.scale.set(1, 1, 1.8); + child.material = new THREE.MeshLambertMaterial({ + color: 0xAAAAAA + }); + } + }); + rollerList.map(item => { + that.object.addObject(customize(obj.clone(), item)); + }) + }); + new THREE.ObjectLoader().load( "../static/model/json/椤跺崌绉绘牻.json", function (obj) { + obj.traverse (function (child) { + if (child instanceof THREE.Mesh) { + child.scale.set(1, 1, 1.8); + child.material = new THREE.MeshLambertMaterial({ + color: 0xAAAAAA + }); + } + }); + transportList.map(item => { + that.object.addObject(customize(obj.clone(), item)); + }) }); } + + function customize(clone, info) { + clone.position.x = 0 + info.position.x; + clone.position.y = 0 + info.position.y; + clone.position.z = 0 + info.position.z; + clone.rotateY(info.rotateY); + if (info.traverse !== undefined) { + let traverse = info.traverse; + clone.traverse (function (child) { + if (child instanceof THREE.Mesh) { + child.scale.set(traverse.scale.x, traverse.scale.y, traverse.scale.z); + child.material = new THREE.MeshLambertMaterial({ + color: traverse.color + }); + } + }); + } + return clone; + } + } export {StoreConvey} -- Gitblit v1.9.1