AlexB Posted June 18, 2018 Share Posted June 18, 2018 I notice that there's a setTextureArray method, but I don't see any corresponding methods for vec2s, vec3s, etc. As an example, if I want something like: (Typescript) const offsets: Vector2[] = [ new Vector2(1, 1), new Vector2(2, 1), new Vector2(3, 1), new Vector2(4, 1), ] And I want to be able to use this in my shader, like this: (GLSL) uniform offsets vec2[4]; for (int i = 0; i < 4; i++) { vec3 tex = texture2D(sampler, uv * offsets[i]); // do something awesome here } I don't see any easy way to do it. Any clues? Quote Link to comment Share on other sites More sharing options...
Guest Posted June 18, 2018 Share Posted June 18, 2018 We should definitely add it do you want to tackle it? Quote Link to comment Share on other sites More sharing options...
Nabroski Posted June 19, 2018 Share Posted June 19, 2018 few examples: for loops: https://playground.babylonjs.com/#4LDXG1#1 setArray2: https://playground.babylonjs.com/#4LDXG1#5 setTextureArray: https://playground.babylonjs.com/#4LDXG1#6 AlexB 1 Quote Link to comment Share on other sites More sharing options...
AlexB Posted June 19, 2018 Author Share Posted June 19, 2018 Thank you, this helps a lot! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.