exc_html5 Posted June 13, 2016 Share Posted June 13, 2016 That's odd. Any idea why they removed it? I guess at this stage we'd have to roll our own or try to re-implement yours on our side. Quote Link to comment Share on other sites More sharing options...
ozRocker Posted June 13, 2016 Author Share Posted June 13, 2016 If you have any C# experience you can get the code from the GITHub history and try and re-factor that into the latest version. I converted this from Unity3D to Babylon.js http://www.punkoffice.com/lotsatrees/ I HAD to use instances for that. The scene is 99% prefabs. Quote Link to comment Share on other sites More sharing options...
exc_html5 Posted June 13, 2016 Share Posted June 13, 2016 Thanks man! I'll check it out. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 13, 2016 Share Posted June 13, 2016 Oups did I overwrite changes you did? If yes I'm really sorry! We had some issues with the Unity exporter can you please point me to your commit? I'll reintroduce your changes Quote Link to comment Share on other sites More sharing options...
ozRocker Posted June 13, 2016 Author Share Posted June 13, 2016 Yeh, I noticed there were some devastating commits in there. Complete file overwrites. Yikes! All my commits are listed under user "punkoffice" Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 13, 2016 Share Posted June 13, 2016 Would it be easier for you to redo the PR? (with all MY APOLOGIES) Quote Link to comment Share on other sites More sharing options...
ozRocker Posted June 13, 2016 Author Share Posted June 13, 2016 It probably would be easier since I know where everything fits. Maybe I can streamline it more with the extra knowledge of Babylon.js that I've gained since then. I'll try and get it done within the next 2 weeks. I'm a bit tied up right now writing pitch-decks and business plans and all that crap that investors care about. Boz 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 13, 2016 Share Posted June 13, 2016 Thank you so much..And I promised to not screw things up again Quote Link to comment Share on other sites More sharing options...
tbgeorge Posted June 15, 2016 Share Posted June 15, 2016 Hi, I'm trying to get the prefab instances to export correctly, and when they export, the .babylon file seems correct though if I have a material on the prefab at all (even the default material) I get an error when loading the scene. This is the error: "Uncaught TypeError: Cannot read property 'index' of undefined babylon.max.nightly.js:6297" Which leads to this section of code: Engine.prototype.updateAndBindInstancesBuffer = function (instancesBuffer, data, offsetLocations) { this._gl.bindBuffer(this._gl.ARRAY_BUFFER, instancesBuffer); if (data) { this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data); } if (offsetLocations[0].index !== undefined) { // this is the line in question var stride = 0; for (var i = 0; i < offsetLocations.length; i++) { var ai = offsetLocations[i]; stride += ai.attributeSize * 4; } for (var i = 0; i < offsetLocations.length; i++) { var ai = offsetLocations[i]; this._gl.enableVertexAttribArray(ai.index); this._gl.vertexAttribPointer(ai.index, ai.attributeSize, ai.attribyteType || this._gl.FLOAT, ai.normalized || false, stride, ai.offset); this._caps.instancedArrays.vertexAttribDivisorANGLE(ai.index, 1); } } else { for (var index = 0; index < 4; index++) { var offsetLocation = offsetLocations[index]; this._gl.enableVertexAttribArray(offsetLocation); this._gl.vertexAttribPointer(offsetLocation, 4, this._gl.FLOAT, false, 64, index * 16); this._caps.instancedArrays.vertexAttribDivisorANGLE(offsetLocation, 1); } } }; This is not the current nightly build, but it is fairly recent, probably a week or two old. Any ideas? I can post more info/code if needed. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 15, 2016 Share Posted June 15, 2016 Hello this is tough to help you without seeing it live. Can you reproduce on the PG or on a live server? Quote Link to comment Share on other sites More sharing options...
tbgeorge Posted June 15, 2016 Share Posted June 15, 2016 I've figured it out. I had this code in the scene.executeWhenReady function and for some reason that was causing problems: scene.materials.forEach( function( mat ) { mat.freeze(); }); I moved it to a render loop that stops itself and it now works fine. Inside scene.executeWhenReady() : engine.runRenderLoop( freezeMaterials ); The 'freezeMaterials' function: function freezeMaterials() { scene.materials.forEach( function( mat ) { mat.freeze(); }); scene.getEngine().stopRenderLoop(freezeMaterials); } GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.