Jump to content

Search the Community

Showing results for tags 'fileapi'.

  • 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. 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?
×
×
  • Create New...