Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --snow_data = nil
- snow_data = snow_data or {}
- if table.Count(snow_data) == 0 then
- local max = 16000
- local grid_size = 512
- local range = max/grid_size
- local pos
- for x = -range, range do
- x = x * grid_size
- for y = -range, range do
- y = y * grid_size
- for z = -range, range do
- z = z * grid_size
- pos = Vector(x,y,z)
- local up = util.QuickTrace(pos, vector_up*max*2)
- local conents = util.PointContents( pos )
- if (up.HitTexture == "TOOLS/TOOLSSKYBOX" or up.HitTexture == "**empty**") and (conents == CONTENTS_EMPTY or conents == CONTENTS_TESTFOGVOLUME) then
- table.insert(snow_data, pos)
- end
- end
- end
- end
- end
- local function FastLength(point)
- return point.x*point.x+point.y*point.y+point.z*point.z
- end
- local draw_these = {}
- local emitter = ParticleEmitter(EyePos(), false)
- hook.Add("Think", "snow", function()
- for _, point in pairs(draw_these) do
- if math.random() < 0.95 then continue end
- local particle = emitter:Add("particle/snow", point)
- if (particle) then
- particle:SetVelocity(VectorRand()*70*Vector(1,1,0))
- particle:SetAngles(Angle(math.random(360), math.random(360), math.random(360)))
- particle:SetLifeTime(0)
- particle:SetDieTime(10)
- particle:SetStartAlpha(255)
- particle:SetEndAlpha(0)
- particle:SetStartSize(0)
- particle:SetEndSize(5)
- particle:SetGravity(Vector(0,0,math.Rand(-30, -200)))
- particle:SetCollide(true)
- end
- end
- end)
- timer.Create("hide_points", 1, 0, function()
- for key, point in pairs(snow_data) do
- if FastLength(point - LocalPlayer():EyePos()) < 4000000 then
- draw_these[key] = point
- else
- draw_these[key] = nil
- end
- end
- end)
- do return end
- --[[ hook.Remove("HUDPaint",1)
- local mat = Material("sprites/sent_ball")
- hook.Add("PostDrawOpaqueRenderables", 1, function()
- render.SetMaterial(mat)
- for key, point in pairs(draw_these) do
- render.DrawSprite(point, 50, 50, color_white)
- end
- end)]]
Advertisement
Add Comment
Please, Sign In to add comment