From 013523ce7fa558b63709f7ed2bec9015c01d8f54 Mon Sep 17 00:00:00 2001 From: techcodie Date: Sun, 16 Nov 2025 23:33:56 +0530 Subject: [PATCH 1/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7237aa514f305d..0f258daba8216a 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![jsDelivr Downloads][jsdelivr-downloads]][jsdelivr-url] [![Discord][discord]][discord-url] -#### JavaScript 3D library +#### JavaScript 3D library The aim of the project is to create an easy-to-use, lightweight, cross-browser, general-purpose 3D library. The current builds only include WebGL and WebGPU renderers but SVG and CSS3D renderers are also available as addons. From b9cd6f8d67979d8eaa00ef6e538f7e9651c5c2c0 Mon Sep 17 00:00:00 2001 From: Ansh Date: Wed, 3 Dec 2025 03:07:01 +0530 Subject: [PATCH 2/2] Add validation for BufferAttribute matrix methods - Add itemSize validation to applyMatrix4(), applyNormalMatrix(), and transformDirection() - These methods now warn and return early if itemSize is not 3 - Prevents silent failures and incorrect results when used with wrong itemSize - Improves consistency with existing documentation that states these methods only work with itemSize 3 --- src/core/BufferAttribute.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/core/BufferAttribute.js b/src/core/BufferAttribute.js index 3e1b10fe68f3f5..a8b330bfccd750 100644 --- a/src/core/BufferAttribute.js +++ b/src/core/BufferAttribute.js @@ -296,6 +296,13 @@ class BufferAttribute { */ applyMatrix4( m ) { + if ( this.itemSize !== 3 ) { + + console.warn( 'THREE.BufferAttribute.applyMatrix4(): itemSize is not 3, which is required.' ); + return this; + + } + for ( let i = 0, l = this.count; i < l; i ++ ) { _vector.fromBufferAttribute( this, i ); @@ -319,6 +326,13 @@ class BufferAttribute { */ applyNormalMatrix( m ) { + if ( this.itemSize !== 3 ) { + + console.warn( 'THREE.BufferAttribute.applyNormalMatrix(): itemSize is not 3, which is required.' ); + return this; + + } + for ( let i = 0, l = this.count; i < l; i ++ ) { _vector.fromBufferAttribute( this, i ); @@ -342,6 +356,13 @@ class BufferAttribute { */ transformDirection( m ) { + if ( this.itemSize !== 3 ) { + + console.warn( 'THREE.BufferAttribute.transformDirection(): itemSize is not 3, which is required.' ); + return this; + + } + for ( let i = 0, l = this.count; i < l; i ++ ) { _vector.fromBufferAttribute( this, i );