From 98e0462e4f6b13ff26af5211409352d45dd9453e Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Sun, 8 Jan 2017 22:28:08 -0500 Subject: Add a ton of icons, more work on refactoring --- gamemode/client/vgui/vgui_DMultiModelPanel.lua | 161 ------------------------- 1 file changed, 161 deletions(-) delete mode 100644 gamemode/client/vgui/vgui_DMultiModelPanel.lua (limited to 'gamemode/client/vgui/vgui_DMultiModelPanel.lua') diff --git a/gamemode/client/vgui/vgui_DMultiModelPanel.lua b/gamemode/client/vgui/vgui_DMultiModelPanel.lua deleted file mode 100644 index 37d0883..0000000 --- a/gamemode/client/vgui/vgui_DMultiModelPanel.lua +++ /dev/null @@ -1,161 +0,0 @@ -local PANEL = {} - -AccessorFunc( PANEL, "m_fAnimSpeed", "AnimSpeed" ) -AccessorFunc( PANEL, "vCamPos", "CamPos" ) -AccessorFunc( PANEL, "fFOV", "FOV" ) -AccessorFunc( PANEL, "vLookatPos", "LookAt" ) -AccessorFunc( PANEL, "aLookAngle", "LookAng" ) -AccessorFunc( PANEL, "colAmbientLight", "AmbientLight" ) -AccessorFunc( PANEL, "colColor", "Color" ) -AccessorFunc( PANEL, "bAnimated", "Animated" ) - -function PANEL:Init() - - self.Entities = {} - self.LastPaint = 0 - self.DirectionalLight = {} - self.FarZ = 4096 - - self:SetCamPos( Vector( 50, 50, 50 ) ) - self:SetLookAt( Vector( 0, 0, 40 ) ) - self:SetFOV( 70 ) - - self:SetText( "" ) - self:SetAnimSpeed( 0.5 ) - self:SetAnimated( false ) - - self:SetAmbientLight( Color( 50, 50, 50 ) ) - - self:SetDirectionalLight( BOX_TOP, Color( 255, 255, 255 ) ) - self:SetDirectionalLight( BOX_FRONT, Color( 255, 255, 255 ) ) - - self:SetColor( Color( 255, 255, 255, 255 ) ) - -end - -function PANEL:SetDirectionalLight( iDirection, color ) - self.DirectionalLight[ iDirection ] = color -end - -function PANEL:AddModel( strModelName ) - - -- Note: Not in menu dll - if ( !ClientsideModel ) then return end - - self.Entities[#self.Entities+1] = ClientsideModel(strModelName, RENDER_GROUP_OPAQUE_ENTITY) - if ( !IsValid( self.Entities[#self.Entities] ) ) then return end - - self.Entities[#self.Entities]:SetNoDraw( true ) - self.Entities[#self.Entities]:SetIK( false ) - -end - -function PANEL:DrawModel() - - local curparent = self - local rightx = self:GetWide() - local leftx = 0 - local topy = 0 - local bottomy = self:GetTall() - local previous = curparent - while( curparent:GetParent() != nil ) do - curparent = curparent:GetParent() - local x, y = previous:GetPos() - topy = math.Max( y, topy + y ) - leftx = math.Max( x, leftx + x ) - bottomy = math.Min( y + previous:GetTall(), bottomy + y ) - rightx = math.Min( x + previous:GetWide(), rightx + x ) - previous = curparent - end - render.SetScissorRect( leftx, topy, rightx, bottomy, true ) - - for k,v in pairs(self.Entities) do - local ret = self:PreDrawModel( v ) - if ( ret != false ) then - v:DrawModel() - self:PostDrawModel( v ) - end - end - - render.SetScissorRect( 0, 0, 0, 0, false ) - -end - -function PANEL:PreDrawModel( ent ) - return true -end - -function PANEL:PostDrawModel( ent ) - -end - -function PANEL:Paint( w, h ) - for k,v in pairs(self.Entities) do - if ( !IsValid( v ) ) then continue end - - local x, y = self:LocalToScreen( 0, 0 ) - - self:LayoutEntity( v ) - - local ang = self.aLookAngle - if ( !ang ) then - ang = ( self.vLookatPos - self.vCamPos ):Angle() - end - - cam.Start3D( self.vCamPos, ang, self.fFOV, x, y, w, h, 5, self.FarZ ) - - render.SuppressEngineLighting( true ) - render.SetLightingOrigin( v:GetPos() ) - render.ResetModelLighting( self.colAmbientLight.r / 255, self.colAmbientLight.g / 255, self.colAmbientLight.b / 255 ) - render.SetColorModulation( self.colColor.r / 255, self.colColor.g / 255, self.colColor.b / 255 ) - render.SetBlend( ( self:GetAlpha() / 255 ) * ( self.colColor.a / 255 ) ) - - for i = 0, 6 do - local col = self.DirectionalLight[ i ] - if ( col ) then - render.SetModelLighting( i, col.r / 255, col.g / 255, col.b / 255 ) - end - end - - self:DrawModel() - - render.SuppressEngineLighting( false ) - cam.End3D() - - self.LastPaint = RealTime() - end -end - ---[[ -function PANEL:StartScene( name ) - - if ( IsValid( self.Scene ) ) then - self.Scene:Remove() - end - - self.Scene = ClientsideScene( name, self.Entity ) - -end -]] - -function PANEL:LayoutEntity( Entity ) - - -- - -- This function is to be overriden - -- - - if ( self.bAnimated ) then - self:RunAnimation() - end - Entity:SetAngles( Angle( 0, RealTime() * 10 % 360, 0 ) ) - -end - -function PANEL:OnRemove() - for k,v in pairs(self.Entities) do - v:Remove() - self.Entities[k] = nil - end -end - -derma.DefineControl( "DModelPanel", "A panel containing a model", PANEL, "DModelPanel" ) -- cgit v1.2.3-70-g09d2