col += cl*line(world,vec2(v1.x,v1.y),vec2(v2.x,v2.y),0.5);
col += cl*line(world,vec2(v2.x,v2.y),vec2(v3.x,v3.y),0.5);
col += cl*line(world,vec2(v3.x,v3.y),vec2(v4.x,v4.y),0.5);
col += cl*line(world,vec2(v4.x,v4.y),vec2(v1.x,v1.y),0.5);
col += cl*line(world,vec2(v5.x,v5.y),vec2(v6.x,v6.y),0.5);
col += cl*line(world,vec2(v6.x,v6.y),vec2(v7.x,v7.y),0.5);
col += cl*line(world,vec2(v7.x,v7.y),vec2(v8.x,v8.y),0.5);
col += cl*line(world,vec2(v8.x,v8.y),vec2(v5.x,v5.y),0.5);
col += cl*line(world,vec2(v8.x,v8.y),vec2(v4.x,v4.y),0.5);
col += cl*line(world,vec2(v7.x,v7.y),vec2(v3.x,v3.y),0.5);
col += cl*line(world,vec2(v5.x,v5.y),vec2(v1.x,v1.y),0.5);
col += cl*line(world,vec2(v6.x,v6.y),vec2(v2.x,v2.y),0.5);
col += cl*line(world,vec2(v2.x,v2.y),vec2(v3.x,v3.y),0.5);
col += cl*line(world,vec2(v2.x,v2.y),vec2(v12.x,v12.y),0.5);
col += cl*line(world,vec2(v3.x,v3.y),vec2(v4.x,v4.y),0.5);
col += cl*line(world,vec2(v4.x,v4.y),vec2(v5.x,v5.y),0.5);
col += cl*line(world,vec2(v4.x,v4.y),vec2(v6.x,v6.y),0.5);
col += cl*line(world,vec2(v6.x,v6.y),vec2(v5.x,v5.y),0.5);
col += cl*line(world,vec2(v5.x,v5.y),vec2(v13.x,v13.y),0.5);
col += cl*line(world,vec2(v8.x,v8.y),vec2(v9.x,v9.y),0.5);
col += cl*line(world,vec2(v8.x,v8.y),vec2(v10.x,v10.y),0.5);
col += cl*line(world,vec2(v10.x,v10.y),vec2(v15.x,v15.y),0.5);
col += cl*line(world,vec2(v10.x,v10.y),vec2(v14.x,v14.y),0.5);
col += cl*line(world,vec2(v2.x,v2.y),vec2(v13.x,v13.y),0.5);
col += cl*line(world,vec2(v4.x,v4.y),vec2(v13.x,v13.y),0.5);
col += cl*line(world,vec2(v9.x,v9.y),vec2(v13.x,v13.y),0.5);
col += cl*line(world,vec2(v10.x,v10.y),vec2(v13.x,v13.y),0.5);
col += cl*line(world,vec2(v3.x,v3.y),vec2(v12.x,v12.y),0.5);
col += cl*line(world,vec2(v8.x,v8.y),vec2(v12.x,v12.y),0.5);
col += cl*line(world,vec2(v12.x,v12.y),vec2(v11.x,v11.y),0.5);
col += cl*line(world,vec2(v11.x,v11.y),vec2(v3.x,v3.y),0.5);
col += cl*line(world,vec2(v11.x,v11.y),vec2(v8.x,v8.y),0.5);
col += cl*line(world,vec2(v11.x,v11.y),vec2(v7.x,v7.y),0.5);
col += cl*line(world,vec2(v11.x,v11.y),vec2(v1.x,v1.y),0.5);
col += cl*line(world,vec2(v9.x,v9.y),vec2(v12.x,v12.y),0.5);
col += cl*line(world,vec2(v8.x,v8.y),vec2(v7.x,v7.y),0.5);
col += cl*line(world,vec2(v3.x,v3.y),vec2(v1.x,v1.y),0.5);
col += cl*line(world,vec2(v1.x,v1.y),vec2(v6.x,v6.y),0.5);
col += cl*line(world,vec2(v7.x,v7.y),vec2(v15.x,v15.y),0.5);
col += cl*line(world,vec2(v12.x,v12.y),vec2(v13.x,v13.y),0.5);
col += cl*line(world,vec2(v13.x,v13.y),vec2(v14.x,v14.y),0.5);
col += cl*line(world,vec2(v14.x,v14.y),vec2(v15.x,v15.y),0.5);
return col;
}
vec3 mountain(vec2 world, mat4 proj, mat4 view, float time, vec3 p, vec3 s, float rotX, float rotY, float rotZ, vec3 cl)
{
vec3 col = vec3(0.0);
float pi = 3.14159265358979;
col += cl*line(world,vec2(v1.x,v1.y),vec2(v2.x,v2.y),0.5);
col += cl*line(world,vec2(v2.x,v2.y),vec2(v3.x,v3.y),0.5);
col += cl*line(world,vec2(v3.x,v3.y),vec2(v1.x,v1.y),0.5);
col += cl*line(world,vec2(v1.x,v1.y),vec2(v4.x,v4.y),0.5);
col += cl*line(world,vec2(v2.x,v2.y),vec2(v4.x,v4.y),0.5);
col += cl*line(world,vec2(v3.x,v3.y),vec2(v4.x,v4.y),0.5);
return col;
}
float loopZ = mod(time*3.0, 30.0);
col += airplane(worldCenter,proj,view,time,vec3(0.0,0.0,loopZ-15.0),vec3(1.8,1.8,1.8),0.0,0.0,sin(time*0.5),vec3(1.0,1.0,1.0));
col += cube(worldCenter,proj,view,time,vec3(6.0,0.0,0.0),vec3(1.2,1.2,1.2),time*.5-(pi/2.),0.0,0.0,vec3(1.0,1.0,1.0));
col += cube(worldCenter,proj,view,time,vec3(-4.0,0.0,6.0),vec3(1.2,2.2,1.2),0.0,0.0,0.0,vec3(1.0,1.0,1.0));
col += mountain(worldCenter,proj,view,time,vec3(4.0,0.0,9.0),vec3(2.2,1.2,1.2),0.0,0.0,0.0,vec3(1.0,1.0,1.0));
col += mountain(worldCenter,proj,view,time,vec3(-4.0,0.0,-6.5),vec3(2.2,2.1,1.2),0.0,0.0,0.0,vec3(1.0,1.0,1.0));
// floor
vec3 gridScale = vec3(3.5,3.5,3.5);
for(float i = -2.; i <= 2.; i ++)
{
vec4 t1 = proj*view*(vec4(-256.0*0.02,-64.0*0.02,i*128.0*0.02,1.0)*scale(gridScale));
vec4 t2 = proj*view*(vec4(256.0*0.02,-64.0*0.02,i*128.0*0.02,1.0)*scale(gridScale));
vec4 t3 = proj*view*(vec4(i*128.0*0.02,-64.0*0.02,-256.0*0.02,1.0)*scale(gridScale));
vec4 t4 = proj*view*(vec4(i*128.0*0.02,-64.0*0.02,256.0*0.02,1.0)*scale(gridScale));
col += vec3(1.0,1.0,1.0)*line(worldCenter,vec2(t1.x,t1.y),vec2(t2.x,t2.y),0.5);
col += vec3(1.0,1.0,1.0)*line(worldCenter,vec2(t3.x,t3.y),vec2(t4.x,t4.y),0.5);
}
// if you don't want posteffect.
//worldCenter = (gl_FragCoord.xy * 2.0 - resolution) / min(resolution.x, resolution.y);