三维编辑器加载模型修改

This commit is contained in:
sunleking 2020-03-02 08:52:58 +08:00
parent ee33dec8a1
commit 7b7345123b
6 changed files with 66 additions and 24 deletions

View File

@ -124,7 +124,7 @@ export function Jlmap3ddata(mapid,scope){
assetloader.assetpromise(scene) assetloader.assetpromise(scene)
.then(function(data){ .then(function(data){
return jlmap3ddata.stationstandlist.loadpromise(jlmap3ddata,standsdata,scene,assetloader); return jlmap3ddata.stationstandlist.loadpromise(jlmap3ddata,standsdata,mapdata.stationStandList,scene,assetloader);
}) })
.then(function(data){ .then(function(data){
//console.log(data); //console.log(data);

View File

@ -313,10 +313,15 @@ export function SectionList() {
} }
let stations = jlmap3ddata.stationstandlist.list; let stations = jlmap3ddata.stationstandlist.list;
let num; let num;
let num2;
for(let j=0;j<assetloader.modellist.length;j++){ for(let j=0;j<assetloader.modellist.length;j++){
if(assetloader.modellist[j].deviceType == "stand"){ if(assetloader.modellist[j].deviceType == "stand"){
num = j; num = j;
} }
if(assetloader.modellist[j].deviceType == "standwaice"){
num2 = j;
assetloader.modellist[num2].mesh.rotation.x = 0;
}
} }
for(let j=0,lenj=stations.length;j<lenj;j++){ for(let j=0,lenj=stations.length;j<lenj;j++){
@ -324,8 +329,13 @@ export function SectionList() {
// console.log(scope.sections.datalist[stations[j].direction1.section]); // console.log(scope.sections.datalist[stations[j].direction1.section]);
let x = scope.sections.datalist[stations[j].direction1.section].mesh.position.x; let x = scope.sections.datalist[stations[j].direction1.section].mesh.position.x;
let z = (scope.sections.datalist[stations[j].direction1.section].mesh.position.z+scope.sections.datalist[stations[j].direction2.section].mesh.position.z)/2; let z = (scope.sections.datalist[stations[j].direction1.section].mesh.position.z+scope.sections.datalist[stations[j].direction2.section].mesh.position.z)/2;
let mesh;
if(stations[j].direction1.inside == true){
mesh = assetloader.modellist[num].mesh.clone(true);
}else{
mesh = assetloader.modellist[num2].mesh.clone(true);
}
var mesh = assetloader.modellist[num].mesh.clone(true);
jlmap3ddata.stationstandlist.list[j].modelid = assetloader.modellist[num].modelid; jlmap3ddata.stationstandlist.list[j].modelid = assetloader.modellist[num].modelid;
jlmap3ddata.stationstandlist.list[j].mesh = mesh; jlmap3ddata.stationstandlist.list[j].mesh = mesh;
// console.log(x); // console.log(x);

View File

@ -52,6 +52,7 @@ export function StationStandList() {
newstationstand.direction1.name = stationstanddata[j].name; newstationstand.direction1.name = stationstanddata[j].name;
newstationstand.direction1.screenDoorOpenStatus = "01"; newstationstand.direction1.screenDoorOpenStatus = "01";
newstationstand.direction1.section = stationstanddata[j].standTrackCode; newstationstand.direction1.section = stationstanddata[j].standTrackCode;
newstationstand.direction1.inside = stationstanddata[j].inside;
// console.log(stationstanddata[j].standTrackCode); // console.log(stationstanddata[j].standTrackCode);
} }
//向左下行 //向左下行
@ -61,6 +62,7 @@ export function StationStandList() {
newstationstand.direction2.name = stationstanddata[j].name; newstationstand.direction2.name = stationstanddata[j].name;
newstationstand.direction2.screenDoorOpenStatus = "01"; newstationstand.direction2.screenDoorOpenStatus = "01";
newstationstand.direction2.section = stationstanddata[j].standTrackCode; newstationstand.direction2.section = stationstanddata[j].standTrackCode;
newstationstand.direction2.inside = stationstanddata[j].inside;
// console.log(stationstanddata[j].standTrackCode); // console.log(stationstanddata[j].standTrackCode);
} }
} }
@ -162,20 +164,35 @@ export function StationStandList() {
resolve("loadedstation"); resolve("loadedstation");
}); });
} }
this.loadpromise = function(jlmap3ddata,standsdata,scene,assetloader){ this.loadpromise = function(jlmap3ddata,standsdata,jlmapstanddata,scene,assetloader){
return new Promise(function(resolve, reject){ return new Promise(function(resolve, reject){
console.log(standsdata);
let stations = jlmap3ddata.stationstandlist.list; let stations = jlmap3ddata.stationstandlist.list;
let num; let num;
let num2;
for(let j=0;j<assetloader.modellist.length;j++){ for(let j=0;j<assetloader.modellist.length;j++){
if(assetloader.modellist[j].deviceType == "stand"){ if(assetloader.modellist[j].deviceType == "stand"){
num = j; num = j;
} }
if(assetloader.modellist[j].deviceType == "standwaice"){
num2 = j;
// assetloader.modellist[num2].mesh.rotation.y = Math.PI/2;
} }
}
console.log("+++++++++++++");
console.log(jlmapstanddata);
console.log(standsdata);
for(let i=0;i<standsdata.length;i++){ for(let i=0;i<standsdata.length;i++){
let newstationstand = new StationStandModel(standsdata[i]); let newstationstand = new StationStandModel(standsdata[i]);
let newstationmesh;
for(let j=0;j<jlmapstanddata.length;j++){
if(jlmapstanddata[j].code == standsdata[i].direction1.code){
if(jlmapstanddata[j].inside == true){
newstationmesh = assetloader.modellist[num].mesh.clone(true);
}else{
newstationmesh = assetloader.modellist[num2].mesh.clone(true);
}
console.log(jlmapstanddata[j]);
newstationstand.code = standsdata[i].code; newstationstand.code = standsdata[i].code;
newstationstand.name = standsdata[i].name; newstationstand.name = standsdata[i].name;
newstationstand.direction1.code = standsdata[i].direction1.code; newstationstand.direction1.code = standsdata[i].direction1.code;
@ -183,16 +200,20 @@ export function StationStandList() {
newstationstand.direction2.code = standsdata[i].direction2.code; newstationstand.direction2.code = standsdata[i].direction2.code;
newstationstand.direction2.name = standsdata[i].direction2.name; newstationstand.direction2.name = standsdata[i].direction2.name;
let newstationmesh = assetloader.modellist[num].mesh.clone(true); console.log(standsdata[i]);
newstationmesh.position.x = standsdata[i].position.x; newstationmesh.position.x = standsdata[i].position.x;
newstationmesh.position.y = standsdata[i].position.y; newstationmesh.position.y = standsdata[i].position.y;
newstationmesh.position.z = standsdata[i].position.z; newstationmesh.position.z = standsdata[i].position.z;
newstationmesh.rotation.x = standsdata[i].rotation._x; // newstationmesh.rotation.x = standsdata[i].rotation._x;
newstationmesh.rotation.y = standsdata[i].rotation._y; // newstationmesh.rotation.y = standsdata[i].rotation._y;
newstationmesh.rotation.z = standsdata[i].rotation._z; // newstationmesh.rotation.z = standsdata[i].rotation._z;
newstationstand.mesh = newstationmesh; newstationstand.mesh = newstationmesh;
scope.group.add(newstationmesh); scope.group.add(newstationmesh);
scope.list.push(newstationstand); scope.list.push(newstationstand);
j = jlmapstanddata.length;
}
}
} }
scene.add(scope.group); scene.add(scope.group);
resolve("loadedstation"); resolve("loadedstation");

View File

@ -32,13 +32,20 @@ let defaulttrain = {
let defaultstation = { let defaultstation = {
id:"8", id:"8",
name:"福州车站", name:"内侧车站",
deviceType:"stand", deviceType:"stand",
type:"num4", type:"num4",
picUrl:"", picUrl:"",
assetUrl:"../../static/model/station/fuzhou.FBX" assetUrl:"../../static/model/station/fuzhou.FBX"
}//modelurl+"/models/station/fuzhou/fuzhou.FBX" }//modelurl+"/models/station/fuzhou/fuzhou.FBX"
let waicestation = {
id:"10",
name:"外侧车站",
deviceType:"standwaice",
type:"num4",
picUrl:"",
assetUrl:"../../static/model/station/waicestation.FBX"
}
let defaulttopstation = { let defaulttopstation = {
id:"104", id:"104",
name:"福州车站1", name:"福州车站1",
@ -163,6 +170,8 @@ export function AssetLoader(){
let station = new AssetModel(defaultstation); let station = new AssetModel(defaultstation);
scope.modellist.push(station); scope.modellist.push(station);
let wstation = new AssetModel(waicestation);
scope.modellist.push(wstation);
// let topstation = new AssetModel(defaulttopstation); // let topstation = new AssetModel(defaulttopstation);
// scope.modellist.push(topstation); // scope.modellist.push(topstation);
@ -237,6 +246,8 @@ export function AssetLoader(){
let station = new AssetModel(defaultstation); let station = new AssetModel(defaultstation);
scope.modellist.push(station); scope.modellist.push(station);
let wstation = new AssetModel(waicestation);
scope.modellist.push(wstation);
// let topstation = new AssetModel(defaulttopstation); // let topstation = new AssetModel(defaulttopstation);
// scope.modellist.push(topstation); // scope.modellist.push(topstation);

View File

@ -3,7 +3,7 @@ export function getBaseUrl() {
let BASE_API; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud'; BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪 // BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛 // BASE_API = 'http://192.168.3.41:9000'; // 张赛

Binary file not shown.