render.ComputeLighting
Açıklama
Belirli bir konumda ışık rengini hesaplar.
Bu hem çevre ışığını hem de dinamik aydınlatmayı içerir.
Görelim. render. ComputeDynamicLighting Sadece dinamik ışık için.
Görelim. render. GetAmbientLightColor Harita çapında çevre rengi için.
Argümanlar
2. Vektör Normal
Işığın ulaşması için hayali bir yüzeyin yönü.
Duvarlardan uzak tutmak, duvardaki ışığı alır.
Geri dönüşler
Örnek
Oyuncunun baktığı noktada ışık seviyesini görüntüler.
hook.Add( "HUDPaint", "test_navmesh", function()
local ply = LocalPlayer()
local tr = ply:GetEyeTrace()
local startPos = tr.HitPos
local color = render.ComputeLighting( startPos, tr.HitNormal )
local colorDyn = render.ComputeDynamicLighting( startPos, tr.HitNormal )
local colorAmbi = color - colorDyn
local pos2D = startPos:ToScreen()
pos2D.x = pos2D.x + 30
draw.RoundedBox( 4, pos2D.x - 25, pos2D.y - 5, 250, 60, Color(0,0,0, 200 ) )
draw.SimpleText( "Color: " .. tostring(color), "Default", pos2D.x, pos2D.y, color_white )
draw.SimpleText( "Dynamic Color: " .. tostring(colorDyn), "Default", pos2D.x, pos2D.y + 20, color_white )
draw.SimpleText( "Ambient Color: " .. tostring(colorAmbi), "Default", pos2D.x, pos2D.y + 40, color_white )
draw.RoundedBox( 4, pos2D.x - 20, pos2D.y, 10, 10, Color( color.x * 255, color.y * 255, color.z * 255 ) )
draw.RoundedBox( 4, pos2D.x - 20, pos2D.y + 20, 10, 10, Color( colorDyn.x * 255, colorDyn.y * 255, colorDyn.z * 255 ) )
draw.RoundedBox( 4, pos2D.x - 20, pos2D.y + 40, 10, 10, Color( colorAmbi.x * 255, colorAmbi.y * 255, colorAmbi.z * 255 ) )
end )
Çıkış: 

Tüm sunucular · GmodTR Launcher · Rehber · GMod Wiki · GmodTR nedir? · Sunucu ekle · Discord