Wingnut Posted January 30, 2016 Share Posted January 30, 2016 Hi Gang! Many questions. (sorry) **** Does anyone know the history-of or reason-for... https://github.com/BabylonJS/Babylon.js/blob/master/src/Mesh/babylon.subMesh.js#L14 During the creation of a SubMesh, it is automatically placed into the mesh.subMeshes array. Is this somewhat new? Anyone know? MY reason for wanting to know? Visit Kostar's cool Tiled Ground Tutorial... particularly playground demo #5. See line 61, where our friend is pushing newly-created subMesh into the tiledGround.subMeshes array? Well... that's no good. Inserting a console.log near line 65, reports that there are 128 subMeshes in Kostar's 64-tile ground. (double, and we know why) Here is my own clone of Kostar's demo #5 - with console.log line showing 128 count. A little adjustment to line 61, and things start working good, with a count of 64. Maybe Kostar needs a mail. Maybe auto-pushing subMesh upon creation... is a bad idea. Dunno. Anyone know any history? Is auto-pushing subMeshes... something new? Bad? Good? Thoughts? (thx) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 1, 2016 Share Posted February 1, 2016 Hey Wingy! This was there since a very long time (I'm wondering if this was not there since the first public version). I guess the best here is to send him a mail. To give more data, here are several pieces of babylon.js that consider that the subMEsh is auto-pushed: https://github.com/BabylonJS/Babylon.js/blob/305c4d9741a7b2e844af7c660d1ed70dcd33d3c6/src/Mesh/babylon.subMesh.js#L128 https://github.com/BabylonJS/Babylon.js/blob/69883ee3148aa0c1a9e6f93dec01e198a8e0e2d8/src/Mesh/babylon.meshSimplification.ts#L566 https://github.com/BabylonJS/Babylon.js/blob/80185c7387a994065d8fe0f82b8da472f64270c0/src/Mesh/babylon.subMesh.ts#L202 https://github.com/BabylonJS/Babylon.js/blob/3fce20e8c99f414f3af93df26e59e1e14f15124a/src/Mesh/babylon.mesh.ts#L1157 Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted February 5, 2016 Author Share Posted February 5, 2016 Thanks for the info, DK! Mail sent. This is good... we might get Kostar to come visit, again. We don't get to see him often enough. Hi Kostar! GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
lesterhaus Posted May 2, 2016 Share Posted May 2, 2016 I was just going to ask about this in a new topic (glad I found this and may now escape the shaming for not searching the forum properly ) I'm working on a little script to create new subMeshes from a selection of faces of a complex mesh (selected via onClick) so that I can use MultiTexture for those subMeshes. Now I noticed that mesh.subMeshes.push() seems to result in 2 subMeshes being pushed to the mesh. Since the first suspect of such strange behaviour is always the non-coding-legend which is I (!), I also crosschecked with an existing example on the PG: http://www.babylonjs-playground.com/#YPL6T The engine doesn't seem to be bothered by this, but in my script I need to keep track of the exact number of existing subMeshes. A new selection could include faces of existing subMeshes which I have to alter in the process. For now I'm just assigning it to a short lived temp. While assigning it to temp is not needed ... it just felt wrong to have new BABYLON.SubMesh() standing there all alone.. without "=" or anything .. and actually I'd really love to push() it let temp = new BABYLON.SubMesh(0, 0, verticesCount, indexStart, indexCount, mesh); Results in exactly 1 subMesh Wingnut 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 2, 2016 Share Posted May 2, 2016 hello! I do not see what is wrong with your repro can you elaborate? Quote Link to comment Share on other sites More sharing options...
lesterhaus Posted May 2, 2016 Share Posted May 2, 2016 Hey! I don't think there is anything wrong in particular. I just didn't know that there was some kind of a subMesh auto-push happening .. and was rather glad that it was the same case in this PG (which I just copied from a multiTexture example somewhere here on the Forum) and not one of my silly mistakes. I guess I just commented here for myself so when at some point in the future I have to switch back to using subMesh.push() I can remind myself why I didn't use it in the first place Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 2, 2016 Share Posted May 2, 2016 lol ok Quote Link to comment Share on other sites More sharing options...
Wingnut Posted May 3, 2016 Author Share Posted May 3, 2016 I love your personality, LH... you funnnnnny! Good to have you with us! "escape the shaming for not searching the forum properly" haha "felt wrong to have new BABYLON.SubMesh() standing there all alone.. without "=" or anything .. and actually I'd really love to push() it" Been there. hahaha. I hate leaving objects sitting alone, outside in the cold, homeless, unappreciated. You're going to be comedic trouble around here, aren't you? You'll fit-in perfectly. Quote Link to comment Share on other sites More sharing options...
lesterhaus Posted May 3, 2016 Share Posted May 3, 2016 Well thank you very much for those welcoming words Since I decided to move entirely to babylon.js for my projects (was using three.js before) I'll be around here more often indeed. Actually this forum is one of the reasons for me switching to babylon.js - never got any meaningful answers over at three.js (apart from the good ol' "Off to stack overflow ya go lllandrrrrat!") Here I get answers from the engine's godfathers directly, so I guess I won't end up in a dead end so frequently. Being able to port all my scripts over to babylon.js while saving somewhere around 40% lines of code per script, having a full functional playground thingy and getting many functionalities I had to script for myself in three.js neatly packed in 1 line function calls.. also helped.. and my never ending hope to get nicely blurvariance shadowmaps working for self-shadowing meshes in a later version of bjs *hint* jerome and Wingnut 2 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 3, 2016 Share Posted May 3, 2016 Quote so I guess I won't end up in a dead end so frequently. My personal goal is to NEVER end up in a dead end 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.