Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*--------------------------------
- Stencil functions
- ----------------------------------*/
- function matcore.StencilStart()
- render.ClearStencil()
- render.SetStencilEnable( true )
- render.SetStencilWriteMask( 1 )
- render.SetStencilTestMask( 1 )
- render.SetStencilFailOperation( STENCILOPERATION_KEEP )
- render.SetStencilZFailOperation( STENCILOPERATION_KEEP )
- render.SetStencilPassOperation( STENCILOPERATION_REPLACE )
- render.SetStencilCompareFunction( STENCILCOMPARISONFUNCTION_ALWAYS )
- render.SetStencilReferenceValue( 1 )
- render.SetColorModulation( 1, 1, 1 )
- end
- function matcore.StencilStartC(m)
- render.ClearStencil()
- render.SetStencilEnable( true )
- render.SetStencilWriteMask( m )
- render.SetStencilTestMask( 1 )
- render.SetStencilFailOperation( STENCILOPERATION_KEEP )
- render.SetStencilZFailOperation( STENCILOPERATION_KEEP )
- render.SetStencilPassOperation( STENCILOPERATION_REPLACE )
- render.SetStencilCompareFunction( STENCILCOMPARISONFUNCTION_ALWAYS )
- render.SetStencilReferenceValue( 1 )
- render.SetColorModulation( 1, 1, 1 )
- end
- function matcore.StencilReplace(v)
- render.SetStencilCompareFunction( STENCILCOMPARISONFUNCTION_EQUAL )
- render.SetStencilPassOperation( STENCILOPERATION_REPLACE )
- render.SetStencilReferenceValue(v or 1)
- end
- function matcore.StencilEnd()
- render.SetStencilEnable( false )
- end
- /*--------------------------------
- Circles
- ----------------------------------*/
- function matcore.DrawCircle(posx, posy, radius, color)
- local poly = { }
- local v = 40
- for i = 0, v do
- poly[i+1] = {x = math.sin(-math.rad(i/v*360)) * radius + posx, y = math.cos(-math.rad(i/v*360)) * radius + posy}
- end
- draw.NoTexture()
- surface.SetDrawColor(color)
- surface.DrawPoly(poly)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement