-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcode-helper.lua
More file actions
64 lines (54 loc) · 1.3 KB
/
Copy pathcode-helper.lua
File metadata and controls
64 lines (54 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
local C_define2const=function(str,ctype)
ctype=ctype or "int"
str=string.gsub(str,"#define%s+(%S+)%s+(%S+)","static const "..ctype.." %1=%2;")
print(str)
return str
end
local clean_function_define=function(str)
str=string.gsub(str,"GLAPI%S*","")
print(str)
return str
end
local t={}
local f=function(str)
local t={}
for a,b,c in string.gmatch(str,"rawset%((m),(%d+),([^%)]*)%)") do
print(a.."["..b.."]="..c..";")
end
print(table.concat(t,";")..";")
end
local str2table=function(str)
local t={}
for s in string.gmatch(str,"(.-)\n") do
if string.match(s,"%S") then table.insert(t,s) end
end
return t
end
local t=str2table[[
TEXTURE_2D
LIGHTING
CULL_FACE
BLEND
]]
--~ for i,v in ipairs(t) do
--~ t[i]=v.."="..math.pow(2,i)
--~ print(string.format([[if(op&%s){glEnable(GL_%s);}else{ glDisable(GL_%s);}]],v,v,v))
--~ end
--~ print(table.concat(t,","))
local str=[[
POINTS 单个顶点集
LINES 多组双顶点线段
POLYGON 单个简单填充凸多边形
TRAINGLES 多组独立填充三角形
QUADS 多组独立填充四边形
LINE_STRIP 不闭合折线
LINE_LOOP 闭合折线
TRAINGLE_STRIP 线型连续填充三角形串
TRAINGLE_FAN 扇形连续填充三角形串
QUAD_STRIP
]]
for s in string.gmatch(str,"[A-Z_]+") do
print(string.format("%s,",s))
end
print(math.rad(180))
print(math.rad(360))