paleRider

Members
  • Content Count

    107
  • Joined

  • Last visited

About paleRider

  • Rank
    Advanced Member

Contact Methods

  • Website URL
    www.vortice3d.com

Profile Information

  • Gender
    Male
  • Location
    EU / Spain / Zaragoza
  • Interests
    Many

Recent Profile Visitors

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

  1. paleRider

    PBR on iOS

    As an epilogue, and thinking it can be useful for somebody, I finally managed to have my DDS local file loaded by means of CreateFromPrefilteredData, on Cordova-iOS, with the help of cordova-plugin-wkwebview-file-xhr. Best regards.
  2. paleRider

    iOS Cordova sound issues

    Well, only as a epilogue for this (already closed) issue, I finally managed to have my DDS local file working on iOS. Please see related thread: ...with the help of cordova-plugin-wkwebview-file-xhr. Sadly, against the expected, that is not the same with the other XHR-loaded asset of my app, the MP3 local file, so I get the following Xcode error output on it: 2018-04-04 16:43:53.758536+0200 ERROR: BJS - [16:43:53]: error on XHR request. 2018-04-04 16:43:53.760983+0200 xhr-polyfill.js - exception delivering event {"isTrusted":false} TypeError: Argument 1 ('audioData') to webkitAudioContext.decodeAudioData must be an instance of ArrayBuffer Oracle's guys says me that it's because "...the babylon code is not setting the XMLHttpRequest responseType to "arraybuffer". The polyfill with this plugin only has a small list of file suffixes to default response types. The native XMLHttpRequest probably defaults "arraybuffer" based on the URL suffix but we are defaulting to text."
  3. paleRider

    iOS Cordova sound issues

    Well, this is embarrasing... the case is that my problem with remote served mp3 not "sounding" was only due to the infamous Side Switch. It was turned off. The confusing thing was that movies and music were played w/o problem (?) and so I didn't realized it was off.
  4. paleRider

    iOS Cordova sound issues

    Thanks JC: Yes, I suppose I need to start looking for this issue in JQM/Ionic/Cordova forums. With iOS you always know it's going to be painful.
  5. paleRider

    PBR on iOS

    Hi there: As using the environment in a DDS format is revealing as an excesive time consuming task, I'm decided to keep the things simple and use the good old 6-sides method for the CubeTexture/CubeMap. Thank you very much.
  6. paleRider

    iOS Cordova sound issues

    Hi JCPalmer: Well, as Deltakosh wrote this is a problem related with the way Cordova-iOS manages the local storage XHR resources. Anyway, when I use a web-served URI, the error is gone (so I suppose the mp3 is loaded) but sadly no sound is produced.
  7. paleRider

    PBR on iOS

    Hi Deltakosh, and thank you very much for your support in this "not-really-a-BJS-issue" issue. If I understand, I need to implement it (more or less) this way: var xhr=new XMLHttpRequest(); xhr.open("GET","assets/textures/environment.dds",true); xhr.responseType="arraybuffer"; xhr.addEventListener("load", function(){ if(xhr.status===200){ var blob=new Blob([xhr.response],{type: "image/png"}); var blobURL=URL.createObjURL(blob); texEnvironment =BABYLON.CubeTexture.CreateFromPrefilteredData(blobURL,_Scene); } },function(){ alert("Error"); }; ); Isn't it? Unfortunately, xhr.status===200 is never reached.
  8. paleRider

    iOS Cordova sound issues

    Hi Deltakosh: I supposed that but the console logs are quite different. Anyway, I'll try the way-of-the-blob also here and let you know. Thank you.
  9. paleRider

    PBR on iOS

    BTW I'm trying to tackle the problem also from the Cordova side. There're are several plugins that promises to solve XHR issues within iOS environment (so this is a really hot matter). The case is that, for example, cordova-plugin-ionic-webview works but its performance is very poor (maybe because I'm using JQM and not Ionic). Maybe that poor performance is due to the overhead of running a local http server. On the other hand the more "framework agnostic" and not running any http server, the Oracle's pair: cordova-plugin-wkwebview-engine (1.1.4) + cordova-plugin-wkwebview-file-xhr (2.1.1) seems not solving the problem and instead refuses to load the .babylon and .PNG files. Keep on investigating!
  10. paleRider

    iOS Cordova sound issues

    Well, my (really-simple) sound related code lines are these: var _Sfx=new BABYLON.Sound("sfx","assets/sounds/sfx.mp3",_Scene,null,{ autoplay: false, loop: true, volume: 0} ); ... function _updateVolume(param){ ... // _Sfx.setVolume(param); } As said, it works 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 But not in mobile - iOS - hybrid app (Cordova). Best regards.
  11. paleRider

    iOS Cordova sound issues

    Hi PsichiX: Tomorrow in the morning (CET) I'll be back in the office, able to show that (very simple) lines of code. Anytime please consider that the code is working flawless in browsers (Win, macOS and Linux) and Android Cordova hybrid app, and only failing in iOS Cordova hybrid app. Thanks for your time. Best regards.
  12. Hi there: I have a BJS development in production that works great in all platform but iOS-Cordova app. In this last configuration the sound doesn't work at all, dumping the following error message: Any clues on this? Thanks for your time.
  13. paleRider

    PBR on iOS

    Hi again Deltakosh: I'm here again after a break, in order to (hopefully) finish this development. Retaking the conversation where we let it, we had a DDS texture that Cordova-iOS implementation refused to load by means of BABYLON.CubeTexture.CreateFromPrefilteredData BJS API, because "...WKWebView appears to treat local files as if they came from a remote server, even though they're in the app itself, and such requests are blocked." (taken from Construct Engine / Ashley's Blog / https://www.construct.net/es/blogs/ashleys-blog-2/hacking-something-useful-out-of-wkwebview-932) From here, following the Ashley's article, I have to implement the following functionality: function fetchLocalFileViaCordova(filename, successCallback, errorCallback){ var path = cordova.file.applicationDirectory + "www/" + filename; window.resolveLocalFileSystemURL(path, function (entry){ entry.file(successCallback, errorCallback); }, errorCallback); }; function fetchLocalFileViaCordovaAsArrayBuffer(filename, successCallback, errorCallback){ fetchLocalFileViaCordova(filename, function (file){ var reader = new FileReader(); reader.onload = function (e){ successCallback(e.target.result); }; reader.readAsArrayBuffer(file); }, errorCallback); }; function fetchLocalFileViaCordovaAsURL(filename, successCallback, errorCallback){ //convert fake Cordova file to a real Blob object, which we can create a URL to fetchLocalFileViaCordovaAsArrayBuffer(filename, function (arrayBuffer){ var blob = new Blob([arrayBuffer]); var url = URL.createObjectURL(blob); successCallback(url); }, errorCallback); }; So I must load my DDS file with this code: fetchLocalFileViaCordovaAsURL("assets/textures/environment.dds",function(link){ alert(link); texEnvironment=BABYLON.CubeTexture.CreateFromPrefilteredData(link,_Scene); },function(){ alert("Error"); } ); Sadly, although the fetchLocalFileViaCordovaAsURL has success in generating the wanted blob (as the first alert shows in my screen), it seems BABYLON.CubeTexture.CreateFromPrefilteredData refused to load the DDS as the geometry is shown in black. Please note the final statement of the (excerpted) console: 2018-04-01 21:36:27.628173+0200 GRB Technology[1019:607207] Finished load of: file:///var/containers/Bundle/Application/4A5035B4-5E5A-49ED-8FF5-526CF779DC72/GRB%20Technology.app/www/index.html >>>> frameSizeChanged = 4096 >>>> frameSizeChanged = 4096 2018-04-01 21:37:54.532608+0200 GRB Technology[1019:607266] void SendDelegateMessage(NSInvocation *): delegate (webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:) failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode 2018-04-01 21:37:54.557541+0200 GRB Technology[1019:607207] Error in Success callbackId: File1392284593 : Error: Cannot load cubemap because files were not defined I suppose the BJS loading method must to be changed anyway in order to work with the blob. Any help with this? P.S.: As a second reference on this issue, I think it could be affordable to implement here the same technique that is already applied in the BJS Sandbox. Your colleague Davrous explains it in this same web-site (http://www.html5gamedevs.com/topic/18078-load-file-without-webserver/), when he says: "The implementation is fairly simple. I'm just taking the blob via the HTML5 File API, storing the texture as blog into an array and I've slightly modified the Babylon.js loader to load the texture from my blob array rather than using XHR to load them from the server." public static LoadImage(url: any, onLoad: (img: HTMLImageElement) => void, onError: (message?: string, exception?: any) => void, database: Nullable<Database>): HTMLImageElement { if (url instanceof ArrayBuffer) { url = Tools.EncodeArrayBufferTobase64(url); } url = Tools.CleanUrl(url); url = Tools.PreprocessUrl(url); var img = new Image(); Tools.SetCorsBehavior(url, img); const loadHandler = () => { img.removeEventListener("load", loadHandler); img.removeEventListener("error", errorHandler); onLoad(img); }; const errorHandler = (err: any) => { img.removeEventListener("load", loadHandler); img.removeEventListener("error", errorHandler); Tools.Error("Error while trying to load image: " + url); if (onError) { onError("Error while trying to load image: " + url, err); } }; img.addEventListener("load", loadHandler); img.addEventListener("error", errorHandler); var noIndexedDB = () => { img.src = url; }; var loadFromIndexedDB = () => { if (database) { database.loadImageFromDB(url, img); } }; //ANY database to do! if (url.substr(0, 5) !== "data:" && database && database.enableTexturesOffline && Database.IsUASupportingBlobStorage) { database.openAsync(loadFromIndexedDB, noIndexedDB); } else { if (url.indexOf("file:") !== -1) { var textureName = decodeURIComponent(url.substring(5).toLowerCase()); if (FilesInput.FilesToLoad[textureName]) { try { var blobURL; try { blobURL = URL.createObjectURL(FilesInput.FilesToLoad[textureName], { oneTimeOnly: true }); } catch (ex) { // Chrome doesn't support oneTimeOnly parameter blobURL = URL.createObjectURL(FilesInput.FilesToLoad[textureName]); } img.src = blobURL; } catch (e) { img.src = ""; } return img; } } noIndexedDB(); } return img; } Thank you for your time.
  14. paleRider

    PBR on iOS

    Hi Deltakosh: Of course this is not BJS Engine fault, but.. please, understand me, I thought it was possible to have a WebGL cross-platform framework capable to achieve the requirements of my average projects. In this direction, the inclusion of PBR materials in the engine was great news. Sadly, you'll need environment textures if you are going to use PBRs in a proper way. And so is how we got to where we are now. Well, if XHR is needed but we canĀ“t use it under iOS-Cordova, ... the available options here are: store that DDS in a web server and include the need for Internet connection in order to use de app, (maybe I'm wrong at all whit this approach) read the local file as an ArrayBuffer, then create a Blob URL from that, following these steps: Do you think this last focus of the problem deserves to be evaluated? If so, what lines of BJS code must I investigate? Best regards.
  15. paleRider

    PBR on iOS

    Hi again DK: I've just realized you were asking me for a profiler screenshot when using online environment DDS path, here you are: I hope this helps! Thank you for your time.