Python1320

Untitled

Nov 27th, 2010
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.92 KB | None | 0 0
  1. require("bass")
  2.  
  3. local smoother = 0
  4. local me = LocalPlayer()
  5. local source = Entity(165)
  6. local emitter = ParticleEmitter(EyePos(), false)
  7.  
  8. source:SetNoDraw(true) 
  9. source:SetModel("models/dav0r/hoverball.mdl")
  10.  
  11. local detail = 6
  12. local mul = 360/detail
  13.  
  14. local fft_detail = 5
  15. local mul_fft = 1024/fft_detail
  16.  
  17. local function Print(...)
  18.     if LocalPlayer():Nick() == "CapsAdmin" then print(...) return end
  19.     if SERVER then print(...) return end
  20.     local tbl = {...}
  21.     for key, value in pairs(tbl) do
  22.         if key ~= #tbl then
  23.             EPOE.AddText(tostring(value)..", ")
  24.         else
  25.             EPOE.AddText(tostring(value).."\n")
  26.         end
  27.     end
  28. end
  29.  
  30. hook.Add("PostDrawOpaqueRenderables",1,function()
  31.     local xd = FUNKY_STREAM
  32.     if not xd then return end
  33.  
  34.     BASS.SetPosition(me:GetPos(), me:GetVelocity()/100, me:GetAimVector()*-1, me:GetUp())
  35.     xd:set3dposition(source:GetPos(), source:GetForward(), source:GetVelocity()/100)
  36.    
  37.     local tbl = xd:fft2048()
  38.    
  39.     smoother = smoother + ((tbl[5] - smoother) / 3)
  40.    
  41.     --EPOE.AddText(smoother.."\n")
  42.    
  43. --[[    source:SetAngles(VectorRand():Angle())
  44.     cam.IgnoreZ(true)
  45.     render.SetBlend(0.8)
  46.     source:DrawModel()
  47.     render.SetBlend(0)
  48.     cam.IgnoreZ(false)
  49.     source:SetModelScale(Vector()*math.max(smoother*10, 0.5)) ]]
  50.    
  51.                        
  52.     for h=1, fft_detail do
  53.         local pow = math.max(((h/fft_detail)*12)-6, 1)
  54.        
  55.         local volume = tbl[math.Clamp(math.Round(h*mul_fft), 1, 1024)] * 100 ^ pow
  56.        
  57.         for i=1, math.Clamp(math.Round(volume*10),0,10) do
  58.             if h == 16 then EPOE.AddText(pow.."\n") end
  59.             --for p=-detail, detail do
  60.                 --for y=-detail, detail do
  61.                     local angle = ((volume-0.5)*180)*2
  62.                     local forward = VectorRand():GetNormal() * volume
  63.                     local particle = emitter:Add("particle/particle_sphere", source:GetPos() + (forward*150))
  64.                     if (particle) then
  65.                         particle:SetVelocity(forward * 500)
  66.                         particle:SetAngles(Angle(math.random(360), math.random(360), math.random(360)))
  67.                         particle:SetLifeTime(0)
  68.                         particle:SetDieTime(math.Clamp(volume^3, 0.1, 0.3))
  69.                         particle:SetStartAlpha(0)
  70.                         particle:SetEndAlpha(255)
  71.                         local length = math.Clamp((h/fft_detail)*420 * (volume^2), 1, 100)
  72.                         --if h==1 then Print(50+volume*100, volume) end
  73.                         particle:SetStartSize(10*(volume+1)*5)
  74.                         particle:SetStartLength(length*(volume+1)*5)
  75.                        
  76.                         particle:SetEndSize(0)
  77.                         particle:SetEndLength(0)
  78.                         --particle:SetGravity(Vector(0,0,-volume+1*600))
  79.                         local color = HSVToColor(math.Clamp(volume*360, 0, 360), math.Clamp((-volume+1)*6, 0, 5), math.Clamp(volume*2, 0, 1))
  80.                         particle:SetColor(color.r, color.g, color.b)
  81.                         particle:SetCollide(true)
  82.                         particle:SetBounce(0.1)
  83.                         particle:SetAirResistance(math.Clamp(1000*(-volume+2), 300, 1000))
  84.                     end
  85.                 --end
  86.             --end
  87.         end
  88.     end
  89.    
  90. end)
  91.  
  92. BASS.StreamFileURL('http://72.26.204.28:6414/', 1, function(stream,b)
  93.     FUNKY_STREAM = FUNKY_STREAM or stream
  94.     FUNKY_STREAM:play()
  95.     FUNKY_STREAM:setvolume(200)
  96. end)
Advertisement
Add Comment
Please, Sign In to add comment