Search the Community
Showing results for tags 'ui blocking'.
-
Hi all, I am revisiting Babylonjs after a long gap. Things have changed drastically in the last year (for good ) and hence I have a newbie question, I am trying to utilise Babylonjs to give visual feedback to the user on his choice of designs. This involves creating a few hole patterns on flat plates based on an algorithm. After going through a few different approaches, I have stumbled upon the solid particle system where I could create cylinders to represent my pattern and display to the users. The cylinder locations are calculated using an external algorithm returned via ajax call and typically ends up creating 40,000 cylinders. Once the creation is completed, the performance is very good with 60fps. The help I need is in keeping the interactiveness ongoing while the SPS is being added in the background and progress displayed to the user. Somehow not much webgl interaction is possible, while the SPS Mesh is being constructed and the initparticles loop is running in my ajax call. I have tried to break it down into smaller batches, but not much luck. Any suggestions would be much appreciated. Regards, Balu --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Here is the code I am using. pointsData is an array of X and Y values and has ~1000 points in each bach - totalling around 40,000 $.ajax({ ... ... }, success: function(pointsData) { var holeMesh = BABYLON.MeshBuilder.CreateCylinder("Hole", { diameterTop: holeDia, diameterBottom: holeDia, height: thickness + 0.001 }, sc); var SPS = new BABYLON.SolidParticleSystem('SPS' , sc, { updatable: false }); SPS.billboard = false; SPS.computeParticleRotation = false; SPS.computeParticleColor = false; SPS.computeParticleTexture = false; SPS.computeBoundingBox = true; SPS.addShape(holeMesh, pointsData.length); var SPSMesh = SPS.buildMesh(); SPSMesh.material = ml; holeMesh.dispose(); SPSMesh.position = new BABYLON.Vector3.Zero(); SPS.initParticles = function () { for (var h = 0; h < pointsData.length; h++) { var holePosn = pointsData[h]; this.particles[h].position = new BABYLON.Vector3(holePosn.X / 1000, -thickness / 2, holePosn.Y / 1000); } } SPS.initParticles(); SPS.setParticles(); SPSMesh.parent = parent; }