JohnM

Members
  • Content Count

    39
  • Joined

  • Last visited

About JohnM

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. JohnM

    Limit frames per second

    will check this out when i have a spare moment, many thanks
  2. JohnM

    Limit frames per second

    ok thanks for this, perhaps the double stop was why i didnt get it to work either ( i only spend 5 seconds trying haha) maybe someone could code in the ability to change fps, there is definitly a need for it. Adobe Animate allows you to do it which I have used multiple times for example if you are creating a book like website and have animations on each page you can change fps to 0 when you change page as pausing the animation still creates frames. same case would apply to babylon thanks again for your help John. hopefully one of the top dogs see's this!
  3. JohnM

    Limit frames per second

    bit messy, but gets the point across!
  4. JohnM

    Limit frames per second

    <!DOCTYPE html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> <script type="text/javascript" src="http://rawgit.com/vitmalina/w2ui/master/dist/w2ui.min.js"></script> <script type="text/javascript" src="https://cdn.babylonjs.com/babylon.max.js"></script> <link rel="stylesheet" type="text/css" href="http://rawgit.com/vitmalina/w2ui/master/dist/w2ui.min.css" /> </head> <body> <div id="previewTabs"> <div id="tabs" style="width: 100%; height: 29px;"></div> <div id="tab1" class="tab" style="background-color: #3E0042;"> <div id="blankTab"> </div> </div> <div id="tab2" class="tab" style="background-color: #3E0042;"> <div id="babylonTab"> <canvas id='babylonCanvas'></canvas> </div> </div> </div> <script type="text/javascript"> var configPreview = { tabs: { name: 'tabs', active: 'tab2', tabs: [ { id: 'tab1', caption: 'Blank Tab' }, { id: 'tab2', caption: 'Babylon Tab' }, ], onClick: function (event) { $("#previewTabs .tab").hide(); // hides all tabs $("#previewTabs #" + event.target).show(); // shows tab of click event.target var allTabs = this.tabs; for(var t = 0; t < allTabs.length; t++){ allTabs[t].style = "background-color: white" w2ui.tabs.refresh(); } switch(event.tab.caption){ case "Babylon Tab": break; } } } }; function setupPreviewTabs() { $('#tabs').w2tabs(configPreview.tabs); $('#tab2').show(); $("#tabs").css("height", 28); tabsResize() }; function tabsResize(){ $("#particleBuilderLayout").css("width", "100%") $("#particleBuilderLayout").css("height", $("#tabs").height()) } (function(){ setupPreviewTabs(); })(); (function (window, BABYLON) { var canvas = document.getElementById("babylonCanvas"); // Check support if (!BABYLON.Engine.isSupported()) { window.alert('Browser not supported'); } else { // Babylon engine = new BABYLON.Engine(canvas, true); //Creating scene (in "Scene.js") scene = createScene(engine); scene.canvas = canvas; scene.activeCamera.attachControl(scene.canvas); // Once the scene is loaded, just register a render loop to render it engine.runRenderLoop(function () { scene.activeCamera.attachControl(scene.canvas); scene.render(); }); } }(window, BABYLON)); function createScene(engine) { //console.log("CREATING SCENE") // Create the scene space var scene = new BABYLON.Scene(engine); scene.clearColor = new BABYLON.Color4(0.243137, 0.0, 0.258823, 1.0); //console.log("CREATING CAMS"); // Add a camera to the scene and attach it to the canvas scene.perspectiveCamera = new BABYLON.ArcRotateCamera("PerspectiveCamera", Math.PI * 1.5, Math.PI / 2, 2, BABYLON.Vector3.Zero(), scene); scene.perspectiveCamera.minZ = 0.01; scene.perspectiveCamera.maxZ = 10000; //console.log("MAKING OBJECTS"); //-----OBJECTS----- // Add and manipulate meshes in the scene scene.emitterParent = BABYLON.MeshBuilder.CreateBox("box", {width: 0.1, height: 0.1, depth: 0.1}, scene); var emitterParentMat = new BABYLON.StandardMaterial("particleEmitterMat", scene); emitterParentMat.wireframe = true; emitterParentMat.disableLighting = true; scene.emitterParent.material = emitterParentMat; var ground = BABYLON.Mesh.CreatePlane("ground", 50.0, scene); ground.position = new BABYLON.Vector3(0, -10, 0); ground.rotation = new BABYLON.Vector3(Math.PI / 2, 0, 0); ground.material = new BABYLON.StandardMaterial("groundMat", scene); ground.material.backFaceCulling = false; ground.material.diffuseColor = new BABYLON.Color3(0.3, 0.3, 1); //console.log("SETTING LIGHTS"); //-----LIGHTING----- // Add lights to the scene scene.light1 = new BABYLON.PointLight("light1", new BABYLON.Vector3(-1, 0, 0), scene); //set light to be at same position as dummy sphere and set parent scene.light1.position = new BABYLON.Vector3(-1, 0, 0) //console.log("SET ACTIVE CAM"); scene.activeCamera = scene.perspectiveCamera; // Fountain object var fountain = BABYLON.Mesh.CreateBox("foutain", 1.0, scene); // Create a particle system var particleSystem = new BABYLON.ParticleSystem("particles", 2000, scene); //Texture of each particle particleSystem.particleTexture = new BABYLON.Texture("https://raw.githubusercontent.com/BabylonJS/Babylon.js/master/Playground/textures/flare.png", scene); // Where the particles come from particleSystem.emitter = fountain; // the starting object, the emitter particleSystem.minEmitBox = new BABYLON.Vector3(-1, 0, 0); // Starting all from particleSystem.maxEmitBox = new BABYLON.Vector3(1, 0, 0); // To... // Colors of all particles particleSystem.color1 = new BABYLON.Color4(0.7, 0.8, 1.0, 1.0); particleSystem.color2 = new BABYLON.Color4(0.2, 0.5, 1.0, 1.0); particleSystem.colorDead = new BABYLON.Color4(0, 0, 0.2, 0.0); // Size of each particle (random between... particleSystem.minSize = 0.1; particleSystem.maxSize = 0.5; // Life time of each particle (random between... particleSystem.minLifeTime = 0.3; particleSystem.maxLifeTime = 1.5; // Emission rate particleSystem.emitRate = 1500; // Blend mode : BLENDMODE_ONEONE, or BLENDMODE_STANDARD particleSystem.blendMode = BABYLON.ParticleSystem.BLENDMODE_ONEONE; // Set the gravity of all particles particleSystem.gravity = new BABYLON.Vector3(0, -9.81, 0); // Direction of each particle after it has been emitted particleSystem.direction1 = new BABYLON.Vector3(-7, 8, 3); particleSystem.direction2 = new BABYLON.Vector3(7, 8, -3); // Angular speed, in radians particleSystem.minAngularSpeed = 0; particleSystem.maxAngularSpeed = Math.PI; // Speed particleSystem.minEmitPower = 1; particleSystem.maxEmitPower = 3; particleSystem.updateSpeed = 0.005; // Start the particle system particleSystem.start(); console.log("LOADING scene"); return scene; }; </script> </body> </html>
  5. JohnM

    Limit frames per second

    ok, give me a few mins, will provide some code
  6. JohnM

    Limit frames per second

    doesnt seem to stop frames from being made unless i am doing something wrong im calling the above and particles are still being created
  7. JohnM

    Limit frames per second

    ah ok ye that makes sense, will give that a go when i can and see if it solves my issue
  8. JohnM

    Limit frames per second

    Hi, sorry to resurrect an old topic but i thought it was relevant, I assume this hasnt been implemented as i cant find an answer? my reason for needing to alter the FPS is that I have multiple babylon canvas in one window. but some of those canvas are hidden when i click onto a different tab (within my window, not a new browser tab) so if i clicked on a diff tab I would like to lower the fps as its unnecessary to render at 60fps when its not on screen. hope that makes sense! let me know if i need to put this into a new topic. many thanks
  9. JohnM

    is not a function

    sorry just found the issue, some how the texture has been applied in an array rather than a string... thought that might fix it but seems not. because obviously i need to apply image as a babylon texture not a string... its early. sorry to be a pain!
  10. JohnM

    is not a function

    sorry, im not sure what you mean? I am only a self taught developer so some phrases still confuse me haha
  11. Hi, before I start, I have to be a pain... I cant share my work due to strong restrictions at my job so i have to describe it as well as possible. Also to recreate this issue... tldr its not possible / takes too long / waste of time, not to seem rude! i will be very greatful at any help! so... I am coming across this error - this._emissiveTexture.isReadyOrNotBlocking is not a function just wondered if there is any reason why this would happen that would pop to mind? from searching i can only find this and this. if the answer is in one of those two posts, it must be escaping me haha. so to get this error, all I (think i am) doing is applying an emissive texture to a standard material that doesnt have one to begin with so before I "apply" it, its value is undefined. if I think of any more info I will update asap many thanks EDITS: maybe this will help - after adding a load of console.logs to see when the error triggers, it happens after i do scene.render(); actually seems to happen even if i remove this line
  12. JohnM

    deprecated spam

    never mind... updated from version 0.1.1 of the plugin to 0.1.3 and it seems to have fixed the issue! thanks a lot for all of your help anyways :)
  13. JohnM

    deprecated spam

    been digging around and cant seem to fix the issue. however it seems to happen when alight.js does a scan. I am using this library - https://github.com/retejs/rete in this plugin from the library - https://github.com/retejs/context-menu-plugin/blob/master/src/context-menu.js on line 62: ```javascript this.$cd.scan(); ``` after that is called is when it seems all my errors pop up. here is one of the examples from the rete github page - https://codepen.io/Ni55aN/pen/rpOKNb i just dont get why alight would trigger something in BJS but then i dont really understand alight that much yet (newb)
  14. JohnM

    deprecated spam

    i am not allowed unfortunately i have also tried to make a dummy project but it didn't replicate the problem 🤣 just hoped there would be a quick answer about what triggers it
  15. JohnM

    deprecated spam

    i havnt put that into my project unless its just running by default in the background? its odd because sometimes there is less than 1000 warnings and sometimes it happens 6k times