修改三维cctv注释

This commit is contained in:
sunzhenyu 2020-10-23 18:06:24 +08:00
parent bd6fc3b077
commit 83e99df71e
10 changed files with 74 additions and 66 deletions

View File

@ -1,51 +1,61 @@
import { Staticmodel } from '@/jlmap3d/jl3dpassflow/config.js';
//静态资源文件路劲
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
//loader
import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader';
//轨道视角控制
import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
//模型管理器
import { ModelManager } from '@/jlmap3d/jl3dpassflow/loader.js';
//骨骼动画模型辅助工具
import { SkeletonUtils } from '@/jlmap3d/main/utils/SkeletonUtils.js';
//获取信息接口
import { getPublishMapVersion, getPublishMapDetail,getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata';
//cctv站台对象
import { PasserStation } from '@/jlmap3d/jl3dpassflow/model/passerstation.js';
//cctv检票机对象
import { PasserCheckDoor } from '@/jlmap3d/jl3dpassflow/model/passercheckdoor.js';
//cctv列车对象
import { PasserTrain } from '@/jlmap3d/jl3dpassflow/model/passertrain.js';
//cctv行人对象
import { PasserHuman } from '@/jlmap3d/jl3dpassflow/model/passerhuman.js';
//cctv渲染器
import { PasserRender } from '@/jlmap3d/jl3dpassflow/passerrender/passerrender.js';
//cctv行人ai
import { PasserAi } from '@/jlmap3d/jl3dpassflow/passerai/passerai.js';
//行人寻路相关工具
import { ZoneManager } from '@/jlmap3d/jl3dpassflow/model/zonemanager.js';
import { PathFinder } from '@/jlmap3d/jl3dpassflow/passerai/pathfinder.js';
//cctv通信工具
import { PassflowConnect } from '@/jlmap3d/jl3dpassflow/connect/passflowconnect.js';
import StompClient from '@/utils/sock';
import store from '@/store/index_APP_TARGET';
// import { Loading } from 'element-ui';
import {Stats} from '@/jlmap3d/main/lib/stats.min.js';
//动画播放相关
let clock = new THREE.Clock();
let delta;
let scene,camerass,renderer;
let aiswitch = 0;
//动画组
let mixers = [];
//车站摄像机模型
let monitor;
//寻路相关对象
let passerZone = new ZoneManager();
let pathFinder = new PathFinder();
let path;
//设备动画action组
let deviceaction = [];
//控制帧率的webworker线程
let passerWebWork = new Worker(JL3D_LOCAL_STATIC+"/workertest/passsimulation/station.js");
//老版本临时ai控制
let olddataai = false;

View File

@ -1,5 +1,5 @@
import { BASE_ASSET_API } from '@/api/jlmap3d/assets3d.js';
//模型管理器
export function ModelManager(){
let scope = this;
@ -65,7 +65,7 @@ export function ModelManager(){
action:null
};
//读取模型
this.loadpromise = function (data,mixers){
let initlist = [];
for(let i=0,leni=data.length;i<leni;i++){
@ -95,7 +95,7 @@ export function ModelManager(){
initlist.push(fbxpromise(data[i],mixers,scope.section));
}
}
//promise按顺序加载
return new Promise(function(resolve, reject){
Promise.all(initlist).then((result) => {
@ -108,18 +108,13 @@ export function ModelManager(){
}
}
//fbx模型加载
function fbxpromise(asset,mixers,model){
return new Promise(function(resolve, reject){
var loader = new THREE.FBXLoader();
loader.load( BASE_ASSET_API+asset.url, function ( object ) {
// let mixer = new THREE.AnimationMixer( object );
// object.traverse( function ( child ) {
// if ( child.isMesh ) {
// child.castShadow = true;
// child.receiveShadow = true;
// }
// } );
//列车模型子物体重新排序
if(asset.type == "cctvTrain"){
// let mixer = new THREE.AnimationMixer( object );
let realtrain = new THREE.Group();

View File

@ -1,9 +1,10 @@
export function PasserCheckDoor(data) {
var scope = this;
//入口闸机组
this.zhajiin = [];
//出口闸机组
this.zhajiout = [];
//定义闸机状态
for(let i=0;i<5;i++){
let zhaji = {
id:"in0"+(i+1),
@ -12,7 +13,6 @@ export function PasserCheckDoor(data) {
}
scope.zhajiin.push(zhaji);
}
for(let i=0;i<5;i++){
let zhaji = {
id:"out0"+(i+1),
@ -21,6 +21,7 @@ export function PasserCheckDoor(data) {
}
scope.zhajiout.push(zhaji);
}
//初始化闸机动画
this.initCheckDoorInAnimation = function(object,mixers ,deviceaction ,scene){
let mixer = new THREE.AnimationMixer( object );
let newclip = object.animations[ 0 ];
@ -116,6 +117,7 @@ export function PasserCheckDoor(data) {
scene.add(newzhaji);
}
//初始化闸机动画
this.initCheckDoorOutAnimation = function(object,mixers ,deviceaction ,scene){
let mixer = new THREE.AnimationMixer( object );
let newclip = object.animations[ 0 ];
@ -207,7 +209,7 @@ export function PasserCheckDoor(data) {
}
scene.add(newzhaji);
}
//闸机动画控制
this.checkDoorControl = function(type,door,deviceaction){
let devicenum = door;

View File

@ -1,12 +1,12 @@
export function PasserHuman() {
let scope = this;
//初始人物模型和动画
let originhuman1 = null;
let originhuman2 = null;
let originanima1 = null;
let originanima2 = null;
//初始化人物模型动画
this.initHumans = function(object1,object2,mixers,deviceaction,scene){
originhuman1 = object1;
originhuman1.progress = 1;
@ -20,7 +20,7 @@ export function PasserHuman() {
originhuman1.remove(originhuman1.children[2]);
}
//创建新的乘客
this.newHumanCreate = function(humanlist,position,stage,direct,door){
let mantype = Math.floor(Math.random()*(3-1+1))+1;
let newhuman;
@ -63,7 +63,7 @@ export function PasserHuman() {
humanlist.add(newhuman);
// console.log(humanlist.children.length);
}
//定义新模型走路动画
this.initMoveAnimate = function(model,name,points,index){
model.status = 1;
let curve = new THREE.CatmullRomCurve3(points);
@ -80,7 +80,7 @@ export function PasserHuman() {
model.runrail = curve;
model.speed = 0.2/curve.getLength();
}
//更新人物列表中人物的动画
this.moveAnimateUpdate = function(humanlist,olddataai,passerHuman){
for(let i=0;i<humanlist.children.length;i++){
if(humanlist.children[i].status == 1){
@ -159,7 +159,7 @@ export function PasserHuman() {
}
}
}
//离开车站释放缓存
this.uncache = function(uncachemodel){
if(uncachemodel){
uncachemodel.mixer.uncacheAction();

View File

@ -29,7 +29,7 @@ export function PasserStation() {
}
scope.stationright.push(sr);
}
//初始化车站模型动画
this.initStationAnimation = function( object,mixers ,deviceaction ,scene){
let mixer = new THREE.AnimationMixer( object ,mixers ,deviceaction ,scene);
@ -91,7 +91,7 @@ export function PasserStation() {
scene.add(object);
}
//初始化车站名称数据
this.initStationList = function(stationdata,standdata,psddata){
let list = [];
if(psddata){
@ -154,15 +154,16 @@ export function PasserStation() {
olddataai = true;
}
}
//加载线路车站名贴图
this.loadMaterial = function(netdata3d){
Materialload(scope,JSON.parse(netdata3d.data.assets).stationTextureList[0]);
}
//更换场景车站
this.changestation = function(stationname){
for(let i=0,leni=scope.stationlist.length;i<leni;i++){
if(scope.stationlist[i].name == stationname){
scope.nowStation = scope.stationlist[i];
if(scope.stationtexture["stationlist"]){
scope.stationMesh.getObjectByName("zhantaiming").material.map = scope.stationtexture[scope.nowStation.code];
scope.stationMesh.getObjectByName("zhantaiming").material.map.needsUpdate = true;

View File

@ -2,7 +2,7 @@ export function PasserTrain() {
let scope = this;
this.toptrain = null;
this.downtrain = null;
//初始化列车模型动画
this.initTrain = function(object,mixers,deviceaction,scene){
let ntracks1,ntracks2,tclip,fclip;
@ -60,6 +60,7 @@ export function PasserTrain() {
scene.add(scope.toptrain);
scene.add(scope.downtrain);
}
//初始化车门动画
function inittrainanimation(train,tclip,fclip,mixers){
for(let j=0;j<train.children.length;j++){
if(train.children[j].name == "c1" || train.children[j].name == "c6"){

View File

@ -1,5 +1,5 @@
import { ZoneModel } from '@/jlmap3d/jl3dpassflow/model/zonemodel.js';
//进站区域1
let enter1 = {
code : '001',
name : "enter1",
@ -11,7 +11,7 @@ let enter1 = {
new THREE.Vector3(32,9.8,-6)
]
};
//进站区域2
let enter2 = {
code : '002',
name : "enter2",
@ -23,7 +23,7 @@ let enter2 = {
new THREE.Vector3(32,9.8,31.5)
]
};
//安检区域
let security = {
code : '003',
name : "security",
@ -35,7 +35,7 @@ let security = {
new THREE.Vector3(21,9.8,21)
]
};
//进方向闸机区域
let entergate = {
code : '004',
name : "entergate",
@ -50,7 +50,7 @@ let entergate = {
new THREE.Vector3(0.7,9.8,18.1)
]
};
//站台上车区域
let standtop = {
code : '005',
name : "standtop",
@ -86,7 +86,7 @@ let standtop = {
new THREE.Vector3(-63.5,1.77,-1.8)
]
};
//站台下车区域
let standdown = {
code : '006',
name : "standdown",
@ -123,6 +123,7 @@ let standdown = {
]
};
//4是刚下车状态
//出方向闸机区域
let exitgate = {
code : '007',
name : "exitgate",
@ -137,7 +138,7 @@ let exitgate = {
new THREE.Vector3(18,9.8,5.4)
]
};
//出站台区域1
let exit1 = {
code : '008',
name : "exit1",
@ -149,7 +150,7 @@ let exit1 = {
new THREE.Vector3(30.5,9.8,-7.4)
]
};
//出站台区域2
let exit2 = {
code : '009',
name : "exit2",
@ -163,6 +164,7 @@ let exit2 = {
};
let enternum = 0;
let exitnum = 0;
//区域管理器
export function ZoneManager() {
var scope = this;
@ -172,7 +174,7 @@ export function ZoneManager() {
this.list = [];
initzone();
//初始化区域对象
function initzone(){
scope.list[enter1.name] = new ZoneModel(enter1);
scope.list[enter2.name] = new ZoneModel(enter2);
@ -184,7 +186,7 @@ export function ZoneManager() {
scope.list[exit1.name] = new ZoneModel(exit1);
scope.list[exit2.name] = new ZoneModel(exit2);
}
//获取区域范围内点
this.getinitposition = function(name){
// console.log(scope.list[name]);
let randompoint = new THREE.Vector3(0,scope.list[name].randompoint.y,0);
@ -246,6 +248,7 @@ export function ZoneManager() {
};
return standdata;
}
this.getgateposition = function(name){
let randompoint = new THREE.Vector3(0,0,0);

View File

@ -15,7 +15,7 @@ export function PasserAi(zone,finder) {
let path;
let playerPosition = new THREE.Vector3( -3.5, 0.5, 5.5 );
let targetPosition = new THREE.Vector3();
//生成下车出站人物
this.passerout = function(direct){
// console.log(direct);
if(direct == "top"){
@ -43,7 +43,7 @@ export function PasserAi(zone,finder) {
}
}
//初始化加载人物
this.initPasser = function(humanlist,passerHuman){
for(let i=0;i<3;i++){
@ -68,7 +68,7 @@ export function PasserAi(zone,finder) {
}
}
//人物站台阶段更新
this.aiUpdate = function(humanlist,passerHuman,passerCheckDoor,deviceaction){
for(let i=0;i<humanlist.children.length;i++){
// console.log(humans[i]);

View File

@ -101,8 +101,8 @@ this.loadpromise = function(sectionList,sectiondata,rails,scene,assetloader){
// console.log(newsection);
let height = Math.random()/1000;
var closedSpline;
if(Math.abs(newsection.railpoint[0].y-newsection.railpoint[2].y)>0.01){
console.log(newsection.railpoint);
closedSpline = new THREE.CatmullRomCurve3( [
new THREE.Vector3(newsection.railpoint[0].x,newsection.railpoint[0].y,newsection.railpoint[0].z),
new THREE.Vector3(newsection.railpoint[1].x,newsection.railpoint[1].y,newsection.railpoint[1].z+0.001),
@ -110,9 +110,9 @@ this.loadpromise = function(sectionList,sectiondata,rails,scene,assetloader){
] );
}else{
closedSpline = new THREE.CatmullRomCurve3( [
new THREE.Vector3(newsection.railpoint[0].x,newsection.railpoint[0].y,newsection.railpoint[0].z),
new THREE.Vector3(newsection.railpoint[1].x,newsection.railpoint[0].y,newsection.railpoint[1].z+0.001),
new THREE.Vector3(newsection.railpoint[2].x,newsection.railpoint[0].y,newsection.railpoint[2].z)
new THREE.Vector3(newsection.railpoint[0].x,newsection.railpoint[2].y,newsection.railpoint[0].z),
new THREE.Vector3(newsection.railpoint[1].x,newsection.railpoint[2].y,newsection.railpoint[1].z+0.01),
new THREE.Vector3(newsection.railpoint[2].x,newsection.railpoint[2].y,newsection.railpoint[2].z)
] );
}
@ -123,18 +123,18 @@ this.loadpromise = function(sectionList,sectiondata,rails,scene,assetloader){
closedSpline.tension = 0.15;
closedSpline.closed = false;
var extrudeSettings = {
steps : 6,
curveSegments : 1,
bevelSegments : 1,
bevelEnabled : false,
extrudePath : closedSpline,
steps : 6,
curveSegments : 1,
bevelSegments : 1,
bevelEnabled : false,
extrudePath : closedSpline,
};
var shape = new THREE.Shape();
len = closedSpline.getLength();
if(Math.abs(newsection.railpoint[0].y - newsection.railpoint[2].y)>0.001){
if(Math.abs(newsection.railpoint[0].y - newsection.railpoint[2].y)>0.01){
shape.moveTo( -2, 0 );
shape.lineTo( 2, 0 );
}else{

View File

@ -152,17 +152,13 @@ export default {
handleDelete(index, row) {
console.log(row);
deleteAsset(row.modelurl).then(netdata => {
console.log(netdata);
deleteAssetData(row.id).then(netdata => {
this.tableData.splice(index, 1);
console.log(netdata);
}).catch(error => {
console.log(error);
});
}).catch(error => {
console.log(error);
});
}
}