Jump to content

Search the Community

Showing results for tags 'web worker recursive'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. Let me start by stating that I have thousands of meshes to import into a scene. Since the following loop will not work because i is incremented before the callback function of ImportMesh is complete for (var i:=0; i< max;i++) { BABYLON.SceneLoader.ImportMesh("", "products/", productBabylonName, scene, function (newMeshes) {}); newMeshes.position = new BABYLON.Vector3(x,y,z) } I solved the problem by creating a recursive loop. Here is my code productLocationData (JSON format) & productCount are retrieved from database using a AJAX-PHP-MySQL call var Pindex=0; populateRack ( productLocationData , productCount,Pindex ); var populateRack = function(productLocationData,productCount,Pindex) { var popRackProdPositionX = parseFloat(productLocationData.products[Pindex].positionX); var popRackProdPositionY = parseFloat(productLocationData.products[Pindex].positionY); var popRackProdPositionZ = parseFloat(productLocationData.products[Pindex].positionZ); var productBabylonName = productLocationData.products[Pindex].productBabylonName; BABYLON.SceneLoader.ImportMesh("", "productshr/", productBabylonName, scene, function (newMeshes) { newMeshes[0].position = new BABYLON.Vector3(popRackProdPositionX,popRackProdPositionY,popRackProdPositionZ); });//end import Pindex +=1; if (Pindex < productCount) { populateRack(productLocationData,productCount,Pindex); } } Everything works fine. However, if there is a simpler way please advise. HOWEVER my MAIN question is the following. Can I run many instances of the above code in parallel ? Reason being of course to have everything load faster. I know that javascript is a sinle-threaded language. Could HTML5 web workers be of help here? Or any other plug-in such as parallel.js ? Has anybody applied parallel processing to BABYLON.SceneLoader.ImportMesh. I am aware that Web Workers has been applied to collisions. Does anybody have an example?
×
×
  • Create New...