剔除三维无用静态模型,修改模型配置

This commit is contained in:
sunzhenyu 2019-12-19 09:40:29 +08:00
parent 0c85459ddc
commit 536cbb4e60
9 changed files with 71 additions and 26 deletions

View File

@ -6,7 +6,8 @@ var Staticmodel = {
type: "fuzhou",
picUrl: "",
assetUrl: "https://joylink.club/oss/wx/switch/switch.FBX"
},
},//"https://joylink.club/oss/wx/switch/switch.FBX"
//../../static/model/device/switch.FBX
Signal: {
id: "2",
name: "信号机",
@ -21,9 +22,9 @@ var Staticmodel = {
deviceType: "stationstand",
type: "low",
picUrl: "",
assetUrl: "../../static/model/device/stationstand.FBX"
assetUrl: "https://joylink.club/oss/wx/stationstand/stationstand.FBX"
//https://joylink.club/oss/wx/stationstand/stationstand.FBX
//
//../../static/model/device/stationstand.FBX
}

View File

@ -1,3 +1,13 @@
import { getBaseUrl } from '@/utils/baseUrl';
const BASE_API = getBaseUrl();
let modelurl = "../../static/model/jdq/";
if(BASE_API == 'https://joylink.club/jlcloud'){
modelurl = "https://joylink.club/oss/jdq/";
}else if(BASE_API == 'https://test.joylink.club/jlcloud'){
modelurl = "https://test.joylink.club/oss/jdq/";
}
var Staticmodel = {
Jdq1: {
id: "1",
@ -5,7 +15,7 @@ var Staticmodel = {
deviceType: "jdq1700",
type: "training",
picUrl: "",
assetUrl: "../../static/model/jdq/jdq1700.FBX"
assetUrl: modelurl + "jdq1700.FBX"
},
Jdq2: {
id: "1",
@ -13,7 +23,7 @@ var Staticmodel = {
deviceType: "jdq",
type: "training",
picUrl: "",
assetUrl: "../../static/model/jdq/jdq1000.FBX"
assetUrl: modelurl + "jdq1000.FBX"
},
Jdq3: {
id: "1",
@ -21,7 +31,7 @@ var Staticmodel = {
deviceType: "jdq",
type: "training",
picUrl: "",
assetUrl: "../../static/model/jdq/jdqh18.FBX"
assetUrl: modelurl + "jdqh18.FBX"
},
Jdq4: {
id: "1",
@ -29,7 +39,7 @@ var Staticmodel = {
deviceType: "jdq",
type: "training",
picUrl: "",
assetUrl: "../../static/model/jdq/jdq480.FBX"
assetUrl: modelurl + "jdq480.FBX"
},
Jdqg:{
id: "0",
@ -37,7 +47,7 @@ var Staticmodel = {
deviceType: "jdqg",
type: "training",
picUrl: "",
assetUrl: "../../static/model/jdq/jdqg.FBX"
assetUrl: modelurl + "jdqg.FBX"
}
}

View File

@ -109,8 +109,8 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup) {
});
});
// let stats = new Stats();
// dom.appendChild( stats.dom );
let stats = new Stats();
dom.appendChild( stats.dom );
// var timer = setInterval(function() {
// if(trainlisttest){
@ -171,7 +171,7 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup) {
//检测动画构造器播放动画
// }
// stats.update();
stats.update();
}
function startWorker(webwork){

View File

@ -1236,7 +1236,17 @@ THREE.FBXLoader = ( function () {
} else {
model = new THREE.Mesh( geometry, material );
geometry.dispose();
geometry = null;
if(material.length>0){
for(let k in material){
material[k].dispose();
}
material = null;
}else{
material.dispose();
material = null;
}
}
return model;

View File

@ -106,21 +106,38 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,store
});
})
.then(function(data){
for(let mn=0;mn<scope.assetloader.modellist.length;mn++){
if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "suidao"){
// scope.assetloader.modellist[mn].mesh.rotation.x = Math.PI/2;
// console.log(scope.assetloader.modellist[mn].mesh.position);
scope.assetloader.modellist[mn].mesh.name = "suidao";
scene.add(scope.assetloader.modellist[mn].mesh);
return new Promise(function(resolve, reject){
let mergegeometry
let mergeindex = 0;
let materialarr = [];
for(let mn=0;mn<scope.assetloader.modellist.length;mn++){
if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "suidao"){
// scope.assetloader.modellist[mn].mesh.rotation.x = Math.PI/2;
// console.log(scope.assetloader.modellist[mn].mesh.position);
scope.assetloader.modellist[mn].mesh.name = "suidao";
console.log(scope.assetloader.modellist[mn].mesh);
scene.add(scope.assetloader.modellist[mn].mesh);
}
if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "background"){
// scope.assetloader.modellist[mn].mesh.rotation.x = Math.PI/2;
// console.log(scope.assetloader.modellist[mn].mesh.position);
scope.assetloader.modellist[mn].mesh.name = "background";
// console.log(scope.assetloader.modellist[mn].mesh);
scene.add(scope.assetloader.modellist[mn].mesh);
}
}
if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "background"){
// scope.assetloader.modellist[mn].mesh.rotation.x = Math.PI/2;
// console.log(scope.assetloader.modellist[mn].mesh.position);
scope.assetloader.modellist[mn].mesh.name = "background";
// console.log(scope.assetloader.modellist[mn].mesh);
scene.add(scope.assetloader.modellist[mn].mesh);
}
}
let mergemesh = new THREE.Mesh( mergegeometry, materialarr );
scene.add(mergemesh);
resolve("mergemodel");
});
})
.then(function(data){
// scope.animateswitch = true;

View File

@ -114,6 +114,13 @@ let mergegeometry = new THREE.Geometry();
testmesh2.rotation.z = data[i].rotation._z;
testmesh2.updateMatrix();
mergegeometry.merge(new THREE.Geometry().fromBufferGeometry(testmesh2.geometry),testmesh2.matrix);
// console.log(testmesh2);
testmesh2.geometry.dispose();
for(let j in testmesh2.material){
testmesh2.material[j].map.dispose();
testmesh2.material[j].dispose();
}
// scope.linkdata.push(testmesh2);
// scope.linksgroup.add(testmesh2);
}

Binary file not shown.

Binary file not shown.