diff --git a/src/jlmap3d/config/SetScene.js b/src/jlmap3d/config/SetScene.js index d7aa434a0..d31d28832 100644 --- a/src/jlmap3d/config/SetScene.js +++ b/src/jlmap3d/config/SetScene.js @@ -1,16 +1,17 @@ export function SetScene() { var scene = new THREE.Scene(); - var cubeTextureLoader = new THREE.CubeTextureLoader(); - - cubeTextureLoader.setPath( '../../static/skybox/star/' ); - - var cubeTexture = cubeTextureLoader.load( [ - 'px.png', 'nx.png', - 'py.png', 'ny.png', - 'pz.png', 'nz.png', - ] ); - - scene.background = cubeTexture; - cubeTexture.dispose(); + // var cubeTextureLoader = new THREE.CubeTextureLoader(); + // + // cubeTextureLoader.setPath( '../../static/skybox/star/' ); + // + // var cubeTexture = cubeTextureLoader.load( [ + // 'px.png', 'nx.png', + // 'py.png', 'ny.png', + // 'pz.png', 'nz.png', + // ] ); + // + var bgTexture = new THREE.TextureLoader().load("../../static/background/background.jpg"); + scene.background = bgTexture; + // cubeTexture.dispose(); return scene; } diff --git a/src/jlmap3d/edit/Jlmap3ddata.js b/src/jlmap3d/edit/Jlmap3ddata.js index 47df13194..2a0a849b0 100644 --- a/src/jlmap3d/edit/Jlmap3ddata.js +++ b/src/jlmap3d/edit/Jlmap3ddata.js @@ -146,7 +146,7 @@ export function Jlmap3ddata(mapid,scope){ assetloader.assetpromise(scene) .then(function(data){ //console.log(data); - return jlmap3ddata.linklist.loadpromise(loaderdata.link,scene,assetloader); + return jlmap3ddata.linklist.loadpromise(loaderdata.link,mapdata.linkList,scene,assetloader); }) .then(function(data){ //console.log(data); diff --git a/src/jlmap3d/edit/action/signalaction.js b/src/jlmap3d/edit/action/signalaction.js index 87a598985..1cd3a44ae 100644 --- a/src/jlmap3d/edit/action/signalaction.js +++ b/src/jlmap3d/edit/action/signalaction.js @@ -50,7 +50,8 @@ export function Signalaction(){ for(let i=0;istandsdata[n].position.z){ @@ -712,7 +712,7 @@ export function SectionList() { autosuidao = assetloader.modellist[i].mesh.children[0]; } } - console.log(suidaodata); + // console.log(suidaodata); let rightlist = []; let leftlist = []; let rightpoint = 0; diff --git a/src/jlmap3d/edit/editmodel/SignalList.js b/src/jlmap3d/edit/editmodel/SignalList.js index fdce9486f..06e6d98d6 100644 --- a/src/jlmap3d/edit/editmodel/SignalList.js +++ b/src/jlmap3d/edit/editmodel/SignalList.js @@ -140,27 +140,30 @@ export function SignalList() { }); }; this.resetsignal = function(jlmap3ddata){ - console.log(jlmap3ddata.linksgroup); - console.log(scope); - let linkdata = jlmap3ddata.linksgroup; + // console.log(jlmap3ddata.linksgroup); + // console.log(jlmap3ddata); + let linkdata = jlmap3ddata.linkdata; for(let i=0;i link.lengthfact/2){ - posx = link.position.x + signaldata.offset - link.lengthfact/2-10; - }else{ - posx = link.position.x - (link.lengthfact/2 - signaldata.offset)+10; - } - //根据线路方向修改信号灯位置 - if(signaldata.directionType == "01"){ - signaldata.position.set(posx,0,link.position.z-3); - signaldata.rotation.z = ( Math.PI / 2 ); - }else if(signaldata.directionType == "02"){ - signaldata.position.set(posx,0,link.position.z+3); - signaldata.rotation.z = ( - Math.PI / 2 ); + //根据线路方向修改信号灯位置 + // console.log(posx); + if(signaldata.directionType == "01"){ + signaldata.position.set(posx,0,linkdata[j].position.z-2.4); + signaldata.rotation.z = ( Math.PI / 2 ); + // signaldata.scale.set(1,1,1); + }else if(signaldata.directionType == "02"){ + signaldata.position.set(posx,0,linkdata[j].position.z+2.4); + signaldata.rotation.z = ( - Math.PI / 2 ); + // signaldata.scale.set(1,1,1); + } + j = lenj; + } } + } }; this.init = function(data,realsectionlist,scene,assetloader){ diff --git a/src/jlmap3d/edit/jlmap3dedit.js b/src/jlmap3d/edit/jlmap3dedit.js index 9676d17f8..e02b26d61 100644 --- a/src/jlmap3d/edit/jlmap3dedit.js +++ b/src/jlmap3d/edit/jlmap3dedit.js @@ -187,13 +187,19 @@ export function JLmap3dEdit(dom, data, mapid) { scope.eventon(); } + if(changedata == "signalreplace"){ + scope.editmode = "signaledit"; + scope.eventon(); + } // if(scope.editmode == "trackedit"){ // scope.selectmodel = scope.action.sectionaction.changemodel(scope,changedata); // } if(scope.actionmode == "signaledit"){ - scope.selectmodel = scope.action.signalaction.changemodel(scope,changedata); + // scope.editmode == "signaledit"; + // scope.eventon(); + // scope.selectmodel = scope.action.signalaction.changemodel(scope,changedata); } @@ -279,7 +285,8 @@ export function JLmap3dEdit(dom, data, mapid) { } if(scope.editmode == "signaledit"){ - scope.selectmodel = scope.action.signalaction.raycaster(scope); + console.log("==========signal========="); + scope.selectmodel = scope.action.signalaction.raycaster(scope,"signal"); } if(scope.editmode == "stationedit"){ diff --git a/src/jlmap3d/jl3ddrive/jl3ddrive.js b/src/jlmap3d/jl3ddrive/jl3ddrive.js index 535fa4b9d..029eb7850 100644 --- a/src/jlmap3d/jl3ddrive/jl3ddrive.js +++ b/src/jlmap3d/jl3ddrive/jl3ddrive.js @@ -92,6 +92,15 @@ export function JLmapDriving(dom,data,mapId,storemod,translation) { this.drivecount = 0; this.drivedata = null; + var sectionlist = null; + var linklist = null; + var signallist = null; + var stationstandlist = null; + var trainlisttest = null; + var realsectionlist = null; + var rails = null; + + this.webwork=new Worker('../../static/workertest/trainworker.js'); // 地图模型数据 let mapdata = new Jl3ddata(); @@ -152,34 +161,34 @@ export function JLmapDriving(dom,data,mapId,storemod,translation) { this.Subscribe.socketon(scope.Subscribe.topic); var timer = setInterval(function() { - if(mapdata.trainlisttest){ - if(mapdata.trainlisttest.group){ - if(mapdata.trainlisttest.group.children[0]){ - updatemmi.updatedrivingcode(mapdata.trainlisttest.group.children[0].name); - scope.Subscribe.initdrivercode(mapdata.trainlisttest.group.children[0].name); - for(let k in mapdata.rails.switchrail){ + if(trainlisttest){ + if(trainlisttest.group){ + if(trainlisttest.group.children[0]){ + // updatemmi.updatedrivingcode(trainlisttest.group.children[0].name); + scope.Subscribe.initdrivercode(trainlisttest.group.children[0].name); + for(let k in rails.switchrail){ const ddd = storemod.getters['map/getDeviceByCode'](k); - let switchdata = mapdata.rails.switchrail[k]; - mapdata.rails.switchrail[k].locateType = ddd.locateType; + let switchdata = rails.switchrail[k]; + rails.switchrail[k].locateType = ddd.locateType; if(ddd.locateType == "01"){ //1--向左 2--向右 //__\__ __/__ - if(mapdata.rails.switchrail[k].directtype == "1"){ - mapdata.rails.linkrail[switchdata.alink].lconnect = switchdata.blink; - mapdata.rails.linkrail[switchdata.blink].rconnect = switchdata.alink; - }else if(mapdata.rails.switchrail[k].directtype == "2"){ - mapdata.rails.linkrail[switchdata.alink].rconnect = switchdata.blink; - mapdata.rails.linkrail[switchdata.blink].lconnect = switchdata.alink; + if(rails.switchrail[k].directtype == "1"){ + rails.linkrail[switchdata.alink].lconnect = switchdata.blink; + rails.linkrail[switchdata.blink].rconnect = switchdata.alink; + }else if(rails.switchrail[k].directtype == "2"){ + rails.linkrail[switchdata.alink].rconnect = switchdata.blink; + rails.linkrail[switchdata.blink].lconnect = switchdata.alink; } }else if(ddd.locateType == "02"){ - if(mapdata.rails.switchrail[k].directtype == "1"){ - mapdata.rails.linkrail[switchdata.alink].lconnect = switchdata.clink; - mapdata.rails.linkrail[switchdata.clink].rconnect = switchdata.alink; - }else if(mapdata.rails.switchrail[k].directtype == "2"){ - mapdata.rails.linkrail[switchdata.alink].rconnect = switchdata.clink; - mapdata.rails.linkrail[switchdata.clink].lconnect = switchdata.alink; + if(rails.switchrail[k].directtype == "1"){ + rails.linkrail[switchdata.alink].lconnect = switchdata.clink; + rails.linkrail[switchdata.clink].rconnect = switchdata.alink; + }else if(rails.switchrail[k].directtype == "2"){ + rails.linkrail[switchdata.alink].rconnect = switchdata.clink; + rails.linkrail[switchdata.clink].lconnect = switchdata.alink; } } } @@ -191,7 +200,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation) { }, 2000); // 初始化加载数据和模型 getPublish3dMapDetail(mapId).then(netdata => { - ModelLoad(data, scope, netdata.data, mapdata, camera, controls3, scene,mixers,storemod); + ModelLoad(data, scope, netdata.data, sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails, camera, controls3, scene,mixers,storemod); }); // let stats = new Stats(); // dom.appendChild( stats.dom ); @@ -217,7 +226,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation) { renderercctv.render(scene,cameracctv); } //相机按键位移 - controls3.update(); + // controls3.update(); delta = clock.getDelta(); for (let i=mixers.length-1; i>=0; i--) { mixers[i].update( delta ); @@ -229,9 +238,9 @@ export function JLmapDriving(dom,data,mapId,storemod,translation) { function updatcontrols() { if (drivingcode) { - controls3.getObject().position.x = mapdata.trainlisttest.list[drivingcode].matrixWorld.elements[12]-27; + controls3.getObject().position.x = trainlisttest.list[drivingcode].matrixWorld.elements[12]-27; controls3.getObject().position.y=5; - controls3.getObject().position.z = mapdata.trainlisttest.list[drivingcode].children[0].matrixWorld.elements[14]; + controls3.getObject().position.z = trainlisttest.list[drivingcode].children[0].matrixWorld.elements[14]; // console.log(controls3); @@ -244,7 +253,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation) { scope.webwork.onmessage = function (event) { // 更新列车位置 - UpdateTrain(camera, mapdata.trainlisttest); + UpdateTrain(camera, trainlisttest); }; } @@ -274,8 +283,9 @@ export function JLmapDriving(dom,data,mapId,storemod,translation) { }; updatemmi.updatedrivingcode = function(code) { + console.log(trainlisttest); drivingcode = code; - mapdata.trainlisttest.list[drivingcode].children[0].add(controls3.getObject()); + trainlisttest.list[drivingcode].children[0].add(controls3.getObject()); controls3.getObject().position.x = 10; controls3.getObject().position.y = 0; controls3.getObject().position.z = 1.5; @@ -316,24 +326,24 @@ export function JLmapDriving(dom,data,mapId,storemod,translation) { this.showstationmsg = function(showtype) { if (showtype == 'show') { - for (let st=0; st=0; i--) { // 遍历列车对象组 + // console.log(trainlisttest); if (trainlisttest) { code = data.body[i].code; @@ -351,7 +350,7 @@ export function Jl3dDriving(updatemmi,sound,translation) { let vexlist = []; let endrotation = null; trainlisttest.list[code].pc = 1; - + console.log(data.body[i]); if (data.body[i].directionType == '02') { // 向右 let point = rails.linkrail[data.body[i].linkCode].lineleft.getPointAt(data.body[i].linkOffsetPercent); trainlisttest.list[code].rotation.y = 0; @@ -362,9 +361,10 @@ export function Jl3dDriving(updatemmi,sound,translation) { } if(data.body[i].targetStation){ trainlisttest.list[code].stopstation = data.body[i].targetStation; + console.log(rails.stops[data.body[i].targetStation].direct2.percent); trainlisttest.list[code].pc = data.body[i].targetLinkPercent/rails.stops[data.body[i].targetStation].direct2.percent; trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct2.percent; - trainlisttest.list[code].progress = data.body[i].linkOffsetPercent/trainlisttest.list[code].pc; + trainlisttest.list[code].progress = data.body[i].linkOffsetPercent*trainlisttest.list[code].pc; trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent; trainlisttest.list[code].targetLink = data.body[i].targetLink; }else{ @@ -387,11 +387,16 @@ export function Jl3dDriving(updatemmi,sound,translation) { // console.log("0000000000000000"); // console.log(data.body[i].linkOffsetPercent); // } + console.log(data.body[i].targetLinkPercent); if(data.body[i].targetStation){ + trainlisttest.list[code].stopstation = data.body[i].targetStation; - trainlisttest.list[code].pc = data.body[i].targetLinkPercent/rails.stops[data.body[i].targetStation].direct1.percent; + trainlisttest.list[code].pc = parseFloat(data.body[i].targetLinkPercent)/parseFloat(rails.stops[data.body[i].targetStation].direct1.percent); + console.log(data.body[i].targetLinkPercent); + console.log(rails.stops[data.body[i].targetStation].direct1.percent); + console.log(trainlisttest.list[code].pc); trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct1.percent; - trainlisttest.list[code].progress = (1-data.body[i].linkOffsetPercent)/trainlisttest.list[code].pc; + trainlisttest.list[code].progress = (1-data.body[i].linkOffsetPercent)*trainlisttest.list[code].pc; trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent; trainlisttest.list[code].targetLink = data.body[i].targetLink; }else{ @@ -651,7 +656,7 @@ export function Jl3dDriving(updatemmi,sound,translation) { } } - if (data.body[i]._type == 'StationStand') { + if (data.body[i]._type == 'StationStand' ) { if (actions) { standupdate(data.body[i]); } @@ -705,72 +710,72 @@ export function Jl3dDriving(updatemmi,sound,translation) { // 77 // 关闭 if (data.status == '01') { - signallist.list[code].mesh.children[0].material.map = materials[3]; + signallist.list[code].mesh.children[0].material.map = materials[0]; signallist.list[code].mesh.children[0].material.map.needsUpdate = true; - signallist.list[code].mesh.children[1].material.map = materials[0]; - signallist.list[code].mesh.children[1].material.map.needsUpdate = true; signallist.list[code].mesh.children[2].material.map = materials[3]; signallist.list[code].mesh.children[2].material.map.needsUpdate = true; + signallist.list[code].mesh.children[3].material.map = materials[3]; + signallist.list[code].mesh.children[3].material.map.needsUpdate = true; } // 开放 if (data.status == '02') { if (data.switchLocateType == '01') { - signallist.list[code].mesh.children[0].material.map = materials[2]; + signallist.list[code].mesh.children[0].material.map = materials[3]; signallist.list[code].mesh.children[0].material.map.needsUpdate = true; - signallist.list[code].mesh.children[1].material.map = materials[3]; - signallist.list[code].mesh.children[1].material.map.needsUpdate = true; signallist.list[code].mesh.children[2].material.map = materials[3]; signallist.list[code].mesh.children[2].material.map.needsUpdate = true; + signallist.list[code].mesh.children[3].material.map = materials[2]; + signallist.list[code].mesh.children[3].material.map.needsUpdate = true; } if (data.switchLocateType == '02') { signallist.list[code].mesh.children[0].material.map = materials[3]; signallist.list[code].mesh.children[0].material.map.needsUpdate = true; - signallist.list[code].mesh.children[1].material.map = materials[3]; - signallist.list[code].mesh.children[1].material.map.needsUpdate = true; signallist.list[code].mesh.children[2].material.map = materials[1]; signallist.list[code].mesh.children[2].material.map.needsUpdate = true; + signallist.list[code].mesh.children[3].material.map = materials[3]; + signallist.list[code].mesh.children[3].material.map.needsUpdate = true; } } // 引导 if (data.status == '03') { - signallist.list[code].mesh.children[0].material.map = materials[3]; + signallist.list[code].mesh.children[0].material.map = materials[0]; signallist.list[code].mesh.children[0].material.map.needsUpdate = true; - signallist.list[code].mesh.children[1].material.map = materials[0]; - signallist.list[code].mesh.children[1].material.map.needsUpdate = true; signallist.list[code].mesh.children[2].material.map = materials[1]; signallist.list[code].mesh.children[2].material.map.needsUpdate = true; + signallist.list[code].mesh.children[3].material.map = materials[3]; + signallist.list[code].mesh.children[3].material.map.needsUpdate = true; } // 封锁 if (data.status == '04') { signallist.list[code].mesh.children[0].material.map = materials[3]; signallist.list[code].mesh.children[0].material.map.needsUpdate = true; - signallist.list[code].mesh.children[1].material.map = materials[3]; - signallist.list[code].mesh.children[1].material.map.needsUpdate = true; signallist.list[code].mesh.children[2].material.map = materials[3]; signallist.list[code].mesh.children[2].material.map.needsUpdate = true; + signallist.list[code].mesh.children[3].material.map = materials[3]; + signallist.list[code].mesh.children[3].material.map.needsUpdate = true; } // 故障 if (data.status == '05') { signallist.list[code].mesh.children[0].material.map = materials[3]; signallist.list[code].mesh.children[0].material.map.needsUpdate = true; - signallist.list[code].mesh.children[1].material.map = materials[3]; - signallist.list[code].mesh.children[1].material.map.needsUpdate = true; signallist.list[code].mesh.children[2].material.map = materials[3]; signallist.list[code].mesh.children[2].material.map.needsUpdate = true; + signallist.list[code].mesh.children[3].material.map = materials[3]; + signallist.list[code].mesh.children[3].material.map.needsUpdate = true; } } - } else if (data.lightType == '01') { + } else if (data.lightType == '02') { if (signallist.list[code].mesh.code) { signallist.list[code].mesh.children[0].material.map = materials[3]; signallist.list[code].mesh.children[0].material.map.needsUpdate = true; diff --git a/src/jlmap3d/jl3ddrive/moveupdate/UpdateTrain.js b/src/jlmap3d/jl3ddrive/moveupdate/UpdateTrain.js index 2f0f52b79..2e3ff02a1 100644 --- a/src/jlmap3d/jl3ddrive/moveupdate/UpdateTrain.js +++ b/src/jlmap3d/jl3ddrive/moveupdate/UpdateTrain.js @@ -13,8 +13,8 @@ export function UpdateTrain(camera,traindata,control){ let movecurve = trainmodel.curve; - if(trainmodel.status == "03"){ - if(movecurve.points.length>1){ + if(trainmodel.status == "03" && movecurve.points.length>1){ + let point = movecurve.getPointAt(traindata.group.children[0].progress); trainmodel.position.x = point.x; trainmodel.position.y = 0; @@ -71,11 +71,10 @@ export function UpdateTrain(camera,traindata,control){ } } trainmodel.progress += trainmodel.speeds; - } + } - if(trainmodel.status == "02"){ - if(movecurve.points.length>1){ + if(trainmodel.status == "02" && mmovecurve.points.length>1){ let point = movecurve.getPointAt(trainmodel.progress); trainmodel.position.x = point.x; trainmodel.position.y = 0; @@ -137,25 +136,20 @@ export function UpdateTrain(camera,traindata,control){ } trainmodel.progress += trainmodel.speeds; } - } + }else{ if(trainmodel.nextcurve){ // if(trainmodel.status == '02'){ // }else if(trainmodel.status == '03'){ // } - trainmodel.progress = 0; trainmodel.len = trainmodel.nextlen; trainmodel.nowcode = trainmodel.nextcode; trainmodel.speeds = parseFloat(trainmodel.speed*10/36/25/trainmodel.len); trainmodel.curve = trainmodel.nextcurve; - trainmodel.nextcurve = null; trainmodel.nextlen = null; trainmodel.nextcode = null; - - - } // console.log(trainmodel.name); @@ -176,8 +170,7 @@ export function UpdateTrain(camera,traindata,control){ let movecurve = trainmodel.curve; - if(trainmodel.status == "03" && trainmodel.progress>0){ - if(movecurve.points.length>1){ + if(trainmodel.status == "03" && trainmodel.progress>0 && movecurve.points.length>1){ let point = movecurve.getPointAt(traindata.group.children[0].progress); if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.005){ trainmodel.children[0].up = new THREE.Vector3(-1,0,0); @@ -235,10 +228,8 @@ export function UpdateTrain(camera,traindata,control){ } } - } - if(trainmodel.status == "02"){ - if(movecurve.points.length>1 && trainmodel.progress>0){ + if(trainmodel.status == "02" && movecurve.points.length>1 && trainmodel.progress>0){ let point = movecurve.getPointAt(trainmodel.progress); if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.005){ @@ -302,7 +293,7 @@ export function UpdateTrain(camera,traindata,control){ trainmodel.progress += trainmodel.speeds; } } - } + } } diff --git a/src/jlmap3d/jl3dsimulation/connect/TrainingConnect.js b/src/jlmap3d/jl3dsimulation/connect/TrainingConnect.js index 77fce6e4c..142c11639 100644 --- a/src/jlmap3d/jl3dsimulation/connect/TrainingConnect.js +++ b/src/jlmap3d/jl3dsimulation/connect/TrainingConnect.js @@ -442,19 +442,20 @@ export function Jlmap3dSubscribe(jlmap3d) { // 0xCD0000 红 // 0xEEEE00 黄 // 0x32CD32 绿 - if (data.body[i]._type == 'Signal') { + if (data.body[i]._type == 'Signal' && signallist) { if (signallist) { + console.log(data.body[i]); signalupdate(data.body[i]); } } - if (data.body[i]._type == 'StationStand') { + if (data.body[i]._type == 'StationStand' && actions) { if (actions) { standupdate(data.body[i]); } } - if (data.body[i]._type == 'Switch') { + if (data.body[i]._type == 'Switch' && sectionlist) { if (sectionlist) { switchupdate(data.body[i]); } @@ -494,6 +495,7 @@ export function Jlmap3dSubscribe(jlmap3d) { function signalupdate(data) { code = data.code; + if (data.lightType == '01') { if (signallist.list[code].mesh.code) { signallist.list[code].mesh.status = data.status; @@ -503,66 +505,66 @@ export function Jlmap3dSubscribe(jlmap3d) { // 77 // 关闭 if (data.status == '01') { - signallist.list[code].mesh.children[0].material.map = materials[3]; + signallist.list[code].mesh.children[0].material.map = materials[0]; signallist.list[code].mesh.children[0].material.map.needsUpdate = true; - signallist.list[code].mesh.children[1].material.map = materials[0]; - signallist.list[code].mesh.children[1].material.map.needsUpdate = true; signallist.list[code].mesh.children[2].material.map = materials[3]; signallist.list[code].mesh.children[2].material.map.needsUpdate = true; + signallist.list[code].mesh.children[3].material.map = materials[3]; + signallist.list[code].mesh.children[3].material.map.needsUpdate = true; } // 开放 if (data.status == '02') { if (data.switchLocateType == '01') { - signallist.list[code].mesh.children[0].material.map = materials[2]; + signallist.list[code].mesh.children[0].material.map = materials[3]; signallist.list[code].mesh.children[0].material.map.needsUpdate = true; - signallist.list[code].mesh.children[1].material.map = materials[3]; - signallist.list[code].mesh.children[1].material.map.needsUpdate = true; signallist.list[code].mesh.children[2].material.map = materials[3]; signallist.list[code].mesh.children[2].material.map.needsUpdate = true; + signallist.list[code].mesh.children[3].material.map = materials[2]; + signallist.list[code].mesh.children[3].material.map.needsUpdate = true; } if (data.switchLocateType == '02') { signallist.list[code].mesh.children[0].material.map = materials[3]; signallist.list[code].mesh.children[0].material.map.needsUpdate = true; - signallist.list[code].mesh.children[1].material.map = materials[3]; - signallist.list[code].mesh.children[1].material.map.needsUpdate = true; signallist.list[code].mesh.children[2].material.map = materials[1]; signallist.list[code].mesh.children[2].material.map.needsUpdate = true; + signallist.list[code].mesh.children[3].material.map = materials[3]; + signallist.list[code].mesh.children[3].material.map.needsUpdate = true; } } // 引导 if (data.status == '03') { - signallist.list[code].mesh.children[0].material.map = materials[3]; + signallist.list[code].mesh.children[0].material.map = materials[0]; signallist.list[code].mesh.children[0].material.map.needsUpdate = true; - signallist.list[code].mesh.children[1].material.map = materials[0]; - signallist.list[code].mesh.children[1].material.map.needsUpdate = true; signallist.list[code].mesh.children[2].material.map = materials[1]; signallist.list[code].mesh.children[2].material.map.needsUpdate = true; + signallist.list[code].mesh.children[3].material.map = materials[3]; + signallist.list[code].mesh.children[3].material.map.needsUpdate = true; } // 封锁 if (data.status == '04') { signallist.list[code].mesh.children[0].material.map = materials[3]; signallist.list[code].mesh.children[0].material.map.needsUpdate = true; - signallist.list[code].mesh.children[1].material.map = materials[3]; - signallist.list[code].mesh.children[1].material.map.needsUpdate = true; signallist.list[code].mesh.children[2].material.map = materials[3]; signallist.list[code].mesh.children[2].material.map.needsUpdate = true; + signallist.list[code].mesh.children[3].material.map = materials[3]; + signallist.list[code].mesh.children[3].material.map.needsUpdate = true; } // 故障 if (data.status == '05') { signallist.list[code].mesh.children[0].material.map = materials[3]; signallist.list[code].mesh.children[0].material.map.needsUpdate = true; - signallist.list[code].mesh.children[1].material.map = materials[3]; - signallist.list[code].mesh.children[1].material.map.needsUpdate = true; signallist.list[code].mesh.children[2].material.map = materials[3]; signallist.list[code].mesh.children[2].material.map.needsUpdate = true; + signallist.list[code].mesh.children[3].material.map = materials[3]; + signallist.list[code].mesh.children[3].material.map.needsUpdate = true; } @@ -572,10 +574,10 @@ export function Jlmap3dSubscribe(jlmap3d) { if (signallist.list[code].mesh.code) { signallist.list[code].mesh.children[0].material.map = materials[3]; signallist.list[code].mesh.children[0].material.map.needsUpdate = true; - signallist.list[code].mesh.children[1].material.map = materials[3]; - signallist.list[code].mesh.children[1].material.map.needsUpdate = true; signallist.list[code].mesh.children[2].material.map = materials[3]; signallist.list[code].mesh.children[2].material.map.needsUpdate = true; + signallist.list[code].mesh.children[3].material.map = materials[3]; + signallist.list[code].mesh.children[3].material.map.needsUpdate = true; } diff --git a/src/jlmap3d/jl3dsimulation/jlmap3d.js b/src/jlmap3d/jl3dsimulation/jlmap3d.js index dc3d834a7..166b4f617 100644 --- a/src/jlmap3d/jl3dsimulation/jlmap3d.js +++ b/src/jlmap3d/jl3dsimulation/jlmap3d.js @@ -53,6 +53,7 @@ export function JLmap3d(dom, data,skinCode,storemod) { let camera = SetCamera(dom); //定义场景(渲染容器) let scene = SetScene(); + //定义镜头操作 let controls = new THREE.OrbitControls(camera); controls.maxPolarAngle = Math.PI/2; diff --git a/src/jlmap3d/main/loaders/AssetLoader.js b/src/jlmap3d/main/loaders/AssetLoader.js index 7911ece4d..4b066d2c9 100644 --- a/src/jlmap3d/main/loaders/AssetLoader.js +++ b/src/jlmap3d/main/loaders/AssetLoader.js @@ -65,7 +65,7 @@ let defaultsuidao = { deviceType:"suidao", type:"suidao", picUrl:"", - assetUrl:modelurl+"/models/suidao/suidao.FBX" + assetUrl:"../../static/model/suidao/suidao.FBX" } //modelurl+"/models/suidao/suidao.FBX" //https://test.joylink.club/oss/models/suidao/suidao.FBX diff --git a/src/jlmap3d/main/loaders/simulationloader.js b/src/jlmap3d/main/loaders/simulationloader.js index 645034f11..e92ebdf5f 100644 --- a/src/jlmap3d/main/loaders/simulationloader.js +++ b/src/jlmap3d/main/loaders/simulationloader.js @@ -12,13 +12,14 @@ import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js'; import { Loading } from 'element-ui'; // import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js'; -export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixerss,storemod){ +export function ModelLoad(data,scope,netdata,sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails,camera,controls,scene,mixerss,storemod){ //console.log(mapdata); Materialload(scope); //console.log(data); //console.log(scope); let sceneload = scene; - let jlmap3ddata = mapdata; + // let jlmap3ddata = mapdata; + let backdata = scope; let assetloader = scope.assetloader; let animateswitch = scope.animateswitch; @@ -50,39 +51,41 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixer // console.log(data); //初始化轨道和道岔 暂时 lengthfact(data); - jlmap3ddata.linklist = new LinkList(); - jlmap3ddata.sectionlist = new SectionList(); - jlmap3ddata.signallist = new SignalList(); - //初始化站台 - jlmap3ddata.stationstandlist = new StationStandList(); - //初始化测试列车 - jlmap3ddata.trainlisttest = new TrainList(); - jlmap3ddata.realsectionlist = new RealSectionList(); - jlmap3ddata.rails = new RailList(); + linklist = new LinkList(); + sectionlist = new SectionList(); + signallist = new SignalList(); + //初始化站台 + stationstandlist = new StationStandList(); + //初始化测试列车 + trainlisttest = new TrainList(); + realsectionlist = new RealSectionList(); + + rails = new RailList(); + let loaderdata = JSON.parse(netdata.sections); let switchdata = JSON.parse(netdata.switchs); let signaldata = JSON.parse(netdata.signals); let standsdata = JSON.parse(netdata.stands); + assetloader.setmodellist(netdata.assets); assetloader.assetpromise(sceneload) .then(function(data){ - //console.log(data); - return jlmap3ddata.linklist.loadpromise(loaderdata.link,scene,assetloader); + return linklist.loadpromise(loaderdata.link,sceneload,assetloader); }) .then(function(data){ //console.log(data); - return jlmap3ddata.stationstandlist.initpromise(mapdata.stationList,mapdata.stationStandList,sceneload,assetloader,netdata.stands,mixers,actions,"0"); + return stationstandlist.initpromise(mapdata.stationList,mapdata.stationStandList,sceneload,assetloader,netdata.stands,mixers,actions,"0"); }) .then(function(data){ //console.log(data); //console.log(assetloader); - return jlmap3ddata.trainlisttest.initpromise(mapdata.trainList,sceneload,assetloader,mixers,actions,"0"); + return trainlisttest.initpromise(mapdata.trainList,sceneload,assetloader,mixers,actions,"0"); }) .then(function(data){ //console.log(data); - return jlmap3ddata.sectionlist.loadpromise(jlmap3ddata,assetloader,loaderdata.section,switchdata,sceneload); + return sectionlist.loadpromise(linklist,assetloader,loaderdata.section,switchdata,sceneload); }) // .then(function(data){ // //console.log(data); @@ -90,11 +93,12 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixer // }) .then(function(data){ //console.log(data); - return jlmap3ddata.signallist.initpromise(mapdata.signalList,sceneload,assetloader,netdata.signals); + return signallist.initpromise(mapdata.signalList,sceneload,assetloader,netdata.signals); }) .then(function(data){ return new Promise(function(resolve, reject){ - jlmap3ddata.rails.init(loaderdata.link,mapdata.linkList,mapdata.sectionList,switchdata,jlmap3ddata.stationstandlist.list,sceneload,storemod); + rails.init(loaderdata.link,mapdata.linkList,mapdata.sectionList,switchdata, + stationstandlist.list,sceneload,storemod); resolve("loadrail"); }); @@ -113,9 +117,9 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixer scope.animateswitch = true; - mapdata = jlmap3ddata; - - scope.Subscribe.updatamap(mapdata,scope.materiallist,scope.actions,scope.sceneload); + // mapdata = jlmap3ddata; + backdata.loaderdata(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails); + scope.Subscribe.updatamap(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails,scope.materiallist,scope.actions,scope.sceneload); scope.webwork.postMessage("on"); loadingInstance.close(); }); diff --git a/src/jlmap3d/main/model/LinkList.js b/src/jlmap3d/main/model/LinkList.js index 094c78b95..1a0d4d5bc 100644 --- a/src/jlmap3d/main/model/LinkList.js +++ b/src/jlmap3d/main/model/LinkList.js @@ -21,6 +21,7 @@ export function LinkList(data){ }; this.loadpromise = function(linkdata,scene,assetloader){ + // console.log(linkdata); return new Promise(function(resolve, reject){ scene.add(scope.linksgroup); loadlink(linkdata,scene,assetloader); diff --git a/src/jlmap3d/main/model/SectionList.js b/src/jlmap3d/main/model/SectionList.js index 12114d0a8..8009771de 100644 --- a/src/jlmap3d/main/model/SectionList.js +++ b/src/jlmap3d/main/model/SectionList.js @@ -104,11 +104,11 @@ export function SectionList() { }); }; - this.loadpromise = function(jlmap3ddata,assetloader,sectiondata,switchdata,scene){ + this.loadpromise = function(linklist,assetloader,sectiondata,switchdata,scene){ return new Promise(function(resolve, reject){ // scene.add(sectiongroup); scene.add(switchgroup); - let linkdata = jlmap3ddata.linklist; + let linkdata = linklist; for(let i=0;i - 信号灯模型设置 + 信号灯模型设置 - 信号灯模型调整 + 信号灯模型调整 diff --git a/static/background/background.jpeg b/static/background/background.jpeg new file mode 100644 index 000000000..d6810d176 Binary files /dev/null and b/static/background/background.jpeg differ diff --git a/static/background/background.jpg b/static/background/background.jpg new file mode 100644 index 000000000..daf921f60 Binary files /dev/null and b/static/background/background.jpg differ diff --git a/static/model/suidao/suidao.FBX b/static/model/suidao/suidao.FBX index 0d7b3d55a..ee589e0a9 100644 Binary files a/static/model/suidao/suidao.FBX and b/static/model/suidao/suidao.FBX differ diff --git a/static/model/suidao/suidao2.FBX b/static/model/suidao/suidao2.FBX new file mode 100644 index 000000000..0d7b3d55a Binary files /dev/null and b/static/model/suidao/suidao2.FBX differ