增加徐州三维课程案例

This commit is contained in:
sunzhenyu 2021-11-19 15:05:16 +08:00
parent ad26f46ca9
commit 343d71fdab
18 changed files with 1642 additions and 3 deletions

View File

@ -0,0 +1,529 @@
//转辙机动画
export function Moveanimate(main){
let scope = this;
//内容信息显示plane
this.helpbox = null;
this.textplane = null;
//动画列表
this.animatelist = [];
this.playlist = null;
this.playorder = 0;
//动画播放器开关
this.enable = true;
//动画开关状态
this.status = true;
//当前动画模型
this.nowmodelname = undefined;
//定义屏蔽门零件动画
this.initDoorAnima = function(animaModel){
scope.animatelist[animaModel.animacode+"chaijie"] = [];
scope.animatelist[animaModel.animacode+"fuwei"] = [];
for(let i=0,leni=animaModel.children.length;i<leni;i++){
if(animaModel.children[i].name == "SJZZ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+10));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"dizuoon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+10));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"dizuooff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "HLGJZ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+8));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"Lxingon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+8));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"Lxingoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "HLGJY"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+8));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"jiaoxingxiantieon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+8));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"jiaoxingxiantieoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "PDJ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+6));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"zhongchuipianon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.xx,animaModel.children[i].position.y+4,animaModel.children[i].position.z+6));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"zhongchuipianoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "PDJ1"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+6));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"laganon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+6));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"laganoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "HLZZZ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+4));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"dongjiedianzhouon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+4));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"dongjiedianzhouoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "HLZZY"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+4));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"neibuon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+4));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"neibuoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "CLPD"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z+4));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"jiedianon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z+4));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"jiedianoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "LCB"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+8,animaModel.children[i].position.z+2));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"yapianon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+8,animaModel.children[i].position.z+2));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"yapianoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "DCU"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+8,animaModel.children[i].position.z+2));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"fanghuozhaoon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+8,animaModel.children[i].position.z+2));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"fanghuozhaooff",points2,0.5,true,0);
}
}
// let points = [];
// points.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
// points.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
// scope.initanimate(animaModel.children[i],animaModel.name+"select1",points,true);
let modelorderlist = [];
modelorderlist[animaModel.animacode] = [
{name:"SJZZ",pos:[0,4,10]},
{name:"HLGJZ",pos:[0,4,8]},
{name:"HLGJY",pos:[0,4,8]},
{name:"PDJ",pos:[0,4,6]},
{name:"PDJ1",pos:[0,4,6]},
{name:"HLZZZ",pos:[0,4,4]},
{name:"HLZZY",pos:[0,4,4]},
{name:"CLPD",pos:[0,6,4]},
{name:"LCB",pos:[0,8,2]},
{name:"DCU",pos:[0,8,2]},
];
scope.animatelist[animaModel.animacode+"on"] = [];
scope.animatelist[animaModel.animacode+"off"] = [];
for(let i=0,leni=modelorderlist[animaModel.animacode].length;i<leni;i++){
let orderdata = modelorderlist[animaModel.animacode];
let modelon = animaModel.getObjectByName(orderdata[i].name);
// modelon.helpbox = undefined;
let pointson = [];
pointson.push(new THREE.Vector3(modelon.position.x,modelon.position.y,modelon.position.z));
pointson.push(new THREE.Vector3(modelon.position.x+orderdata[i].pos[0],modelon.position.y+orderdata[i].pos[1],modelon.position.z+orderdata[i].pos[2]));
let pointsoff = [];
pointsoff.push(new THREE.Vector3(modelon.position.x+orderdata[i].pos[0],modelon.position.y+orderdata[i].pos[1],modelon.position.z+orderdata[i].pos[2]));
pointsoff.push(new THREE.Vector3(modelon.position.x,modelon.position.y,modelon.position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"on"],modelon,animaModel.animacode+modelon.name+"on",pointson,0.03,true,i);
scope.initanimate(scope.animatelist[animaModel.animacode+"off"],modelon,animaModel.animacode+modelon.name+"off",pointsoff,0.03,true,leni-i-1);
}
}
//定义转辙机零件动画
this.initSwitchAnima = function(animaModel){
scope.animatelist[animaModel.animacode+"chaijie"] = [];
scope.animatelist[animaModel.animacode+"fuwei"] = [];
for(let i=0,leni=animaModel.children.length;i<leni;i++){
if(animaModel.children[i].name == "DDJ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x-1.5,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"dizuoon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x-1.5,animaModel.children[i].position.y,animaModel.children[i].position.z));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"dizuooff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "DJZ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x-3,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"Lxingon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x-3,animaModel.children[i].position.y,animaModel.children[i].position.z));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"Lxingoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "DINGK"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+9,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"jiaoxingxiantieon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+9,animaModel.children[i].position.z));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"jiaoxingxiantieoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "SZ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x-1.5,animaModel.children[i].position.y,animaModel.children[i].position.z-1));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"zhongchuipianon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.xx-1.5,animaModel.children[i].position.y,animaModel.children[i].position.z-1));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"zhongchuipianoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "JSQ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x-3,animaModel.children[i].position.y+3,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"laganon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x-3,animaModel.children[i].position.y+3,animaModel.children[i].position.z));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"laganoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "YWJCQ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z+3));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"dongjiedianzhouon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z+3));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"dongjiedianzhouoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "ESWCJJ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"neibuon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"neibuoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "AQJD"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z-2));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"jiedianon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z-2));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"jiedianoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "QDP"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z-3));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"yapianon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z-3));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"yapianoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "SDP"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z-4));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"fanghuozhaoon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z-4));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"fanghuozhaooff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "ZDKBQ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+3,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"dianyuanpianon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+3,animaModel.children[i].position.z));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"dianyuanpianoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "ZZ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x+3,animaModel.children[i].position.y+3,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"xinpianon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x+3,animaModel.children[i].position.y+3,animaModel.children[i].position.z));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"xinpianoff",points2,0.5,true,0);
}
if(animaModel.children[i].name =="BSG"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x+1,animaModel.children[i].position.y,animaModel.children[i].position.z-5));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"jueyuanzhouon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x+1,animaModel.children[i].position.y,animaModel.children[i].position.z-5));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"jueyuanzhouoff",points2,0.5,true,0);
}
if(animaModel.children[i].name =="DZG"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x-1,animaModel.children[i].position.y,animaModel.children[i].position.z-5));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"cigangon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x-1,animaModel.children[i].position.y,animaModel.children[i].position.z-5));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"cigangoff",points2,0.5,true,0);
}
if(animaModel.children[i].name =="CTK"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"ccichuihuqion",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"ccichuihuqioff",points2,0.5,true,0);
}
}
// let points = [];
// points.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
// points.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
// scope.initanimate(animaModel.children[i],animaModel.name+"select1",points,true);
let modelorderlist = [];
modelorderlist[animaModel.animacode] = [
{name:"SZ",pos:[-1.5,0,-1]},
{name:"DINGK",pos:[0,9,0]},
{name:"DJZ",pos:[-3,0,0]},
{name:"DDJ",pos:[-1.5,0,0]},
{name:"JSQ",pos:[-3,3,0]},
{name:"ZDKBQ",pos:[0,3,0]},
{name:"ZZ",pos:[3,3,0]},
{name:"ESWCJJ",pos:[0,6,0]},
{name:"CTK",pos:[0,6,0]},
{name:"YWJCQ",pos:[0,6,3]},
{name:"AQJD",pos:[0,6,-2]},
{name:"QDP",pos:[0,6,-3]},
{name:"SDP",pos:[0,6,-4]},
{name:"BSG",pos:[1,0,-5]},
{name:"DZG",pos:[-1,0,-5]}
];
scope.animatelist[animaModel.animacode+"on"] = [];
scope.animatelist[animaModel.animacode+"off"] = [];
for(let i=0,leni=modelorderlist[animaModel.animacode].length;i<leni;i++){
let orderdata = modelorderlist[animaModel.animacode];
let modelon = animaModel.getObjectByName(orderdata[i].name);
// modelon.helpbox = undefined;
let pointson = [];
pointson.push(new THREE.Vector3(modelon.position.x,modelon.position.y,modelon.position.z));
pointson.push(new THREE.Vector3(modelon.position.x+orderdata[i].pos[0],modelon.position.y+orderdata[i].pos[1],modelon.position.z+orderdata[i].pos[2]));
let pointsoff = [];
pointsoff.push(new THREE.Vector3(modelon.position.x+orderdata[i].pos[0],modelon.position.y+orderdata[i].pos[1],modelon.position.z+orderdata[i].pos[2]));
pointsoff.push(new THREE.Vector3(modelon.position.x,modelon.position.y,modelon.position.z));
// if(i == 0){
scope.initanimate(scope.animatelist[animaModel.animacode+"on"],modelon,animaModel.animacode+modelon.name+"on",pointson,0.03,true,i);
scope.initanimate(scope.animatelist[animaModel.animacode+"off"],modelon,animaModel.animacode+modelon.name+"off",pointsoff,0.03,true,leni-i-1);
// }else if((i+1)<leni){
// scope.initanimate(modelon,animaModel.animacode+modelon.name+"on",pointson,0.03,true,animaModel.animacode+orderdata[i+1].name+"on");
// scope.initanimate(modelon,animaModel.animacode+modelon.name+"off",pointsoff,0.03,true,animaModel.animacode+orderdata[i-1].name+"off");
// }else{
// scope.initanimate(modelon,animaModel.animacode+modelon.name+"on",pointson,0.03,true);
// scope.initanimate(modelon,animaModel.animacode+modelon.name+"off",pointsoff,0.03,true,animaModel.animacode+orderdata[i-1].name+"off");
// }
// if(animaModel.children[i].name == "xinpian"){
// }
// if(animaModel.children[i].name =="cigang"){
// }
}
}
//动画对象定义
this.initanimate = function(list,modelobject,name,points,speed,type,nextname){
let curve = new THREE.CatmullRomCurve3(points);
// curve动画轨迹
// progress动画进度
// enable当前动画开关
// speed动画速度
let animate = {
name:name,
curve:curve,
progress:0,
directchange:false,
connectmodel:modelobject,
enable:false,
status:"start",
speed:speed,
next:null
};
// list[nextname] = [];
if(list[nextname] == undefined){
list[nextname] = [];
}
list[nextname].push(animate);
}
//设置动画播放列表
this.setplaylist = function(nowlist,enable){
scope.playlist = nowlist;
scope.enable = enable;
scope.playorder = 0;
for(let i=0;i<scope.playlist[scope.playorder].length;i++){
scope.playlist[scope.playorder][i].status = "start";
}
}
//更新信息plane内容
this.updatehelpbox = function(nowhelpbox,nowtextplane){
scope.textplane = nowtextplane;
scope.helpbox = nowhelpbox;
}
this.startstop = function(){
}
this.next = function(){
}
this.before = function(){
}
//动画播放器
this.animateupdate = function(){
if(scope.enable){
if(scope.playlist){
for(let i=0;i<scope.playlist[scope.playorder].length;i++){
if(scope.playlist[scope.playorder][i].status == "start"){
}
if(scope.playlist[scope.playorder][i].progress>=1){
let point = scope.playlist[scope.playorder][i].curve.getPointAt(1);
//更新模型坐标
scope.playlist[scope.playorder][i].connectmodel.position.x = point.x;
scope.playlist[scope.playorder][i].connectmodel.position.y = point.y;
scope.playlist[scope.playorder][i].connectmodel.position.z = point.z;
scope.playlist[scope.playorder][i].enable = false;
scope.playlist[scope.playorder][i].status = "end";
scope.playlist[scope.playorder][i].progress = 0;
if(i >= scope.playlist[scope.playorder].length-1){
if(scope.playorder >= scope.playlist.length-1 ){
scope.playlist = null;
scope.status = true;
scope.enable = false;
main.animationmsgshowoff();
scope.nowmodelname = undefined;
scope.playorder = null;
break;
}else{
scope.playorder += 1;
}
}
}else{
// console.log(scope.animatelist[k].connectmodel);
if(scope.nowmodelname != scope.playlist[scope.playorder][i].connectmodel.name){
scope.nowmodelname = scope.playlist[scope.playorder][i].connectmodel.name;
main.animationmsgshowon(scope.playlist[scope.playorder][i].connectmodel);
}
//根据动画进度获取动画轨迹上点
scope.status = false;
let point = scope.playlist[scope.playorder][i].curve.getPointAt(scope.playlist[scope.playorder][i].progress);
//更新模型坐标
scope.playlist[scope.playorder][i].connectmodel.position.x = point.x;
scope.playlist[scope.playorder][i].connectmodel.position.y = point.y;
scope.playlist[scope.playorder][i].connectmodel.position.z = point.z;
if(scope.helpbox){
scope.helpbox.update();
}
if(scope.textplane){
scope.textplane.position.x = scope.playlist[scope.playorder][i].connectmodel.matrixWorld.elements[12];
scope.textplane.position.y = scope.playlist[scope.playorder][i].connectmodel.matrixWorld.elements[13]+100;
scope.textplane.position.z = scope.playlist[scope.playorder][i].connectmodel.matrixWorld.elements[14];
}
//判断模型转向
if(scope.playlist[scope.playorder][i].directchange){
let tangent = scope.playlist[scope.playorder][i].curve.getPointAt(scope.playlist[scope.playorder][i].progress+0.001);
// scope.animatelist[k]
tangent = null;
}
//增加动画进度,释放点变量
scope.playlist[scope.playorder][i].progress += scope.playlist[scope.playorder][i].speed;
point = null;
}
}
}
}
}
}

