Permalink
Browse files

Update Simple DOF

* Works properly with cameras
* Increased size for the sprites for higher FOVs
  • Loading branch information...
1 parent a27fd92 commit 92a097b642e32b2cf2fecaf414189c982518ac56 @robotboy655 robotboy655 committed Apr 11, 2014
Showing with 8 additions and 4 deletions.
  1. +8 −4 garrysmod/gamemodes/base/entities/effects/dof_node.lua
@@ -1,5 +1,4 @@
-
EFFECT.Mat = Material( "pp/dof" )
--[[---------------------------------------------------------
@@ -34,12 +33,17 @@ function EFFECT:Think( )
local pos = ply:EyePos()
local fwd = ply:EyeAngles():Forward()
- pos = pos + (fwd * self.spacing) + (fwd * self.offset)
+ if ( ply:GetViewEntity() != ply ) then
+ pos = ply:GetViewEntity():GetPos()
+ fwd = ply:GetViewEntity():GetForward()
+ end
+
+ pos = pos + ( fwd * self.spacing ) + ( fwd * self.offset )
self:SetParent( nil )
self:SetPos( pos )
self:SetParent( ply )
-
+
-- We don't kill this, the pp effect should
return true
@@ -54,7 +58,7 @@ function EFFECT:Render()
render.UpdateRefractTexture()
//render.UpdateScreenEffectTexture()
- local SpriteSize = (self.spacing + self.offset) * 4.0
+ local SpriteSize = ( self.spacing + self.offset ) * 8
render.SetMaterial( self.Mat )
render.DrawSprite( self:GetPos(), SpriteSize, SpriteSize, Color(255, 255, 255, 255) )

0 comments on commit 92a097b

Please sign in to comment.