Jump to content

[solved]how to multiple babylon file load ??


MinsuKim
 Share

Recommended Posts

hi

as always

one problem T.T

 

issue is how to multiple *.babylon file load?

i have 16 files

one file has 31box create by 3DMAX

 

my code is below

for (let i = 0; i < resourceCount; i++) {
onLoadImage();
}
 
function onLoadImageFileT() {
 
   BABYLON.SceneLoader.AppendAsync(strResourceURL, fileName, scene, function (newScene) {
 
   newScene.executeWhenReady(function () {
 
   let loadMesh = newScene.getMeshByName("resoucreName");
   scene.lights[1].dispose();
   loadMesh.position = new BABYLON.Vector3(machineForLayout.mPositionX, machineForLayout.mPositionY, machineForLayout.mPositionZ);
   loadMesh.scaling = new BABYLON.Vector3(0.035, 0.035, 0.035);
   loadMesh.rotation.y = machineForLayout.mRotationY;
   loadMesh.name = "Machine#" + machineForLayout.mMachineId;
   loadMesh.id = "Machine#" + machineForLayout.mMachineId;
   loadMesh.isPickable = true;
   });
 
   }, function (progress) {
   // To do: give progress feedback to user
   }, function (error) {
   console.log(error);
   });
 
}

 

problem is 12file load is OK

but 15 file over is "Too many active WebGL contexts. Oldest context will be lost."

i do not understand message..

i many search and try other code... but same issue

(assetmanager, importMesh, Append)

 

please help me

 

Link to comment
Share on other sites

@Dad72  i tried   BABYLON.SceneLoader.Append  instead of BABYLON.SceneLoader.AppendAsync 

but same thing

thank you for reply!

 

@JohnK you code is good  I have updated my code by comparison.

thank you for reply!

 

@Deltakosh you correct! 

my code some changed!

this problem is solved

but I do not know how it was resolved.

BABYLON.Engine.isSupported() Issue...????  don't know ㅇ_ㅇ....

 

Thank you to everyone who helped me.

see you later with other Issue! lol

 

my code below

before

for (let i = 0; i < machineCount; i++) {
 
     if (BABYLON.Engine.isSupported()) {
         onLoadImage();
     }
}

 

after

for (let i = 0; i < machineCount; i++) {
     onLoadImage();
}
Link to comment
Share on other sites

  • MinsuKim changed the title to [solved]how to multiple babylon file load ??

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...