修改三维vr通号上下车切换站台bug,分离三维vr通号中冗杂代码,优化部分vr功能
This commit is contained in:
parent
c38a0acf91
commit
96ffe64eb6
@ -2,8 +2,7 @@ import { Staticmodel } from '@/jlmap3d/jl3ddevice/config.js';
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
//loader
|
||||
import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader';
|
||||
import { OBJLoader } from '@/jlmap3d/main/loaders/OBJLoader';
|
||||
import { Pathfinding } from '@/jlmap3d/jl3dpassflow/utils/Pathfinding.js';
|
||||
|
||||
import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
|
||||
|
||||
import { ModelManagerVR } from '@/jlmap3d/jl3dmaintainer/jl3dFaultDeviceVr/utils/vrloader.js';
|
||||
@ -11,7 +10,9 @@ import { VRButton } from '@/jlmap3d/jl3dmaintainer/jl3dFaultDeviceVr/utils/VRBut
|
||||
import { VrGui } from '@/jlmap3d/jl3dmaintainer/jl3dFaultDeviceVr/utils/vrgui.js';
|
||||
import { TrainControl } from '@/jlmap3d/jl3dmaintainer/jl3dFaultDeviceVr/utils/trainControl.js';
|
||||
import { MoveanimateVr } from '@/jlmap3d/jl3dmaintainer/jl3dFaultDeviceVr/utils/moveanimatevr.js';
|
||||
import { VrVoice } from '@/jlmap3d/jl3dmaintainer/jl3dFaultDeviceVr/utils/vrVoice.js';
|
||||
import { VrPathFinder } from '@/jlmap3d/jl3dmaintainer/jl3dFaultDeviceVr/utils/vrPathFinder.js';
|
||||
|
||||
import { LocalVoice } from '@/jlmap3d/utils/localvoice/localVoice.js';
|
||||
|
||||
import { Textconfig } from '@/jlmap3d/jl3ddevice/component/textconfig.js';
|
||||
import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
|
||||
@ -35,6 +36,22 @@ let vrPlane;
|
||||
//vrUI面板控制状态
|
||||
let vrPlaneStatus = false;
|
||||
|
||||
//vr导航寻路
|
||||
let navStatus = false;
|
||||
let pathPoints = [];
|
||||
let targetPosition = new THREE.Vector3();
|
||||
var textureNav = new THREE.TextureLoader().load( JL3D_LOCAL_STATIC+'/vrtest/daohang.png' );
|
||||
textureNav.wrapS = THREE.RepeatWrapping;
|
||||
textureNav.wrapT=THREE.RepeatWrapping;
|
||||
textureNav.repeat.x = 40;
|
||||
textureNav.repeat.y = 2;
|
||||
var materialNav = new THREE.MeshBasicMaterial( {
|
||||
map: textureNav,
|
||||
|
||||
transparent: true,
|
||||
} );
|
||||
let pathFinderVr = new VrPathFinder();
|
||||
|
||||
let tempMatrix = new THREE.Matrix4();
|
||||
|
||||
let nowdevice = null;
|
||||
@ -58,35 +75,13 @@ let positionStatus = "dm";
|
||||
//列车地板
|
||||
let floors = [];
|
||||
//设定声音
|
||||
let voiceModel = new VrVoice();
|
||||
let voiceModel = new LocalVoice();
|
||||
voiceModel.localVoiceInit();
|
||||
|
||||
export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
|
||||
var scope = this;
|
||||
|
||||
const ZONE = 'level';
|
||||
const SPEED = 10;
|
||||
const OFFSET = 0.2;
|
||||
THREE.Pathfinding = Pathfinding;
|
||||
let groupID,path,level,navmesh;
|
||||
let pathPoints = [];
|
||||
let playerPosition = new THREE.Vector3( -3.5, 0.5, 5.5 );
|
||||
let targetPosition = new THREE.Vector3();
|
||||
let pathFinder = new THREE.Pathfinding();
|
||||
var textureNav = new THREE.TextureLoader().load( JL3D_LOCAL_STATIC+'/vrtest/daohang.png' );
|
||||
textureNav.wrapS = THREE.RepeatWrapping;
|
||||
textureNav.wrapT=THREE.RepeatWrapping;
|
||||
textureNav.repeat.x = 40;
|
||||
textureNav.repeat.y = 2;
|
||||
var materialNav = new THREE.MeshBasicMaterial( {
|
||||
map: textureNav,
|
||||
|
||||
transparent: true,
|
||||
} );
|
||||
let navMesh;
|
||||
let navStatus = false;
|
||||
|
||||
let switchModel;
|
||||
|
||||
this.dom = dom;
|
||||
@ -120,8 +115,6 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
this.renderer.setClearColor(new THREE.Color(0x000000));
|
||||
this.renderer.setPixelRatio( window.devicePixelRatio );
|
||||
this.renderer.setSize(window.innerWidth, window.innerHeight);
|
||||
// this.renderer.shadowMap.enabled = true;
|
||||
// this.renderer.shadowMap.type = THREE.PCFSoftShadowMap;
|
||||
this.renderer.gammaInput = true;
|
||||
this.renderer.gammaOutput = true;
|
||||
this.renderer.vr.enabled = true;
|
||||
@ -164,78 +157,21 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
|
||||
raycastervr = new THREE.Raycaster();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
let loaderObj = new THREE.OBJLoader();
|
||||
|
||||
// load a resource
|
||||
loaderObj.load(
|
||||
// resource URL
|
||||
JL3D_LOCAL_STATIC+'/vrtest/path.obj',
|
||||
// called when resource is loaded
|
||||
function ( object ) {
|
||||
|
||||
|
||||
// console.time('createZone()');
|
||||
|
||||
const zone = THREE.Pathfinding.createZone(object.children[0].geometry);
|
||||
// console.timeEnd('createZone()');
|
||||
|
||||
pathFinder.setZoneData( ZONE, zone );
|
||||
|
||||
const navWireframe = new THREE.Mesh(object.children[0].geometry, new THREE.MeshBasicMaterial({
|
||||
color: 0x808080,
|
||||
wireframe: true
|
||||
}));
|
||||
navWireframe.position.y = OFFSET / 2;
|
||||
// scene.add(navWireframe);
|
||||
|
||||
navmesh = object;
|
||||
|
||||
// scene.add(navmesh);
|
||||
// movegroup.add(navmesh);
|
||||
// Set the player's navigation mesh group
|
||||
groupID = pathFinder.getGroup( ZONE, playerPosition );
|
||||
|
||||
},
|
||||
// called when loading is in progresses
|
||||
function ( xhr ) {
|
||||
|
||||
console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
|
||||
|
||||
},
|
||||
// called when loading has errors
|
||||
function ( error ) {
|
||||
|
||||
console.log( 'An error happened' );
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
let moveanima = new MoveanimateVr(scope);
|
||||
|
||||
//定义全局光
|
||||
let ambientLight = new THREE.AmbientLight(0xffffff, 1.3);
|
||||
this.scene.add(ambientLight);
|
||||
|
||||
//鼠标轨道相机控制
|
||||
this.controls = new THREE.OrbitControls(scope.camera, dom);
|
||||
// this.controls.maxPolarAngle = Math.PI / 2;
|
||||
// this.controls.minPolarangle = Math.PI / 5;
|
||||
this.controls.maxDistance = 600;
|
||||
// this.controls.screenSpacePanning = true;
|
||||
this.controls.target.set( 0, 1.6, 0 );
|
||||
|
||||
this.controls.update();
|
||||
|
||||
|
||||
//鼠标点击事件
|
||||
document.addEventListener( "mousedown", onselect, false );
|
||||
|
||||
|
||||
let vrwebworker = new Worker(JL3D_LOCAL_STATIC+"/workertest/vrwebworker.js");
|
||||
|
||||
let connectmsg = {
|
||||
@ -247,7 +183,7 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
vrwebworker.postMessage(connectmsg);
|
||||
|
||||
vrwebworker.onmessage = function (event) {
|
||||
|
||||
//获取故障信息
|
||||
if(event.data.type == "Device_Fault_Set_3D"){
|
||||
let newfault = {
|
||||
code:event.data.body.code,
|
||||
@ -292,11 +228,12 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
|
||||
}
|
||||
faultList.push(newfault)
|
||||
updateFaultList();
|
||||
vrPlane.updataFaultList(faultList);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
//在车上时
|
||||
if(event.data.type == "takeTopTrain"){
|
||||
|
||||
for(let i=0,leni=stationList.length;i<leni;i++){
|
||||
@ -308,16 +245,21 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
type:'station',
|
||||
station:scope.nowstation
|
||||
};
|
||||
|
||||
let voicetext = scope.nowstation.name.split("(");
|
||||
voiceModel.localVoicePlay("列车即将进站"+voicetext[0]);
|
||||
if(positionStatus == "topfloor"){
|
||||
trainControl.sound.pause();
|
||||
}
|
||||
if(positionStatus == "downfloor"){
|
||||
trainControl.sound.pause();
|
||||
}
|
||||
|
||||
vrwebworker.postMessage(stationworket);
|
||||
vrPlane.updataStationMsg(scope.nowstation);
|
||||
trainControl.toptrain.position.x = 20000;
|
||||
trainControl.downtrain.position.x = 20000;
|
||||
|
||||
let voicetext = scope.nowstation.name.split("(");
|
||||
voiceModel.localVoicePlay("列车即将进站"+voicetext[0]);
|
||||
|
||||
|
||||
|
||||
trainControl.toptrain.status = "0";
|
||||
trainControl.downtrain.status = "0";
|
||||
scope.nowStationModel.getObjectByName("zhantaiming").material.map = scope.stationtexture[scope.nowstation.code];
|
||||
@ -329,7 +271,7 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
//在车上时
|
||||
if(event.data.type == "takeDownTrain"){
|
||||
|
||||
for(let i=0,leni=stationList.length;i<leni;i++){
|
||||
@ -361,20 +303,19 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
}
|
||||
}
|
||||
|
||||
if(event.data.type == "topTrain"){
|
||||
|
||||
if(event.data.type == "topTrain"){
|
||||
if(trainControl.toptrain.status != 1){
|
||||
trainControl.toptrain.position.copy(trainControl.toptrain.curve.getPointAt(event.data.offset));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(event.data.type == "downTrain"){
|
||||
if(trainControl.downtrain.status != 1){
|
||||
trainControl.downtrain.position.copy(trainControl.downtrain.curve.getPointAt(event.data.offset));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//上行列车车门控制
|
||||
if(event.data.type == "topTrainDoor"){
|
||||
|
||||
if(event.data.open == "0"){
|
||||
@ -386,6 +327,7 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
}
|
||||
|
||||
}
|
||||
//下行列车车门控制
|
||||
if(event.data.type == "downTrainDoor"){
|
||||
if(event.data.open == "0"){
|
||||
trainControl.closetraindoor(trainControl.downtrain,event.data.doorCode,positionStatus,"down");
|
||||
@ -396,7 +338,7 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//上行屏蔽门
|
||||
if(event.data.type == "topPsd"){
|
||||
|
||||
if(event.data.open == 0){
|
||||
@ -412,6 +354,7 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
deviceaction.top.action.play();
|
||||
}
|
||||
}
|
||||
//下行屏蔽门
|
||||
if(event.data.type == "downPsd"){
|
||||
if(event.data.open == 0){
|
||||
deviceaction.down.action.reset();
|
||||
@ -425,20 +368,21 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
deviceaction.down.action.play();
|
||||
}
|
||||
}
|
||||
|
||||
//道岔切换
|
||||
if(event.data.type == "SWITCH"){
|
||||
scope.updateaction(event.data);
|
||||
}
|
||||
//故障修复信息
|
||||
if(event.data.type == "Device_Fault_Over_3D"){
|
||||
for (let i = 0, leni = faultList.length; i < leni; i++) {
|
||||
if (event.data.body.code == faultList[i].code) {
|
||||
faultList.splice(i, 1);
|
||||
updateFaultList();
|
||||
vrPlane.updataFaultList(faultList);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//获取初始故障
|
||||
if(event.data.type == "Device_Load_Destroy_3D"){
|
||||
|
||||
let fault = event.data.body.faultInfoList;
|
||||
@ -489,20 +433,17 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
faultList.push(newfault)
|
||||
|
||||
}
|
||||
updateFaultList();
|
||||
vrPlane.updataFaultList(faultList);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
window.onresize = function () {
|
||||
scope.camera.aspect = window.innerWidth / window.innerHeight;
|
||||
scope.camera.updateProjectionMatrix();
|
||||
scope.renderer.setSize(window.innerWidth, window.innerHeight);
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.modelmanager = new ModelManagerVR();
|
||||
getPublishMapDetail(skinCode).then(netdata => {
|
||||
let mapnetdata = netdata.data;
|
||||
@ -533,13 +474,9 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
// switchModel.position.set(switchPos.x,switchPos.y,switchPos.z);
|
||||
human.position.set(switchModel.matrixWorld.elements[12],switchModel.matrixWorld.elements[13],switchModel.matrixWorld.elements[14]);
|
||||
|
||||
|
||||
initstationanimation(scope.modelmanager.stationIn.mesh);
|
||||
initstationanimation(scope.modelmanager.stationOut.mesh);
|
||||
|
||||
|
||||
|
||||
|
||||
// scope.modelmanager.otherDevice.mesh.scale.set(0.1,0.1,0.1);
|
||||
if(scope.nowstation.inside == true){
|
||||
scope.nowStationModel = scope.modelmanager.stationOut.mesh;
|
||||
@ -551,11 +488,14 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
trainControl.inittrain(scope.scene,scope.modelmanager.train.mesh,scope.modelmanager.train.animations,mixers);
|
||||
floors.push(trainControl.toptrain.floor);
|
||||
floors.push(trainControl.downtrain.floor);
|
||||
floors.push(navmesh.children[0]);
|
||||
|
||||
|
||||
|
||||
let detectedVRDevices;
|
||||
let timer=setInterval(function(){
|
||||
if(pathFinderVr.navmesh){
|
||||
floors.push(pathFinderVr.navmesh.children[0]);
|
||||
}
|
||||
|
||||
if(scope.stationtexture["stationlist"]){
|
||||
vrPlane.setStationPlane(stationList,scope.stationtexture);
|
||||
@ -593,15 +533,11 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
}
|
||||
},1000);
|
||||
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
function onselect(event){
|
||||
//定义光线
|
||||
let raycaster = new THREE.Raycaster();
|
||||
@ -699,8 +635,8 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
}
|
||||
|
||||
if(object.name == "nav"){
|
||||
if(navMesh){
|
||||
scope.scene.remove( navMesh );
|
||||
if(pathFinderVr.navmesh){
|
||||
scope.scene.remove( pathFinderVr.navmesh );
|
||||
}
|
||||
if(navStatus){
|
||||
navStatus = false;
|
||||
@ -709,23 +645,17 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
pathPoints = [];
|
||||
let startPoint = new THREE.Vector3(human.position.x,human.position.y-0.6,human.position.z);
|
||||
pathPoints.push(new THREE.Vector3(human.position.x,human.position.y,human.position.z));
|
||||
groupID = pathFinder.getGroup( ZONE, startPoint );
|
||||
targetPosition = new THREE.Vector3(switchModel.matrixWorld.elements[12],-5.596,switchModel.matrixWorld.elements[14]);
|
||||
//
|
||||
// console.log(pathPoints[0]);
|
||||
// console.log(targetPosition);
|
||||
// console.log(ZONE);
|
||||
// console.log(groupID);
|
||||
let path = pathFinder.findPath( startPoint, targetPosition, ZONE, groupID );
|
||||
|
||||
let path = pathFinderVr.find(startPoint,targetPosition);
|
||||
if(path){
|
||||
for(let i=0;i<path.length;i++){
|
||||
pathPoints.push(new THREE.Vector3(path[i].x,path[i].y+0.6,path[i].z));
|
||||
}
|
||||
let curve = new THREE.CatmullRomCurve3(pathPoints,false);
|
||||
var geometry = new THREE.TubeGeometry( curve, 100, 0.2, 50, false );
|
||||
navMesh = new THREE.Mesh( geometry, materialNav );
|
||||
scope.scene.add( navMesh );
|
||||
pathFinderVr.navmesh = new THREE.Mesh( geometry, materialNav );
|
||||
scope.scene.add( pathFinderVr.navmesh );
|
||||
}
|
||||
}
|
||||
|
||||
@ -764,161 +694,154 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
// console.log(event);
|
||||
let clickGui = getGuiButton(controller);
|
||||
if(clickGui.length > 0){
|
||||
if(positionStatus == "dm"){
|
||||
if(vrPlaneStatus){
|
||||
var intersection = clickGui[ 0 ];
|
||||
var object = intersection.object;
|
||||
|
||||
if(object.name == "buttonHome"){
|
||||
vrPlane.homeButtonClick();
|
||||
}
|
||||
|
||||
if(vrPlaneStatus){
|
||||
var intersection = clickGui[ 0 ];
|
||||
var object = intersection.object;
|
||||
if(object.name == "buttonStationList"){
|
||||
vrPlane.stationListButtonClick();
|
||||
}
|
||||
|
||||
if(object.name == "buttonHome"){
|
||||
vrPlane.homeButtonClick();
|
||||
}
|
||||
if(object.name == "buttonFaultList"){
|
||||
vrPlane.faultListButtonClick();
|
||||
}
|
||||
|
||||
if(object.name == "buttonStationList"){
|
||||
vrPlane.stationListButtonClick();
|
||||
}
|
||||
|
||||
if(object.name == "buttonFaultList"){
|
||||
vrPlane.faultListButtonClick();
|
||||
}
|
||||
|
||||
// if(object.name == "buttonPrevious"){
|
||||
// vrPlane.previousButtonClick();
|
||||
// }
|
||||
//
|
||||
// if(object.name == "buttonNext"){
|
||||
// vrPlane.nextButtonClick();
|
||||
// }
|
||||
if(object.name == "stationList"){
|
||||
for(let i=0,leni=stationList.length;i<leni;i++){
|
||||
if(stationList[i].code == object.code){
|
||||
if(scope.nowstation.inside != stationList[i].inside){
|
||||
if(stationList[i].inside == true){
|
||||
scope.scene.remove(scope.nowStationModel);
|
||||
scope.nowStationModel = scope.modelmanager.stationOut.mesh;
|
||||
scope.scene.add(scope.nowStationModel);
|
||||
}else{
|
||||
scope.scene.remove(scope.nowStationModel);
|
||||
scope.nowStationModel = scope.modelmanager.stationIn.mesh;
|
||||
scope.scene.add(scope.nowStationModel);
|
||||
// if(object.name == "buttonPrevious"){
|
||||
// vrPlane.previousButtonClick();
|
||||
// }
|
||||
//
|
||||
// if(object.name == "buttonNext"){
|
||||
// vrPlane.nextButtonClick();
|
||||
// }
|
||||
if(object.name == "stationList"){
|
||||
for(let i=0,leni=stationList.length;i<leni;i++){
|
||||
if(stationList[i].code == object.code){
|
||||
if(scope.nowstation.inside != stationList[i].inside){
|
||||
if(stationList[i].inside == true){
|
||||
scope.scene.remove(scope.nowStationModel);
|
||||
scope.nowStationModel = scope.modelmanager.stationOut.mesh;
|
||||
scope.scene.add(scope.nowStationModel);
|
||||
}else{
|
||||
scope.scene.remove(scope.nowStationModel);
|
||||
scope.nowStationModel = scope.modelmanager.stationIn.mesh;
|
||||
scope.scene.add(scope.nowStationModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scope.nowstation = stationList[i];
|
||||
let stationworket = {
|
||||
type:'station',
|
||||
station:scope.nowstation
|
||||
scope.nowstation = stationList[i];
|
||||
let stationworket = {
|
||||
type:'station',
|
||||
station:scope.nowstation
|
||||
};
|
||||
vrwebworker.postMessage(stationworket);
|
||||
vrPlane.updataStationMsg(scope.nowstation);
|
||||
scope.nowStationModel.getObjectByName("zhantaiming").material.map = scope.stationtexture[scope.nowstation.code];
|
||||
scope.nowStationModel.getObjectByName("zhantaiming").material.map.needsUpdate = true;
|
||||
trainControl.toptrain.position.x = 20000;
|
||||
trainControl.downtrain.position.x = 20000;
|
||||
trainControl.toptrain.status = "0";
|
||||
trainControl.downtrain.status = "0";
|
||||
i = leni;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(object.name == "faultList"){
|
||||
for(let i=0,leni=faultList.length;i<leni;i++){
|
||||
if(faultList[i].code == object.code){
|
||||
nowdevice = faultList[i];
|
||||
vrPlane.updataDeviceFaultMsg(faultList[i]);
|
||||
i = leni;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(object.name == "shebeijian"){
|
||||
human.position.set( 41.30, 6.05+0.6, -5.55);
|
||||
}
|
||||
if(object.name == "jiankongshi"){
|
||||
human.position.set( 28.30, 6.05+0.6,5.65);
|
||||
}
|
||||
if(object.name == "station1"){
|
||||
human.position.set( -12.21, 1.38+0.6, 3.49);
|
||||
}
|
||||
if(object.name == "station2"){
|
||||
human.position.set( -0.63, 6.05+0.6, 4.40 );
|
||||
}
|
||||
|
||||
if(object.name == "anime"){
|
||||
if(scope.animastats){
|
||||
scope.animastats = false;
|
||||
moveanima.setplaylist(moveanima.animatelist["undefinedon"],true)
|
||||
}else{
|
||||
scope.animastats = true;
|
||||
moveanima.setplaylist(moveanima.animatelist["undefinedoff"],true);
|
||||
}
|
||||
}
|
||||
|
||||
if(object.name == "nav"){
|
||||
if(pathFinderVr.navmesh){
|
||||
scope.scene.remove( pathFinderVr.navmesh );
|
||||
}
|
||||
|
||||
if(navStatus){
|
||||
navStatus = false;
|
||||
}else{
|
||||
navStatus = true;
|
||||
pathPoints = [];
|
||||
let startPoint = new THREE.Vector3(human.position.x,human.position.y-0.6,human.position.z);
|
||||
pathPoints.push(new THREE.Vector3(human.position.x,human.position.y,human.position.z));
|
||||
|
||||
targetPosition = new THREE.Vector3(switchModel.matrixWorld.elements[12],switchModel.matrixWorld.elements[13],switchModel.matrixWorld.elements[14]);
|
||||
|
||||
|
||||
let path = pathFinderVr.find(startPoint,targetPosition);
|
||||
|
||||
|
||||
if(path){
|
||||
for(let i=0;i<path.length;i++){
|
||||
pathPoints.push(new THREE.Vector3(path[i].x,path[i].y+0.6,path[i].z));
|
||||
}
|
||||
let curve = new THREE.CatmullRomCurve3(pathPoints,false);
|
||||
var geometry = new THREE.TubeGeometry( curve, 100, 0.2, 50, false );
|
||||
pathFinderVr.navmesh = new THREE.Mesh( geometry, materialNav );
|
||||
scope.scene.add( pathFinderVr.navmesh );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(object.name == "reset"){
|
||||
scope.resetmodel();
|
||||
}
|
||||
|
||||
if(object.name == "repire"){
|
||||
if(nowdevice){
|
||||
let command = {
|
||||
code:nowdevice.code,
|
||||
faultType:nowdevice.fault,
|
||||
};
|
||||
vrwebworker.postMessage(stationworket);
|
||||
vrPlane.updataStationMsg(scope.nowstation);
|
||||
scope.nowStationModel.getObjectByName("zhantaiming").material.map = scope.stationtexture[scope.nowstation.code];
|
||||
scope.nowStationModel.getObjectByName("zhantaiming").material.map.needsUpdate = true;
|
||||
trainControl.toptrain.position.x = 20000;
|
||||
trainControl.downtrain.position.x = 20000;
|
||||
trainControl.toptrain.status = "0";
|
||||
trainControl.downtrain.status = "0";
|
||||
i = leni;
|
||||
sendCommandNew(group,"Cancel_Fault", command).then((response) => {
|
||||
resolve(response);
|
||||
if(response.code == 200){
|
||||
|
||||
nowdevice = null;
|
||||
}
|
||||
}).catch(error => {
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(object.name == "faultList"){
|
||||
for(let i=0,leni=faultList.length;i<leni;i++){
|
||||
if(faultList[i].code == object.code){
|
||||
nowdevice = faultList[i];
|
||||
vrPlane.updataDeviceFaultMsg(faultList[i]);
|
||||
i = leni;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(object.name == "shebeijian"){
|
||||
human.position.set( 41.30, 6.05+0.6, -5.55);
|
||||
}
|
||||
if(object.name == "jiankongshi"){
|
||||
human.position.set( 28.30, 6.05+0.6,5.65);
|
||||
}
|
||||
if(object.name == "station1"){
|
||||
human.position.set( -12.21, 1.38+0.6, 3.49);
|
||||
}
|
||||
if(object.name == "station2"){
|
||||
human.position.set( -0.63, 6.05+0.6, 4.40 );
|
||||
}
|
||||
|
||||
if(object.name == "anime"){
|
||||
if(scope.animastats){
|
||||
scope.animastats = false;
|
||||
moveanima.setplaylist(moveanima.animatelist["undefinedon"],true)
|
||||
}else{
|
||||
scope.animastats = true;
|
||||
moveanima.setplaylist(moveanima.animatelist["undefinedoff"],true);
|
||||
}
|
||||
}
|
||||
|
||||
if(object.name == "nav"){
|
||||
if(navMesh){
|
||||
scope.scene.remove( navMesh );
|
||||
}
|
||||
|
||||
if(navStatus){
|
||||
navStatus = false;
|
||||
}else{
|
||||
navStatus = true;
|
||||
pathPoints = [];
|
||||
let startPoint = new THREE.Vector3(human.position.x,human.position.y-0.6,human.position.z);
|
||||
pathPoints.push(new THREE.Vector3(human.position.x,human.position.y,human.position.z));
|
||||
groupID = pathFinder.getGroup( ZONE, startPoint );
|
||||
targetPosition = new THREE.Vector3(switchModel.matrixWorld.elements[12],switchModel.matrixWorld.elements[13],switchModel.matrixWorld.elements[14]);
|
||||
|
||||
//
|
||||
// console.log(pathPoints[0]);
|
||||
// console.log(targetPosition);
|
||||
// console.log(ZONE);
|
||||
// console.log(groupID);
|
||||
let path = pathFinder.findPath( startPoint, targetPosition, ZONE, groupID );
|
||||
|
||||
if(path){
|
||||
for(let i=0;i<path.length;i++){
|
||||
pathPoints.push(new THREE.Vector3(path[i].x,path[i].y+0.6,path[i].z));
|
||||
}
|
||||
let curve = new THREE.CatmullRomCurve3(pathPoints,false);
|
||||
var geometry = new THREE.TubeGeometry( curve, 100, 0.2, 50, false );
|
||||
navMesh = new THREE.Mesh( geometry, materialNav );
|
||||
scope.scene.add( navMesh );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(object.name == "reset"){
|
||||
scope.resetmodel();
|
||||
}
|
||||
|
||||
if(object.name == "repire"){
|
||||
if(nowdevice){
|
||||
let command = {
|
||||
code:nowdevice.code,
|
||||
faultType:nowdevice.fault,
|
||||
};
|
||||
sendCommandNew(group,"Cancel_Fault", command).then((response) => {
|
||||
resolve(response);
|
||||
if(response.code == 200){
|
||||
|
||||
nowdevice = null;
|
||||
}
|
||||
}).catch(error => {
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}else{
|
||||
var intersections = getIntersections( controller );
|
||||
// console.log(intersections);
|
||||
@ -929,15 +852,15 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
if(positionStatus != intersection.object.name){
|
||||
positionStatus = intersection.object.name;
|
||||
|
||||
if(intersection.object.name == "dm"){
|
||||
if(positionStatus == "dm"){
|
||||
scope.scene.add(human);
|
||||
vrwebworker.postMessage("takeStation");
|
||||
}
|
||||
if(intersection.object.name == "topfloor"){
|
||||
if(positionStatus == "topfloor"){
|
||||
trainControl.toptrain.add(human);
|
||||
vrwebworker.postMessage("takeTopTrain");
|
||||
}
|
||||
if(intersection.object.name == "downfloor"){
|
||||
if(positionStatus == "downfloor"){
|
||||
trainControl.downtrain.add(human);
|
||||
vrwebworker.postMessage("takeDownTrain");
|
||||
}
|
||||
@ -972,81 +895,73 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
};
|
||||
vrwebworker.postMessage(postData);
|
||||
|
||||
// var object = intersection.object;
|
||||
// // object.matrix.premultiply( tempMatrix );
|
||||
// // object.matrix.decompose( object.position, object.quaternion, object.scale );
|
||||
// // object.material.emissive.b = 1;
|
||||
// // controller.add( object );
|
||||
//
|
||||
// // controller.userData.selected = object;
|
||||
// // console.log(object.matrixWorld.elements);
|
||||
// human.position.set( intersection.point.x, intersection.point.y+0.6, intersection.point.z );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onSelectEnd( event ) {
|
||||
var controller = event.target;
|
||||
if ( controller.userData.selected !== undefined ) {
|
||||
// var object = controller.userData.selected;
|
||||
// object.matrix.premultiply( controller.matrixWorld );
|
||||
// object.matrix.decompose( object.position, object.quaternion, object.scale );
|
||||
// object.material.emissive.b = 0;
|
||||
// group.add( object );
|
||||
controller.userData.selected = undefined;
|
||||
}
|
||||
}
|
||||
function onSelectEnd( event ) {
|
||||
var controller = event.target;
|
||||
if ( controller.userData.selected !== undefined ) {
|
||||
// var object = controller.userData.selected;
|
||||
// object.matrix.premultiply( controller.matrixWorld );
|
||||
// object.matrix.decompose( object.position, object.quaternion, object.scale );
|
||||
// object.material.emissive.b = 0;
|
||||
// group.add( object );
|
||||
controller.userData.selected = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function onControlModelStart( event ) {
|
||||
// var controller = event.target;
|
||||
// var intersections = getIntersections( controller );
|
||||
// if ( intersections.length > 0 ) {
|
||||
//
|
||||
// // for(){}
|
||||
// // console.log(intersections);
|
||||
// var intersection = intersections[ 0 ];
|
||||
// // console.log(intersection);
|
||||
// // tempMatrix.getInverse( controller.matrixWorld );
|
||||
// //
|
||||
// // var object = intersection.object;
|
||||
// // object.matrix.premultiply( tempMatrix );
|
||||
// // object.matrix.decompose( object.position, object.quaternion, object.scale );
|
||||
// // object.material.emissive.b = 1;
|
||||
// // controller.add( object );
|
||||
//
|
||||
// }
|
||||
function onControlModelStart( event ) {
|
||||
// var controller = event.target;
|
||||
// var intersections = getIntersections( controller );
|
||||
// if ( intersections.length > 0 ) {
|
||||
//
|
||||
// // for(){}
|
||||
// // console.log(intersections);
|
||||
// var intersection = intersections[ 0 ];
|
||||
// // console.log(intersection);
|
||||
// // tempMatrix.getInverse( controller.matrixWorld );
|
||||
// //
|
||||
// // var object = intersection.object;
|
||||
// // object.matrix.premultiply( tempMatrix );
|
||||
// // object.matrix.decompose( object.position, object.quaternion, object.scale );
|
||||
// // object.material.emissive.b = 1;
|
||||
// // controller.add( object );
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function onControlModelEnd( event ) {
|
||||
var controller = event.target;
|
||||
if ( controller.userData.selected !== undefined ) {
|
||||
// var object = controller.userData.selected;
|
||||
// object.matrix.premultiply( controller.matrixWorld );
|
||||
// object.matrix.decompose( object.position, object.quaternion, object.scale );
|
||||
// // object.material.emissive.b = 0;
|
||||
// group.add( object );
|
||||
// controller.userData.selected = undefined;
|
||||
}
|
||||
}
|
||||
function onControlModelEnd( event ) {
|
||||
var controller = event.target;
|
||||
if ( controller.userData.selected !== undefined ) {
|
||||
// var object = controller.userData.selected;
|
||||
// object.matrix.premultiply( controller.matrixWorld );
|
||||
// object.matrix.decompose( object.position, object.quaternion, object.scale );
|
||||
// // object.material.emissive.b = 0;
|
||||
// group.add( object );
|
||||
// controller.userData.selected = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function squeezeStart(){
|
||||
scope.modelmanager.otherDevice.action.play();
|
||||
if(vrPlaneStatus){
|
||||
vrPlaneStatus = false;
|
||||
|
||||
// vrPlane.group.position.copy(circle.position);
|
||||
vrPlane.group.position.set(10000,10000,10000);
|
||||
scope.scene.remove( vrPlane.group );
|
||||
if(positionStatus == "dm"){
|
||||
if(vrPlaneStatus){
|
||||
vrPlaneStatus = false;
|
||||
// vrPlane.group.position.copy(circle.position);
|
||||
vrPlane.group.position.set(10000,10000,10000);
|
||||
scope.scene.remove( vrPlane.group );
|
||||
}else{
|
||||
vrPlaneStatus = true;
|
||||
vrPlane.group.position.copy(circle.position);
|
||||
vrPlane.group.lookAt(human.position);
|
||||
scope.scene.add( vrPlane.group );
|
||||
}
|
||||
}else{
|
||||
vrPlaneStatus = true;
|
||||
vrPlane.group.position.copy(circle.position);
|
||||
vrPlane.group.lookAt(human.position);
|
||||
scope.scene.add( vrPlane.group );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.animationmsgshowon = function(nowobject){
|
||||
@ -1138,7 +1053,6 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
function intersectObjects( controller ) {
|
||||
|
||||
var intersections = getIntersections( controller );
|
||||
@ -1155,7 +1069,6 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
|
||||
|
||||
function animate() {
|
||||
|
||||
scope.renderer.setAnimationLoop( render );
|
||||
}
|
||||
|
||||
@ -1166,7 +1079,7 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
let delta = clock.getDelta();
|
||||
if (mixers) {
|
||||
for (let i = 0; i < mixers.length; i++) {
|
||||
if (mixers[i]) {
|
||||
if (mixers[i]._actions[0].isRunning()) {
|
||||
mixers[i].update(delta);
|
||||
}
|
||||
}
|
||||
@ -1182,7 +1095,6 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
};
|
||||
|
||||
this.updateaction = function (data) {
|
||||
console.log(data);
|
||||
if (data.type == "SWITCH") {
|
||||
if (data.normal == "0") {
|
||||
scope.modelmanager.otherDevice.normalPosition = "0";
|
||||
@ -1197,12 +1109,9 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
scope.modelmanager.otherDevice.action.timeScale = -1;
|
||||
scope.modelmanager.otherDevice.action.play();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getdevicemsg(selectname){
|
||||
// console.log(selectname);
|
||||
for(let i=0,leni=scope.devicetext.devicelist.length;i<leni;i++){
|
||||
@ -1281,10 +1190,6 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
// console.log(scope.nowstation);
|
||||
}
|
||||
|
||||
function updateFaultList(){
|
||||
vrPlane.updataFaultList(faultList);
|
||||
}
|
||||
|
||||
function initstationanimation(object){
|
||||
let mixer = new THREE.AnimationMixer( object );
|
||||
|
||||
@ -1339,68 +1244,5 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
}
|
||||
|
||||
|
||||
function setTextVr(intersects,plane){
|
||||
|
||||
if(intersects.text){
|
||||
let textgeometry = new THREE.PlaneBufferGeometry( 1.2, 0.8, 1 );
|
||||
let textt = new THREE.CanvasTexture(getTextCanvas(intersects));
|
||||
let textmaterial = new THREE.MeshBasicMaterial( {
|
||||
side: THREE.DoubleSide,
|
||||
map:textt ,transparent: true,
|
||||
alphaTest:0.1
|
||||
} );
|
||||
if(textplane){
|
||||
scope.scene.remove(textplane);
|
||||
textplane.geometry.dispose();
|
||||
textplane.material.dispose();
|
||||
}
|
||||
textplane= new THREE.Mesh( textgeometry, textmaterial );
|
||||
// textplane.name = data[i].code;
|
||||
textplane.position.x = 0;
|
||||
textplane.position.y = 1.55;
|
||||
textplane.position.z = 0.01;
|
||||
// console.log(textplane.position);
|
||||
// textplane.tcode = data[i].code;
|
||||
// textplane.rotation.y = -Math.PI/2;
|
||||
// scope.textlist.push(textplane);
|
||||
// newmesh.children[0].add(textplane);
|
||||
|
||||
plane.group.add(textplane);
|
||||
|
||||
textgeometry.dispose();
|
||||
textmaterial.dispose();
|
||||
textt.dispose();
|
||||
}
|
||||
}
|
||||
var beauty = new Image();
|
||||
beauty.src = JL3D_LOCAL_STATIC+"/texture/scene.png";
|
||||
//canvas文字贴图方法
|
||||
//PS:待提炼 增强功能
|
||||
function getTextCanvas(text){
|
||||
var canvas = document.getElementById('canvastexture');
|
||||
|
||||
canvas.width = 256;
|
||||
canvas.height = 128;
|
||||
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
//var bg = canvas.createPattern(img, "no-repeat");
|
||||
//ctx.fillStyle = bg;
|
||||
ctx.fillRect(0, 0,256,128);
|
||||
ctx.font = "20px Verdana";
|
||||
ctx.fillStyle = '#FFFFFF';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.textBaseline = 'middle';
|
||||
ctx.clearRect(0,0,256,128);
|
||||
//console.log(text.groupNumber);
|
||||
ctx.drawImage(beauty,0,0,256, 128);
|
||||
ctx.fillText("新的设备故障", 110,30);
|
||||
ctx.fillText(text.name, 110,65);
|
||||
ctx.fillText("故障原因:"+text.text, 110,100);
|
||||
//ctx.fillText(text.trainModel.name, width/2,height*3/4);
|
||||
let data = ctx.getImageData(0, 0,256, 128);
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,68 @@
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
import { Pathfinding } from '@/jlmap3d/utils/pathfinder/Pathfinding.js';
|
||||
import { OBJLoader } from '@/jlmap3d/main/loaders/OBJLoader';
|
||||
|
||||
export function VrPathFinder(){
|
||||
let scope = this;
|
||||
this.navmesh = null;
|
||||
|
||||
const ZONE = 'level';
|
||||
const SPEED = 10;
|
||||
const OFFSET = 0.2;
|
||||
THREE.Pathfinding = Pathfinding;
|
||||
let groupID,path,level;
|
||||
let playerPosition = new THREE.Vector3( -3.5, 0.5, 5.5 );
|
||||
|
||||
let pathFinder = new THREE.Pathfinding();
|
||||
|
||||
|
||||
|
||||
let loaderObj = new THREE.OBJLoader();
|
||||
|
||||
// load a resource
|
||||
loaderObj.load(
|
||||
// resource URL
|
||||
JL3D_LOCAL_STATIC+'/vrtest/path.obj',
|
||||
// called when resource is loaded
|
||||
function ( object ) {
|
||||
|
||||
|
||||
// console.time('createZone()');
|
||||
|
||||
const zone = THREE.Pathfinding.createZone(object.children[0].geometry);
|
||||
// console.timeEnd('createZone()');
|
||||
|
||||
pathFinder.setZoneData( ZONE, zone );
|
||||
|
||||
const navWireframe = new THREE.Mesh(object.children[0].geometry, new THREE.MeshBasicMaterial({
|
||||
color: 0x808080,
|
||||
wireframe: true
|
||||
}));
|
||||
navWireframe.position.y = OFFSET / 2;
|
||||
// scene.add(navWireframe);
|
||||
|
||||
scope.navmesh = object;
|
||||
|
||||
|
||||
groupID = pathFinder.getGroup( ZONE, playerPosition );
|
||||
|
||||
},
|
||||
// called when loading is in progresses
|
||||
function ( xhr ) {
|
||||
|
||||
console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
|
||||
|
||||
},
|
||||
// called when loading has errors
|
||||
function ( error ) {
|
||||
|
||||
console.log( 'An error happened' );
|
||||
|
||||
}
|
||||
);
|
||||
this.find = function(startPoint,targetPosition){
|
||||
groupID = pathFinder.getGroup( ZONE, startPoint );
|
||||
let resultPath = pathFinder.findPath( startPoint, targetPosition, ZONE, groupID );
|
||||
return resultPath;
|
||||
}
|
||||
}
|
63
src/jlmap3d/jl3dmaintainer/jl3dFaultDeviceVr/utils/vrText.js
Normal file
63
src/jlmap3d/jl3dmaintainer/jl3dFaultDeviceVr/utils/vrText.js
Normal file
@ -0,0 +1,63 @@
|
||||
function setTextVr(intersects,plane){
|
||||
|
||||
if(intersects.text){
|
||||
let textgeometry = new THREE.PlaneBufferGeometry( 1.2, 0.8, 1 );
|
||||
let textt = new THREE.CanvasTexture(getTextCanvas(intersects));
|
||||
let textmaterial = new THREE.MeshBasicMaterial( {
|
||||
side: THREE.DoubleSide,
|
||||
map:textt ,transparent: true,
|
||||
alphaTest:0.1
|
||||
} );
|
||||
if(textplane){
|
||||
scope.scene.remove(textplane);
|
||||
textplane.geometry.dispose();
|
||||
textplane.material.dispose();
|
||||
}
|
||||
textplane= new THREE.Mesh( textgeometry, textmaterial );
|
||||
// textplane.name = data[i].code;
|
||||
textplane.position.x = 0;
|
||||
textplane.position.y = 1.55;
|
||||
textplane.position.z = 0.01;
|
||||
// console.log(textplane.position);
|
||||
// textplane.tcode = data[i].code;
|
||||
// textplane.rotation.y = -Math.PI/2;
|
||||
// scope.textlist.push(textplane);
|
||||
// newmesh.children[0].add(textplane);
|
||||
|
||||
plane.group.add(textplane);
|
||||
|
||||
textgeometry.dispose();
|
||||
textmaterial.dispose();
|
||||
textt.dispose();
|
||||
}
|
||||
}
|
||||
var beauty = new Image();
|
||||
beauty.src = JL3D_LOCAL_STATIC+"/texture/scene.png";
|
||||
//canvas文字贴图方法
|
||||
//PS:待提炼 增强功能
|
||||
function getTextCanvas(text){
|
||||
var canvas = document.getElementById('canvastexture');
|
||||
|
||||
canvas.width = 256;
|
||||
canvas.height = 128;
|
||||
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
//var bg = canvas.createPattern(img, "no-repeat");
|
||||
//ctx.fillStyle = bg;
|
||||
ctx.fillRect(0, 0,256,128);
|
||||
ctx.font = "20px Verdana";
|
||||
ctx.fillStyle = '#FFFFFF';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.textBaseline = 'middle';
|
||||
ctx.clearRect(0,0,256,128);
|
||||
//console.log(text.groupNumber);
|
||||
ctx.drawImage(beauty,0,0,256, 128);
|
||||
ctx.fillText("新的设备故障", 110,30);
|
||||
ctx.fillText(text.name, 110,65);
|
||||
ctx.fillText("故障原因:"+text.text, 110,100);
|
||||
//ctx.fillText(text.trainModel.name, width/2,height*3/4);
|
||||
let data = ctx.getImageData(0, 0,256, 128);
|
||||
return data;
|
||||
|
||||
}
|
@ -3,7 +3,7 @@ import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
|
||||
//loader
|
||||
import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader';
|
||||
import { Pathfinding } from '@/jlmap3d/jl3dpassflow/utils/Pathfinding.js';
|
||||
import { Pathfinding } from '@/jlmap3d/utils/pathfinder/Pathfinding.js'
|
||||
import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
|
||||
|
||||
import { ModelManagerVR } from '@/jlmap3d/jl3dmaintainer/jl3dTrainRescue/trainrescueloader.js';
|
||||
|
@ -10,7 +10,7 @@ import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
|
||||
import { ModelManager } from '@/jlmap3d/jl3dpassflow/loader.js';
|
||||
import { SkeletonUtils } from '@/jlmap3d/main/utils/SkeletonUtils.js';
|
||||
|
||||
import { Pathfinding } from '@/jlmap3d/jl3dpassflow/utils/Pathfinding.js';
|
||||
import { Pathfinding } from '@/jlmap3d/utils/pathfinder/Pathfinding.js';
|
||||
import { ZoneManager } from '@/jlmap3d/jl3dpassflow/model/zonemanager.js';
|
||||
|
||||
import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
//win10限定本地语音工具
|
||||
window.speechSynthesis.getVoices()
|
||||
let voices = speechSynthesis.getVoices();
|
||||
|
||||
export function VrVoice(){
|
||||
export function LocalVoice(){
|
||||
let scope = this;
|
||||
let voiceSelect = null;
|
||||
this.localVoiceInit = function(){
|
@ -695,10 +695,10 @@ function timedCount(){
|
||||
station = e.data.station;
|
||||
}
|
||||
|
||||
if(e.data.type == "takeStation"){
|
||||
if(e.data == "takeStation"){
|
||||
nowTakeTrain = {
|
||||
code:null,
|
||||
type:"",
|
||||
type:"onStation",
|
||||
status:"trainStop"
|
||||
};
|
||||
}
|
||||
@ -760,6 +760,7 @@ function timedCount(){
|
||||
// let nowTopTrain = null;
|
||||
// let nowDownTrain = null;
|
||||
if(data.type == 'TrainRun_3D'){
|
||||
|
||||
if(nowTakeTrain.status == "trainStop" ){
|
||||
|
||||
for(let i=0,leni = data.body.length;i<leni;i++){
|
||||
@ -768,6 +769,7 @@ function timedCount(){
|
||||
nowTopTrain = data.body[i].code;
|
||||
}
|
||||
data.body[i].type = "topTrain";
|
||||
|
||||
postMessage(data.body[i]);
|
||||
}
|
||||
if(data.body[i].section == station.downsection){
|
||||
@ -775,6 +777,7 @@ function timedCount(){
|
||||
nowDownTrain = data.body[i].code;
|
||||
}
|
||||
data.body[i].type = "downTrain";
|
||||
|
||||
postMessage(data.body[i]);
|
||||
}
|
||||
}
|
||||
@ -786,12 +789,14 @@ function timedCount(){
|
||||
if(data.body.groupNumber == nowTakeTrain.code && nowTakeTrain.code != null){
|
||||
// nowTakeTrain.code = null;
|
||||
|
||||
let arriveStation = {
|
||||
stationcode:data.body.stationCode,
|
||||
type:nowTakeTrain.type,
|
||||
};
|
||||
if(nowTakeTrain.type != "onStation"){
|
||||
let arriveStation = {
|
||||
stationcode:data.body.stationCode,
|
||||
type:nowTakeTrain.type,
|
||||
};
|
||||
postMessage(arriveStation);
|
||||
}
|
||||
|
||||
postMessage(arriveStation);
|
||||
}
|
||||
}
|
||||
if(data.type == 'DeviceCtrl_3D'){
|
||||
@ -806,14 +811,16 @@ function timedCount(){
|
||||
data.body.type = "downTrainDoor";
|
||||
postMessage(data.body);
|
||||
}
|
||||
if(nowTakeTrain.type === "takeTopTrain"){
|
||||
|
||||
if(nowTakeTrain.type == "takeTopTrain"){
|
||||
if(data.body.open == "0"){
|
||||
nowTakeTrain.status = "trainRun";
|
||||
}else{
|
||||
nowTakeTrain.status = "trainStop";
|
||||
}
|
||||
}
|
||||
if(nowTakeTrain.type === "takeDownTrain"){
|
||||
|
||||
if(nowTakeTrain.type == "takeDownTrain"){
|
||||
if(data.body.open == "0"){
|
||||
nowTakeTrain.status = "trainRun";
|
||||
}else{
|
||||
|
Loading…
Reference in New Issue
Block a user