Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ENT=Entity(343)
- if not IsValid(ENT) then return end
- local len=ScrW()*ScrH()
- local t = {}
- for i = 1, len do t[i] = i end
- function shuffle(t)
- local n = #t
- while n > 2 do
- local k = math.random(n)
- t[n], t[k] = t[k], t[n]
- n = n - 1
- end
- return t
- end
- shuffle(t)
- local tl=#t
- local rand={}
- local i=tl
- local varnum=0
- local lastpos=1
- local function rand()
- local pos=lastpos
- while not t[pos] and pos<tl do
- pos=pos+1
- end
- found=t[pos]
- if found then
- t[pos]=false
- lastpos=pos
- end
- return found
- end
- local surface=surface
- local render=render
- local texFSB = render.GetSuperFPTex()
- local matFSB = Material( "pp/motionblur" )
- function ENT.Draw3D2D(s,w,h)
- matFSB:SetMaterialFloat( "$alpha", 1 )
- matFSB:SetMaterialTexture( "$basetexture", texFSB )
- render.SetMaterial( matFSB )
- surface.SetDrawColor(255,255,255,255)
- render.DrawQuad(Vector(0, 0),
- Vector(w, 0, 0),
- Vector(w, h, 0),
- Vector(0, h, 0))
- end
- /*
- render.CapturePixels()
- local OldRT = render.GetRenderTarget()
- render.SetRenderTarget( texFSB )
- render.Clear( 50, 200, 255 )
- render.SetRenderTarget( OldRT )*/
- local sw,sh=ScrW(),ScrH()
- local function RenderPixel( )
- local r=rand()
- if not r then return true end
- local y=math.floor(r/sw)
- local x=r-y*sw
- surface.SetDrawColor( math.tan(x/sw)*255,math.tan(y/sh)*255,0, 255 )
- surface.DrawRect( x,y, 1,1 )
- end
- local done=false
- local function RenderPixels()
- local TimeEnd = SysTime() + ( 1 / 60 )
- while ( not done ) do
- done = RenderPixel()
- if ( TimeEnd < SysTime() ) then
- return
- end
- end
- end
- function ENT:BaseDraw3D2D()
- if self.debug and self:IsScrAccessible() then
- self:DrawDebugOutline()
- end
- local pos, ang = self:GetPos(), self:GetAngles()
- pos=pos+self:GetRight()*(self.Width/2)
- pos=pos+self:GetUp()*(self.Height/2)
- ang:RotateAroundAxis(ang:Up(), 90)
- ang:RotateAroundAxis(ang:Forward(), 90)
- local wide=self.Width*(1/self.Scale)
- local tall=self.Height*(1/self.Scale)
- render.SetRenderTarget( texFSB )
- cam.Start2D()
- RenderPixels()
- cam.End2D()
- render.SetRenderTarget( nil )
- cam.Start3D2D(pos,ang,self.Scale)
- local ret,err=pcall(self.Draw3D2D,self,wide,tall)
- cam.End3D2D()
- if !ret then
- return err
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment