Created
April 23, 2014 17:05
-
-
Save CapsAdmin/11223740 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local data = {} | |
| local temp_ang = Angle(0,0,0) | |
| local function rot(vec, yaw) | |
| temp_ang.y = yaw | |
| temp_ang.p = math.Rand(-10, 10) * 5 | |
| vec:Rotate(temp_ang) | |
| return vec | |
| end | |
| local spread = 654 | |
| local up = Vector(0,0,1) | |
| for i=0, 1024*21 do | |
| local pos = Vector(math.Rand(-spread, spread), math.Rand(-spread, spread), 0) | |
| local yaw = math.Rand(-180, 180) | |
| local height = (math.random() ^ 3) * 20 + 5 | |
| local width = math.Rand(1, 5) | |
| local color = Color(math.random(255), math.random(255), math.random(255)) | |
| table.insert(data, {color = color, normal = up, u = 1, v = -0, pos = pos + rot(Vector(0,width,0), yaw)}) | |
| table.insert(data, {color = color, normal = up, u = 0, v = -0, pos = pos + rot(Vector(0,0,0), yaw)}) | |
| table.insert(data, {color = color, normal = up, u = 0.5, v = -1, pos = pos + rot(Vector(0,width*0.5,height), yaw)}) | |
| end | |
| local mesh = Mesh() | |
| mesh:BuildFromTriangles(data) | |
| local matrix = Matrix() | |
| matrix:SetTranslation(Vector(-2456.2087402344, -8746.53125, -11823.96875)) | |
| local material = CreateMaterial("grass_lol_" .. os.clock(), "VertexLitGeneric", | |
| { | |
| ["$basetexture"] = "models/props_swamp/tallgrass_01", | |
| }) | |
| material:SetFloat("$alpha", 1) | |
| --material:SetFloat("$translucent", 0) | |
| material:SetFloat("$alphatest", 1) | |
| material:SetFloat("$nocull", 1) | |
| material:SetFloat("$vertexcolor", 1) | |
| local lol = ClientsideModel("error.mdl") | |
| lol:SetModelScale(0,0) | |
| local function draw(yaw) | |
| matrix:SetAngles(Angle(0,yaw,0)) | |
| matrix:SetTranslation(Vector(-2456.2087402344, -8746.53125, -11823.96875)) | |
| matrix:Scale(Vector(1,1,4)) | |
| cam.PushModelMatrix(matrix) | |
| render.CullMode(0) | |
| mesh:Draw() | |
| render.CullMode(1) | |
| mesh:Draw() | |
| render.CullMode(0) | |
| cam.PopModelMatrix() | |
| end | |
| hook.Add("PostDrawTranslucentRenderables", 1, function() | |
| lol:DrawModel() | |
| render.SetMaterial(material) | |
| draw(0) | |
| draw(180) | |
| draw(90) | |
| draw(-90) | |
| end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment