1
我玩GLSL Sandbox不知何故for
循環不工作如我所料:GLSL - for循環不工作
float map(vec3 p)
{
p.yz = rotate(p.yz, mouse.y*10.);
float aa = 0.;
float b = box(p, vec3(1.,1.,1.));
for(int i=0; i<5; i++)
{
float off = float(i);
vec3 q = p+off*.05;//<--pivot go down diagonally
float c = box(q, vec3(off,1.,1.));//<--scale the box in x
aa = min(c,b);
}
return aa;
}
我希望它至少有5盒逐漸下移去與xscale
變得更大。但結果好像所有重複的框都以循環的最後結果結束。
我該如何解決這個問題?