Last active
August 29, 2020 14:22
-
-
Save Reselim/4f4168ae427ef4b33d3c9bca7d960147 to your computer and use it in GitHub Desktop.
This file contains 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
-- GENERATED MESH: https://www.roblox.com/library/2983070137/Circle | |
local NUM_POINTS = 90 | |
local Vertices = {} | |
local Faces = {} | |
for index = 1, NUM_POINTS do | |
local rotation = index / NUM_POINTS * math.pi * 2 | |
table.insert(Vertices, { | |
X = (math.sin(rotation) + 1) / 2, | |
Y = (math.cos(rotation) + 1) / 2 | |
}) | |
end | |
for index = 2, NUM_POINTS do | |
table.insert(Faces, { 1, index, index + 1 }) | |
end | |
local Lines = {} | |
for _, vertex in pairs(Vertices) do | |
table.insert(Lines, ("v %.6f 0 %.6f"):format(vertex.X, vertex.Y)) | |
end | |
for _, vertex in pairs(Vertices) do | |
table.insert(Lines, ("vt %.6f %.6f"):format(vertex.X, 1 - vertex.Y)) | |
end | |
table.insert(Lines, "vn 0 1 0") | |
for _, face in pairs(Faces) do | |
table.insert(Lines, ("f %d/%d/1, %d/%d/1, %d/%d/1"):format( | |
face[1], face[1], | |
face[2], face[2], | |
face[3], face[3] | |
)) | |
end | |
for _, line in pairs(Lines) do | |
print(line) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment