Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash on smooth shading for meshes with no index buffers. #1109

Closed

Conversation

SergioRZMasson
Copy link
Contributor

Overview

When forceSharedVertices is called on a mesh that does not have a index buffer, the forceSharedVertices will create empty arrays for its positions and normals vertex attributes. This will result in a NativeEngine::RecordVertexBuffer been called with undefined arguments been passed as VertexBuffer* argument.

A similar behavior happens on the Web engine; however, the web engine creates vertex attribute arrays of size zero, which results in no rendering for those meshes. By simply returning from NativeEngine::RecordVertexBuffer we get the same behavior on the Native engine.

Issues

Comment on lines +612 to +615
auto vertexBufferValue = info[1];

if (vertexBufferValue.IsUndefined())
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend doing this check on the JS side.

@SergioRZMasson
Copy link
Contributor Author

This fix was moved to the JS side and should be solved with PR BabylonJS/Babylon.js#12781

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Smooth shading is not working in Babylon Native
3 participants