Is there anyway to have uniform values be Arrays instead of Vectors?
Such as:
"myUniform" : { type: "4fv", value: [[0, 1, 2, 3], [4, 5, 6, 7]] }
I’ve been perusing around, but unable to find a way if there is.
Is there anyway to have uniform values be Arrays instead of Vectors?
Such as:
"myUniform" : { type: "4fv", value: [[0, 1, 2, 3], [4, 5, 6, 7]] }
I’ve been perusing around, but unable to find a way if there is.
This is currently not supported and will cause runtime errors. Why do you have to use arrays instead of vectors?
For testing: https://jsfiddle.net/f2Lommf5/1695/
It’s just for a sense of consistency I wanted in my library. I didn’t want the front facing elements to consider using Vectors or custom types for something that ranges from 1 - 4 values. It’s more common for newer devs in this realm to understand an array of 4 elements over stuffing them specifically into a vector. Also the less Threejs specificity I use, the more i’ll be able to massage the application for future concepts.
I also like the arrays because you have nice elements like splice and and slice and what not, and you can even get super tricky if you desire with typed arrays and use the super fast operations included in them.
So, in a nutshell, I’m abstracting things and a vector is not what I want for my abstraction. Requiring the Vector4 there I believe is a potential bottleneck and now I have to do a hop to convert to Vectors before those vectors get converted back to an array (during the flatten operation threejs uses).
Edit: Also typescript is now having stronger support for tuple types which makes the array even more appealing.
Sorry for the double: Is there a way to mark a post as the answer?
I don’t know. Maybe @looeee can help here.
You can edit the title and put in [SOLVED] if you like, then link to the comment / post that solved it.
However, I rather leave things open, since there is rarely just one way of doing things and posts often have multiple solutions.