Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function GO()
- local function decode(str)
- local out = {}
- local v = {}
- local vn = {}
- local f = {}
- for t, x, y, z in str:gmatch("(%S+)%s-(%S+)%s-(%S+)%s-(%S+)%s-\n") do
- x, y, z = tonumber(x), tonumber(y), tonumber(z)
- if t == "v" then
- table.insert(v, Vector(x,y,z))
- elseif t == "vn" then
- table.insert(vn, Vector(x,y,z))
- elseif t == "f" then
- -- !?!?!?!?!?!
- table.insert(f, Vector(x,y,z))
- end
- end
- for i = 1, #v do
- out[i] = {pos = v[i], normal = vn[i]}
- end
- return out
- end
- local mesh = NewMesh()
- local data = decode(file.Read("skull_obj.txt"))
- mesh:BuildFromTriangles(data)
- local material = Material("models/wireframe")
- SafeRemoveEntity(_G.render_node)
- local node = ClientsideModel("error.mdl")
- node:SetPos(LocalPlayer():EyePos() + LocalPlayer():GetAimVector() * 200)
- function node:RenderOverride()
- local matrix = Matrix()
- matrix:SetAngle(self:GetAngles())
- matrix:SetTranslation(self:GetPos())
- matrix:Scale(self:GetModelScale())
- render.SetMaterial(material)
- cam.PushModelMatrix(matrix)
- mesh:Draw()
- cam.PopModelMatrix()
- end
- _G.render_node = node
- end
- if not file.Exists("skull_obj.txt") then
- print("downloading skull lol3%50!!!!!")
- http.Get("http://web.eecs.umich.edu/~guskov/eecs598-1/skull.obj", "", function(c)
- -- lol3%50
- file.Write("skull_obj.txt")
- GO()
- end)
- else
- GO()
- end
Advertisement
Add Comment
Please, Sign In to add comment