Garry's Mod Wiki

DModelPanel:SetDirectionalLight

DModelPanel:SetDirectionalLight( number direction, table color )

Description

Sets the directional lighting used on the rendered entity.

Arguments

1 number direction
The light direction, see Enums/BOX.
2 table color
The color of the directional lighting.

Example

Displays a model panel with no directional lighting. Dr. Kleiner is only lit by the ambient light set by DModelPanel:SetAmbientLight.

-- Black background panel BGPanel = vgui.Create("DPanel") BGPanel:SetPos(20, 20) BGPanel:SetSize(400, 400) BGPanel:SetBackgroundColor(Color(0, 0, 0, 255)) local mdl = vgui.Create("DModelPanel", BGPanel) mdl:SetSize(BGPanel:GetSize()) -- Setup model and camera mdl:SetModel("models/kleiner.mdl") mdl:SetCamPos(Vector(20, 20, 60)) mdl:SetLookAt(Vector(0, 0, 60)) -- Make Kleiner pace mdl:GetEntity():SetSequence(mdl:GetEntity():LookupSequence("pace_all")) -- Disable directional lighting mdl:SetDirectionalLight(BOX_TOP, Color(0, 0, 0)) mdl:SetDirectionalLight(BOX_FRONT, Color(0, 0, 0)) -- Spin around faster and play animation function mdl:LayoutEntity(ent) ent:SetAngles(Angle( 0, self.LastPaint*60, 0)) self:RunAnimation() end
Output:

Page Links


Special Pages


Wikis

?

Render Time: 32ms

DB GetPage 4
Generate Html 6
SaveChanges (1) 13
Render Body 0
Render Sidebar 6