Skip to content

Instantly share code, notes, and snippets.

@seece
Created May 21, 2017 19:07
Show Gist options
  • Save seece/dcc4e1a6a68f0a911ad05e3be755588b to your computer and use it in GitHub Desktop.
Save seece/dcc4e1a6a68f0a911ad05e3be755588b to your computer and use it in GitHub Desktop.
float fBomber(in vec3 p, in float lod)
{
float sc = 0.05;
p*=sc;
pR(p.xy, PI/2.0);
vec3 pc = p;
float t = fCapsule(pc + vec3(0., -45., 0.), 12., 45.);
t = min(t, fCapsule(pc, 10., 45.));
t = min(t, fCapsule(pc + vec3(-3., 0., 0.0), 9., 90.));
t = min(t, fCapsule(pc + vec3(-5., 20., 0.), 3.5, 90.));
vec3 p2 = p;
pR(p2.xz, PI/2.0);
p2.x = abs(p2.x);
vec3 pz = p;
pz.z = abs(pz.z);
float motor_thick = 9.;
float tm = fCapsule(pz + vec3(0.0, -15.0, -60.0), motor_thick, 10.);
tm = min(tm, fCapsule(pz + vec3(0.0, 17.0, -120.0), motor_thick, 10.));
tm = min(tm, fCapsule(pz + vec3(0.0, 32.0, -155.0), 3.5, 4.));
t = min(t, tm);
pR(p2.xy, -0.5);
vec3 wo = vec3(80.0, 18.0, -5.0);
float wt = 2.0;
float b = fBox(p2 - wo, vec3(100.0, 25.0, wt));
pR(p2.xy, 0.07*2.0);
float b2 = fBox(p2 - wo + vec3(-2.0, 15.+28.0, 0.0), vec3(200.0, 25.0, wt+40.0));
b = max(b, -b2);
t = min(t, b);
vec3 p3 = p;
pR(p3.xz, PI/2.0);
p3.x = abs(p3.x);
float bt = fBox(p3 + vec3(0.0, 82.0, 4.0), vec3(55.0, 20.0, wt));
pR(p3.xy, -0.5);
float bt2 = fBox(p3 - wo + vec3(0.0, 50.0, 0.0), vec3(200.0, 25.0, wt+40.0));
bt = max(bt, -bt2);
t = min(t, bt);
return t / sc;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment