Garry's Mod Wiki

Garry's Mod Wiki

  IMesh:Draw()

Description

Renders the mesh with the active matrix.

If this function is paired with VertexLitGeneric material, this function will reuse light parameters calculated on previously drawn model unless other are specified using render library (such as render.ResetModelLighting). If you experience lighting issues or you want engine to calculate light for you, draw a dummy (invisible) model in origin of mesh, then draw the mesh.

If utilized inside ENTITY:Draw, drawing entity's model (if it has one) should be enough.

Example

Properly renders the mesh using the SENT's model matrix.

self.Mesh in this case is the IMesh.

local myMaterial = Material( "models/wireframe" ) -- models/debug/debugwhite function ENT:Draw() -- Code containing self:DrawModel() if ( self.Mesh ) then render.SetMaterial( myMaterial ) cam.PushModelMatrix( self:GetWorldTransformMatrix() ) self.Mesh:Draw() cam.PopModelMatrix() end -- Probably other code end

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...