Skip to content

Commit

Permalink
WebGLRenderer: Fix runtime error when rendering wireframes with empty…
Browse files Browse the repository at this point in the history
… geometry. (#26465)
  • Loading branch information
Mugen87 committed Jul 20, 2023
1 parent afe58df commit 39305cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/renderers/WebGLRenderer.js
Expand Up @@ -795,6 +795,9 @@ class WebGLRenderer {
if ( material.wireframe === true ) {

index = geometries.getWireframeAttribute( geometry );

if ( index === undefined ) return;

rangeFactor = 2;

}
Expand Down
6 changes: 5 additions & 1 deletion src/renderers/webgl/WebGLGeometries.js
Expand Up @@ -128,7 +128,7 @@ function WebGLGeometries( gl, attributes, info, bindingStates ) {

}

} else {
} else if ( geometryPosition !== undefined ) {

const array = geometryPosition.array;
version = geometryPosition.version;
Expand All @@ -143,6 +143,10 @@ function WebGLGeometries( gl, attributes, info, bindingStates ) {

}

} else {

return;

}

const attribute = new ( arrayNeedsUint32( indices ) ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 );
Expand Down

0 comments on commit 39305cf

Please sign in to comment.