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

Setting mat3 row doesn't transpile correctly #56

Open
DVLP opened this issue Oct 4, 2023 · 3 comments · Fixed by #59
Open

Setting mat3 row doesn't transpile correctly #56

DVLP opened this issue Oct 4, 2023 · 3 comments · Fixed by #59

Comments

@DVLP
Copy link

DVLP commented Oct 4, 2023

Declaration
varying mat3 mat3one;

With value assignment
mat3one[0] = vec3(1., 1., 0.);

Transpiles to
mat3one.slice(0, 3) = [1., 1., 0.];

Which doesn't work.
With arrays of matrices
varying mat3 mat3Arr[15];
mat3Arr[4][0] = vec3(1., 1., 0.)
transpiles to
= [1, 1, 0]

@dy
Copy link
Member

dy commented Jan 21, 2024

yeah, that's tricky one. Not sure if it's better to manually detect all possible kinds of left-hand target or convert all arrays to Float32Array and use subarray+reduce, sort of
([1,1,0]).reduce((arr,v,i)=>(arr[i]=v,arr), mat3Arr.subarray(0,3))

@dy dy mentioned this issue Jan 22, 2024
@dy dy closed this as completed in #59 Jan 22, 2024
@dy dy reopened this Jan 22, 2024
@dy
Copy link
Member

dy commented Jan 22, 2024

Done as outlined case. Array of matrices is not yet supported, needs explicit effort.

@DVLP
Copy link
Author

DVLP commented Jan 23, 2024

Nice! For now I only updated the package and it seems to be still working. I'll try some matrix read/writes tomorrow

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 a pull request may close this issue.

2 participants