View File

@ -0,0 +1,38 @@
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
//信号机贴图
export function Signallightload(lights) {
settexture(lights, "red", JL3D_LOCAL_STATIC+'/device/signal/1.jpg');
settexture(lights, "yellow", JL3D_LOCAL_STATIC+'/device/signal/2.jpg');
settexture(lights, "green", JL3D_LOCAL_STATIC+'/device/signal/3.jpg');
settexture(lights, "black", JL3D_LOCAL_STATIC+'/device/signal/4.jpg');
}
//加载贴图
function settexture(lights, name, textureurl) {
var loader = new THREE.TextureLoader();
// 加载一个资源
loader.load(
// 资源URL
textureurl,
// onLoad回调
function (texture) {
texture.name = name;
lights[name] = texture;
},
// 目前暂不支持onProgress的回调
undefined,
// onError回调
function (err) {
console.error('An error happened.');
}
);
}

View File

@ -0,0 +1,204 @@
export function Textconfig(){
let scope = this;
this.devicelist = [];
//配置继电器文字信息
this.initdevicetext = function(selectmodel){
if(scope.devicelist.length>0){
scope.devicelist = [];
}
console.log(selectmodel.deviceType);
if(selectmodel.deviceType == "DeviceSwitch"){
initSwitchText(selectmodel);
}
if(selectmodel.deviceType == "DeviceDoor"){
initDoorText(selectmodel);
}
}
function initDoorText(selectmodel){
for(let i=0,leni=selectmodel.children.length;i<leni;i++){
let part= {
name:selectmodel.children[i].name,
text:null,
mesh:selectmodel.children[i],
index:i,
show:true,
msg:null,
};
if(selectmodel.children[i].name == "HLGJZ"){
part.text = "滑轮挂件左";
part.msg = "滑轮挂件左";
selectmodel.children[i].text = "滑轮挂件左";
}
if(selectmodel.children[i].name == "HLGJY"){
part.text = "滑轮挂件右";
part.msg = "滑轮挂件右";
selectmodel.children[i].text = "滑轮挂件右";
}
if(selectmodel.children[i].name == "HLZZZ"){
part.text = "滑轮装置左";
part.msg = "滑轮装置左";
selectmodel.children[i].text = "滑轮装置左";
}
if(selectmodel.children[i].name == "HLZZY"){
part.text = "滑轮装置右";
part.msg = "滑轮装置右";
selectmodel.children[i].text = "滑轮装置右";
}
if(selectmodel.children[i].name == "CLPD"){
part.text = "齿轮皮带";
part.msg = "齿轮皮带";
selectmodel.children[i].text = "齿轮皮带";
}
if(selectmodel.children[i].name == "SJZZ"){
part.text = "锁紧装置";
part.msg = "锁紧装置";
selectmodel.children[i].text = "锁紧装置";
}
if(selectmodel.children[i].name == "DCU"){
part.text = "门控单元";
part.msg = "门控单元";
selectmodel.children[i].text = "门控单元";
}
if(selectmodel.children[i].name == "MJL"){
part.text = "门机梁";
part.msg = "门机梁";
selectmodel.children[i].text = "门机梁";
}
if(selectmodel.children[i].name =="LCB"){
part.text = "就地控制盒";
part.msg = "就地控制盒";
selectmodel.children[i].text = "就地控制盒";
}
if(selectmodel.children[i].name =="PDJ"){
part.text = "皮带夹左";
part.msg = "皮带夹左";
selectmodel.children[i].text = "皮带夹左";
}
if(selectmodel.children[i].name =="PDJ1"){
part.text = "皮带夹右";
part.msg = "皮带夹右";
selectmodel.children[i].text = "皮带夹右";
}
// if(part.text == null){
// console.log(selectmodel.children[i].name);
// }
if(part.text){
scope.devicelist.push(part);
}
}
}
function initSwitchText(selectmodel){
for(let i=0,leni=selectmodel.children.length;i<leni;i++){
let part= {
name:selectmodel.children[i].name,
text:null,
mesh:selectmodel.children[i],
index:i,
show:true,
msg:null,
};
if(selectmodel.children[i].name == "AQJD"){
part.text = "安全接点";
part.msg = "安全接点应接触良好。在插入手摇把或钥匙时,安全接点应可靠断开,非经人工恢复不得接通电路。";
selectmodel.children[i].text = "安全接点";
}
if(selectmodel.children[i].name == "DDJ"){
part.text = "电动机";
part.msg = "电动转辙机的电动机在转辙机转换时起机械传动动作源的作用。";
selectmodel.children[i].text = "电动机";
}
if(selectmodel.children[i].name == "DINGK"){
part.text = "机盖";
part.msg = "用于防护机内零部件。";
selectmodel.children[i].text = "机盖";
}
if(selectmodel.children[i].name == "SZ"){
part.text = "锁";
part.msg = "用于将机盖锁在底壳上,并用专用钥匙才能打开。最早锁是从底壳内紧固,机外无法拆卸,但由于加工质量及其他原因导致无法开盖,故目前已改为从底壳外紧固。";
selectmodel.children[i].text = "锁";
}
if(selectmodel.children[i].name == "YWJCQ"){
part.text = "移位接触器";
part.msg = "移位接触器是一只非复式辙动开关,它有一组常闭接点,在转辙机中位于机壳侧壁齿条块顶杆的上方。它的作用是用它的常闭接点窜联在道岔表示电路中,监督主挤切削的状态是否完好,在道岔被挤时,如果表示杆被推或拉的动慢不足,检查柱未被顶起,而主副挤切销被挤断,动作杆在齿条块内位移,导致顶杆上升,使位移接点断开,切断转辙机表示电路,向行车值班员报警";
selectmodel.children[i].text = "移位接触器";
}
if(selectmodel.children[i].name == "ZDKBQ"){
part.text = "自动开闭器";
part.msg = "1.构成转辙机启动电路后在转换过程中以其机械动作构成两次接点变位监督转辙机转换全过程动作是否按要求完成。2.道岔被挤时,表示杆移动将检查柱顶起,使自动开闭器一排动接点离开静接点,从而切断道岔表示电路。";
selectmodel.children[i].text = "自动开闭器";
}
if(selectmodel.children[i].name == "SDP"){
part.text = "速动片";
part.msg = "速动片的作用是检查主轴解锁、转换和锁闭三个动作过程的完成,并最后使自动开闭器迅速切断电机动作电路,接通表示电路。";
selectmodel.children[i].text = "速动片";
}
if(selectmodel.children[i].name == "JSQ"){
part.text = "减速器";
part.msg = "将电动机输出的高转速、低转距的机械能,转变成低转速、大转距的机械能,防止非正常情况下损坏机件或烧毁电动机。";
selectmodel.children[i].text = "减速器";
}
if(selectmodel.children[i].name == "BSG"){
part.text = "表示杆";
part.msg = "检查道岔尖轨的开通方向,监督道岔的状态,给自动开闭器的准确动作提供充分条件。";
selectmodel.children[i].text = "表示杆";
}
if(selectmodel.children[i].name == "DZG"){
part.text = "动作杆";
part.msg = "齿条块和动作杆是转辙机转换道岔最后的执行部件。它们不仅要有足够的机械强度,还要在每次转换结束将道岔锁住。此外,当发生挤岔事故时,尽可能保证转辙机内部机件不受损坏。";
selectmodel.children[i].text = "动作杆";
}
if(selectmodel.children[i].name == "CTK"){
part.text = "齿条块";
part.msg = "齿条块和动作杆是转辙机转换道岔最后的执行部件。它们不仅要有足够的机械强度,还要在每次转换结束将道岔锁住。此外,当发生挤岔事故时,尽可能保证转辙机内部机件不受损坏。";
selectmodel.children[i].text = "齿条块";
}
if(selectmodel.children[i].name == "ZZ"){
part.text = "主轴";
part.msg = "主轴主要由主轴套、承轴、止挡栓和锁闭齿轮等附件与主轴组成。主轴的作用是推动大齿块以转换道岔并和削尖齿相配合完成对道岔的机械锁闭。";
selectmodel.children[i].text = "主轴";
}
if(selectmodel.children[i].name == "DJZ"){
part.text = "电机罩";
part.msg = "保护电机。";
selectmodel.children[i].text = "电机罩";
}
if(selectmodel.children[i].name == "DK"){
part.text = "底壳";
part.msg = "固定转辙机的各部件,确保相关部件的轴向或径向通信。";
selectmodel.children[i].text = "底壳";
}
if(selectmodel.children[i].name =="QDP"){
part.text = "启动片";
part.msg = "1.起输出轴与主轴间的十字接头作用使主轴随输出轴同时旋转。2.控制自动开闭器动作,在道岔转换前切断原表示电路,并为电机反转电路准备条件。";
selectmodel.children[i].text = "启动片";
}
if(selectmodel.children[i].name =="ESWCJJ"){
part.text = "二十位插接件";
part.msg = "用于机内外电缆连接,方便更换转辙机。";
selectmodel.children[i].text = "二十位插接件";
}
// if(part.text == null){
// console.log(selectmodel.children[i].name);
// }
if(part.text){
scope.devicelist.push(part);
}
}
}
}

