修改旧数据三维通信bug,cctv三维逻辑修改

This commit is contained in:
sunzhenyu 2020-06-01 12:29:30 +08:00
parent bfe172ff30
commit e7224548b8
16 changed files with 453 additions and 394 deletions

View File

@ -154,6 +154,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
let assetsdata = JSON.parse(netdata.data.sections);
if(assetsdata.link){
scope.datatype = "old";
// datanew();
// scope.jsonwebwork = new Worker("../../static/workertest/jsonworker.js");
// scope.Subscribe = new Jlmap3dSubscribe(scope,routegroup,scope.jsonwebwork);
// scope.Subscribe.socketon(scope.Subscribe.topic);
@ -165,7 +166,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
if(trainlisttest){
if(trainlisttest.group){
if(trainlisttest.group.children[0]){
console.log(trainlisttest.group.children[0].name);
// console.log(trainlisttest.group.children[0].name);
updatemmi.updatedrivingcode(trainlisttest.group.children[0].name);
scope.Subscribe.initdrivercode(trainlisttest.group.children[0].name);
for(let k in rails.switchrail){

View File

@ -100,6 +100,7 @@ export function Jl3dDriving(mixers, updatemmi, sound, translation, routegroup) {
//
// }
// console.log(data);
// console.log(data);
switch (data.type) {
case 'Simulation_Driver_Change':
@ -113,6 +114,7 @@ export function Jl3dDriving(mixers, updatemmi, sound, translation, routegroup) {
updatemmi.updatedrivingcode( data.body.code);
break;
case 'Simulation_TrainSpeed':
trainspeed(data);
break;
case 'SJL3D_TrainStatus':

View File

@ -98,6 +98,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
// console.log(data);
if(data.type == "Train_Position"){
// stats.update();
trainrun(data.body);
return;
}

View File

@ -48,6 +48,22 @@ var Staticmodel = {
picUrl: "",
assetUrl: "../../static/model/passflow/monitor.FBX"
},
train: {
id: "7",
name: "列车",
deviceType: "train",
type: "hrb",
picUrl: "",
assetUrl: "../../static/model/train/train.FBX"
},
section: {
id: "8",
name: "区段",
deviceType: "section",
type: "hrb",
picUrl: "",
assetUrl: "../../static/model/passflow/section.FBX"
},
}

View File

@ -38,7 +38,6 @@ let originhuman1 = null;
let originhuman2 = null;
let originanima1 = null;
let originanima2 = null;
let moveanimatelist = [];
let zhajiin = [];
let zhajiout = [];
@ -218,10 +217,6 @@ export function Jl3dpassflow(dom) {
this.selectmodel = null;
const Color = {
GROUND: new THREE.Color( 0x606060 ).convertGammaToLinear( 2.2 ).getHex(),
NAVMESH: new THREE.Color( 0xFFFFFF ).convertGammaToLinear( 2.2 ).getHex(),
};
const ZONE = 'level';
const SPEED = 10;
@ -233,12 +228,12 @@ export function Jl3dpassflow(dom) {
let groupID, path;
const playerPosition = new THREE.Vector3( -3.5, 0.5, 5.5 );
const targetPosition = new THREE.Vector3();
let playerPosition = new THREE.Vector3( -3.5, 0.5, 5.5 );
let targetPosition = new THREE.Vector3();
const pathfinder = new THREE.Pathfinding();
const mouse = new THREE.Vector2();
const raycaster = new THREE.Raycaster();
let pathfinder = new THREE.Pathfinding();
let mouse = new THREE.Vector2();
let raycaster = new THREE.Raycaster();
var loader = new THREE.OBJLoader();
@ -250,9 +245,9 @@ export function Jl3dpassflow(dom) {
function ( object ) {
console.time('createZone()');
// console.time('createZone()');
const zone = THREE.Pathfinding.createZone(object.children[0].geometry);
console.timeEnd('createZone()');
// console.timeEnd('createZone()');
pathfinder.setZoneData( ZONE, zone );
@ -301,7 +296,6 @@ export function Jl3dpassflow(dom) {
console.log(intersects[0].point);
targetPosition.copy( intersects[0].point );
originhuman1.position.copy( playerPosition );
// Teleport on ctrl/cmd click or RMB.
if (event.metaKey || event.ctrlKey || event.button === 2) {
@ -320,28 +314,14 @@ export function Jl3dpassflow(dom) {
points.push(path[i]);
}
originhuman1.curve = new THREE.CatmullRomCurve3(points);
originhuman1.curve.curvrtype = "chordal";
originhuman1.curve.curvrtype = "centripetal";
originhuman1.progress = 0;
console.log(path);
}
function tick ( dt ) {
// if ( !level || !(path||[]).length ) return
//
// let targetPosition = path[ 0 ];
// const velocity = targetPosition.clone().sub( playerPosition );
//
// if (velocity.lengthSq() > 0.05 * 0.05) {
// velocity.normalize();
// // Move player to target
// playerPosition.add( velocity.multiplyScalar( dt * SPEED ) );
// // originhuman1.lookAt();
// originhuman1.position.copy( playerPosition );
// } else {
// // Remove node from the path we calculated
// path.shift();
// }
if(originhuman1.curve){
if(originhuman1.progress<1){
let point = originhuman1.curve.getPointAt(originhuman1.progress);
@ -383,7 +363,8 @@ export function Jl3dpassflow(dom) {
initstationanimation(scope.modelmanager.station.mesh);
initzhajiinaimation(scope.modelmanager.zhajiin.mesh);
initzhajioutanimation(scope.modelmanager.zhajiout.mesh);
scene.add(scope.modelmanager.section.mesh);
scene.add(scope.modelmanager.train.mesh);
level = scope.modelmanager.station.mesh;
monitor = scope.modelmanager.monitor.mesh;
@ -415,45 +396,6 @@ export function Jl3dpassflow(dom) {
scene.add(humanlist);
scene.add(scope.modelmanager.man1.mesh);
for(let i=0;i<200;i++){
var mantype = Math.floor(Math.random()*(3-1+1))+1;
let newhuman;
if(mantype == 1){
newhuman = THREE.SkeletonUtils.clone( originhuman1 );
newhuman.animations = [];
newhuman.animations.push(originanima1.clone());
}else{
newhuman = THREE.SkeletonUtils.clone( originhuman2 );
newhuman.animations = [];
newhuman.animations.push(originanima2.clone());
}
// zhajiin[j].waiting = 1;
let mixer = new THREE.AnimationMixer( newhuman );
mixer.runplay = false;
let action = mixer.clipAction( newhuman.animations[ 0 ] );
newhuman.status = 1;
newhuman.stage = 0;
let newone = {
id:i,
mesh:newhuman,
direct:null,
doorstatus:null,
doors:null,
action:action,
mixer:mixer,
runrail:null
};
humans.push(newone);
mixers.push(mixer);
humanlist.add(newhuman);
}
}
@ -466,8 +408,8 @@ export function Jl3dpassflow(dom) {
clearInterval(checkobject);
//进站控制
startWorker();
// stationwebwork.postMessage("on");
// passerwebwork.postMessage("on");
stationwebwork.postMessage("on");
passerwebwork.postMessage("on");
};
},1000);
@ -488,123 +430,40 @@ export function Jl3dpassflow(dom) {
}
}
function initpasser(){
for(let i=0;i<3;i++){
newhumancreate(stationzon.getinitposition("enter1"),0);
}
for(let i=0;i<3;i++){
newhumancreate(stationzon.getinitposition("enter2"),0);
}
for(let i=0;i<3;i++){
newhumancreate(stationzon.getinitposition("security"),1);
}
for(let i=0;i<2;i++){
newhumancreate(stationzon.getinitposition("entergate"),2);
}
for(let i=0;i<6;i++){
newhumancreate(stationzon.getinitposition("standtop"),3);
}
for(let i=0;i<6;i++){
newhumancreate(stationzon.getinitposition("standdown"),3);
}
for(let i=0;i<5;i++){
newhumancreate(stationzon.getinitposition("exitgate"),4);
}
console.log(humanlist);
}
function startWorker(){
initpasser();
passerwebwork.onmessage = function (event) {
if(humans){
// console.log(humans.length);
// console.log(humans.length);
for(let i=0;i<humans.length;i++){
// console.log(humans[i]);
if(humans[i].status == 0){
if(humans[i].stage == 1){
let points = [];
points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z-5));
zhajicontrol("in",humans[i].doors);
moveanimateinit(humans[i],i,points,i,0.02);
}
if(humans[i].stage == 2){
let points = [];
points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
points.push(new THREE.Vector3(12,10,12.9));
points.push(new THREE.Vector3(28,1.7,12.9));
points.push(new THREE.Vector3(34,1.7,12.9));
//1--left
//2-- right
if(humans[i].direct == 1){
points.push(new THREE.Vector3(34,1.7,16));
for(let j =0;j<22;j++){
if(stationleft[j].waiting == 0){
points.push(new THREE.Vector3(51-j*5,1.7,22));
points.push(new THREE.Vector3(51-j*5,1.7,23));
humans[i].doors = j;
stationright[j].waiting = 1;
moveanimateinit(humans[i],i,points,i,0.002);
j =22;
}
}
}else{
points.push(new THREE.Vector3(34,1.7,16));
points.push(new THREE.Vector3(14,1.7,17));
points.push(new THREE.Vector3(14,1.7,3));
for(let j =0;j<22;j++){
if(stationright[j].waiting == 0){
points.push(new THREE.Vector3(51-j*5,1.7,3));
points.push(new THREE.Vector3(51-j*5,1.7,2));
humans[i].doors = j;
stationright[j].waiting = 1;
moveanimateinit(humans[i],i,points,i,0.002);
j =22;
}
}
}
moveanimateinit(humans[i],i,points,i,0.002);
}
//出站
if(humans[i].stage == 3){
let points = [];
points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
if(humans[i].doors<11){
if(humans[i].direct == 1){
points.push(new THREE.Vector3(10,1.7,17));
}else{
points.push(new THREE.Vector3(8,1.7,5));
}
points.push(new THREE.Vector3(8,1.7,13));
points.push(new THREE.Vector3(5,1.7,13));
points.push(new THREE.Vector3(-4,6,13));
}else{
if(humans[i].direct == 1){
points.push(new THREE.Vector3(-19,1.7,17));
}else{
points.push(new THREE.Vector3(-18,1.7,6.4));
}
points.push(new THREE.Vector3(-18,1.7,13));
points.push(new THREE.Vector3(-12,1.7,13));
points.push(new THREE.Vector3(-7,6.8,12));
}
points.push(new THREE.Vector3(-5,10,4));
points.push(new THREE.Vector3(14,10,3));
var j = Math.floor(Math.random()*(4-1+1))+1;
points.push(new THREE.Vector3(19,10,-2+j*1.4));
humans[i].doors = j;
moveanimateinit(humans[i],i,points,i,0.002);
}
if(humans[i].stage == 4){
let points = [];
points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
points.push(new THREE.Vector3(humans[i].mesh.position.x+4,humans[i].mesh.position.y,humans[i].mesh.position.z));
if(humans[i].direct == 1){
points.push(new THREE.Vector3(33,10,25));
}else{
points.push(new THREE.Vector3(33.5,10,-5));
}
zhajicontrol("out",humans[i].doors);
moveanimateinit(humans[i],i,points,i,0.002);
}
}
}
}
moveanimateupdate();
// delta = clock.getDelta();
// tick(delta);
passerai();
if(mixers[i]._actions[0].isRunning()){
mixers[i].update( delta );
}
delta = clock.getDelta();
// tick(delta);
for(let i=mixers.length-1;i>=0;i--){
if(mixers[i]._actions[0].isRunning()){
@ -615,9 +474,17 @@ export function Jl3dpassflow(dom) {
};
stationwebwork.onmessage = function (event) {
// console.log("stationwebwork");
if(humans.length<200){
newhumancreate();
// if(humans.length<200){
var direct = Math.floor(Math.random()*(3-1+1))+1;
//1--top
//2-- down
if(direct == 1){
newhumancreate(stationzon.getzoneposition("enter1"),0);
}else{
newhumancreate(stationzon.getzoneposition("enter2"),0);
}
// }
};
}
@ -632,125 +499,257 @@ export function Jl3dpassflow(dom) {
monitorrender();
}
delta = clock.getDelta();
tick(delta);
// delta = clock.getDelta();
// tick(delta);
requestAnimationFrame(animate);
}
function moveanimateinit(model,name,points,index,speed){
function passerai(){
for(let i=0;i<humanlist.children.length;i++){
// console.log(humans[i]);
if(humanlist.children[i].status == 0){
if(humanlist.children[i].stage == 0){
groupID = pathfinder.getGroup( ZONE, humanlist.children[i].position );
targetPosition = stationzon.getzoneposition("security");
path = pathfinder.findPath( humanlist.children[i].position, targetPosition, ZONE, groupID );
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
}
moveanimateinit(humanlist.children[i],i,points,i);
// console.log(path);
}
if(humanlist.children[i].stage == 1){
groupID = pathfinder.getGroup( ZONE, humanlist.children[i].position );
targetPosition = stationzon.getzoneposition("entergate");
path = pathfinder.findPath( humanlist.children[i].position, targetPosition, ZONE, groupID );
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
}
moveanimateinit(humanlist.children[i],i,points,i);
}
if(humanlist.children[i].stage == 2){
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z-5));
// zhajicontrol("in",humans[i].doors);
moveanimateinit(humanlist.children[i],i,points,i);
}
if(humanlist.children[i].stage == 3){
var direct = Math.floor(Math.random()*(3-1+1))+1;
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
//1--top
//2-- down
if(direct == 1){
groupID = pathfinder.getGroup( ZONE, humanlist.children[i].position );
targetPosition = stationzon.getzoneposition("standtop");
path = pathfinder.findPath( humanlist.children[i].position, targetPosition, ZONE, groupID );
}else{
groupID = pathfinder.getGroup( ZONE, humanlist.children[i].position );
targetPosition = stationzon.getzoneposition("standdown");
path = pathfinder.findPath( humanlist.children[i].position, targetPosition, ZONE, groupID );
}
for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
}
moveanimateinit(humanlist.children[i],i,points,i);
}
// //出站
// if(humanlist.children[i].stage == 3){
// // let points = [];
// // points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
// // if(humans[i].doors<11){
// // if(humans[i].direct == 1){
// // points.push(new THREE.Vector3(10,1.7,17));
// // }else{
// // points.push(new THREE.Vector3(8,1.7,5));
// // }
// // points.push(new THREE.Vector3(8,1.7,13));
// // points.push(new THREE.Vector3(5,1.7,13));
// // points.push(new THREE.Vector3(-4,6,13));
// // }else{
// // if(humans[i].direct == 1){
// // points.push(new THREE.Vector3(-19,1.7,17));
// // }else{
// // points.push(new THREE.Vector3(-18,1.7,6.4));
// // }
// // points.push(new THREE.Vector3(-18,1.7,13));
// // points.push(new THREE.Vector3(-12,1.7,13));
// // points.push(new THREE.Vector3(-7,6.8,12));
// // }
// // points.push(new THREE.Vector3(-5,10,4));
// // points.push(new THREE.Vector3(14,10,3));
// // var j = Math.floor(Math.random()*(4-1+1))+1;
// // points.push(new THREE.Vector3(19,10,-2+j*1.4));
// //
// // humans[i].doors = j;
// // moveanimateinit(humans[i],i,points,i,0.002);
// }
if(humanlist.children[i].stage == 4){
groupID = pathfinder.getGroup( ZONE, humanlist.children[i].position );
targetPosition = stationzon.getzoneposition("exitgate");
path = pathfinder.findPath( humanlist.children[i].position, targetPosition, ZONE, groupID );
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
}
moveanimateinit(humanlist.children[i],i,points,i);
}
if(humanlist.children[i].stage == 5){
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
points.push(new THREE.Vector3(humanlist.children[i].position.x+5,humanlist.children[i].position.y,humanlist.children[i].position.z));
// zhajicontrol("in",humans[i].doors);
moveanimateinit(humanlist.children[i],i,points,i);
}
if(humanlist.children[i].stage == 6){
var direct = Math.floor(Math.random()*(3-1+1))+1;
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
//1--top
//2-- down
if(direct == 1){
groupID = pathfinder.getGroup( ZONE, humanlist.children[i].position );
targetPosition = stationzon.getzoneposition("exit1");
path = pathfinder.findPath( humanlist.children[i].position, targetPosition, ZONE, groupID );
}else{
groupID = pathfinder.getGroup( ZONE, humanlist.children[i].position );
targetPosition = stationzon.getzoneposition("exit2");
path = pathfinder.findPath( humanlist.children[i].position, targetPosition, ZONE, groupID );
}
for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
}
moveanimateinit(humanlist.children[i],i,points,i);
}
}
}
}
function moveanimateinit(model,name,points,index){
model.status = 1;
let curve = new THREE.CatmullRomCurve3(points);
curve.curvrtype = "chordal";
curve.curvrtype = "centripetal";
// curve.getLength();
// curve动画轨迹
// progress动画进度
// enable当前动画开关
// speed动画速度
// console.log(curve);
let animate = {
name:index,
index:index,
curve:curve,
progress:0,
directchange:false,
enable:true,
status:"start",
speed:speed,
};
humans[index].runrail = animate;
humans[index].status = 1;
humans[index].action.play();
humans[index].mixer.runplay = true;
moveanimatelist.push(animate);
model.action.play();
model.progress = 0;
model.runrail = curve;
model.speed = 0.1/curve.getLength();
}
function moveanimateupdate(){
if(humans.length>0){
for(let i=0;i<humans.length;i++){
if(humans[i].runrail.enable){
// 动画播放结束
if(humans[i].runrail.progress>=1){
// let point = humans[i].runrail.curve.getPointAt(1);
//更新模型坐标
// console.log(moveanimatelist);
if(humans[i].status == 1){
humans[i].runrail.enable = false;
humans[i].runrail.progress = 1;
humans[i].mixer.runplay = false;
humans[i].action.stop();
humans[i].status = 0;
for(let i=0;i<humanlist.children.length;i++){
if(humanlist.children[i].status == 1){
if(humanlist.children[i].progress>=1){
// let point = humans[i].runrail.curve.getPointAt(1);
//更新模型坐标
if(humanlist.children[i].status == 1){
// humanlist.children[i].runrail.enable = false;
humanlist.children[i].progress = 1;
// humanlist.children[i].mixer.runplay = false;
humanlist.children[i].action.stop();
humanlist.children[i].status = 0;
if(humans[i].stage == 4){
// if(humanlist.children[i].stage == 4){
//
// humanlist.remove(humanlist.children[i].mesh);
// // humans.splice(i,1);
// }
//
if(humanlist.children[i].stage == 6){
humanlist.remove(humanlist.children[i]);
// humanlist.children[i].stage = 7;
humanlist.remove(humans[i].mesh);
// humans.splice(i,1);
}
if(humans[i].stage == 3){
if(humans[i].direct == 1){
stationleft[humans[i].doors].waiting = 0;
}else{
stationright[humans[i].doors].waiting = 0;
}
humans[i].stage = 4;
}
if(humans[i].stage == 2){
humans[i].stage = 3;
}
if(humans[i].stage == 1){
humans[i].stage = 2;
}
if(humans[i].stage == 0){
// console.log(humans[i].doors);
zhajiin[humans[i].doors].waiting = 0;
humans[i].stage = 1;
}
moveanimatelist.splice(i,1);
}
}else{
//根据动画进度获取动画轨迹上点
let point = humans[i].runrail.curve.getPointAt(humans[i].runrail.progress);
//更新模型坐标
humans[i].mesh.position.x = point.x;
humans[i].mesh.position.y = point.y;
humans[i].mesh.position.z = point.z;
if((humans[i].runrail.progress+0.001)<1){
let tangent = humans[i].runrail.curve.getPointAt(humans[i].runrail.progress+0.001);
humans[i].mesh.lookAt(new THREE.Vector3(tangent.x,humans[i].mesh.position.y,tangent.z));
}
humans[i].runrail.progress += humans[i].runrail.speed;
point = null;
}
}
}
if(humanlist.children[i].stage == 5){
humanlist.children[i].stage = 6;
}
if(humanlist.children[i].stage == 4){
humanlist.children[i].stage = 5;
}
if(humanlist.children[i].stage == 3){
humanlist.children[i].stage = 4;
}
//
if(humanlist.children[i].stage == 2){
humanlist.children[i].stage = 3;
}
if(humanlist.children[i].stage == 1){
humanlist.children[i].stage = 2;
}
if(humanlist.children[i].stage == 0){
// // console.log(humans[i].doors);
// zhajiin[humanlist.children[i].doors].waiting = 0;
humanlist.children[i].stage = 1;
}
}
}else{
//根据动画进度获取动画轨迹上点
// console.log(i);
// console.log(humanlist.children[i].runrail);
// console.log(humanlist.children[i].progress);
let point = humanlist.children[i].runrail.getPointAt(humanlist.children[i].progress);
//更新模型坐标
humanlist.children[i].position.x = point.x;
humanlist.children[i].position.y = point.y;
humanlist.children[i].position.z = point.z;
if((humanlist.children[i].progress+0.001)<1){
let tangent = humanlist.children[i].runrail.getPointAt(humanlist.children[i].progress+0.001);
humanlist.children[i].lookAt(new THREE.Vector3(tangent.x,humanlist.children[i].position.y,tangent.z));
}
humanlist.children[i].progress += humanlist.children[i].speed;
point = null;
}
}
}
}
function newhumancreate(){
var direct = Math.floor(Math.random()*(3-1+1))+1;
function newhumancreate(position,stage,){
var mantype = Math.floor(Math.random()*(3-1+1))+1;
// console.log(direct);
let points = [];
let newhuman;
if(mantype == 1){
newhuman = THREE.SkeletonUtils.clone( originhuman1 );
@ -762,51 +761,21 @@ export function Jl3dpassflow(dom) {
newhuman.animations.push(originanima2.clone());
}
if(direct == 1|| direct == 2){
let testposition = stationzon.getzoneposition("enter1");
newhuman.position.set(32,10,25);
points.push(testposition);
points.push(new THREE.Vector3(26,10,21));
points.push(new THREE.Vector3(18,10,18));
}else{
let testposition = stationzon.getzoneposition("enter2");
newhuman.position.set(32,10,-5);
points.push(testposition);
points.push(new THREE.Vector3(26,10,12));
points.push(new THREE.Vector3(24,10,17));
points.push(new THREE.Vector3(18,10,18));
}
let j = Math.floor(Math.random()*(4-1+1))+1;
points.push(new THREE.Vector3(-0.5+j*1.4,10,18.5));
// zhajiin[j].waiting = 1;
let mixer = new THREE.AnimationMixer( newhuman );
mixer.runplay = false;
let action = mixer.clipAction( newhuman.animations[ 0 ] );
newhuman.position.copy(position);
newhuman.status = 0;
var stationdirection = Math.floor(Math.random()*(2-1+1))+1;
let newone = {
id:humans.length,
mesh:newhuman,
status:1,
stage:0,
direct:stationdirection,
doorstatus:null,
doors:j,
action:action,
mixer:mixer,
runrail:null
};
humans.push(newone);
newhuman.stage = stage;
newhuman.direct = null;
newhuman.doorstatus = null;
newhuman.doors = null;
newhuman.action = mixer.clipAction( newhuman.animations[ 0 ] );
newhuman.mixer = mixer;
newhuman.runrail = null;
newhuman.speed = 0;
mixers.push(mixer);
humanlist.add(newhuman);
moveanimateinit(newone,humans.length,points,newone.id,0.002);
// return newone;
}
function initstationanimation(object){

View File

@ -44,6 +44,22 @@ export function ModelManager(){
action:null
};
this.train = {
code:null,
screenDoorOpenStatus:"01",
mesh:null,
action:null
};
this.section = {
code:null,
screenDoorOpenStatus:"01",
mesh:null,
action:null
};
this.loadpromise = function (data,mixers){
let initlist = [];
initlist.push(fbxpromise(data.man1,mixers,scope.man1));
@ -52,6 +68,8 @@ export function ModelManager(){
initlist.push(fbxpromise(data.zhajiin,mixers,scope.zhajiin));
initlist.push(fbxpromise(data.zhajiout,mixers,scope.zhajiout));
initlist.push(fbxpromise(data.monitor,mixers,scope.monitor));
initlist.push(fbxpromise(data.train,mixers,scope.train));
initlist.push(fbxpromise(data.section,mixers,scope.section));
return new Promise(function(resolve, reject){

View File

@ -5,6 +5,7 @@ let enter1 = {
name : "enter1",
type : "normal",
stage : "0",
randompoint : new THREE.Vector3(26.6,9.8,-2.7),
railpoints : [
new THREE.Vector3(34,9.8,-6),
new THREE.Vector3(32,9.8,-6)
@ -16,6 +17,7 @@ let enter2 = {
name : "enter2",
type : "normal",
stage : "0",
randompoint : new THREE.Vector3(27,9.8,16),
railpoints : [
new THREE.Vector3(35,9.8,31.5),
new THREE.Vector3(31,9.8,31.5)
@ -27,6 +29,7 @@ let security = {
name : "security",
type : "device",
stage : "1",
randompoint : new THREE.Vector3(8.8,9.8,18),
railpoints : [
new THREE.Vector3(20.5,9.8,18),
new THREE.Vector3(21,9.8,21)
@ -38,6 +41,7 @@ let entergate = {
name : "entergate",
type : "device",
stage : "2",
randompoint : new THREE.Vector3(2.3,9.8,13),
railpoints : [
new THREE.Vector3(6.3,9.8,17.4),
new THREE.Vector3(4.8,9.8,17.4),
@ -52,6 +56,7 @@ let standtop = {
name : "standtop",
type : "stand",
stage : "3",
randompoint : new THREE.Vector3(-64,1.77,0.38),
railpoints : [
new THREE.Vector3(52.1,1.77,-1.8),
new THREE.Vector3(-63.5,1.77,-1.8)
@ -63,6 +68,7 @@ let standdown = {
name : "standdown",
type : "stand",
stage : "3",
randompoint : new THREE.Vector3(-64,1.77,21),
railpoints : [
new THREE.Vector3(52.1,1.77,24),
new THREE.Vector3(-64,1.77,24)
@ -74,6 +80,7 @@ let exitgate = {
name : "exitgate",
type : "device",
stage : "5",
randompoint : new THREE.Vector3(-16,9.8,-0.4),
railpoints : [
new THREE.Vector3(18.8,9.8,-0.27),
new THREE.Vector3(18.8,9.8,1.18),
@ -88,6 +95,7 @@ let exit1 = {
name : "exit1",
type : "normal",
stage : "6",
randompoint : new THREE.Vector3(),
railpoints : [
new THREE.Vector3(28.2,9.8,-7),
new THREE.Vector3(30.5,9.8,-7.4)
@ -99,6 +107,7 @@ let exit2 = {
name : "exit2",
type : "normal",
stage : "6",
randompoint : new THREE.Vector3(),
railpoints : [
new THREE.Vector3(28.3,9.8,28.8),
new THREE.Vector3(31.2,9.8,28.8)
@ -127,6 +136,44 @@ export function ZoneManager() {
scope.list[exit2.name] = new ZoneModel(exit2);
}
this.getinitposition = function(name){
// console.log(scope.list[name]);
let randompoint = new THREE.Vector3(0,scope.list[name].randompoint.y,0);
// console.log(randompoint);
if(name == "enter1"){
randompoint.x = scope.list[name].randompoint.x + Math.random()*8;
randompoint.z = scope.list[name].randompoint.z + Math.random()*8;
}
if(name == "enter2"){
randompoint.x = scope.list[name].randompoint.x + Math.random()*8;
randompoint.z = scope.list[name].randompoint.z + Math.random()*8;
}
if(name == "security"){
randompoint.x = scope.list[name].randompoint.x + Math.random()*10;
randompoint.z = scope.list[name].randompoint.z + Math.random()*2;
}
if(name == "entergate"){
randompoint.x = scope.list[name].randompoint.x + Math.random()*5;
randompoint.z = scope.list[name].randompoint.z - Math.random()*2;
}
if(name == "standtop"){
randompoint.x = scope.list[name].randompoint.x + Math.random()*100;
randompoint.z = scope.list[name].randompoint.z + Math.random();
}
if(name == "standdown"){
randompoint.x = scope.list[name].randompoint.x + Math.random()*100;
randompoint.z = scope.list[name].randompoint.z ;
}
if(name == "exitgate"){
randompoint.x = scope.list[name].randompoint.x + Math.random()*30;
randompoint.z = scope.list[name].randompoint.z + Math.random()*5;
}
// let random = Math.random();
return randompoint;
}
this.getzoneposition = function(name){
// let random = Math.random();
let position = scope.list[name].railline.getPointAt(Math.random());

View File

@ -7,6 +7,7 @@ export function ZoneModel(data) {
this.type = data.type;
this.stage = data.stage;
this.status = 0;
this.randompoint = data.randompoint;
//轨迹点
this.railpoints = data.railpoints;

View File

@ -66,6 +66,7 @@ export function Jlmap3dSubscribe(jlmap3d,routegroup,jsonwebwork) {
// if(event.data.type == 'Simulation_DeviceStatus'){
// devicestatus(event.data);
// }
// console.log(data);
if(event.data._type == 'Simulation_Driver_Change'){
drivingcode = event.data.body.code;
jlmap3d.updatedrivingcode( event.data.body.code);

View File

@ -191,12 +191,12 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
scope.webwork.onmessage = function (event) {
//更新列车位置
// if(scope.datatype == "new"){
//
// UpdateTrainNew(camera,trainlisttest);
// }else{
// UpdateTrain(camera,trainlisttest);
// }
if(scope.datatype == "new"){
// UpdateTrainNew(camera,trainlisttest);
}else{
UpdateTrain(camera,trainlisttest);
}
if(camerarail.moveswitch == true){
// console.log(camerarail.progress);

View File

@ -7,66 +7,68 @@ export function Materialload(jlmap3dedit,assettype){
settexture( jlmap3dedit.materiallist,"green",'../../static/material/signal/3.jpg');
settexture( jlmap3dedit.materiallist,"black",'../../static/material/signal/5.jpg');
if(assettype.stationtexture == "xian3"){
if(jlmap3dedit.stationtexture){
setstationtexture(jlmap3dedit.stationtexture,"stationlist",'../../static/texture/xian3/xian3list.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station18000",'../../static/texture/xian3/Station18000.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station61238",'../../static/texture/xian3/Station61238.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station41790",'../../static/texture/xian3/Station41790.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station67945",'../../static/texture/xian3/Station67945.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station85598",'../../static/texture/xian3/Station85598.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station4324",'../../static/texture/xian3/Station4324.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station55755",'../../static/texture/xian3/Station55755.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station53597",'../../static/texture/xian3/Station53597.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station68029",'../../static/texture/xian3/Station68029.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station17596",'../../static/texture/xian3/Station17596.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station66742",'../../static/texture/xian3/Station66742.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station90701",'../../static/texture/xian3/Station90701.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station90652",'../../static/texture/xian3/Station90652.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station54200",'../../static/texture/xian3/Station54200.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station19253",'../../static/texture/xian3/Station19253.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station37821",'../../static/texture/xian3/Station37821.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station47557",'../../static/texture/xian3/Station47557.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station78551",'../../static/texture/xian3/Station78551.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station64474",'../../static/texture/xian3/Station64474.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station21203",'../../static/texture/xian3/Station21203.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station34499",'../../static/texture/xian3/Station34499.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station571",'../../static/texture/xian3/Station571.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station99903",'../../static/texture/xian3/Station99903.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station43447",'../../static/texture/xian3/Station43447.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station67917",'../../static/texture/xian3/Station67917.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station60649",'../../static/texture/xian3/Station60649.jpg');
if(assettype){
if(assettype.stationtexture == "xian3"){
if(jlmap3dedit.stationtexture){
setstationtexture(jlmap3dedit.stationtexture,"stationlist",'../../static/texture/xian3/xian3list.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station18000",'../../static/texture/xian3/Station18000.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station61238",'../../static/texture/xian3/Station61238.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station41790",'../../static/texture/xian3/Station41790.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station67945",'../../static/texture/xian3/Station67945.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station85598",'../../static/texture/xian3/Station85598.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station4324",'../../static/texture/xian3/Station4324.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station55755",'../../static/texture/xian3/Station55755.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station53597",'../../static/texture/xian3/Station53597.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station68029",'../../static/texture/xian3/Station68029.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station17596",'../../static/texture/xian3/Station17596.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station66742",'../../static/texture/xian3/Station66742.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station90701",'../../static/texture/xian3/Station90701.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station90652",'../../static/texture/xian3/Station90652.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station54200",'../../static/texture/xian3/Station54200.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station19253",'../../static/texture/xian3/Station19253.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station37821",'../../static/texture/xian3/Station37821.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station47557",'../../static/texture/xian3/Station47557.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station78551",'../../static/texture/xian3/Station78551.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station64474",'../../static/texture/xian3/Station64474.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station21203",'../../static/texture/xian3/Station21203.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station34499",'../../static/texture/xian3/Station34499.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station571",'../../static/texture/xian3/Station571.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station99903",'../../static/texture/xian3/Station99903.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station43447",'../../static/texture/xian3/Station43447.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station67917",'../../static/texture/xian3/Station67917.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station60649",'../../static/texture/xian3/Station60649.jpg');
}
}
}
if(assettype.stationtexture == "haerbin1"){
if(jlmap3dedit.stationtexture){
setstationtexture(jlmap3dedit.stationtexture,"stationlist",'../../static/texture/heb/haerbinlist.jpg');
if(assettype.stationtexture == "haerbin1"){
if(jlmap3dedit.stationtexture){
setstationtexture(jlmap3dedit.stationtexture,"stationlist",'../../static/texture/heb/haerbinlist.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station5361",'../../static/texture/heb/Station5361.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station11094",'../../static/texture/heb/Station11094.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station11136",'../../static/texture/heb/Station11136.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station17293",'../../static/texture/heb/Station17293.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station18398",'../../static/texture/heb/Station18398.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station22163",'../../static/texture/heb/Station22163.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station25464",'../../static/texture/heb/Station25464.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station28090",'../../static/texture/heb/Station28090.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station41999",'../../static/texture/heb/Station41999.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station44338",'../../static/texture/heb/Station44338.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station46464",'../../static/texture/heb/Station46464.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station50565",'../../static/texture/heb/Station50565.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station60068",'../../static/texture/heb/Station60068.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station62429",'../../static/texture/heb/Station62429.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station64444",'../../static/texture/heb/Station64444.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station71700",'../../static/texture/heb/Station71700.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station72132",'../../static/texture/heb/Station72132.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station78164",'../../static/texture/heb/Station78164.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station79537",'../../static/texture/heb/Station79537.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station82618",'../../static/texture/heb/Station82618.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station85520",'../../static/texture/heb/Station85520.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station89483",'../../static/texture/heb/Station89483.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station96090",'../../static/texture/heb/Station96090.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station5361",'../../static/texture/heb/Station5361.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station11094",'../../static/texture/heb/Station11094.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station11136",'../../static/texture/heb/Station11136.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station17293",'../../static/texture/heb/Station17293.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station18398",'../../static/texture/heb/Station18398.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station22163",'../../static/texture/heb/Station22163.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station25464",'../../static/texture/heb/Station25464.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station28090",'../../static/texture/heb/Station28090.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station41999",'../../static/texture/heb/Station41999.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station44338",'../../static/texture/heb/Station44338.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station46464",'../../static/texture/heb/Station46464.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station50565",'../../static/texture/heb/Station50565.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station60068",'../../static/texture/heb/Station60068.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station62429",'../../static/texture/heb/Station62429.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station64444",'../../static/texture/heb/Station64444.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station71700",'../../static/texture/heb/Station71700.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station72132",'../../static/texture/heb/Station72132.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station78164",'../../static/texture/heb/Station78164.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station79537",'../../static/texture/heb/Station79537.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station82618",'../../static/texture/heb/Station82618.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station85520",'../../static/texture/heb/Station85520.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station89483",'../../static/texture/heb/Station89483.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station96090",'../../static/texture/heb/Station96090.jpg');
}
}
}
//console.log(jlmap3dedit.materiallist);

View File

@ -2,9 +2,9 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// 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.6:9000'; // 旭强
BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip';

View File

@ -138,6 +138,7 @@ import axios from 'axios';
}
},
updatetrainlist(){
console.log(this.group);
getSimulationTrainlistNew(this.group).then(netdata => {
this.options = [];
this.trainlist = netdata.data;

View File

@ -3,11 +3,11 @@
<div id="jl3d" class="jl3ddraw">
</div>
<!-- <div class="menutop">
<div class="menutop">
<el-button-group>
<el-button type="primary" @click="switchrender">{{rendermode}}</el-button>
</el-button-group>
</div> -->
</div>
<div class="menudown">
<el-button-group>
<el-button type="primary" @click="back">退出</el-button>
@ -18,7 +18,7 @@
</template>
<script>
import Vue from 'vue';
import { Jl3dpassflow } from '@/jlmap3d/jl3dpassflow/jl3dpassflow.js';
import { Jl3dpassflow } from '@/jlmap3d/jl3dpassflow/jl3dpassflownew.js';
import { ProjectIcon } from '@/scripts/ProjectConfig';
export default {

Binary file not shown.

View File

@ -675,7 +675,7 @@ function timedCount(){
// postMessage(data);
// }
//
console.log(e.data);
// console.log(e.data);
if(e.data.type == "init"){
topic = e.data.topic;
@ -695,7 +695,7 @@ function timedCount(){
function callback(Response) {
// console.log(Response);
data = JSON.parse(Response.body);
console.log(data);
// console.log(data);
if(data.type == 'SJL3D_TrainStatus'){
for (let i=0,leni = data.body.length; i<leni; i++) {
postMessage(data.body[i]);