Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.06 KB | None | 0 0
  1. include("shared.lua")
  2.  
  3. /*===========================================================================================================================      
  4.     Name: ENT.Initialize
  5.     Purpose: Initialize entity
  6.     Author: Goluch
  7. ===========================================================================================================================*/
  8. function ENT:Initialize()
  9. end
  10.  
  11. /*===========================================================================================================================
  12.     Name: ENT.Think
  13.     Purpose: Set the render bounds
  14.     Author: Divran
  15. ===========================================================================================================================*/
  16. function ENT:Think() self:SetRenderBounds( Vector(1,1,1)*-10000, Vector(1,1,1)*10000 ) end
  17.  
  18. /*===========================================================================================================================      
  19.     Name: ENT.Draw
  20.     Purpose: Draw entity
  21.     Author: Goluch
  22. ===========================================================================================================================*/
  23. ENT.RenderGroup = RENDERGROUP_BOTH
  24. function ENT:Draw( )
  25.  
  26.     local matrix = Matrix( );
  27.     matrix:Translate( self:GetPos( ) )
  28.     matrix:Rotate( self:GetAngles( ) )
  29.    
  30.     local X,Y,Z = self:GetBoxScale()
  31.     X = X / 2
  32.     Y = Y / 2
  33.     Z = Z / 2
  34.    
  35.     render.SuppressEngineLighting( true )
  36.     render.SetMaterial( Material( "models/debug/debugwhite" ) )
  37.     render.SetColorModulation(1,0,0)
  38.     render.SetBlend( 160/255 )
  39.        
  40.     cam.PushModelMatrix( matrix )
  41.        
  42.         //Corners
  43.         local A = Vector(-X,-Y,Z)
  44.         local B = Vector(X,-Y,Z)
  45.         local C = Vector(X,Y,Z)
  46.         local D = Vector(-X,Y,Z)
  47.         local E = Vector(-X,Y,-Z)
  48.         local F = Vector(-X,-Y,-Z)
  49.         local G = Vector(X,-Y,-Z)
  50.         local H = Vector(X,Y,-Z)
  51.        
  52.         mesh.Begin( MATERIAL_QUADS, 6 );
  53.            
  54.             //Top
  55.             mesh.Quad(D,C,B,A)
  56.             //Bottom
  57.             mesh.Quad(E,F,G,H)
  58.             //Left
  59.             mesh.Quad(F,E,D,A)
  60.             //Right
  61.             mesh.Quad(B,C,H,G)
  62.             //Front
  63.             mesh.Quad(C,D,E,H)
  64.             //Back
  65.             mesh.Quad(A,B,G,F)
  66.            
  67.         mesh.End( )
  68.        
  69.     cam.PopModelMatrix( )
  70.  
  71. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement