|
@@ -46,7 +46,7 @@ export default {
|
|
|
},
|
|
|
setup() {
|
|
|
const loading_a1=ref(null);
|
|
|
- const loadProgressValue=ref(0);
|
|
|
+ const loadProgressValue=ref(1);//模型加载初始进度
|
|
|
const EngineContent=ref(null);
|
|
|
const reconnect=ref(false);
|
|
|
const isShowIframeWin = ref(false);
|
|
@@ -208,10 +208,10 @@ export default {
|
|
|
player.on("NativeLoad", async (Native) => {
|
|
|
modelLoadState={};
|
|
|
EngineContent.value.play();
|
|
|
- playerNative.value =Native;
|
|
|
- loadProgressValue.value = 1;//模型加载初始进度
|
|
|
+ playerNative.value =Native;
|
|
|
//模型加载完成监听处理
|
|
|
Native.Model.EventProgressEnd.connect(function(step,id,name){
|
|
|
+ modelLoadState[name]=true;
|
|
|
if(window.CurrentTargetType!=name){
|
|
|
return
|
|
|
}
|
|
@@ -237,8 +237,7 @@ export default {
|
|
|
player.Native.Model.setModelVisible('FAC',false);
|
|
|
player.Native.Model.setModelVisible('IN02',false);
|
|
|
player.Native.Model.setModelVisible(name,window.CurrentTargetType==name?true:false);
|
|
|
- }
|
|
|
- modelLoadState[name]=true;
|
|
|
+ }
|
|
|
});
|
|
|
//模型加载中监听处理
|
|
|
Native.Model.EventProgress.connect(function(v,hander,name){
|
|
@@ -347,7 +346,9 @@ export default {
|
|
|
await player.Native.Settings.set('ambientIndenty', 'float', 0.39);//初始化环境光补偿
|
|
|
await player.Native.Settings.set('diffuseIntensity', 'float', 1.2);//初始化光线强度
|
|
|
await player.Native.Settings.set('specularIntensity', 'float', 0.64);//初始化高光强度
|
|
|
- if(modelLoadState[currentTargetType.value]==null){
|
|
|
+ if(modelLoadState[currentTargetType.value]==null){
|
|
|
+ loadProgressValue.value = 1;
|
|
|
+ modelLoadState['FAC']=false;
|
|
|
var cf = "data://models/T_ALL.pr";
|
|
|
//var errStr = await PlayerUtils.call(Native.Model.loadModel, currentTargetType.value, cf);
|
|
|
//异步加载模型,加载进度通过EventProgress及EventProgressEnd进行监听
|
|
@@ -356,30 +357,30 @@ export default {
|
|
|
"unloadThreshold": 100000,
|
|
|
"dynamicLoadEnabled ": true
|
|
|
});
|
|
|
- modelLoadState['FAC']=true;
|
|
|
if(modelLoadState['IN02']==null){
|
|
|
+ modelLoadState['IN02']=false;
|
|
|
var cf = "data://models/T_02.pr";
|
|
|
PlayerUtils.call(Native.Model.loadModelWithParam, 'IN02', cf, {
|
|
|
"loadThreshold": 10000,
|
|
|
"unloadThreshold": 100000,
|
|
|
"dynamicLoadEnabled ": true
|
|
|
- });
|
|
|
- modelLoadState['IN02']=true;
|
|
|
+ });
|
|
|
}
|
|
|
if(modelLoadState['IN03']==null){
|
|
|
+ modelLoadState['IN03']=false;
|
|
|
var cf = "data://models/T_03.pr";
|
|
|
PlayerUtils.call(Native.Model.loadModelWithParam, 'IN03', cf, {
|
|
|
"loadThreshold": 10000,
|
|
|
"unloadThreshold": 100000,
|
|
|
"dynamicLoadEnabled ": true
|
|
|
- });
|
|
|
- modelLoadState['IN03']=true;
|
|
|
+ });
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
await player.Native.Model.setModelVisible("IN02",false);
|
|
|
await player.Native.Model.setModelVisible("IN03",false);
|
|
|
- await player.Native.Model.setModelVisible(currentTargetType.value,true);
|
|
|
+ await player.Native.Model.setModelVisible(currentTargetType.value,true);
|
|
|
+ if(modelLoadState[currentTargetType.value]==true) facModelLoadState.value=true;
|
|
|
}
|
|
|
//印花
|
|
|
async function loadIn03Model(Native){
|
|
@@ -389,7 +390,8 @@ export default {
|
|
|
if(currentTargetType.value=="IN03") return;
|
|
|
currentTargetType.value="IN03";
|
|
|
if(modelLoadState[currentTargetType.value]==null){
|
|
|
- loadProgressValue.value = 0.1;
|
|
|
+ loadProgressValue.value = 1;
|
|
|
+ modelLoadState[currentTargetType.value]=false;
|
|
|
var cf = "data://models/T_03.pr";
|
|
|
//异步加载模型,加载进度通过EventProgress及EventProgressEnd进行监听
|
|
|
PlayerUtils.call(Native.Model.loadModelWithParam, currentTargetType.value, cf, {
|
|
@@ -402,6 +404,7 @@ export default {
|
|
|
await player.Native.Model.setModelVisible("FAC",false);
|
|
|
await player.Native.Model.setModelVisible("IN02",false);
|
|
|
await player.Native.Model.setModelVisible(currentTargetType.value,true);
|
|
|
+ if(modelLoadState[currentTargetType.value]==true) in03modelloadstate.value=true;
|
|
|
}
|
|
|
//经编
|
|
|
async function loadIn02Model(Native){
|
|
@@ -411,7 +414,8 @@ export default {
|
|
|
if(currentTargetType.value=="IN02") return;
|
|
|
currentTargetType.value="IN02";
|
|
|
if(modelLoadState[currentTargetType.value]==null){
|
|
|
- loadProgressValue.value = 0.1;
|
|
|
+ loadProgressValue.value = 1;
|
|
|
+ modelLoadState[currentTargetType.value]=false;
|
|
|
var cf = "data://models/T_02.pr";
|
|
|
//异步加载模型,加载进度通过EventProgress及EventProgressEnd进行监听
|
|
|
PlayerUtils.call(Native.Model.loadModelWithParam, 'IN02', cf, {
|
|
@@ -424,6 +428,7 @@ export default {
|
|
|
await player.Native.Model.setModelVisible("FAC",false);
|
|
|
await player.Native.Model.setModelVisible("IN03",false);
|
|
|
await player.Native.Model.setModelVisible(currentTargetType.value,true);
|
|
|
+ if(modelLoadState[currentTargetType.value]==true) in02modelloadstate.value=true;
|
|
|
}
|
|
|
onMounted(()=>{
|
|
|
window.addEventListener("click", handleBodyClick);
|