Jump to content

Shouldn't mergeMeshes ignore invalid meshes and continue merging?


gamefan
 Share

Recommended Posts

Firstly, Congrats for completing 3.2 . We were looking forward to quite of a lot of features implemented here.

This isn't a bug, but in my opinion I think the merge meshes should continue merging the rest of the meshes in the list when it encounters an invalid mesh instead of throwing an error. We have a model load workflow which on load finds the center and extent of the model using mergeMeshes. Few of our models have empty container like meshes that are parent of meshes that have real vertex data. And this breaks our App when vertexData.validate() throws "Positions are required".

There is an easy fix for this - I made a pass before mergingMeshes like so:

for (var i = 0; i < meshes.length; i++) {
//only pass meshes that have valid position data
if (meshes[i].getVerticesData(BABYLON.VertexBuffer.PositionKind))
	clones.push(meshes[i].clone("clone" + i));
}
var combinedMesh = BABYLON.Mesh.MergeMeshes(clones);

This is potentially a breaking change as it works right with 3.1

Link to comment
Share on other sites

We cannot change that behavior because it could swallow an error unknown to the user

AS there is an easy fix (that you found :)) I don't think we will integrate it

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...