Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1a9022c

Browse filesBrowse files
authored
Improve skypaint matproxy performance (Facepunch#2107)
1 parent cd72f68 commit 1a9022c
Copy full SHA for 1a9022c

File tree

Expand file treeCollapse file tree

1 file changed

+23
-26
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+23
-26
lines changed

‎garrysmod/lua/matproxy/sky_paint.lua

Copy file name to clipboardExpand all lines: garrysmod/lua/matproxy/sky_paint.lua
+23-26Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,32 @@ matproxy.Add( {
88
bind = function( self, mat, ent )
99

1010
local skyPaint = g_SkyPaint
11-
if ( !IsValid( skyPaint ) ) then return end
12-
13-
local values = skyPaint:GetNetworkVars()
14-
15-
mat:SetVector( "$TOPCOLOR", values.TopColor )
16-
mat:SetVector( "$BOTTOMCOLOR", values.BottomColor )
17-
mat:SetVector( "$DUSKCOLOR", values.DuskColor )
18-
mat:SetFloat( "$DUSKSCALE", values.DuskScale )
19-
mat:SetFloat( "$DUSKINTENSITY", values.DuskIntensity )
20-
mat:SetFloat( "$FADEBIAS", values.FadeBias )
21-
mat:SetFloat( "$HDRSCALE", values.HDRScale )
22-
23-
mat:SetVector( "$SUNNORMAL", values.SunNormal )
24-
mat:SetVector( "$SUNCOLOR", values.SunColor )
25-
mat:SetFloat( "$SUNSIZE", values.SunSize )
26-
27-
if ( values.DrawStars ) then
28-
29-
mat:SetInt( "$STARLAYERS", values.StarLayers )
30-
mat:SetFloat( "$STARSCALE", values.StarScale )
31-
mat:SetFloat( "$STARFADE", values.StarFade )
32-
mat:SetFloat( "$STARPOS", values.StarSpeed * RealTime() )
33-
mat:SetTexture( "$STARTEXTURE", values.StarTexture )
11+
if ( not IsValid( skyPaint ) ) then return end
12+
13+
mat:SetVector( "$TOPCOLOR", skyPaint:GetDTVector( 0 ) )
14+
mat:SetVector( "$BOTTOMCOLOR", skyPaint:GetDTVector( 1 ) )
15+
mat:SetVector( "$DUSKCOLOR", skyPaint:GetDTVector( 4 ) )
16+
mat:SetFloat( "$DUSKSCALE", skyPaint:GetDTFloat( 2 ) )
17+
mat:SetFloat( "$DUSKINTENSITY", skyPaint:GetDTFloat( 3 ) )
18+
mat:SetFloat( "$FADEBIAS", skyPaint:GetDTFloat( 0 ) )
19+
mat:SetFloat( "$HDRSCALE", skyPaint:GetDTFloat( 1 ) )
20+
21+
mat:SetVector( "$SUNNORMAL", skyPaint:GetDTVector( 2 ) )
22+
mat:SetVector( "$SUNCOLOR", skyPaint:GetDTVector( 3 ) )
23+
mat:SetFloat( "$SUNSIZE", skyPaint:GetDTFloat( 4 ) )
24+
25+
if ( not skyPaint:GetDTBool( 0 ) ) then
26+
return mat:SetInt( "$STARLAYERS", 0 )
27+
end
3428

35-
else
29+
mat:SetInt( "$STARLAYERS", skyPaint:GetDTInt( 0 ) )
3630

37-
mat:SetInt( "$STARLAYERS", 0 )
31+
local star = skyPaint:GetDTAngle( 0 )
32+
mat:SetFloat( "$STARSCALE", star.p )
33+
mat:SetFloat( "$STARFADE", star.y )
34+
mat:SetFloat( "$STARPOS", star.r * RealTime() )
3835

39-
end
36+
mat:SetTexture( "$STARTEXTURE", skyPaint:GetDTString( 0 ) )
4037

4138
end
4239
} )

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.