Skip to content

Instantly share code, notes, and snippets.

@vietnt
Created July 25, 2016 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vietnt/235b041f1354b6e027d2d12dbdf93fbc to your computer and use it in GitHub Desktop.
Save vietnt/235b041f1354b6e027d2d12dbdf93fbc to your computer and use it in GitHub Desktop.
let inline drawQuadTexture (x0, y0, u0, v0, c0) (x1, y1, u1, v1, c1) (x2, y2, u2, v2, c2) (x3, y3, u3, v3, c3) add vbo =
vbo |> add x0 y0 u0 v0 c0
vbo |> add x1 y1 u1 v1 c1
vbo |> add x3 y3 u3 v3 c3
vbo |> add x1 y1 u1 v1 c1
vbo |> add x2 y2 u2 v2 c2
vbo |> add x3 y3 u3 v3 c3
let inline calcArc cx cy rx ry thickness start delta count f =
let inc = delta/float32 (count - 1)
let mutable x = cos start
let mutable y = sin start
let c = cos inc
let s = sin inc
let mutable t = 0.f
let r1 = rx
let r2 = rx + thickness
let mutable ax = 0.f
let mutable ay = 0.f
let mutable bx = 0.f
let mutable by = 0.f
for i = 0 to count-1 do
let ax' = r2 * x + cx
let ay' = r2 * y + cy
let bx' = r1 * x + cx
let by' = r1 * y + cy
f (ax, ay, bx, by) (ax', ay', bx', by')
ax <- ax'
bx <- bx'
ay <- ay'
by <- by'
t <- x
x <- c * x - s * y
y <- s * t + c * y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment