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
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Plugins/NativeEngine/Source/NativeEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,13 @@ namespace Babylon
void NativeEngine::RecordVertexBuffer(const Napi::CallbackInfo& info)
{
VertexArray* vertexArray = info[0].As<Napi::Pointer<VertexArray>>().Get();
VertexBuffer* vertexBuffer = info[1].As<Napi::Pointer<VertexBuffer>>().Get();

auto vertexBufferValue = info[1];

if (vertexBufferValue.IsUndefined())
return;
Comment on lines +612 to +615
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.


VertexBuffer* vertexBuffer = vertexBufferValue.As<Napi::Pointer<VertexBuffer>>().Get();
const uint32_t location = info[2].As<Napi::Number>().Uint32Value();
const uint32_t byteOffset = info[3].As<Napi::Number>().Uint32Value();
const uint32_t byteStride = info[4].As<Napi::Number>().Uint32Value();
Expand Down