View File

@ -0,0 +1,161 @@
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
//loader
import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader';
import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
import { ModelManager } from '@/jlmap3d/otherproject/xzexam/loader.js';
import { Moveanimate } from '@/jlmap3d/otherproject/xzexam/component/moveanimate.js';
var clock = new THREE.Clock();
export function Jl3dXzexam(dom) {
var scope = this;
this.dom = dom;
this.nowcode = null;
this.animateswitch = false;
this.mixers = [];
this.showmodel = null;
//动画状态
this.animastats = false;
//初始化webgl渲染
this.renderer = new THREE.WebGLRenderer({ antialias: true });
this.renderer.setClearColor(new THREE.Color(0x000000));
this.renderer.setSize(dom.offsetWidth, dom.offsetHeight);
this.renderer.shadowMap.enabled = true;
this.renderer.shadowMap.type = THREE.PCFSoftShadowMap;
this.dom.appendChild(this.renderer.domElement);
//定义相机
this.camera = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 2000);
this.camera.position.set(27, 2.4, -1);
this.camera.rotation.y = Math.PI/2;
this.camera.aspect = dom.offsetWidth / dom.offsetHeight;
this.camera.updateProjectionMatrix();
//定义场景(渲染容器)
this.scene = new THREE.Scene();
this.scene.background = new THREE.Color(0xa0a0a0);
let moveanima = new Moveanimate(scope);
//定义全局光
let ambientLight = new THREE.AmbientLight(0xffffff, 1.3);
this.scene.add(ambientLight);
//定义轨道视角控制器
this.controls = new THREE.OrbitControls(this.camera, dom);
this.controls.maxPolarAngle = Math.PI / 2;
this.controls.minPolarangle = Math.PI / 5;
this.controls.maxDistance = 30;
this.controls.screenSpacePanning = true;
this.controls.update();
document.addEventListener( "mousedown", onselect, false );
function onselect(){
// console.log(scope.camera.position);
}
this.anime = null;
let modelCzsb,modelFadianji,modelZcg,modelQjd,modelShengzi;
this.modelmanager = new ModelManager();
scope.modelmanager.loadpromise(scope.mixers).then(function (data) {
scope.scene.add(scope.modelmanager.model2.mesh);
modelCzsb = scope.modelmanager.model2.mesh.getObjectByName("CZSB");
scope.modelmanager.model2.mesh.remove(modelCzsb);
// modelCzsb.visible = false;
modelFadianji = scope.modelmanager.model2.mesh.getObjectByName("FADIANJI");
scope.modelmanager.model2.mesh.remove(modelFadianji);
modelZcg = scope.modelmanager.model2.mesh.getObjectByName("ZCG");
scope.modelmanager.model2.mesh.remove(modelZcg);
modelQjd = scope.modelmanager.model2.mesh.getObjectByName("QJD");
scope.modelmanager.model2.mesh.remove(modelQjd);
modelShengzi = scope.modelmanager.model2.mesh.getObjectByName("SHENGZI");
scope.modelmanager.model2.mesh.remove(modelShengzi);
let human1 = scope.modelmanager.model1.mesh;
human1.position.set(25, 0, 1.8);
// human1.rotation.y = -Math.PI/2;
let human2 = human1.clone(true);
human2.position.set(25, 0, -2);
// human2.rotation.y = -Math.PI/2;
scope.scene.add(human1);
scope.scene.add(human2);
animate();
});
window.onresize = function () {
scope.renderer.setSize(dom.offsetWidth,dom.offsetHeight);
}
this.changeIndex = function(index){
if(index == "1"){
// modelCzsb.visible = true;
scope.modelmanager.model2.mesh.add(modelCzsb);
}
if(index == "2"){
scope.modelmanager.model2.mesh.add(modelFadianji);
}
if(index == "3"){
scope.modelmanager.model2.mesh.add(modelZcg);
}
if(index == "4"){
scope.modelmanager.model2.mesh.add(modelQjd);
}
if(index == "5"){
scope.modelmanager.model2.mesh.add(modelShengzi);
}
if(index == "6"){
scope.modelmanager.model2.action.play();
}
if(index == "7"){
scope.modelmanager.model2.mesh.remove(modelCzsb);
scope.modelmanager.model2.mesh.remove(modelFadianji);
scope.modelmanager.model2.mesh.remove(modelZcg);
scope.modelmanager.model2.mesh.remove(modelQjd);
scope.modelmanager.model2.mesh.remove(modelShengzi);
}
}
let stopTime = 0;
//循环渲染函数
function animate() {
scope.anime = requestAnimationFrame(animate);
scope.renderer.render(scope.scene, scope.camera);
scope.controls.update();
//scope.camera.lookAt(plane);
// moveanima.animateupdate();
let delta = clock.getDelta();
if (scope.mixers) {
for (let i = 0; i < scope.mixers.length; i++) {
scope.mixers[i].update(delta);
// if (scope.mixers[i]) {
// if( scope.mixers[i].staticType){
// // console.log(scope.mixers[i].time);
// if(scope.mixers[i]._actions[0].time<stopTime){
// scope.mixers[i].update(delta);
// }else{
// scope.mixers[i]._actions[0].paused = true;
// }
// }else{
// scope.mixers[i].update(delta);
// }
// }
}
}
}
}

