Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
thesai 2021-12-20 11:06:26 +08:00
commit 8195bafa03
3 changed files with 1059 additions and 1003 deletions

View File

@ -297,17 +297,15 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
//三维交互点击事件函数
function onselect(event) {
if(event.button == "0"){
if(controlManager.controlMode != 'fps'){
//定义光线
let raycaster = new THREE.Raycaster();
//定义平面鼠标点击坐标
let mouse = new THREE.Vector2();
mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
raycaster.setFromCamera( mouse, controlManager.orbitCamera );
if(controlManager.controlMode != 'fps' && event.button == "0" && stationstandlist){
//定义光线
let raycaster = new THREE.Raycaster();
//定义平面鼠标点击坐标
let mouse = new THREE.Vector2();
mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
raycaster.setFromCamera( mouse, controlManager.orbitCamera );
//从站台对象组获取点击目标
let intersects1 = raycaster.intersectObjects( stationstandlist.group.children,true);
@ -319,7 +317,6 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
controlManager.attachFpsCamera(intersects1[0].object.parent,intersects1[0].point);
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,437 +1,475 @@
import {StationStandModel} from '@/jlmap3d/main/newmodel/StationStandModel.js';
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
import {
StationStandModel
} from '@/jlmap3d/main/newmodel/StationStandModel.js';
import {
JL3D_LOCAL_STATIC
} from '@/api/jlmap3d/assets3d.js';
export function StationStandListN() {
let scope = this;
let scope = this;
this.type = "stationstandlist";
this.type = "stationstandlist";
this.list = [];
this.list = [];
this.group = new THREE.Group();
this.group.name = "station";
this.textlist = [];
this.group = new THREE.Group();
this.group.name = "station";
this.textlist = [];
this.initpromise = function(stationdata,standsdata,psddata,scene,assetloader,mixers,actionss,mode){
return new Promise(function(resolve, reject){
this.initpromise = function(stationdata, standsdata, psddata, scene, assetloader, mixers, actionss, mode) {
return new Promise(function(resolve, reject) {
let stations = stationdata;
let selectmesh1;
let stations = stationdata;
let selectmesh1;
for(let j=0;j<assetloader.modellist.length;j++){
if(assetloader.modellist[j].deviceType == "stand"){
selectmesh1 = assetloader.modellist[j].mesh;
}
}
for (let j = 0; j < assetloader.modellist.length; j++) {
if (assetloader.modellist[j].deviceType == "stand") {
selectmesh1 = assetloader.modellist[j].mesh;
}
}
for(let i=0;i<standsdata.length;i++){
let newstationstand = new StationStandModel(standsdata[i]);
for (let i = 0; i < standsdata.length; i++) {
let newstationstand = new StationStandModel(standsdata[i]);
newstationstand.code = standsdata[i].code;
newstationstand.name = standsdata[i].name;
newstationstand.type = "station";
newstationstand.num = i;
newstationstand.code = standsdata[i].code;
newstationstand.name = standsdata[i].name;
newstationstand.type = "station";
newstationstand.num = i;
newstationstand.direction1.code = standsdata[i].direction1.code;
newstationstand.direction1.name = standsdata[i].direction1.name;
newstationstand.direction1.screenDoorOpenStatus = "01";
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";
newstationstand.direction2.code = standsdata[i].direction2.code;
newstationstand.direction2.name = standsdata[i].direction2.name;
newstationstand.direction2.screenDoorOpenStatus = "01";
let newstationmesh = selectmesh1.clone(true);
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);
let newstationmesh = selectmesh1.clone(true);
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;
scope.list[standsdata[i].code] = newstationstand;
let newclip = selectmesh1.animations[ 0 ];
for(let j=0;j<newstationmesh.children.length;j++){
let newclip = selectmesh1.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());
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] );
let mixer = new THREE.AnimationMixer(newstationmesh.children[j]);
for(let n=0;n<psddata.length;n++){
if(psddata[n].standCode == newstationstand.direction2.code){
for (let n = 0; n < psddata.length; n++) {
if (psddata[n].standCode == newstationstand.direction2.code) {
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;
}
}
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;
}
}
}
if(newstationmesh.children[j].name == "down"){
newstationmesh.children[j].animations = [];
newstationmesh.children[j].animations.push(newclip.clone());
}
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++){
if(psddata[n].standCode == newstationstand.direction1.code){
let mixer = new THREE.AnimationMixer(newstationmesh.children[j]);
for (let n = 0; n < psddata.length; n++) {
if (psddata[n].standCode == newstationstand.direction1.code) {
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;
}
}
}
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;
}
}
}
}
}
if(mode){
if(mode == "02"){
let textgeometry = new THREE.PlaneBufferGeometry( 65, 90, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(stationdata[i]));
if (mode) {
if (mode == "02") {
let textgeometry = new THREE.PlaneBufferGeometry(65, 90, 1);
let textt = new THREE.CanvasTexture(getTextCanvas(stationdata[i]));
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
let textplane = new THREE.Mesh( textgeometry, textmaterial );
textplane.name = stationdata[i].code;
textplane.modeltype = "textplane";
textplane.position.y = 80;
textplane.rotation.x = Math.PI/2;
//textplane.position.x = -30;
scope.textlist.push(textplane);
newstationmesh.add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
// let newtopstation = topstationmesh.clone(true);
// newtopstation.position.x = map[k].mesh.position.x;
// newtopstation.position.z = map[k].mesh.position.z;
// scene.add(newtopstation);
}
}
}
// scene.add(scope.textlist);
stationdata = null;
psddata = null;
scene.add(scope.group);
resolve("loadedstation");
});
let textmaterial = new THREE.MeshBasicMaterial({
side: THREE.DoubleSide,
map: textt,
transparent: true
});
let textplane = new THREE.Mesh(textgeometry, textmaterial);
textplane.name = stationdata[i].code;
textplane.modeltype = "textplane";
textplane.position.y = 80;
textplane.rotation.x = Math.PI / 2;
//textplane.position.x = -30;
scope.textlist.push(textplane);
newstationmesh.add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
// let newtopstation = topstationmesh.clone(true);
// newtopstation.position.x = map[k].mesh.position.x;
// newtopstation.position.z = map[k].mesh.position.z;
// scene.add(newtopstation);
}
}
}
// scene.add(scope.textlist);
stationdata = null;
psddata = null;
scene.add(scope.group);
resolve("loadedstation");
});
}
this.loadpromise = function(stationdata,standsdata,psddata,scene,assetloader,mixers,actionss,mode,otherStation,project){
return new Promise(function(resolve, reject){
// console.log(standsdata);
let stations = stationdata;
let selectmesh1;
let selectmesh2;
let selectmesh3;
let specilmesh;
}
this.loadpromise = function(stationdata, standsdata, psddata, scene, assetloader, mixers, actionss, mode, otherStation, project) {
return new Promise(function(resolve, reject) {
// console.log(standsdata);
let stations = stationdata;
let selectmesh1;
let selectmesh2;
let selectmesh3;
let specilmesh;
let nologonc,nologowc,nologohc;
let nologonc, nologowc, nologohc;
for(let j=0;j<assetloader.modellist.length;j++){
// console.log(assetloader.modellist[j].type);
if(assetloader.modellist[j].type == "stationInside"){
selectmesh1 = assetloader.modellist[j].mesh;
}
if(assetloader.modellist[j].type == "stationOutside"){
selectmesh2 = assetloader.modellist[j].mesh;
// assetloader.modellist[num2].mesh.rotation.y = Math.PI/2;
}
if(assetloader.modellist[j].type == "stationThree"){
selectmesh3 = assetloader.modellist[j].mesh;
// assetloader.modellist[num2].mesh.rotation.y = Math.PI/2;
}
if(assetloader.modellist[j].type == "spmxa"){
specilmesh = assetloader.modellist[j].mesh;
}
for (let j = 0; j < assetloader.modellist.length; j++) {
// console.log(assetloader.modellist[j].type);
if (assetloader.modellist[j].type == "stationInside") {
selectmesh1 = assetloader.modellist[j].mesh;
}
if (assetloader.modellist[j].type == "stationOutside") {
selectmesh2 = assetloader.modellist[j].mesh;
// assetloader.modellist[num2].mesh.rotation.y = Math.PI/2;
}
if (assetloader.modellist[j].type == "stationThree") {
selectmesh3 = assetloader.modellist[j].mesh;
// assetloader.modellist[num2].mesh.rotation.y = Math.PI/2;
}
if (assetloader.modellist[j].type == "spmxa") {
specilmesh = assetloader.modellist[j].mesh;
}
if(project == "nologo"){
if(assetloader.modellist[j].type == "nologonc"){
nologonc = assetloader.modellist[j].mesh;
// assetloader.modellist[num2].mesh.rotation.y = Math.PI/2;
}
if(assetloader.modellist[j].type == "nologowc"){
nologowc = assetloader.modellist[j].mesh;
// assetloader.modellist[num2].mesh.rotation.y = Math.PI/2;
}
if(assetloader.modellist[j].type == "nologohc"){
nologohc = assetloader.modellist[j].mesh;
}
}
if (project == "nologo") {
if (assetloader.modellist[j].type == "nologonc") {
nologonc = assetloader.modellist[j].mesh;
// assetloader.modellist[num2].mesh.rotation.y = Math.PI/2;
}
if (assetloader.modellist[j].type == "nologowc") {
nologowc = assetloader.modellist[j].mesh;
// assetloader.modellist[num2].mesh.rotation.y = Math.PI/2;
}
if (assetloader.modellist[j].type == "nologohc") {
nologohc = assetloader.modellist[j].mesh;
}
}
}
selectmesh1.traverse( function ( child ) {
if (project == "say") {
if (assetloader.modellist[j].type == "nologonc") {
nologonc = assetloader.modellist[j].mesh;
// assetloader.modellist[num2].mesh.rotation.y = Math.PI/2;
}
if (assetloader.modellist[j].type == "nologohc") {
nologohc = assetloader.modellist[j].mesh;
}
}
if ( child.isMesh ) {
child.renderOrder = 9;
}
}
selectmesh1.traverse(function(child) {
} );
selectmesh2.traverse( function ( child ) {
if (child.isMesh) {
child.renderOrder = 9;
}
if ( child.isMesh ) {
child.renderOrder = 9;
}
});
selectmesh2.traverse(function(child) {
} );
// selectmesh3.traverse( function ( child ) {
//
// if ( child.isMesh ) {
// child.renderOrder = 9;
// }
//
// } );
//新车门动画获取待定
let allClear = 0;
for(let j=0;j<standsdata.length;j++){
if (child.isMesh) {
child.renderOrder = 9;
}
allClear = 0;
for(let i=0;i<psddata.length;i++){
});
// selectmesh3.traverse( function ( child ) {
//
// if ( child.isMesh ) {
// child.renderOrder = 9;
// }
//
// } );
//新车门动画获取待定
let allClear = 0;
for (let j = 0; j < standsdata.length; j++) {
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;
}
}
allClear = 0;
for (let i = 0; i < psddata.length; i++) {
if(allClear == standsdata[j].stands.length){
standsdata[j].stands.sort(compare);
i = psddata.length;
}
}
}
//
//
// console.log(psddata);
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;
}
}
for(let i=0;i<standsdata.length;i++){
if (allClear == standsdata[j].stands.length) {
standsdata[j].stands.sort(compare);
i = psddata.length;
}
}
}
//
//
// console.log(psddata);
for (let i = 0; i < standsdata.length; i++) {
let newstationstand = new StationStandModel(standsdata[i]);
let newstationstand = new StationStandModel(standsdata[i]);
newstationstand.code = standsdata[i].code;
newstationstand.name = standsdata[i].name;
newstationstand.type = "station";
newstationstand.num = i;
newstationstand.stands = standsdata[i].stands;
// 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;
let newclip =null;
newstationstand.code = standsdata[i].code;
newstationstand.name = standsdata[i].name;
newstationstand.type = "station";
newstationstand.num = i;
newstationstand.stands = standsdata[i].stands;
// 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;
let newclip = null;
let nowModelType = "normal";
let nowModelType = "normal";
if(otherStation){
for(let o=0;o<otherStation.length;o++){
if(standsdata[i].code == otherStation[o].code){
let selectmeshother = assetloader.modelgroup[ otherStation[o].code];
newstationmesh = selectmeshother;
newclip = selectmeshother.animations[ 0 ];
nowModelType = "specil";
newstationmesh.traverse( function ( child ) {
if (otherStation) {
for (let o = 0; o < otherStation.length; o++) {
if (standsdata[i].code == otherStation[o].code) {
let selectmeshother = assetloader.modelgroup[otherStation[o].code];
newstationmesh = selectmeshother;
newclip = selectmeshother.animations[0];
nowModelType = "specil";
newstationmesh.traverse(function(child) {
if ( child.isMesh ) {
child.renderOrder = 9;
}
if (child.isMesh) {
child.renderOrder = 9;
}
} );
}
}
}
if(nowModelType == "normal"){
if(standsdata[i].stands.length<=2){
});
}
}
}
if (nowModelType == "normal") {
if (standsdata[i].stands.length <= 2) {
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{
newstationmesh = selectmesh3.clone(true);
newclip = selectmesh3.animations[ 0 ];
}
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 {
newstationmesh = selectmesh3.clone(true);
newclip = selectmesh3.animations[0];
}
if(standsdata[i].code == "Station17596"){
newstationmesh = specilmesh.clone(true);
newclip = specilmesh.animations[ 0 ];
}
if (standsdata[i].code == "Station17596") {
newstationmesh = specilmesh.clone(true);
newclip = specilmesh.animations[0];
}
if(project == "nologo"){
if(i == 1){
newstationmesh = nologohc.clone(true);
newclip = nologohc.animations[ 0 ];
}
if(i == 2){
newstationmesh = selectmesh2.clone(true);
newclip = selectmesh2.animations[ 0 ];
}
if(i == 3){
newstationmesh = nologonc.clone(true);
newclip = nologonc.animations[ 0 ];
}
if(i == 4){
newstationmesh = nologowc.clone(true);
newclip = nologowc.animations[ 0 ];
}
}
}
if (project == "nologo") {
if (i == 1) {
newstationmesh = nologohc.clone(true);
newclip = nologohc.animations[0];
}
if (i == 2) {
newstationmesh = selectmesh2.clone(true);
newclip = selectmesh2.animations[0];
}
if (i == 3) {
newstationmesh = nologonc.clone(true);
newclip = nologonc.animations[0];
}
if (i == 4) {
newstationmesh = nologowc.clone(true);
newclip = nologowc.animations[0];
}
}
console.log(nologohc);
if (project == "say") {
if (i == 1) {
newstationmesh = nologohc.clone(true);
newclip = nologohc.animations[0];
}
if (i == 3) {
newstationmesh = nologonc.clone(true);
newclip = nologonc.animations[0];
}
if (i == 4) {
newstationmesh = nologonc.clone(true);
newclip = nologonc.animations[0];
}
}
}
newstationmesh.code = standsdata[i].code;
newstationmesh.name = standsdata[i].code;
// console.log(newstationmesh.name);
// console.log(standsdata[i].inside);
newstationmesh.inside = standsdata[i].inside;
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;
//
for(let j=0;j<standsdata[i].stands.length;j++){
let num = j+1;
newstationmesh.code = standsdata[i].code;
newstationmesh.name = standsdata[i].code;
// console.log(newstationmesh.name);
// console.log(standsdata[i].inside);
newstationmesh.inside = standsdata[i].inside;
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;
//
for (let j = 0; j < standsdata[i].stands.length; j++) {
let num = j + 1;
let addAnimaMesh = newstationmesh.getObjectByName('door'+num);
let addAnimaMesh = newstationmesh.getObjectByName('door' + num);
if(addAnimaMesh){
newstationmesh.getObjectByName('door'+num).animations = [];
if(newclip){
newstationmesh.getObjectByName('door'+num).animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newstationmesh.getObjectByName('door'+num) );
if (addAnimaMesh) {
newstationmesh.getObjectByName('door' + num).animations = [];
if (newclip) {
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++) {
if(psddata[n].standCode == standsdata[i].stands[j].code){
if (psddata[n].standCode == standsdata[i].stands[j].code) {
let key = psddata[n].code;
actionss[key] = {
status:"01",
action:mixer.clipAction( newstationmesh.getObjectByName('door'+num).animations[0])
};
actionss[key].action.setLoop(THREE.LoopOnce);
actionss[key].action.clampWhenFinished = true;
//actionss[key].play();
let key = psddata[n].code;
actionss[key] = {
status: "01",
action: mixer.clipAction(newstationmesh.getObjectByName('door' + num).animations[0])
};
actionss[key].action.setLoop(THREE.LoopOnce);
actionss[key].action.clampWhenFinished = true;
//actionss[key].play();
n = psddata.length;
}
}
n = psddata.length;
}
}
mixers.push(mixer);
}
mixers.push(mixer);
}
}
}
}
}
if(mode){
if(mode == "02"){
let textgeometry = new THREE.PlaneBufferGeometry( 65, 90, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(standsdata[i]));
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.modeltype = "textplane";
textplane.position.y = 70;
textplane.rotation.x = Math.PI/2;
textplane.position.z = 80;
scope.textlist.push(textplane);
newstationmesh.add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
}
}
}
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.modeltype = "textplane";
textplane.position.y = 70;
textplane.rotation.x = Math.PI / 2;
textplane.position.z = 80;
scope.textlist.push(textplane);
newstationmesh.add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
}
}
}
// scene.add(scope.textlist);
stationdata = null;
psddata = null;
scene.add(scope.group);
resolve("loadedstation");
});
// scene.add(scope.textlist);
stationdata = null;
psddata = null;
scene.add(scope.group);
resolve("loadedstation");
});
}
}
}
var compare = function (obj1, obj2) {
var val1 = obj1.position.y;
var val2 = obj2.position.y;
if (val1 < val2) {
return -1;
} else if (val1 > val2) {
return 1;
} else {
return 0;
}
var compare = function(obj1, obj2) {
var val1 = obj1.position.y;
var val2 = obj2.position.y;
if (val1 < val2) {
return -1;
} else if (val1 > val2) {
return 1;
} else {
return 0;
}
}
//canvas文字贴图方法
//PS:待提炼 增强功能
var stationcanvas = new Image();
stationcanvas.src = JL3D_LOCAL_STATIC+"/texture/msgtnew.png";
function getTextCanvas(text){
let canvas = document.getElementById('canvastexture');
stationcanvas.src = JL3D_LOCAL_STATIC + "/texture/msgtnew.png";
canvas.width = 128;
canvas.height = 256;
// canvas.style.width = width;
// canvas.style.height = height;
function getTextCanvas(text) {
let canvas = document.getElementById('canvastexture');
let ctx = canvas.getContext('2d');
//ctx.fillStyle = '#FFFFFF';
ctx.fillRect(0, 0,128,256);
canvas.width = 128;
canvas.height = 256;
// canvas.style.width = width;
// canvas.style.height = height;
ctx.fillStyle = '#FFFFFF';
// ctx.textAlign = 'center';
// ctx.textBaseline = 'middle';
ctx.clearRect(0,0,128,256);
let ctx = canvas.getContext('2d');
//ctx.fillStyle = '#FFFFFF';
ctx.fillRect(0, 0, 128, 256);
ctx.drawImage(stationcanvas,0,0,128,256);
ctx.fillStyle = '#FFFFFF';
// ctx.textAlign = 'center';
// ctx.textBaseline = 'middle';
ctx.clearRect(0, 0, 128, 256);
ctx.font = "10px";
ctx.fillText("车站: "+text.name, 15,25);
ctx.drawImage(stationcanvas, 0, 0, 128, 256);
ctx.fillText("漫游", 18,48);
ctx.fillText("信息", 54,48);
ctx.fillText("备忘", 93,48);
ctx.font = "10px";
ctx.fillText("车站: " + text.name, 15, 25);
ctx.fillText("车站序号: "+text.name, 10,115);
ctx.fillText("漫游", 18, 48);
ctx.fillText("信息", 54, 48);
ctx.fillText("备忘", 93, 48);
ctx.fillText("公里标记:",10 ,135);
ctx.fillText(text.kmPost,10 ,155);
ctx.fillText("车站序号: " + text.name, 10, 115);
let data = ctx.getImageData(0, 0,128,256);
return data;
ctx.fillText("公里标记:", 10, 135);
ctx.fillText(text.kmPost, 10, 155);
let data = ctx.getImageData(0, 0, 128, 256);
return data;
}