render.PushCustomClipPlane

From Garry's Mod
Revision as of 20:52, 27 April 2016 by Zombine (Talk | contribs)
Jump to: navigation, search
 render.PushCustomClipPlane( )

Contents

Description

Pushes a new clipping plane of the clip plane stack and sets it as active.

Arguments

Vector normal

The normal of the clipping plane.

Arguments

number distance

The distance of the plane.

Examples

Example

Clips the lower half of your custom entity

function ENT:Draw()
    local normal = self:GetUp() -- Everything "behind" this normal will be clipped
    local position = normal:Dot( self:GetPos() ) -- self:GetPos() is the origin of the clipping plane

    render.EnableClipping( true )
    render.PushCustomClipPlane( normal, position )

    self:DrawModel()

    render.PopCustomClipPlane()
    render.EnableClipping(false)
end


Personal tools
Navigation