View File

@ -0,0 +1,75 @@
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
import { BASE_ASSET_API } from '@/api/jlmap3d/assets3d.js';
export function ModelManager(){
let scope = this;
this.model1 = {};
this.model2 = {};
this.loadpromise = function (mixers){
let initlist = [];
let staticJyHuman = {
assetname: "救援人员",
deviceType: "JyHuman",
id: "xz1",
packageName: "救援人员",
type: "static",
url: "/MODEL/2021-11-19/527-70780.FBX"
};
initlist.push(fbxpromise(staticJyHuman,mixers,scope.model1));
let staticJyScene = {
assetname: "列车救援场景",
deviceType: "JyScene",
id: "xz2",
packageName: "列车救援场景",
type: "static",
url: "/MODEL/2021-11-19/528-20265.FBX"
};
initlist.push(fbxpromise(staticJyScene,mixers,scope.model2));
return new Promise(function(resolve, reject){
Promise.all(initlist).then((result) => {
resolve("success"); //['成功了', 'success']
}).catch((error) => {
//console.log(error);
});
});
}
}
function fbxpromise(asset,mixers,model){
return new Promise(function(resolve, reject){
var loader = new THREE.FBXLoader();
let modelurl;
modelurl = BASE_ASSET_API+asset.url;
loader.load( modelurl, function ( object ) {
let mixer = new THREE.AnimationMixer( object );
object.traverse( function ( child ) {
if ( child.isMesh ) {
child.castShadow = true;
child.receiveShadow = true;
}
} );
model.mesh = object;
if(object.animations.length>0){
model.action = mixer.clipAction( object.animations[ 0 ] );
model.action.setLoop(THREE.LoopOnce);
model.action.clampWhenFinished = true;
mixers.push(mixer);
}
resolve(asset.deviceType);
} );
});
}

