Garry's Mod Wiki

render.DrawQuadEasy

  render.DrawQuadEasy( Vector position, Vector normal, number width, number height, table color, number rotation = 0 )

Description

Draws a quad.

This is a rendering function that requires a 3d rendering context.

This means that it will only work in 3d Rendering Hooks.

Arguments

1 Vector position
Origin of the sprite.
2 Vector normal
The face direction of the quad.
3 number width
The width of the quad.
4 number height
The height of the quad.
5 table color
The color of the quad. Uses the Color.
6 number rotation = 0
The rotation of the quad counter-clockwise in degrees around the normal axis. In other words, the quad will always face the same way but this will rotate its corners.

Example

Example usage of this function.

local mat = Material( "sprites/sent_ball" ) local mat2 = Material( "models/wireframe" ) hook.Add("PostDrawTranslucentRenderables", "DrawQuadEasyExample", function() -- Draw a rotating circle under local player render.SetMaterial( mat ) local pos = LocalPlayer():GetPos() render.DrawQuadEasy( pos + Vector( 0, 0, 1 ), Vector( 0, 0, 1 ), 64, 64, Color( 255, 255, 255, 200 ), ( CurTime() * 50 ) % 360 ) -- Draw 3 rotating wireframe quads where local player is looking at render.SetMaterial( mat2 ) local tr = LocalPlayer():GetEyeTrace() render.DrawQuadEasy( tr.HitPos + tr.HitNormal, tr.HitNormal, 64, 64, Color( 255, 255, 255 ), ( CurTime() * 50 ) % 360 ) local dir = tr.HitNormal:Angle() dir:RotateAroundAxis( tr.HitNormal, ( CurTime() * 50 ) % 360 ) dir = dir:Up() -- We need to call this function twice, once for each side render.DrawQuadEasy( tr.HitPos + tr.HitNormal * 32, dir, 64, 64, Color( 255, 255, 255 ), 0 ) render.DrawQuadEasy( tr.HitPos + tr.HitNormal * 32, -dir, 64, 64, Color( 255, 255, 255 ), 0 ) end )