Search the Community
Showing results for tags 'xhr'.
-
Hello there. What is intended method of playing the same sound multiple times *concurrently* without re-downloading the sound file from the server? const gunshot = new BABYLON.Sound('foo', "sounds/gun_semi_etc.wav", scene, null, { volume: 1 }) If I have multiple players or bots in my game, any of them can produce gunfire. As each of them shoots, I end up with a separate web request per entity: I'm accustomed to howler, where the first time a sound is created, like 'foo.wav' it will load it from the server. Any subsequent sound objects created that play 'foo.wav' will build themselves from the same sound data without an xhr. How do I accomplish the equivalent? TY TY
-
How does one load a *.obj in NullEngine? const BABYLON = require('babylonjs') require('babylonjs-loaders') // mutates something globally global.XMLHttpRequest = require('xhr2').XMLHttpRequest ... BABYLON.SceneLoader.LoadAssetContainer("./", "cubio.obj", scene, function (container) { console.log('CONTAINER', container) container.addAllToScene() }) Error: ...\node_modules\xhr2\lib\xhr2.js:206 throw new NetworkError("Unsupported protocol " + this._url.protocol); Do I need to do something to xhr2 to teach it about obj?
-
Hi there: I'm trying to have done a cross-platform development these days. After some problems here and there I have my development running OK on: desktop - windows - web - ff desktop - windows - web - chrome desktop - macosx - web - safari mobile - android - web - chrome mobile - android - hybrid app (cordova) mobile - iOS - web - safari Sadly it doesn't work as presumed on the last platform I'm targeting, of course: mobile - iOS - hybrid app (cordova). Under this last scenario a have several "hard" issues: my PBR materials are completely invisible; and some of my Standard materials (textures on planes) are shown all black. The other Standard material I am using (particle textures) are shown OK. Any help or advice with this? Thanks for your time.
-
I developed an HTML5 app and i used cocoon.io as compiler and webview as renderer, when i launch the app from my phone XHR doesn't wotk, looking at console i have a message "404 not found", but url exist and if i launch app from a browser it wotks!!!! Is It possibile cocoon compiler disable Ajax request?
-
I'm pretty fine working with the .babylon file format. Exporter which was developed for Blender 3D editor works perfectly and if to load the exported model using the next code: // won't write the full code// because it was fetched from the playground and it's very standard and worksBABYLON.SceneLoader.Load("", "fileName.babylon", engine, function (newScene) {...works well and WebGL renderer in browser shows my model. But, what if I don't want to load models as static files which must be saved in public folder of HTTP-server ( IIS, Apache, lighttpd, nginx, etc.. ). For e.g. I wanna load a .babylon file from the user's side or to secure the access to .babylon files at my backend. All right, let's watch the situation, if I provide some kind of Uploader (using File API from browser) in my web-application, from which user will be able to load 3D-models from their PC or other devices. I'm trying to load models like this way: File uploading ( change event of input-file ) which works well: function handleFiles( event ) { var uploader = event.srcElement || event.currentTarget; var files = uploader.files; var reader = new FileReader(); reader.onload = function( event ) { var data = JSON.parse( event.target.result ); loadCustomMesh( data ); }; // passing only single mesh because of testing purpose reader.readAsText( files[ 0 ] ); }Handling geometry and adding to scene: function loadCustomMesh( data ) { var mesh = new BABYLON.Mesh( Math.random().toString(), scene ); mesh.setVerticesData( BABYLON.VertexBuffer.PositionKind, data.meshes[ 0 ].positions, true ); mesh.setVerticesData( BABYLON.VertexBuffer.NormalKind, data.meshes[ 0 ].normals, true ); mesh.setIndices( data.meshes[ 0 ].indices ); mesh.position = new BABYLON.Vector3( 0, 0, 0 ); ...It works FINE! But!!! Without materials... I've found that multimaterial is here from the uploaded data: But if to use the next code: mesh.material = data.multiMaterials[ 0 ];Which is valid exactly for this sample, it throws the next error: Uncaught TypeError: t.needAlphaBlending is not a functionAnd I don't even know what to do next, any ideas?
-
So far I've always used a standard image loader method in my games. I.e. I'll create a new Image() and use the src and onload to load it from a list. This works fine and I'm happy with it, but have wondered if you can do the same via xhr. Writing an xhr loader is fine and I've got it working, loading the PNGs, but am stuck in how to get the image data out of the xhr.response in a format that I can then use in a canvas drawImage call (or even putImageData). Is it easily possible? Is there a way to maybe populate an Image() from the xhr loaded data? Is there anything you need to do to the responseType? Note for this I'm only targeting IE9 and above. Cheers, Rich