View File

@ -18,6 +18,10 @@ const Jlmap3dLesson3dPlayer = () => import('@/views/jlmap3d/lesson3dplayer/lesso
const Jlmap3dLesson3dSelect = () => import('@/views/jlmap3d/lesson3dplayer/lesson3dselect');
const Jlmap3dZzwwTest = () => import('@/views/jlmap3d/otherproject/zzww/zzwwtest');
const XzExam = () => import('@/views/jlmap3d/otherproject/xzexam/xzexam');
const LcJy = () => import('@/views/jlmap3d/otherproject/xzexam/lcjy');
const Jlmap3d = () => import('@/views/jlmap3d/drive/jl3ddrive');
const Jlmap3dSandbox = () => import('@/views/jlmap3d/simulation/jl3dsimulation');
@ -305,6 +309,16 @@ export const constantRoutes = [
component: Jlmap3dZzwwTest,
hidden: true
},
{
path: '/jlmap3d/xzexam',
component: XzExam,
hidden: true
},
{
path: '/jlmap3d/lcjy',
component: LcJy,
hidden: true
},
{
path: '/data2json',

View File

@ -56,6 +56,16 @@ export const loginInfo = {
navigationMarginLeft: '140px',
systemType: '011'
},
xzexam:{
title: '城市轨道交通标准化培训软件',
loginPath: '/login?project=xzexam',
loginParam: 'DEFAULT',
loginTitle: '空串',
logoWidth: '140px',
navigationLogoWidth: '120px',
navigationMarginLeft: '140px',
systemType: '011'
},
bjd: {
title: '城市轨道交通列车运行智慧辅助系统',
loginPath: '/login?project=bjd',
@ -675,13 +685,13 @@ export const GetMapListByProjectList = ['xty', 'designxty', 'gzb', 'designgzb',
'richorlesson3d', 'richorjoint', 'designrichorjoint', 'nologo', 'designnologo', 'srsandbox', 'designsrsandbox', 'designhlsdrts', 'hlsdrts', 'jxgm', 'designjxgm']; // 实训设计平台通过项目code获取地图列表的项目
export const CaseHideProjectList = ['heb', 'designheb', 'cgy', 'designcgy']; // 案例展示隐藏的项目
export const VersionBaseNoShow = ['heb', 'designheb', 'hls', 'designhls', 'drts', 'wjls', 'hyd', 'designhyd', 'cgy', 'designcgy', 'xadt',
'designxadt', 'nologo', 'designnologo', 'srsandbox', 'designsrsandbox', 'designhlsdrts', 'hlsdrts', 'jxgm', 'designjxgm']; // 登录页右下角版本开发基于不展示
'designxadt', 'nologo', 'designnologo', 'srsandbox', 'designsrsandbox', 'designhlsdrts', 'hlsdrts', 'jxgm', 'designjxgm','xzexam']; // 登录页右下角版本开发基于不展示
export const MainBodyNoShow = ['heb', 'designheb', 'jyd', 'designjyd', 'tky', 'designtky', 'bxkc', 'designbxkc', 'crsc', 'designcrsc', 'hls',
'designhls', 'hyd', 'designhyd', 'cgy', 'designcgy', 'xadt', 'designxadt', 'richor', 'richorlesson3d', 'richorjoint', 'nologo', 'designnologo',
'srsandbox', 'designsrsandbox', 'designhlsdrts', 'hlsdrts', 'jxgm', 'designjxgm']; // 登录页右下角主体不展示
'srsandbox', 'designsrsandbox', 'designhlsdrts', 'hlsdrts', 'jxgm', 'designjxgm','xzexam']; // 登录页右下角主体不展示
export const ProjectLoginStyleList = ['gzb', 'designgzb', 'xty', 'designxty', 'xadt', 'designxadt', 'tky', 'designtky', 'jyd', 'designjyd', 'bxkc', 'designbxkc',
'crsc', 'designcrsc', 'hls', 'designhls', 'drts', 'wjls', 'hyd', 'designhyd', 'nty', 'designnty', 'bjd', 'designbjd', 'sdy', 'designsdy', 'ntyc', 'designntyc',
'ntyl', 'designntyl', 'cgy', 'designcgy', 'zzww', 'zzwwtest', 'srsandbox', 'designsrsandbox', 'designhlsdrts', 'hlsdrts', 'jxgm', 'designjxgm']; // 登录页样式
'ntyl', 'designntyl', 'cgy', 'designcgy', 'zzww', 'zzwwtest', 'srsandbox', 'designsrsandbox', 'designhlsdrts', 'hlsdrts', 'jxgm', 'designjxgm','xzexam']; // 登录页样式
export const NoQrcodeList = ['heb', 'designheb', 'cgy', 'designcgy', 'ntyl', 'designntyl'];
export const NoSimulationQrCodeList = ['heb', 'bjd'];
export const RegisterCodeList = ['cgy', 'designcgy'];

