Китайская шляпа

name = "China Hat"
local color1 = nil
local color2 = nil
function onInit()
    color1 = settings:createColorPicker("First color", color:rgba(255, 100, 100, 255))
    color2 = settings:createColorPicker("Second color", color:rgba(100, 100, 255, 255))
end
function onRender(e)
    if e:is3d() then
        local pos = player:pos()
        pos.y = pos.y + player:height()

        local color = color2:get()

        gl11:begin(drawMode.TRIANGLE_FAN) -- начинаем рендер
        gl11:vertex(pos.x, pos.y + 0.22, pos.z, color1:get()) -- первая точка (середина)

        for i = 1, 361, 1 do
            local cos = math.cos(i / 180 * 3.14159) * 0.5;
            local sin = math.sin(i / 180 * 3.14159) * 0.5;
            gl11:vertex(pos.x + cos, pos.y - 0.2, pos.z + sin, color)
        end
        gl11:draw()
    end
end

Last updated