Skip to content

Conversation

@z4122
Copy link
Contributor

@z4122 z4122 commented Jul 16, 2024

Support mat4 to mat3 and mat3 to mat2 in TSL.
In glsl, mat3(mat4) is a convinent method to convert matrix, it will help simpify code.

before

const bm = mat3(
			batchingMatrix[ 0 ].xyz,
			batchingMatrix[ 1 ].xyz,
			batchingMatrix[ 2 ].xyz
		 );

after

const bm = mat3( batchingMatrix );

Because WGSL doesn't support code like mat3(mat4). So it will be split into different part in NodeBuilder.js

if ( fromTypeLength === 16 && toTypeLength === 9 ) {

      return `${ this.getType( toType ) }(${ snippet }[0].xyz, ${ snippet }[1].xyz, ${ snippet }[2].xyz)`;

    }

@z4122 z4122 marked this pull request as draft July 16, 2024 16:23
@github-actions
Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
683.5 kB (169.2 kB) 683.5 kB (169.2 kB) +0 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
460.7 kB (111.1 kB) 460.7 kB (111.1 kB) +0 B

@z4122 z4122 marked this pull request as ready for review July 16, 2024 16:29
@sunag sunag added this to the r167 milestone Jul 16, 2024
@sunag sunag merged commit dbd5e11 into mrdoob:dev Jul 16, 2024
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.

2 participants