View File

@ -0,0 +1,392 @@
<template>
<div id="lesson3ddiv" class="lesson3ddiv">
<div class="selectjobdiv"
:style="{'background-image': 'url('+staticImg+'/texture/bg.jpg)'}"
v-show="showSelect">
<div class="selectjobbuttondiv">
<div
class="selectjobimg"
v-for="(job,index) in selectJobList"
@click="selectJob(job)"
:style="{'background-image': 'url('+staticImg+'/lesson3d/mst.png)'}">
<!-- <div>{{job}}</div> -->
<div style="width:100%;position:absolute;bottom:0;font-size:30px;textAlign:center;">{{job}}</div>
</div>
</div>
</div>
<div class="lessontopdiv"
:style="{'background-image': 'url('+lessonbg+')'}">
<div class="lessontopdivtittle"
:style="{'background-image': 'url('+lessonbg+')'}">
课程:{{lessonMsg.lessonTittle}}
</div>
<div class="lessontopdivmsg"
:style="{'background-image': 'url('+lessonbg+')'}"
@click="openBack">
退出
</div>
<div class="lessontopdivmsg"
:style="{'background-image': 'url('+lessonbg+')'}">
用户ID:{{lessonMsg.userId}}
</div>
<div class="lessontopdivmsg"
:style="{'background-image': 'url('+lessonbg+')'}"
v-if="lessonMsg.userJob">
当前训练角色:{{lessonMsg.userJob}}
</div>
</div>
<div class="lesson3dplayer">
<Step-Tips
:lessonData='lessonData'
:lessonPlayIndex='lessonPlayIndex'
@jumpEvent="jumpEvent">
</Step-Tips>
<div id="lesson3ddraw" class="lesson3ddraw">
</div>
</div>
<div class="lessondowndiv"
:style="{'background-image': 'url('+lessonbg+')'}">
<div class="lessondowndivroommsg"
:style="{'background-image': 'url('+lessonbg+')'}">
房间编号:1
</div>
<!-- <div class="lessondowndivmsg"
:style="{'background-image': 'url('+lessonbg+')'}"
v-show = "endExam && examMode"
@click="showResult">
考试成绩分析
</div> -->
<!-- <div class="lessondowndivmsg"
:style="{'background-image': 'url('+lessonbg+')'}"
>
考试计时:{{this.lastPlayTime}}
</div>
<div class="lessondowndivmsg"
:style="{'background-image': 'url('+lessonbg+')'}"
>
考核步骤:{{examStatus.nowStep}}/{{examStatus.allStep}}
</div>
<div class="lessondowndivmsg"
:style="{'background-image': 'url('+lessonbg+')'}"
>
考试得分:{{examStatus.lastScore}}/{{examStatus.allScore}}
</div> -->
</div>
<canvas id="canvastexture" width="128px" height="64px"></canvas>
</div>
</template>
<script>
import Vue from 'vue';
import localStore from 'storejs';
import { JL3D_LOCAL_STATIC,BASE_ASSET_API } from '@/api/jlmap3d/assets3d.js';
import StepTips from '@/views/jlmap3d/otherproject/xzexam/stepstips';
import { Jl3dXzexam } from '@/jlmap3d/otherproject/xzexam/jl3dxzexam';
export default {
name: 'LcJy',
components: {
// AssetsModel,
StepTips,
},
data() {
return {
staticImg:JL3D_LOCAL_STATIC,
lessonbg:JL3D_LOCAL_STATIC+"/lesson3d/lessonbg.png",
jl3d:'',
lessonPlayIndex:0,
lessonData:{
lessonProgress:[
{
text:"列车发生脱轨事故,救援人员前往救援"
},
{
text:"救援人员设置操作台",
},
{
text:"救援人员设置发电设备",
},
{
text:"救援人员布置起重位置",
},
{
text:"救援人员放置起重机",
},
{
text:"救援人员连接设备",
},
{
text:"救援人员操作起重设备",
},
{
text:"列车复位,回收设备,救援结束",
},
]
},
showSelect:true,
lessonMsg:{
lessonTittle:"列车救援",
userId:"1",
userJob:"救援人员"
},
examStatus:{
nowStep:0,
allStep:10,
allScore:100,
},
selectJobList:[
'救援人员',
// '',
// '',
// '',
// ''
],
lastPlayTime:0,
}
},
computed: {
},
watch: {
},
mounted() {
this.init();
},
beforeDestroy() {
},
methods: {
init(){
let dom = document.getElementById('lesson3ddraw');
this.jl3d = new Jl3dXzexam(dom);
},
selectJob(){
this.showSelect = false;
},
timeStart(){
this.time =setInterval(this.timer,100)
},
timer(){//
this.ms =this.ms +100 //
if (this.ms >=1000) {
this.ms =0
this.playTime.s =this.playTime.s +1 //
}
if (this.playTime.s >=60) {
this.playTime.s =0;
this.playTime.m =this.playTime.m +1 //
}
if (this.playTime.m >=60) {
this.playTime.m;
this.playTime.h =this.playTime.h +1 //
}
this.lastPlayTime =this.toDub(this.playTime.h) +':' +this.toDub(this.playTime.m) +':' +this.toDub(this.playTime.s)/*+""+this.toDubms(this.ms)+"毫秒"*/
},
toDub(n){//0
if (n <10) {
return '0' + n
}else {
return '' + n
}
},
stopTime(){
clearInterval(this.time);
},
jumpEvent(){
this.lessonPlayIndex += 1;
this.jl3d.changeIndex(this.lessonPlayIndex);
},
openBack(){
history.go(-1);
},
},
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
* {
touch-action: none;
}
.selectjobdiv{
width:100%;
height:100%;
position: absolute;
z-index: 5;
background-size: 100%;
}
.selectjobimg{
width:250px;
height:250px;
background-size: 100%;
// float:left;
display: inline-block;
position:relative;
}
.selectjobbuttondiv{
position:absolute;
width:80%;
height:30%;
left:10%;
top:35%;
overflow-x:scroll;
overflow-y:hidden;
text-align: center;
}
.selectjobbackdiv{
}
.lessontopdiv{
width:100%;
height: 50px;
position: absolute;
top:0;
border-radius:10px;
border:solid 2px #000;
z-index: 10;
color:#fff;
}
.lessontopdivtittle{
width: 33%;
height:50px;
position: absolute;
left:0;
text-align: center;
font-size: 30px;
line-height: 40px;
border-radius:10px;
border:solid 2px #000;
}
.lessontopdivmsg{
width: 20%;
height:49px;
position: relative;
float:right;
text-align: center;
font-size: 18px;
line-height: 40px;
border-radius:10px;
border:solid 2px #000;
}
.lessondowndiv{
width:100%;
height: 40px;
position: absolute;
bottom:0;
border-radius:10px;
border:solid 2px #000;
z-index: 10;
color:#fff;
font-size: 18px;
line-height: 25px;
}
.lessondowndivroommsg{
width: 20%;
height:38px;
position: absolute;
left:0;
text-align: center;
border-radius:10px;
border:solid 2px #000;
}
.lessondowndivmsg{
width: 20%;
height:38px;
position: relative;
float:right;
text-align: center;
border-radius:10px;
border:solid 2px #000;
}
.lesson3ddiv {
width: 100%;
height: 100%;
}
.lesson3dplayer{
width:100%;
height:100%;
position: absolute;
// top: 0;
// left:15%;
// border:solid 2px #000;
}
.lesson3ddraw {
float: left;
//left:20%;
position: absolute;
width: 100%;
height: 100%;
z-inde: -1;
}
.activediv{
position: absolute;
width: 15%;
height:100%;
left:0;
border-radius:10px;
border:solid 2px #000;
}
.lessonsetup {
position: absolute;
width: 15%;
height: 20%;
right:0;
top:0;
border-radius:10px;
border:solid 2px #000;
text-align:center;
}
.el-tabs__content{
position: absolute;
}
</style>

View File

@ -0,0 +1,90 @@
<template>
<div class="stepstipsdiv"
v-if="lessonData.lessonProgress[lessonPlayIndex]"
:style="{'background-image': 'url('+lessonbg+')'}">
<div class="stepstipstittle" >
当前情况
<!-- {{lessonData.lessonData.lessonProgress[lessonPlayIndex].stepTipsData.tittle}} -->
</div>
<div class="stepstipstext" >
{{lessonData.lessonProgress[lessonPlayIndex].text}}
</div>
<div class="nextbuttondiv"
:style="{'background-image': 'url('+staticImg+'/lesson3d/nextbutton.png)'}"
@click="explainJump"></div>
</div>
</template>
<script>
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
//
export default {
name: 'StepTips',
props:['lessonData','lessonPlayIndex','nowRole'],
components: {
},
data() {
return {
lessonbg:JL3D_LOCAL_STATIC+"/lesson3d/lessonbg.png",
staticImg:JL3D_LOCAL_STATIC,
}
},
computed: {
},
watch: {
},
mounted() {
},
beforeDestroy() {
},
methods: {
explainJump(){
this.$emit('jumpEvent','jump');
},
},
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.stepstipsdiv {
position: absolute;
width: 20%;
height: 20%;
left:0;
top:50px;
border-radius:10px;
border:solid 2px #000;
// background-color: #223458;
// opacity: 0.6;
color:#fff;
z-index:1;
}
.stepstipstittle{
text-align: center;
font-size: 20px;
}
.stepstipstext{
font-size: 18px;
}
.nextbuttondiv{
width:30px;
height:30px;
background-size: 100%;
position: absolute;
right:0;
bottom:0;
}
</style>

View File

@ -0,0 +1,124 @@
<template>
<div class="jl3dmap3dMaintainer">
<div class="jl3dmap3dMaintainerSelect" :style="{'background-color': '#e4eaea'}">
<div style="position:absolute;left:25%;top:10%;font-size:80px">
<el-row>
城市轨道交通标准化培训软件
</el-row>
</div>
<div class="lesson3dSelectButton"
:style="{'background-image': 'url('+localStatic+'/other/ck.png)'}"
style="left:15%;top:25%;" @click=""></div>
<div class="lesson3dSelectButton"
:style="{'background-image': 'url('+localStatic+'/other/hk.png)'}"
style="left:40%;top:25%;" @click=""></div>
<div class="lesson3dSelectButton"
:style="{'background-image': 'url('+localStatic+'/other/jy.png)'}"
style="left:65%;top:25%;" @click="enterPlayer()"></div>
<div class="lesson3dSelectButton"
:style="{'background-image': 'url('+localStatic+'/other/yx.png)'}"
style="left:15%;top:60%;" @click=""></div>
<div class="lesson3dSelectButton"
:style="{'background-image': 'url('+localStatic+'/other/zf.png)'}"
style="left:40%;top:60%;" @click=""></div>
<div class="lesson3dSelectButton"
:style="{'background-image': 'url('+localStatic+'/other/xr51.png)'}"
style="left:65%;top:60%;" @click=""></div>
</div>
</div>
</template>
<script>
import { ProjectIcon } from '@/scripts/ProjectConfig';
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
import bgPsdImg from '@/assets/bg_psd.png';
// import Jlmap3dMsg from '@/views/jlmap3d/show/msg';
var train;
export default {
name: 'XzExam',
components: {
},
data() {
return {
localStatic:JL3D_LOCAL_STATIC,
};
},
beforeDestroy() {
},
created() {
// document.querySelector("link[rel*='icon']").href = loginInfo[this.$route.query.project].linkIcon || ProjectIcon[this.$route.query.project];
},
mounted() {
// console.log("");
},
methods: {
enterPlayer:function () {
this.$router.push({ path: '/jlmap3d/lcjy', query: {} });
},
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.jl3dmap3dMaintainer {
position:absolute;
width: 100%;
height: 100%;
z-index: 35;
// color:#FFF;
}
.jl3dmap3dMaintainerSelect{
position:absolute;
width: 100%;
height: 100%;
z-index: 350;
top:0;
left:0;
// background-repeat:no-repeat;
z-index: 350;
background-size:100%;
}
.lesson3dSelectButton{
position:absolute;
width: 20%;
height: 30%;
position:absolute;
text-align: center;
font-size: 50px;
line-height:150px;
background-size: 100%;
background-repeat: no-repeat;
color:#FFF;
cursor:pointer;
}
</style>

View File

@ -593,6 +593,8 @@ export default {
});
} else if (this.project === 'zzwwtest') {
this.$router.push({ path: '/jlmap3d/zzwwtest', query: {lessonId:'35'} });
}else if (this.project === 'xzexam') {
this.$router.push({ path: '/jlmap3d/xzexam', query: {} });
} else if (this.project === 'richorlesson3d') {
this.$router.push({ path: '/jlmap3d/lesson3dselect', query: {} });
} else {

BIN
static/background/bg.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

BIN
static/other/ck.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

BIN
static/other/hk.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

BIN
static/other/jy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

BIN
static/other/xr51.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
static/other/yx.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

BIN
static/other/zf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB