)
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
--@client
|
||||
|
||||
function render.drawWedge(x, y, w, h, angle, mouthSize, fidelity)
|
||||
if w > 0 and h > 0 and mouthSize <= 360 then
|
||||
local vertices = {}
|
||||
|
||||
vertices[1] = { x = x, y = y, u = 0, v = 0 }
|
||||
|
||||
local _ang = -math.rad(angle)
|
||||
local _c = math.cos(_ang)
|
||||
local _s = math.sin(_ang)
|
||||
|
||||
for ii = 0, fidelity do
|
||||
local _i = ii * (360 - mouthSize) / fidelity
|
||||
local _radd = math.rad(_i)
|
||||
local _x = math.cos(_radd)
|
||||
local _u = 0.5
|
||||
local _y = math.sin(_radd)
|
||||
local _v = 0.5
|
||||
|
||||
local _tempx = _x * w * _c - _y * h * _s + x
|
||||
_y = _x * w * _s + _y * h * _c + y
|
||||
_x = _tempx
|
||||
|
||||
vertices[ii + 2] = { x = _x, y = _y, u = _u, v = _v }
|
||||
end
|
||||
|
||||
render.drawPoly(vertices)
|
||||
end
|
||||
end
|
||||
|
||||
function render.drawArc(x, y, ang, p, rad, color, seg)
|
||||
seg = seg || 80
|
||||
ang = (-ang) + 180
|
||||
local vertices = {}
|
||||
|
||||
table.insert(vertices, {x = x, y = y})
|
||||
for i = 0, seg do
|
||||
local a = math.rad((i / seg) * -p + ang)
|
||||
table.insert(vertices, {x = x + math.sin(a) * rad, y = y + math.cos(a) * rad})
|
||||
end
|
||||
|
||||
render.drawPoly(vertices)
|
||||
end
|
||||
Reference in New Issue
Block a user