修改三维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';
|
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||||
//loader
|
//loader
|
||||||
import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader';
|
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 { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
|
||||||
|
|
||||||
import { ModelManagerVR } from '@/jlmap3d/jl3dmaintainer/jl3dFaultDeviceVr/utils/vrloader.js';
|
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 { VrGui } from '@/jlmap3d/jl3dmaintainer/jl3dFaultDeviceVr/utils/vrgui.js';
|
||||||
import { TrainControl } from '@/jlmap3d/jl3dmaintainer/jl3dFaultDeviceVr/utils/trainControl.js';
|
import { TrainControl } from '@/jlmap3d/jl3dmaintainer/jl3dFaultDeviceVr/utils/trainControl.js';
|
||||||
import { MoveanimateVr } from '@/jlmap3d/jl3dmaintainer/jl3dFaultDeviceVr/utils/moveanimatevr.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 { Textconfig } from '@/jlmap3d/jl3ddevice/component/textconfig.js';
|
||||||
import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
|
import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
|
||||||
@ -35,6 +36,22 @@ let vrPlane;
|
|||||||
//vrUI面板控制状态
|
//vrUI面板控制状态
|
||||||
let vrPlaneStatus = false;
|
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 tempMatrix = new THREE.Matrix4();
|
||||||
|
|
||||||
let nowdevice = null;
|
let nowdevice = null;
|
||||||
@ -58,35 +75,13 @@ let positionStatus = "dm";
|
|||||||
//列车地板
|
//列车地板
|
||||||
let floors = [];
|
let floors = [];
|
||||||
//设定声音
|
//设定声音
|
||||||
let voiceModel = new VrVoice();
|
let voiceModel = new LocalVoice();
|
||||||
voiceModel.localVoiceInit();
|
voiceModel.localVoiceInit();
|
||||||
|
|
||||||
export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||||
|
|
||||||
var scope = this;
|
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;
|
let switchModel;
|
||||||
|
|
||||||
this.dom = dom;
|
this.dom = dom;
|
||||||
@ -120,8 +115,6 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
this.renderer.setClearColor(new THREE.Color(0x000000));
|
this.renderer.setClearColor(new THREE.Color(0x000000));
|
||||||
this.renderer.setPixelRatio( window.devicePixelRatio );
|
this.renderer.setPixelRatio( window.devicePixelRatio );
|
||||||
this.renderer.setSize(window.innerWidth, window.innerHeight);
|
this.renderer.setSize(window.innerWidth, window.innerHeight);
|
||||||
// this.renderer.shadowMap.enabled = true;
|
|
||||||
// this.renderer.shadowMap.type = THREE.PCFSoftShadowMap;
|
|
||||||
this.renderer.gammaInput = true;
|
this.renderer.gammaInput = true;
|
||||||
this.renderer.gammaOutput = true;
|
this.renderer.gammaOutput = true;
|
||||||
this.renderer.vr.enabled = true;
|
this.renderer.vr.enabled = true;
|
||||||
@ -164,78 +157,21 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
|
|
||||||
raycastervr = new THREE.Raycaster();
|
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 moveanima = new MoveanimateVr(scope);
|
||||||
|
|
||||||
//定义全局光
|
//定义全局光
|
||||||
let ambientLight = new THREE.AmbientLight(0xffffff, 1.3);
|
let ambientLight = new THREE.AmbientLight(0xffffff, 1.3);
|
||||||
this.scene.add(ambientLight);
|
this.scene.add(ambientLight);
|
||||||
|
|
||||||
|
//鼠标轨道相机控制
|
||||||
this.controls = new THREE.OrbitControls(scope.camera, dom);
|
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.maxDistance = 600;
|
||||||
// this.controls.screenSpacePanning = true;
|
|
||||||
this.controls.target.set( 0, 1.6, 0 );
|
this.controls.target.set( 0, 1.6, 0 );
|
||||||
|
|
||||||
this.controls.update();
|
this.controls.update();
|
||||||
|
|
||||||
|
//鼠标点击事件
|
||||||
document.addEventListener( "mousedown", onselect, false );
|
document.addEventListener( "mousedown", onselect, false );
|
||||||
|
|
||||||
|
|
||||||
let vrwebworker = new Worker(JL3D_LOCAL_STATIC+"/workertest/vrwebworker.js");
|
let vrwebworker = new Worker(JL3D_LOCAL_STATIC+"/workertest/vrwebworker.js");
|
||||||
|
|
||||||
let connectmsg = {
|
let connectmsg = {
|
||||||
@ -247,7 +183,7 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
vrwebworker.postMessage(connectmsg);
|
vrwebworker.postMessage(connectmsg);
|
||||||
|
|
||||||
vrwebworker.onmessage = function (event) {
|
vrwebworker.onmessage = function (event) {
|
||||||
|
//获取故障信息
|
||||||
if(event.data.type == "Device_Fault_Set_3D"){
|
if(event.data.type == "Device_Fault_Set_3D"){
|
||||||
let newfault = {
|
let newfault = {
|
||||||
code:event.data.body.code,
|
code:event.data.body.code,
|
||||||
@ -292,11 +228,12 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
faultList.push(newfault)
|
faultList.push(newfault)
|
||||||
updateFaultList();
|
vrPlane.updataFaultList(faultList);
|
||||||
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//在车上时
|
||||||
if(event.data.type == "takeTopTrain"){
|
if(event.data.type == "takeTopTrain"){
|
||||||
|
|
||||||
for(let i=0,leni=stationList.length;i<leni;i++){
|
for(let i=0,leni=stationList.length;i<leni;i++){
|
||||||
@ -308,16 +245,21 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
type:'station',
|
type:'station',
|
||||||
station:scope.nowstation
|
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);
|
vrwebworker.postMessage(stationworket);
|
||||||
vrPlane.updataStationMsg(scope.nowstation);
|
vrPlane.updataStationMsg(scope.nowstation);
|
||||||
trainControl.toptrain.position.x = 20000;
|
trainControl.toptrain.position.x = 20000;
|
||||||
trainControl.downtrain.position.x = 20000;
|
trainControl.downtrain.position.x = 20000;
|
||||||
|
|
||||||
let voicetext = scope.nowstation.name.split("(");
|
|
||||||
voiceModel.localVoicePlay("列车即将进站"+voicetext[0]);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
trainControl.toptrain.status = "0";
|
trainControl.toptrain.status = "0";
|
||||||
trainControl.downtrain.status = "0";
|
trainControl.downtrain.status = "0";
|
||||||
scope.nowStationModel.getObjectByName("zhantaiming").material.map = scope.stationtexture[scope.nowstation.code];
|
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"){
|
if(event.data.type == "takeDownTrain"){
|
||||||
|
|
||||||
for(let i=0,leni=stationList.length;i<leni;i++){
|
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){
|
if(trainControl.toptrain.status != 1){
|
||||||
trainControl.toptrain.position.copy(trainControl.toptrain.curve.getPointAt(event.data.offset));
|
trainControl.toptrain.position.copy(trainControl.toptrain.curve.getPointAt(event.data.offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(event.data.type == "downTrain"){
|
if(event.data.type == "downTrain"){
|
||||||
if(trainControl.downtrain.status != 1){
|
if(trainControl.downtrain.status != 1){
|
||||||
trainControl.downtrain.position.copy(trainControl.downtrain.curve.getPointAt(event.data.offset));
|
trainControl.downtrain.position.copy(trainControl.downtrain.curve.getPointAt(event.data.offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//上行列车车门控制
|
||||||
if(event.data.type == "topTrainDoor"){
|
if(event.data.type == "topTrainDoor"){
|
||||||
|
|
||||||
if(event.data.open == "0"){
|
if(event.data.open == "0"){
|
||||||
@ -386,6 +327,7 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//下行列车车门控制
|
||||||
if(event.data.type == "downTrainDoor"){
|
if(event.data.type == "downTrainDoor"){
|
||||||
if(event.data.open == "0"){
|
if(event.data.open == "0"){
|
||||||
trainControl.closetraindoor(trainControl.downtrain,event.data.doorCode,positionStatus,"down");
|
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.type == "topPsd"){
|
||||||
|
|
||||||
if(event.data.open == 0){
|
if(event.data.open == 0){
|
||||||
@ -412,6 +354,7 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
deviceaction.top.action.play();
|
deviceaction.top.action.play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//下行屏蔽门
|
||||||
if(event.data.type == "downPsd"){
|
if(event.data.type == "downPsd"){
|
||||||
if(event.data.open == 0){
|
if(event.data.open == 0){
|
||||||
deviceaction.down.action.reset();
|
deviceaction.down.action.reset();
|
||||||
@ -425,20 +368,21 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
deviceaction.down.action.play();
|
deviceaction.down.action.play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//道岔切换
|
||||||
if(event.data.type == "SWITCH"){
|
if(event.data.type == "SWITCH"){
|
||||||
scope.updateaction(event.data);
|
scope.updateaction(event.data);
|
||||||
}
|
}
|
||||||
|
//故障修复信息
|
||||||
if(event.data.type == "Device_Fault_Over_3D"){
|
if(event.data.type == "Device_Fault_Over_3D"){
|
||||||
for (let i = 0, leni = faultList.length; i < leni; i++) {
|
for (let i = 0, leni = faultList.length; i < leni; i++) {
|
||||||
if (event.data.body.code == faultList[i].code) {
|
if (event.data.body.code == faultList[i].code) {
|
||||||
faultList.splice(i, 1);
|
faultList.splice(i, 1);
|
||||||
updateFaultList();
|
vrPlane.updataFaultList(faultList);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//获取初始故障
|
||||||
if(event.data.type == "Device_Load_Destroy_3D"){
|
if(event.data.type == "Device_Load_Destroy_3D"){
|
||||||
|
|
||||||
let fault = event.data.body.faultInfoList;
|
let fault = event.data.body.faultInfoList;
|
||||||
@ -489,20 +433,17 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
faultList.push(newfault)
|
faultList.push(newfault)
|
||||||
|
|
||||||
}
|
}
|
||||||
updateFaultList();
|
vrPlane.updataFaultList(faultList);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
window.onresize = function () {
|
window.onresize = function () {
|
||||||
scope.camera.aspect = window.innerWidth / window.innerHeight;
|
scope.camera.aspect = window.innerWidth / window.innerHeight;
|
||||||
scope.camera.updateProjectionMatrix();
|
scope.camera.updateProjectionMatrix();
|
||||||
scope.renderer.setSize(window.innerWidth, window.innerHeight);
|
scope.renderer.setSize(window.innerWidth, window.innerHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.modelmanager = new ModelManagerVR();
|
this.modelmanager = new ModelManagerVR();
|
||||||
getPublishMapDetail(skinCode).then(netdata => {
|
getPublishMapDetail(skinCode).then(netdata => {
|
||||||
let mapnetdata = netdata.data;
|
let mapnetdata = netdata.data;
|
||||||
@ -533,13 +474,9 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
// switchModel.position.set(switchPos.x,switchPos.y,switchPos.z);
|
// switchModel.position.set(switchPos.x,switchPos.y,switchPos.z);
|
||||||
human.position.set(switchModel.matrixWorld.elements[12],switchModel.matrixWorld.elements[13],switchModel.matrixWorld.elements[14]);
|
human.position.set(switchModel.matrixWorld.elements[12],switchModel.matrixWorld.elements[13],switchModel.matrixWorld.elements[14]);
|
||||||
|
|
||||||
|
|
||||||
initstationanimation(scope.modelmanager.stationIn.mesh);
|
initstationanimation(scope.modelmanager.stationIn.mesh);
|
||||||
initstationanimation(scope.modelmanager.stationOut.mesh);
|
initstationanimation(scope.modelmanager.stationOut.mesh);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// scope.modelmanager.otherDevice.mesh.scale.set(0.1,0.1,0.1);
|
// scope.modelmanager.otherDevice.mesh.scale.set(0.1,0.1,0.1);
|
||||||
if(scope.nowstation.inside == true){
|
if(scope.nowstation.inside == true){
|
||||||
scope.nowStationModel = scope.modelmanager.stationOut.mesh;
|
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);
|
trainControl.inittrain(scope.scene,scope.modelmanager.train.mesh,scope.modelmanager.train.animations,mixers);
|
||||||
floors.push(trainControl.toptrain.floor);
|
floors.push(trainControl.toptrain.floor);
|
||||||
floors.push(trainControl.downtrain.floor);
|
floors.push(trainControl.downtrain.floor);
|
||||||
floors.push(navmesh.children[0]);
|
|
||||||
|
|
||||||
|
|
||||||
let detectedVRDevices;
|
let detectedVRDevices;
|
||||||
let timer=setInterval(function(){
|
let timer=setInterval(function(){
|
||||||
|
if(pathFinderVr.navmesh){
|
||||||
|
floors.push(pathFinderVr.navmesh.children[0]);
|
||||||
|
}
|
||||||
|
|
||||||
if(scope.stationtexture["stationlist"]){
|
if(scope.stationtexture["stationlist"]){
|
||||||
vrPlane.setStationPlane(stationList,scope.stationtexture);
|
vrPlane.setStationPlane(stationList,scope.stationtexture);
|
||||||
@ -593,15 +533,11 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
}
|
}
|
||||||
},1000);
|
},1000);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function onselect(event){
|
function onselect(event){
|
||||||
//定义光线
|
//定义光线
|
||||||
let raycaster = new THREE.Raycaster();
|
let raycaster = new THREE.Raycaster();
|
||||||
@ -699,8 +635,8 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(object.name == "nav"){
|
if(object.name == "nav"){
|
||||||
if(navMesh){
|
if(pathFinderVr.navmesh){
|
||||||
scope.scene.remove( navMesh );
|
scope.scene.remove( pathFinderVr.navmesh );
|
||||||
}
|
}
|
||||||
if(navStatus){
|
if(navStatus){
|
||||||
navStatus = false;
|
navStatus = false;
|
||||||
@ -709,23 +645,17 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
pathPoints = [];
|
pathPoints = [];
|
||||||
let startPoint = new THREE.Vector3(human.position.x,human.position.y-0.6,human.position.z);
|
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));
|
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]);
|
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){
|
if(path){
|
||||||
for(let i=0;i<path.length;i++){
|
for(let i=0;i<path.length;i++){
|
||||||
pathPoints.push(new THREE.Vector3(path[i].x,path[i].y+0.6,path[i].z));
|
pathPoints.push(new THREE.Vector3(path[i].x,path[i].y+0.6,path[i].z));
|
||||||
}
|
}
|
||||||
let curve = new THREE.CatmullRomCurve3(pathPoints,false);
|
let curve = new THREE.CatmullRomCurve3(pathPoints,false);
|
||||||
var geometry = new THREE.TubeGeometry( curve, 100, 0.2, 50, false );
|
var geometry = new THREE.TubeGeometry( curve, 100, 0.2, 50, false );
|
||||||
navMesh = new THREE.Mesh( geometry, materialNav );
|
pathFinderVr.navmesh = new THREE.Mesh( geometry, materialNav );
|
||||||
scope.scene.add( navMesh );
|
scope.scene.add( pathFinderVr.navmesh );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -764,8 +694,7 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
// console.log(event);
|
// console.log(event);
|
||||||
let clickGui = getGuiButton(controller);
|
let clickGui = getGuiButton(controller);
|
||||||
if(clickGui.length > 0){
|
if(clickGui.length > 0){
|
||||||
|
if(positionStatus == "dm"){
|
||||||
|
|
||||||
if(vrPlaneStatus){
|
if(vrPlaneStatus){
|
||||||
var intersection = clickGui[ 0 ];
|
var intersection = clickGui[ 0 ];
|
||||||
var object = intersection.object;
|
var object = intersection.object;
|
||||||
@ -832,7 +761,6 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(object.name == "shebeijian"){
|
if(object.name == "shebeijian"){
|
||||||
human.position.set( 41.30, 6.05+0.6, -5.55);
|
human.position.set( 41.30, 6.05+0.6, -5.55);
|
||||||
}
|
}
|
||||||
@ -857,8 +785,8 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(object.name == "nav"){
|
if(object.name == "nav"){
|
||||||
if(navMesh){
|
if(pathFinderVr.navmesh){
|
||||||
scope.scene.remove( navMesh );
|
scope.scene.remove( pathFinderVr.navmesh );
|
||||||
}
|
}
|
||||||
|
|
||||||
if(navStatus){
|
if(navStatus){
|
||||||
@ -868,15 +796,12 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
pathPoints = [];
|
pathPoints = [];
|
||||||
let startPoint = new THREE.Vector3(human.position.x,human.position.y-0.6,human.position.z);
|
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));
|
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]);
|
targetPosition = new THREE.Vector3(switchModel.matrixWorld.elements[12],switchModel.matrixWorld.elements[13],switchModel.matrixWorld.elements[14]);
|
||||||
|
|
||||||
//
|
|
||||||
// console.log(pathPoints[0]);
|
let path = pathFinderVr.find(startPoint,targetPosition);
|
||||||
// console.log(targetPosition);
|
|
||||||
// console.log(ZONE);
|
|
||||||
// console.log(groupID);
|
|
||||||
let path = pathFinder.findPath( startPoint, targetPosition, ZONE, groupID );
|
|
||||||
|
|
||||||
if(path){
|
if(path){
|
||||||
for(let i=0;i<path.length;i++){
|
for(let i=0;i<path.length;i++){
|
||||||
@ -884,8 +809,8 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
}
|
}
|
||||||
let curve = new THREE.CatmullRomCurve3(pathPoints,false);
|
let curve = new THREE.CatmullRomCurve3(pathPoints,false);
|
||||||
var geometry = new THREE.TubeGeometry( curve, 100, 0.2, 50, false );
|
var geometry = new THREE.TubeGeometry( curve, 100, 0.2, 50, false );
|
||||||
navMesh = new THREE.Mesh( geometry, materialNav );
|
pathFinderVr.navmesh = new THREE.Mesh( geometry, materialNav );
|
||||||
scope.scene.add( navMesh );
|
scope.scene.add( pathFinderVr.navmesh );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -914,9 +839,7 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
@ -929,15 +852,15 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
if(positionStatus != intersection.object.name){
|
if(positionStatus != intersection.object.name){
|
||||||
positionStatus = intersection.object.name;
|
positionStatus = intersection.object.name;
|
||||||
|
|
||||||
if(intersection.object.name == "dm"){
|
if(positionStatus == "dm"){
|
||||||
scope.scene.add(human);
|
scope.scene.add(human);
|
||||||
vrwebworker.postMessage("takeStation");
|
vrwebworker.postMessage("takeStation");
|
||||||
}
|
}
|
||||||
if(intersection.object.name == "topfloor"){
|
if(positionStatus == "topfloor"){
|
||||||
trainControl.toptrain.add(human);
|
trainControl.toptrain.add(human);
|
||||||
vrwebworker.postMessage("takeTopTrain");
|
vrwebworker.postMessage("takeTopTrain");
|
||||||
}
|
}
|
||||||
if(intersection.object.name == "downfloor"){
|
if(positionStatus == "downfloor"){
|
||||||
trainControl.downtrain.add(human);
|
trainControl.downtrain.add(human);
|
||||||
vrwebworker.postMessage("takeDownTrain");
|
vrwebworker.postMessage("takeDownTrain");
|
||||||
}
|
}
|
||||||
@ -972,16 +895,6 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
};
|
};
|
||||||
vrwebworker.postMessage(postData);
|
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 );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1019,7 +932,6 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function onControlModelEnd( event ) {
|
function onControlModelEnd( event ) {
|
||||||
var controller = event.target;
|
var controller = event.target;
|
||||||
if ( controller.userData.selected !== undefined ) {
|
if ( controller.userData.selected !== undefined ) {
|
||||||
@ -1034,9 +946,9 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
|
|
||||||
function squeezeStart(){
|
function squeezeStart(){
|
||||||
scope.modelmanager.otherDevice.action.play();
|
scope.modelmanager.otherDevice.action.play();
|
||||||
|
if(positionStatus == "dm"){
|
||||||
if(vrPlaneStatus){
|
if(vrPlaneStatus){
|
||||||
vrPlaneStatus = false;
|
vrPlaneStatus = false;
|
||||||
|
|
||||||
// vrPlane.group.position.copy(circle.position);
|
// vrPlane.group.position.copy(circle.position);
|
||||||
vrPlane.group.position.set(10000,10000,10000);
|
vrPlane.group.position.set(10000,10000,10000);
|
||||||
scope.scene.remove( vrPlane.group );
|
scope.scene.remove( vrPlane.group );
|
||||||
@ -1045,8 +957,11 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
vrPlane.group.position.copy(circle.position);
|
vrPlane.group.position.copy(circle.position);
|
||||||
vrPlane.group.lookAt(human.position);
|
vrPlane.group.lookAt(human.position);
|
||||||
scope.scene.add( vrPlane.group );
|
scope.scene.add( vrPlane.group );
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.animationmsgshowon = function(nowobject){
|
this.animationmsgshowon = function(nowobject){
|
||||||
@ -1138,7 +1053,6 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
function intersectObjects( controller ) {
|
function intersectObjects( controller ) {
|
||||||
|
|
||||||
var intersections = getIntersections( controller );
|
var intersections = getIntersections( controller );
|
||||||
@ -1155,7 +1069,6 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
|
|
||||||
|
|
||||||
function animate() {
|
function animate() {
|
||||||
|
|
||||||
scope.renderer.setAnimationLoop( render );
|
scope.renderer.setAnimationLoop( render );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1166,7 +1079,7 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
let delta = clock.getDelta();
|
let delta = clock.getDelta();
|
||||||
if (mixers) {
|
if (mixers) {
|
||||||
for (let i = 0; i < mixers.length; i++) {
|
for (let i = 0; i < mixers.length; i++) {
|
||||||
if (mixers[i]) {
|
if (mixers[i]._actions[0].isRunning()) {
|
||||||
mixers[i].update(delta);
|
mixers[i].update(delta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1182,7 +1095,6 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.updateaction = function (data) {
|
this.updateaction = function (data) {
|
||||||
console.log(data);
|
|
||||||
if (data.type == "SWITCH") {
|
if (data.type == "SWITCH") {
|
||||||
if (data.normal == "0") {
|
if (data.normal == "0") {
|
||||||
scope.modelmanager.otherDevice.normalPosition = "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.timeScale = -1;
|
||||||
scope.modelmanager.otherDevice.action.play();
|
scope.modelmanager.otherDevice.action.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getdevicemsg(selectname){
|
function getdevicemsg(selectname){
|
||||||
// console.log(selectname);
|
// console.log(selectname);
|
||||||
for(let i=0,leni=scope.devicetext.devicelist.length;i<leni;i++){
|
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);
|
// console.log(scope.nowstation);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateFaultList(){
|
|
||||||
vrPlane.updataFaultList(faultList);
|
|
||||||
}
|
|
||||||
|
|
||||||
function initstationanimation(object){
|
function initstationanimation(object){
|
||||||
let mixer = new THREE.AnimationMixer( 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
|
//loader
|
||||||
import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader';
|
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 { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
|
||||||
|
|
||||||
import { ModelManagerVR } from '@/jlmap3d/jl3dmaintainer/jl3dTrainRescue/trainrescueloader.js';
|
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 { ModelManager } from '@/jlmap3d/jl3dpassflow/loader.js';
|
||||||
import { SkeletonUtils } from '@/jlmap3d/main/utils/SkeletonUtils.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 { ZoneManager } from '@/jlmap3d/jl3dpassflow/model/zonemanager.js';
|
||||||
|
|
||||||
import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
|
import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
//win10限定本地语音工具
|
||||||
window.speechSynthesis.getVoices()
|
window.speechSynthesis.getVoices()
|
||||||
let voices = speechSynthesis.getVoices();
|
let voices = speechSynthesis.getVoices();
|
||||||
|
|
||||||
export function VrVoice(){
|
export function LocalVoice(){
|
||||||
let scope = this;
|
let scope = this;
|
||||||
let voiceSelect = null;
|
let voiceSelect = null;
|
||||||
this.localVoiceInit = function(){
|
this.localVoiceInit = function(){
|
@ -695,10 +695,10 @@ function timedCount(){
|
|||||||
station = e.data.station;
|
station = e.data.station;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(e.data.type == "takeStation"){
|
if(e.data == "takeStation"){
|
||||||
nowTakeTrain = {
|
nowTakeTrain = {
|
||||||
code:null,
|
code:null,
|
||||||
type:"",
|
type:"onStation",
|
||||||
status:"trainStop"
|
status:"trainStop"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -760,6 +760,7 @@ function timedCount(){
|
|||||||
// let nowTopTrain = null;
|
// let nowTopTrain = null;
|
||||||
// let nowDownTrain = null;
|
// let nowDownTrain = null;
|
||||||
if(data.type == 'TrainRun_3D'){
|
if(data.type == 'TrainRun_3D'){
|
||||||
|
|
||||||
if(nowTakeTrain.status == "trainStop" ){
|
if(nowTakeTrain.status == "trainStop" ){
|
||||||
|
|
||||||
for(let i=0,leni = data.body.length;i<leni;i++){
|
for(let i=0,leni = data.body.length;i<leni;i++){
|
||||||
@ -768,6 +769,7 @@ function timedCount(){
|
|||||||
nowTopTrain = data.body[i].code;
|
nowTopTrain = data.body[i].code;
|
||||||
}
|
}
|
||||||
data.body[i].type = "topTrain";
|
data.body[i].type = "topTrain";
|
||||||
|
|
||||||
postMessage(data.body[i]);
|
postMessage(data.body[i]);
|
||||||
}
|
}
|
||||||
if(data.body[i].section == station.downsection){
|
if(data.body[i].section == station.downsection){
|
||||||
@ -775,6 +777,7 @@ function timedCount(){
|
|||||||
nowDownTrain = data.body[i].code;
|
nowDownTrain = data.body[i].code;
|
||||||
}
|
}
|
||||||
data.body[i].type = "downTrain";
|
data.body[i].type = "downTrain";
|
||||||
|
|
||||||
postMessage(data.body[i]);
|
postMessage(data.body[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -786,13 +789,15 @@ function timedCount(){
|
|||||||
if(data.body.groupNumber == nowTakeTrain.code && nowTakeTrain.code != null){
|
if(data.body.groupNumber == nowTakeTrain.code && nowTakeTrain.code != null){
|
||||||
// nowTakeTrain.code = null;
|
// nowTakeTrain.code = null;
|
||||||
|
|
||||||
|
if(nowTakeTrain.type != "onStation"){
|
||||||
let arriveStation = {
|
let arriveStation = {
|
||||||
stationcode:data.body.stationCode,
|
stationcode:data.body.stationCode,
|
||||||
type:nowTakeTrain.type,
|
type:nowTakeTrain.type,
|
||||||
};
|
};
|
||||||
|
|
||||||
postMessage(arriveStation);
|
postMessage(arriveStation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(data.type == 'DeviceCtrl_3D'){
|
if(data.type == 'DeviceCtrl_3D'){
|
||||||
|
|
||||||
@ -806,14 +811,16 @@ function timedCount(){
|
|||||||
data.body.type = "downTrainDoor";
|
data.body.type = "downTrainDoor";
|
||||||
postMessage(data.body);
|
postMessage(data.body);
|
||||||
}
|
}
|
||||||
if(nowTakeTrain.type === "takeTopTrain"){
|
|
||||||
|
if(nowTakeTrain.type == "takeTopTrain"){
|
||||||
if(data.body.open == "0"){
|
if(data.body.open == "0"){
|
||||||
nowTakeTrain.status = "trainRun";
|
nowTakeTrain.status = "trainRun";
|
||||||
}else{
|
}else{
|
||||||
nowTakeTrain.status = "trainStop";
|
nowTakeTrain.status = "trainStop";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(nowTakeTrain.type === "takeDownTrain"){
|
|
||||||
|
if(nowTakeTrain.type == "takeDownTrain"){
|
||||||
if(data.body.open == "0"){
|
if(data.body.open == "0"){
|
||||||
nowTakeTrain.status = "trainRun";
|
nowTakeTrain.status = "trainRun";
|
||||||
}else{
|
}else{
|
||||||
|
Loading…
Reference in New Issue
Block a user