vector - How do I limit a for-loop in GLSL with a Vec3 as iterator? -


vec3 origin = vec3(0,0,0); vec3 stepvalue = vec3(0,1,0); vec3 destination = origin + (10*stepvalue);  (vec3 stepper; stepper==destination; stepper += stepvalue) 

this not actual code, example doing same thing, except vectors aren't clean , easy these.

this not work. loop not iterate @ all!

using ...

for(vec3 stepper; stepper==stepper; stepper += stepvalue) 

... iterates through loop either until driver crashes, or until loop terminates manually.

the operaters >,<,>= , <= aren't allowed vectors , lessthan / greaterthan neither.

so how work this, besides running infinite loops?

is there other option besides using == ?

thanks!

for (vec3 stepper = origin; all(lessthan(stepper, destination)); stepper += stepvalue) 

lessthan, lessthanequal , return bvec* can evaluated boolean value using functions all , any. however, aware still not iterate in example, since x , z of destination 0 , not >= stepper.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -