修改三维列车车站车门动画逻辑

This commit is contained in:
sunzhenyu 2020-11-18 18:04:09 +08:00
parent 6bb859e27d
commit 4e61d7270d
7 changed files with 163 additions and 301 deletions

View File

@ -143,7 +143,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
scene.add(controls3.getObject()); scene.add(controls3.getObject());
let cameracctv = new THREE.PerspectiveCamera(50, dom.clientWidth/dom.clientHeight, 0.1, 50); let cameracctv = new THREE.PerspectiveCamera(50, dom.clientWidth/dom.clientHeight, 0.1, 50);
cameracctv.position.set( -3, 0,1.5 ); cameracctv.position.set( -3, 0,4.5 );
cameracctv.rotation.y = -Math.PI/2; cameracctv.rotation.y = -Math.PI/2;
cameracctv.rotation.x = Math.PI/2; cameracctv.rotation.x = Math.PI/2;
@ -220,7 +220,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
if (drivingcode) { if (drivingcode) {
controls3.getObject().position.x = trainlisttest.list[drivingcode].matrixWorld.elements[12]-27; controls3.getObject().position.x = trainlisttest.list[drivingcode].matrixWorld.elements[12]-27;
controls3.getObject().position.y=5; controls3.getObject().position.y=5;
controls3.getObject().position.z = trainlisttest.list[drivingcode].children[0].matrixWorld.elements[14]; controls3.getObject().position.z = trainlisttest.list[drivingcode].children[0].matrixWorld.elements[14]+5;
} }
} }
@ -274,7 +274,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
trainlisttest.group.children[0].children[0].add(controls3.getObject()); trainlisttest.group.children[0].children[0].add(controls3.getObject());
controls3.getObject().position.x = 10; controls3.getObject().position.x = 10;
controls3.getObject().position.y = 0; controls3.getObject().position.y = 0;
controls3.getObject().position.z = 1.5; controls3.getObject().position.z = 4.5;
controls3.getObject().rotation.x = Math.PI/2; controls3.getObject().rotation.x = Math.PI/2;
controls3.getObject().rotation.y = -Math.PI/2; controls3.getObject().rotation.y = -Math.PI/2;
}; };
@ -284,7 +284,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
trainlisttest.group.children[0].children[0].add(controls3.getObject()); trainlisttest.group.children[0].children[0].add(controls3.getObject());
controls3.getObject().position.x = 10; controls3.getObject().position.x = 10;
controls3.getObject().position.y = 0; controls3.getObject().position.y = 0;
controls3.getObject().position.z = 1.5; controls3.getObject().position.z = 4.5;
controls3.getObject().rotation.x = Math.PI/2; controls3.getObject().rotation.x = Math.PI/2;
controls3.getObject().rotation.y = -Math.PI/2; controls3.getObject().rotation.y = -Math.PI/2;
}; };
@ -385,7 +385,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
rails = loadrails; rails = loadrails;
console.log(trainlisttest.group.children[0]); console.log(trainlisttest.group.children[0]);
trainlisttest.group.children[0].getObjectByName("c3").add(cameracctv); trainlisttest.group.children[0].getObjectByName("C3").add(cameracctv);
} }
this.eventon = function() { this.eventon = function() {

View File

@ -165,7 +165,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
trainlisttest.list[code].children[0].position.z = parseFloat(-point.z); trainlisttest.list[code].children[0].position.z = parseFloat(-point.z);
for (let tl=1; tl<6; tl++) { for (let tl=1; tl<trainlisttest.list[code].children.length; tl++) {
trainlisttest.list[code].children[tl].rotalist = []; trainlisttest.list[code].children[tl].rotalist = [];
trainlisttest.list[code].children[tl].position.z = trainlisttest.list[code].children[0].position.z; trainlisttest.list[code].children[tl].position.z = trainlisttest.list[code].children[0].position.z;
} }
@ -205,7 +205,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
trainlisttest.list[code].position.x = point.x; trainlisttest.list[code].position.x = point.x;
trainlisttest.list[code].children[0].rotalist = []; trainlisttest.list[code].children[0].rotalist = [];
trainlisttest.list[code].children[0].position.z = parseFloat(point.z); trainlisttest.list[code].children[0].position.z = parseFloat(point.z);
for (let tl=1; tl<6; tl++) { for (let tl=1; tl<trainlisttest.list[code].children.length; tl++) {
trainlisttest.list[code].children[tl].rotalist = []; trainlisttest.list[code].children[tl].rotalist = [];
trainlisttest.list[code].children[tl].position.z = trainlisttest.list[code].children[0].position.z; trainlisttest.list[code].children[tl].position.z = trainlisttest.list[code].children[0].position.z;
} }
@ -253,7 +253,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
trainlisttest.list[code].position.x = point.x; trainlisttest.list[code].position.x = point.x;
trainlisttest.list[code].position.y = 0; trainlisttest.list[code].position.y = 0;
// for (let tl=0; tl<6; tl++) { // for (let tl=0; tl<trainlisttest.list[code].children.length; tl++) {
// trainlisttest.list[code].children[tl].position.z = parseFloat(point.z); // trainlisttest.list[code].children[tl].position.z = parseFloat(point.z);
// } // }
@ -293,8 +293,8 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
let offsety = parseFloat(point.y) - parseFloat(trainlisttest.list[code].children[0].position.y); let offsety = parseFloat(point.y) - parseFloat(trainlisttest.list[code].children[0].position.y);
trainlisttest.list[code].children[0].position.y += offsety; trainlisttest.list[code].children[0].position.y += offsety;
} }
if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){ // if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){
for(let rs = 1;rs<6;rs++){ for(let rs = 1;rs<trainlisttest.list[code].children.length;rs++){
//console.log(rs); //console.log(rs);
if(trainlisttest.list[code].children[rs].rotalist[0]){ if(trainlisttest.list[code].children[rs].rotalist[0]){
let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[14]); let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[14]);
@ -309,7 +309,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
// console.log(trainlisttest.list[code].children[rs].matrixWorld.elements[12]); // console.log(trainlisttest.list[code].children[rs].matrixWorld.elements[12]);
// console.log(trainlisttest.list[code].children[rs].rotalist[0].posr.x); // console.log(trainlisttest.list[code].children[rs].rotalist[0].posr.x);
// } // }
if(rs != 5){ if(rs != (trainlisttest.list[code].children.length-1)){
let asd = trainlisttest.list[code].children[rs].rotalist[0]; let asd = trainlisttest.list[code].children[rs].rotalist[0];
trainlisttest.list[code].children[rs+1].rotalist.push(asd); trainlisttest.list[code].children[rs+1].rotalist.push(asd);
@ -326,7 +326,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
//console.log(trainlisttest.list[code].children[rs].rotalist.length); //console.log(trainlisttest.list[code].children[rs].rotalist.length);
} }
} }
} // }
@ -344,7 +344,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
trainlisttest.list[code].position.x = point.x; trainlisttest.list[code].position.x = point.x;
trainlisttest.list[code].position.y = 0; trainlisttest.list[code].position.y = 0;
// for (let tl=0; tl<6; tl++) { // for (let tl=0; tl<trainlisttest.list[code].children.length; tl++) {
// trainlisttest.list[code].children[tl].position.z = parseFloat(-point.z); // trainlisttest.list[code].children[tl].position.z = parseFloat(-point.z);
// } // }
@ -384,9 +384,9 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
// trainlisttest.list[code].position.z = point.z; // trainlisttest.list[code].position.z = point.z;
} }
if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){ // if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){
for(let rs = 1;rs<6;rs++){ for(let rs = 1;rs<trainlisttest.list[code].children.length;rs++){
//console.log(rs); //console.log(rs);
if(trainlisttest.list[code].children[rs].rotalist[0]){ if(trainlisttest.list[code].children[rs].rotalist[0]){
@ -398,7 +398,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){ for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])<=trainlisttest.list[code].children[rs].rotalist[0].posr.x){ if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])<=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
if(rs != 5){ if(rs != (trainlisttest.list[code].children.length-1)){
let asd = trainlisttest.list[code].children[rs].rotalist[0]; let asd = trainlisttest.list[code].children[rs].rotalist[0];
trainlisttest.list[code].children[rs+1].rotalist.push(asd); trainlisttest.list[code].children[rs+1].rotalist.push(asd);
} }
@ -418,7 +418,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
} }
// console.log(trainlisttest.list[code].rotalist); // console.log(trainlisttest.list[code].rotalist);
} // }
} }
@ -440,7 +440,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
trainlisttest.list[code].rotation.y = 0; trainlisttest.list[code].rotation.y = 0;
trainlisttest.list[code].position.x = point.x; trainlisttest.list[code].position.x = point.x;
trainlisttest.list[code].position.y = 0; trainlisttest.list[code].position.y = 0;
for (let tl=0; tl<6; tl++) { for (let tl=0; tl<trainlisttest.list[code].children.length; tl++) {
trainlisttest.list[code].children[tl].position.z = parseFloat(point.z); trainlisttest.list[code].children[tl].position.z = parseFloat(point.z);
} }
@ -467,7 +467,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
trainlisttest.list[code].position.x = point.x; trainlisttest.list[code].position.x = point.x;
trainlisttest.list[code].position.y = 0; trainlisttest.list[code].position.y = 0;
for (let tl=0; tl<6; tl++) { for (let tl=0; tl<trainlisttest.list[code].children.length; tl++) {
trainlisttest.list[code].children[tl].position.z = parseFloat(-point.z); trainlisttest.list[code].children[tl].position.z = parseFloat(-point.z);
} }
@ -765,6 +765,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
} }
function standupdate(data) { function standupdate(data) {
code = data.code; code = data.code;
if ( actions[code]) { if ( actions[code]) {
if (data.open == '1') { if (data.open == '1') {
actions[code].status = '1'; actions[code].status = '1';

View File

@ -41,7 +41,7 @@ var Staticmodel = [
name: "列车", name: "列车",
deviceType: "cctvTrain", deviceType: "cctvTrain",
type: "cctvTrain", type: "cctvTrain",
url: "/cbtc/static/trafficplan/train.FBX" url: "/cbtc/static/trafficplan/normaltrain.FBX"
},{ },{
id: "8", id: "8",
name: "区段", name: "区段",

View File

@ -239,7 +239,7 @@ export function AssetLoader(){
let modeldata = JSON.parse(data); let modeldata = JSON.parse(data);
console.log(modeldata);
for(let j=0;j<modeldata.assets.length;j++){ for(let j=0;j<modeldata.assets.length;j++){
let had = false; let had = false;
for(let i=0;i<scope.modellist.length;i++){ for(let i=0;i<scope.modellist.length;i++){
@ -265,10 +265,12 @@ export function AssetLoader(){
this.assetPromiseOver = function (scene){ this.assetPromiseOver = function (scene){
let initlist = []; let initlist = [];
for(let i=0;i<scope.modellist.length;i++){ for(let i=0;i<scope.modellist.length;i++){
initlist.push(fbxPromiseOver(scope.modellist[i])); initlist.push(fbxPromiseOver(scope.modellist[i]));
} }
return new Promise(function(resolve, reject){ return new Promise(function(resolve, reject){
@ -329,7 +331,6 @@ export function AssetLoader(){
let autoswitchs = new AssetModel(autoswitch); let autoswitchs = new AssetModel(autoswitch);
scope.modellist.push(autoswitchs); scope.modellist.push(autoswitchs);
console.log(signal);
fbxpromise(signal) fbxpromise(signal)
.then(function(data){ .then(function(data){
////console.log(data); ////console.log(data);
@ -587,6 +588,7 @@ export function AssetLoader(){
//object.traverse(function (node) {//获取其中对象 //object.traverse(function (node) {//获取其中对象
// node.frustumCulled = true; // node.frustumCulled = true;
//}); //});
if(asset.deviceType == "train"){ if(asset.deviceType == "train"){
let realtrain = new THREE.Group(); let realtrain = new THREE.Group();
@ -664,11 +666,12 @@ export function AssetLoader(){
//object.traverse(function (node) {//获取其中对象 //object.traverse(function (node) {//获取其中对象
// node.frustumCulled = true; // node.frustumCulled = true;
//}); //});
if(asset.type == "train"){ if(asset.type == "train"){
console.log(scope.trainoffset);
let realtrain = new THREE.Group(); let realtrain = new THREE.Group();
for(let j=6;j>0;j--){ let j = object.children.length;
let name = "c"+j; for(j;j>0;j--){
let name = "C"+j;
for(let i=0;i<object.children.length;i++){ for(let i=0;i<object.children.length;i++){
if(object.children[i].name == name){ if(object.children[i].name == name){

View File

@ -172,42 +172,41 @@ export function StationStandListN() {
} }
} ); } );
selectmesh3.traverse( function ( child ) { // selectmesh3.traverse( function ( child ) {
if ( child.isMesh ) {
child.renderOrder = 9;
}
} );
//新车门动画获取待定
// let allClear = 0;
// for(let j=0;j<standsdata.length;j++){
// //
// allClear = 0; // if ( child.isMesh ) {
// for(let i=0;i<psddata.length;i++){ // child.renderOrder = 9;
//
// for(let n=0;n<standsdata[j].stands.length;n++){
// if(psddata[i].standCode == standsdata[j].stands[n].code){
// allClear++;
// standsdata[j].stands[n].position = psddata[i].position;
// }
// }
//
// if(allClear == standsdata[j].stands.length){
// standsdata[j].stands.sort(compare);
// i = psddata.length;
// }
// } // }
// } //
// } );
//新车门动画获取待定
let allClear = 0;
for(let j=0;j<standsdata.length;j++){
allClear = 0;
for(let i=0;i<psddata.length;i++){
for(let n=0;n<standsdata[j].stands.length;n++){
if(psddata[i].standCode == standsdata[j].stands[n].code){
allClear++;
standsdata[j].stands[n].position = psddata[i].position;
}
}
if(allClear == standsdata[j].stands.length){
standsdata[j].stands.sort(compare);
i = psddata.length;
}
}
}
// //
// //
// console.log(standsdata); // console.log(standsdata);
// console.log(psddata); // console.log(psddata);
for(let i=0;i<standsdata.length;i++){ for(let i=0;i<standsdata.length;i++){
let newstationstand = new StationStandModel(standsdata[i]); let newstationstand = new StationStandModel(standsdata[i]);
// console.log(standsdata[i]);
if(standsdata[i].code != "Station96090"){
console.log("3");
newstationstand.code = standsdata[i].code; newstationstand.code = standsdata[i].code;
newstationstand.name = standsdata[i].name; newstationstand.name = standsdata[i].name;
newstationstand.type = "station"; newstationstand.type = "station";
@ -221,12 +220,22 @@ export function StationStandListN() {
// newstationstand.direction2.name = standsdata[i].direction2.name; // newstationstand.direction2.name = standsdata[i].direction2.name;
// newstationstand.direction2.screenDoorOpenStatus = "01"; // newstationstand.direction2.screenDoorOpenStatus = "01";
let newstationmesh = null; let newstationmesh = null;
if(standsdata[i].inside == undefined){ let newclip =null;
newstationmesh = selectmesh1.clone(true);
}else if(standsdata[i].inside == true){ if(standsdata[i].stands.length<=2){
newstationmesh = selectmesh1.clone(true); if(standsdata[i].inside == undefined){
newstationmesh = selectmesh1.clone(true);
newclip = selectmesh1.animations[ 0 ];
}else if(standsdata[i].inside == true){
newstationmesh = selectmesh1.clone(true);
newclip = selectmesh1.animations[ 0 ];
}else{
newstationmesh = selectmesh2.clone(true);
newclip = selectmesh2.animations[ 0 ];
}
}else{ }else{
newstationmesh = selectmesh2.clone(true); newstationmesh = selectmesh3.clone(true);
newclip = selectmesh3.animations[ 0 ];
} }
newstationmesh.code = standsdata[i].code; newstationmesh.code = standsdata[i].code;
@ -244,71 +253,93 @@ export function StationStandListN() {
// //
scope.list[standsdata[i].code] = newstationstand; scope.list[standsdata[i].code] = newstationstand;
// //
let newclip =null; for(let j=0;j<standsdata[i].stands.length;j++){
if(standsdata[i].inside == true){ let num = j+1;
newclip = selectmesh1.animations[ 0 ];
}else{
newclip = selectmesh2.animations[ 0 ];
}
for(let j=0;j<newstationmesh.children.length;j++){ let addAnimaMesh = newstationmesh.getObjectByName('door'+num);
if(newstationmesh.children[j].name == "top"){
newstationmesh.children[j].animations = [];
newstationmesh.children[j].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newstationmesh.children[j] );
if(addAnimaMesh){
newstationmesh.getObjectByName('door'+num).animations = [];
newstationmesh.getObjectByName('door'+num).animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newstationmesh.getObjectByName('door'+num) );
for(let n=0;n<psddata.length;n++){ for(let n=0;n<psddata.length;n++){
for(let m=0;m<newstationstand.stands.length;m++){ if(psddata[n].standCode == standsdata[i].stands[j].code){
let key = psddata[n].code;
if(psddata[n].standCode == newstationstand.stands[m].code && newstationstand.stands[m].right == false){ actionss[key] = {
status:"01",
let key = psddata[n].code; action:mixer.clipAction( newstationmesh.getObjectByName('door'+num).animations[0])
actionss[key] = { };
status:"01", actionss[key].action.setLoop(THREE.LoopOnce);
action:mixer.clipAction( newstationmesh.children[j].animations[0]) actionss[key].action.clampWhenFinished = true;
}; //actionss[key].play();
actionss[key].action.setLoop(THREE.LoopOnce);
actionss[key].action.clampWhenFinished = true;
//actionss[key].play();
mixers.push(mixer);
n = psddata.length;
m = newstationstand.stands.length;
}
}
}
}
if(newstationmesh.children[j].name == "down"){
newstationmesh.children[j].animations = [];
newstationmesh.children[j].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newstationmesh.children[j] );
for(let n=0;n<psddata.length;n++){
for(let m=0;m<newstationstand.stands.length;m++){
if(psddata[n].standCode == newstationstand.stands[m].code && newstationstand.stands[m].right == true){
let key = psddata[n].code;
actionss[key] = {
status:"01",
action:mixer.clipAction( newstationmesh.children[j].animations[0])
};
actionss[key].action.setLoop(THREE.LoopOnce);
actionss[key].action.clampWhenFinished = true;
//actionss[key].play();
mixers.push(mixer);
n = psddata.length;
m = newstationstand.stands.length;
}
n = psddata.length;
} }
} }
mixers.push(mixer);
} }
} }
// for(let j=0;j<newstationmesh.children.length;j++){
//
// if(newstationmesh.children[j].name == "top"){
// newstationmesh.children[j].animations = [];
// newstationmesh.children[j].animations.push(newclip.clone());
//
// let mixer = new THREE.AnimationMixer( newstationmesh.children[j] );
//
//
// for(let n=0;n<psddata.length;n++){
// for(let m=0;m<newstationstand.stands.length;m++){
//
// if(psddata[n].standCode == newstationstand.stands[m].code && newstationstand.stands[m].right == false){
//
// let key = psddata[n].code;
// actionss[key] = {
// status:"01",
// action:mixer.clipAction( newstationmesh.children[j].animations[0])
// };
// actionss[key].action.setLoop(THREE.LoopOnce);
// actionss[key].action.clampWhenFinished = true;
// //actionss[key].play();
// mixers.push(mixer);
// n = psddata.length;
// m = newstationstand.stands.length;
// }
// }
//
//
// }
//
// }
// if(newstationmesh.children[j].name == "down"){
// newstationmesh.children[j].animations = [];
// newstationmesh.children[j].animations.push(newclip.clone());
//
// let mixer = new THREE.AnimationMixer( newstationmesh.children[j] );
// for(let n=0;n<psddata.length;n++){
// for(let m=0;m<newstationstand.stands.length;m++){
//
// if(psddata[n].standCode == newstationstand.stands[m].code && newstationstand.stands[m].right == true){
// let key = psddata[n].code;
// actionss[key] = {
// status:"01",
// action:mixer.clipAction( newstationmesh.children[j].animations[0])
// };
// actionss[key].action.setLoop(THREE.LoopOnce);
// actionss[key].action.clampWhenFinished = true;
// //actionss[key].play();
// mixers.push(mixer);
// n = psddata.length;
// m = newstationstand.stands.length;
// }
//
// }
// }
// }
// }
if(mode){ if(mode){
if(mode == "02"){ if(mode == "02"){
@ -328,116 +359,7 @@ export function StationStandListN() {
textt.dispose(); textt.dispose();
} }
} }
}else{
newstationstand.code = standsdata[i].code;
newstationstand.name = standsdata[i].name;
newstationstand.type = "station";
newstationstand.num = i;
newstationstand.stand = [];
// newstationstand.direction1.code = standsdata[i].direction1.code;
// newstationstand.direction1.name = standsdata[i].direction1.name;
// newstationstand.direction1.screenDoorOpenStatus = "01";
//
// newstationstand.direction2.code = standsdata[i].direction2.code;
// newstationstand.direction2.name = standsdata[i].direction2.name;
// newstationstand.direction2.screenDoorOpenStatus = "01";
let newstationmesh = null;
newstationmesh = selectmesh3.clone(true);
newstationmesh.code = standsdata[i].code;
newstationmesh.name = standsdata[i].code;
newstationmesh.position.x = standsdata[i].position.x;
newstationmesh.position.y = standsdata[i].position.y;
newstationmesh.position.z = standsdata[i].position.z;
// newstationmesh.rotation.x = standsdata[i].rotation._x;
// newstationmesh.rotation.y = standsdata[i].rotation._y;
// newstationmesh.rotation.z = standsdata[i].rotation._z;
newstationstand.mesh = newstationmesh;
scope.group.add(newstationmesh);
//
scope.list[standsdata[i].code] = newstationstand;
//
let newclip =null;
newclip = selectmesh3.animations[ 0 ];
for(let j=0;j<newstationmesh.children.length;j++){
if(newstationmesh.children[j].name == "top"){
newstationmesh.children[j].animations = [];
newstationmesh.children[j].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newstationmesh.children[j] );
for(let n=0;n<psddata.length;n++){
for(let m=0;m<newstationstand.stands.length;m++){
console.log("====================");
console.log(newstationstand.stands[m]);
console.log(psddata[n]);
if(psddata[n].standCode == newstationstand.stands[m].code && newstationstand.stands[m].right == false){
let key = psddata[n].code;
actionss[key] = {
status:"01",
action:mixer.clipAction( newstationmesh.children[j].animations[0])
};
actionss[key].action.setLoop(THREE.LoopOnce);
actionss[key].action.clampWhenFinished = true;
//actionss[key].play();
mixers.push(mixer);
n = psddata.length;
m = newstationstand.stands.length;
}
}
}
}
if(newstationmesh.children[j].name == "down"){
newstationmesh.children[j].animations = [];
newstationmesh.children[j].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newstationmesh.children[j] );
for(let n=0;n<psddata.length;n++){
for(let m=0;m<newstationstand.stands.length;m++){
console.log("====================");
console.log(newstationstand.stands[m]);
console.log(psddata[n]);
if(psddata[n].standCode == newstationstand.stands[m].code && newstationstand.stands[m].right == true){
let key = psddata[n].code;
actionss[key] = {
status:"01",
action:mixer.clipAction( newstationmesh.children[j].animations[0])
};
actionss[key].action.setLoop(THREE.LoopOnce);
actionss[key].action.clampWhenFinished = true;
//actionss[key].play();
mixers.push(mixer);
n = psddata.length;
m = newstationstand.stands.length;
}
}
}
}
}
if(mode){
if(mode == "02"){
let textgeometry = new THREE.PlaneBufferGeometry( 65, 90, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(standsdata[i]));
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
let textplane = new THREE.Mesh( textgeometry, textmaterial );
textplane.name = standsdata[i].code;
textplane.position.y = 70;
textplane.rotation.x = Math.PI/2;
textplane.position.z = 50;
scope.textlist.push(textplane);
newstationmesh.add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
}
}
}
} }
// scene.add(scope.textlist); // scene.add(scope.textlist);

View File

@ -77,13 +77,13 @@ export function TrainListN() {
// //
// fclip = new THREE.AnimationClip("four",2,ntracks2); // fclip = new THREE.AnimationClip("four",2,ntracks2);
ntracks2 = assetloader.modellist[n].animations.slice(6,14); // ntracks2 = assetloader.modellist[n].animations.slice(6,14);
//
// fclip = new THREE.AnimationClip("four",2,ntracks2);
//
// ntracks1 = assetloader.modellist[n].animations.slice(0,6);
fclip = new THREE.AnimationClip("four",2,ntracks2); tclip = new THREE.AnimationClip("three",2,assetloader.modellist[n].animations);
ntracks1 = assetloader.modellist[n].animations.slice(0,6);
tclip = new THREE.AnimationClip("three",2,ntracks1);
n = 0; n = 0;
} }
@ -97,8 +97,6 @@ export function TrainListN() {
newmesh.mixer = []; newmesh.mixer = [];
for(let j=0;j<newmesh.children.length;j++){ for(let j=0;j<newmesh.children.length;j++){
if(newmesh.children[j].name == "c1" || newmesh.children[j].name == "c6"){
// console.log("==================="); // console.log("===================");
for(let n=0,lenn = newmesh.children[j].children.length;n<lenn;n++){ for(let n=0,lenn = newmesh.children[j].children.length;n<lenn;n++){
@ -135,37 +133,7 @@ export function TrainListN() {
mixers.push(mixer); mixers.push(mixer);
} }
} }
}else{
for(let n=0,lenn = newmesh.children[j].children.length;n<lenn;n++){
if(newmesh.children[j].children[n].name == "top"){
newmesh.children[j].children[n].animations = [];
newmesh.children[j].children[n].animations.push(fclip.clone());
let mixer = new THREE.AnimationMixer( newmesh.children[j].children[n] );
newmesh.mixer.push(mixer);
newmesh.mixerpush = false;
let action = mixer.clipAction( newmesh.children[j].children[n].animations[ 0 ] );
//action.play();
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
actionss["traindoor"].top.push(action);
mixers.push(mixer);
}
if(newmesh.children[j].children[n].name == "down"){
newmesh.children[j].children[n].animations = [];
newmesh.children[j].children[n].animations.push(fclip.clone());
let mixer = new THREE.AnimationMixer( newmesh.children[j].children[n] );
newmesh.mixer.push(mixer);
newmesh.mixerpush = false;
let action = mixer.clipAction( newmesh.children[j].children[n].animations[ 0 ] );
//action.play();
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
actionss["traindoor"].down.push(action);
mixers.push(mixer);
}
}
}
newmesh.children[j].axis = new THREE.Vector3(); newmesh.children[j].axis = new THREE.Vector3();
newmesh.children[j].up = new THREE.Vector3(1, 0, 0); newmesh.children[j].up = new THREE.Vector3(1, 0, 0);
@ -208,8 +176,7 @@ export function TrainListN() {
for(let n=assetloader.modellist.length-1;n>=0;n--){ for(let n=assetloader.modellist.length-1;n>=0;n--){
if(assetloader.modellist[n].type == "train"){ if(assetloader.modellist[n].type == "train"){
selectmesh = assetloader.modellist[n].mesh selectmesh = assetloader.modellist[n].mesh;
// ntracks1 = assetloader.modellist[n].animations.slice(16,27); // ntracks1 = assetloader.modellist[n].animations.slice(16,27);
// //
// tclip = new THREE.AnimationClip("three",2,ntracks1); // tclip = new THREE.AnimationClip("three",2,ntracks1);
@ -218,13 +185,12 @@ export function TrainListN() {
// //
// fclip = new THREE.AnimationClip("four",2,ntracks2); // fclip = new THREE.AnimationClip("four",2,ntracks2);
ntracks2 = assetloader.modellist[n].animations.slice(6,14); // ntracks2 = assetloader.modellist[n].animations.slice(6,14);
//
fclip = new THREE.AnimationClip("four",2,ntracks2); // fclip = new THREE.AnimationClip("four",2,ntracks2);
//
ntracks1 = assetloader.modellist[n].animations.slice(0,6); // ntracks1 = assetloader.modellist[n].animations.slice(0,6);
tclip = new THREE.AnimationClip("three",2,assetloader.modellist[n].animations);
tclip = new THREE.AnimationClip("three",2,ntracks1);
n = 0; n = 0;
} }
} }
@ -252,7 +218,6 @@ export function TrainListN() {
// console.log(data[i]); // console.log(data[i]);
for(let j=0;j<newmesh.children.length;j++){ for(let j=0;j<newmesh.children.length;j++){
if(newmesh.children[j].name == "c1" || newmesh.children[j].name == "c6"){
// console.log("==================="); // console.log("===================");
for(let n=0,lenn = newmesh.children[j].children.length;n<lenn;n++){ for(let n=0,lenn = newmesh.children[j].children.length;n<lenn;n++){
@ -288,37 +253,7 @@ export function TrainListN() {
actionss[data[i].groupNumber].down.push(action); actionss[data[i].groupNumber].down.push(action);
} }
} }
}else{
for(let n=0,lenn = newmesh.children[j].children.length;n<lenn;n++){
if(newmesh.children[j].children[n].name == "top"){
newmesh.children[j].children[n].animations = [];
newmesh.children[j].children[n].animations.push(fclip.clone());
let mixer = new THREE.AnimationMixer( newmesh.children[j].children[n] );
newmesh.mixer.push(mixer);
newmesh.mixerpush = false;
// mixers.push(mixer);
let action = mixer.clipAction( newmesh.children[j].children[n].animations[ 0 ] );
//action.play();
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
actionss[data[i].groupNumber].top.push(action);
}
if(newmesh.children[j].children[n].name == "down"){
newmesh.children[j].children[n].animations = [];
newmesh.children[j].children[n].animations.push(fclip.clone());
let mixer = new THREE.AnimationMixer( newmesh.children[j].children[n] );
newmesh.mixer.push(mixer);
newmesh.mixerpush = false;
// mixers.push(mixer);
let action = mixer.clipAction( newmesh.children[j].children[n].animations[ 0 ] );
//action.play();
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
actionss[data[i].groupNumber].down.push(action);
}
}
}
//newmesh.children[j].name = data[i].code; //newmesh.children[j].name = data[i].code;
newmesh.children[j].groupNumber = data[i].groupNumber; newmesh.children[j].groupNumber = data[i].groupNumber;
newmesh.children[j].axis = new THREE.Vector3(); newmesh.children[j].axis = new THREE.Vector3();
@ -331,6 +266,7 @@ export function TrainListN() {
newmesh.children[j].rotalist = []; newmesh.children[j].rotalist = [];
// console.log(newmesh); // console.log(newmesh);
} }
// //
// // newmesh.children[4].add(newmesh.children[5]); // // newmesh.children[4].add(newmesh.children[5]);
// // newmesh.children[3].add(newmesh.children[4]); // // newmesh.children[3].add(newmesh.children[4]);

Binary file not shown.