修改三维cctv中路径

This commit is contained in:
sunzhenyu 2020-06-01 15:43:40 +08:00
parent 3bf766cbe1
commit 041528ebaa
4 changed files with 1111 additions and 990 deletions

View File

@ -12,6 +12,8 @@ import { Pathfinding } from '@/jlmap3d/jl3dpassflow/utils/Pathfinding.js';
// const Pathfinding = window.threePathfinding.Pathfinding; // const Pathfinding = window.threePathfinding.Pathfinding;
import { ZoneManager } from '@/jlmap3d/jl3dpassflow/model/zonemanager.js'; import { ZoneManager } from '@/jlmap3d/jl3dpassflow/model/zonemanager.js';
import { getPublishMapVersion, getPublishMapDetail,getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata';
import StompClient from '@/utils/sock'; import StompClient from '@/utils/sock';
import { Loading } from 'element-ui'; import { Loading } from 'element-ui';
@ -143,7 +145,7 @@ var views = [
]; ];
export function Jl3dpassflow(dom) { export function Jl3dpassflow(dom,skinCode) {
var scope = this; var scope = this;
this.dom = dom; this.dom = dom;
@ -235,6 +237,29 @@ export function Jl3dpassflow(dom) {
let mouse = new THREE.Vector2(); let mouse = new THREE.Vector2();
let raycaster = new THREE.Raycaster(); let raycaster = new THREE.Raycaster();
getPublishMapDetail(skinCode).then(netdata => {
// let assetsdata = JSON.parse(netdata.data.sections);
console.log(netdata);
// if(assetsdata.link){
// scope.datatype = "old";
// scope.jsonwebwork = new Worker("../../static/workertest/jsonworker.js");
// scope.Subscribe = new Jlmap3dSubscribe(scope,routegroup,scope.jsonwebwork);
// scope.Subscribe.socketon(scope.Subscribe.topic);
// SimulationLoad(mapnetdata,scope,netdata.data,mapdata,camera,controls,scenesimulation,storemod);
//
// }else{
// scope.datatype = "new";
// scope.jsonwebworknew = new Worker("../../static/workertest/jsonworkernew.js");
// scope.Subscribe = new Jlmap3dSubscribeNew(scope,routegroup,scope.jsonwebworknew);
// scope.Subscribe.socketon(scope.Subscribe.topic);
// SimulationLoadNew(mapnetdata,scope,netdata.data,mapdata,camera,controls,scenesimulation,storemod);
// }
});
var loader = new THREE.OBJLoader(); var loader = new THREE.OBJLoader();
// load a resource // load a resource
@ -364,7 +389,7 @@ export function Jl3dpassflow(dom) {
initzhajiinaimation(scope.modelmanager.zhajiin.mesh); initzhajiinaimation(scope.modelmanager.zhajiin.mesh);
initzhajioutanimation(scope.modelmanager.zhajiout.mesh); initzhajioutanimation(scope.modelmanager.zhajiout.mesh);
scene.add(scope.modelmanager.section.mesh); scene.add(scope.modelmanager.section.mesh);
scene.add(scope.modelmanager.train.mesh); // scene.add(scope.modelmanager.train.mesh);
level = scope.modelmanager.station.mesh; level = scope.modelmanager.station.mesh;
monitor = scope.modelmanager.monitor.mesh; monitor = scope.modelmanager.monitor.mesh;
@ -511,13 +536,13 @@ export function Jl3dpassflow(dom) {
if(humanlist.children[i].status == 0){ if(humanlist.children[i].status == 0){
if(humanlist.children[i].stage == 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 = []; 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));
groupID = pathfinder.getGroup( ZONE, points[0] );
targetPosition = stationzon.getzoneposition("security");
path = pathfinder.findPath( points[0], targetPosition, ZONE, groupID );
for(let i=0;i<path.length;i++){ for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z)); points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
} }
@ -526,13 +551,13 @@ export function Jl3dpassflow(dom) {
} }
if(humanlist.children[i].stage == 1){ 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 = []; 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));
groupID = pathfinder.getGroup( ZONE, points[0] );
targetPosition = stationzon.getzoneposition("entergate");
path = pathfinder.findPath( points[0], targetPosition, ZONE, groupID );
for(let i=0;i<path.length;i++){ for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z)); points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
} }
@ -555,13 +580,17 @@ export function Jl3dpassflow(dom) {
//1--top //1--top
//2-- down //2-- down
if(direct == 1){ if(direct == 1){
groupID = pathfinder.getGroup( ZONE, humanlist.children[i].position ); groupID = pathfinder.getGroup( ZONE, points[0] );
targetPosition = stationzon.getzoneposition("standtop"); targetPosition = stationzon.getzoneposition("standtop");
path = pathfinder.findPath( humanlist.children[i].position, targetPosition, ZONE, groupID ); path = pathfinder.findPath( points[0], targetPosition, ZONE, groupID );
}else{ }else{
groupID = pathfinder.getGroup( ZONE, humanlist.children[i].position ); groupID = pathfinder.getGroup( ZONE, points[0] );
targetPosition = stationzon.getzoneposition("standdown"); targetPosition = stationzon.getzoneposition("standdown");
path = pathfinder.findPath( humanlist.children[i].position, targetPosition, ZONE, groupID ); path = pathfinder.findPath( points[0], targetPosition, ZONE, groupID );
}
if(path == null){
console.log(points);
console.log(path);
} }
for(let i=0;i<path.length;i++){ for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z)); points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
@ -600,13 +629,16 @@ export function Jl3dpassflow(dom) {
// // moveanimateinit(humans[i],i,points,i,0.002); // // moveanimateinit(humans[i],i,points,i,0.002);
// } // }
if(humanlist.children[i].stage == 4){ 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 = []; 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));
groupID = pathfinder.getGroup( ZONE, points[0] );
targetPosition = stationzon.getzoneposition("exitgate");
path = pathfinder.findPath( points[0], targetPosition, ZONE, groupID );
if(path == null){
console.log(points[0]);
console.log(targetPosition);
}
for(let i=0;i<path.length;i++){ for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z)); points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
} }
@ -628,18 +660,23 @@ export function Jl3dpassflow(dom) {
//1--top //1--top
//2-- down //2-- down
if(direct == 1){ if(direct == 1){
groupID = pathfinder.getGroup( ZONE, humanlist.children[i].position ); groupID = pathfinder.getGroup( ZONE, points[0] );
targetPosition = stationzon.getzoneposition("exit1"); targetPosition = stationzon.getzoneposition("exit1");
path = pathfinder.findPath( humanlist.children[i].position, targetPosition, ZONE, groupID ); path = pathfinder.findPath( points[0], targetPosition, ZONE, groupID );
}else{ }else{
groupID = pathfinder.getGroup( ZONE, humanlist.children[i].position ); groupID = pathfinder.getGroup( ZONE, points[0] );
targetPosition = stationzon.getzoneposition("exit2"); targetPosition = stationzon.getzoneposition("exit2");
path = pathfinder.findPath( humanlist.children[i].position, targetPosition, ZONE, groupID ); path = pathfinder.findPath( points[0], targetPosition, ZONE, groupID );
}
if(path == null){
console.log(points[0]);
console.log(targetPosition);
} }
for(let i=0;i<path.length;i++){ for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z)); points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
} }
moveanimateinit(humanlist.children[i],i,points,i); moveanimateinit(humanlist.children[i],i,points,i);
} }
} }
} }
@ -671,10 +708,7 @@ export function Jl3dpassflow(dom) {
//更新模型坐标 //更新模型坐标
if(humanlist.children[i].status == 1){ if(humanlist.children[i].status == 1){
// humanlist.children[i].runrail.enable = false; // 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(humanlist.children[i].stage == 4){ // if(humanlist.children[i].stage == 4){
// //
@ -682,6 +716,12 @@ export function Jl3dpassflow(dom) {
// // humans.splice(i,1); // // humans.splice(i,1);
// } // }
// //
humanlist.children[i].progress = 1;
// humanlist.children[i].mixer.runplay = false;
humanlist.children[i].action.stop();
humanlist.children[i].status = 0;
if(humanlist.children[i].stage == 6){ if(humanlist.children[i].stage == 6){
humanlist.remove(humanlist.children[i]); humanlist.remove(humanlist.children[i]);
// humanlist.children[i].stage = 7; // humanlist.children[i].stage = 7;

View File

@ -19,8 +19,8 @@ let enter2 = {
stage : "0", stage : "0",
randompoint : new THREE.Vector3(27,9.8,16), randompoint : new THREE.Vector3(27,9.8,16),
railpoints : [ railpoints : [
new THREE.Vector3(35,9.8,31.5), new THREE.Vector3(34,9.8,31.5),
new THREE.Vector3(31,9.8,31.5) new THREE.Vector3(32,9.8,31.5)
] ]
}; };
@ -43,11 +43,11 @@ let entergate = {
stage : "2", stage : "2",
randompoint : new THREE.Vector3(2.3,9.8,13), randompoint : new THREE.Vector3(2.3,9.8,13),
railpoints : [ railpoints : [
new THREE.Vector3(6.3,9.8,17.4), new THREE.Vector3(6.3,9.8,18.1),
new THREE.Vector3(4.8,9.8,17.4), new THREE.Vector3(4.8,9.8,18.1),
new THREE.Vector3(3.4,9.8,17.4), new THREE.Vector3(3.4,9.8,18.1),
new THREE.Vector3(2.1,9.8,17.4), new THREE.Vector3(2.1,9.8,18.1),
new THREE.Vector3(0.7,9.8,17.4) new THREE.Vector3(0.7,9.8,18.1)
] ]
}; };
@ -82,11 +82,11 @@ let exitgate = {
stage : "5", stage : "5",
randompoint : new THREE.Vector3(-16,9.8,-0.4), randompoint : new THREE.Vector3(-16,9.8,-0.4),
railpoints : [ railpoints : [
new THREE.Vector3(18.8,9.8,-0.27), new THREE.Vector3(18,9.8,-0.27),
new THREE.Vector3(18.8,9.8,1.18), new THREE.Vector3(18,9.8,1.18),
new THREE.Vector3(18.8,9.8,2.64), new THREE.Vector3(18,9.8,2.64),
new THREE.Vector3(18.8,9.8,4.1), new THREE.Vector3(18,9.8,4.1),
new THREE.Vector3(18.8,9.8,5.4) new THREE.Vector3(18,9.8,5.4)
] ]
}; };
@ -109,8 +109,8 @@ let exit2 = {
stage : "6", stage : "6",
randompoint : new THREE.Vector3(), randompoint : new THREE.Vector3(),
railpoints : [ railpoints : [
new THREE.Vector3(28.3,9.8,28.8), new THREE.Vector3(28.3,9.8,28),
new THREE.Vector3(31.2,9.8,28.8) new THREE.Vector3(30.2,9.8,28)
] ]
}; };

View File

@ -54,7 +54,7 @@ export default {
init: function () { init: function () {
// let mapdata = this.$store.state.socket.device; // let mapdata = this.$store.state.socket.device;
const dom = document.getElementById('jl3d'); const dom = document.getElementById('jl3d');
this.jl3d = new Jl3dpassflow(dom); this.jl3d = new Jl3dpassflow(dom,this.$route.query.mapid);
}, },
switchrender() { switchrender() {
if (this.renderswitch == true) { if (this.renderswitch == true) {

File diff suppressed because it is too large Load Diff