-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.lua
More file actions
60 lines (53 loc) · 1.55 KB
/
utils.lua
File metadata and controls
60 lines (53 loc) · 1.55 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
peak_cpu_useage = 0
showing_controls = false
-- used to output the contents of anything and everything
function dump(o)
if type(o) == 'table' then
local s = '{ '
for k,v in pairs(o) do
if type(k) ~= 'number' then k = '"'..k..'"' end
s = s .. '['..k..'] = ' .. dump(v) .. ','
end
return s .. '} '
else
return tostring(o)
end
end
function print_sys_info()
if ((stat(1)*100) > peak_cpu_useage) peak_cpu_useage = (stat(1)*100)
print("fps:"..stat(7))
print("cpu:"..(stat(1)*100).."% ("..peak_cpu_useage.."% peak)")
print("memory:"..stat(0).." kb")
end
function print_mesh_info()
local vert_count = 0
local face_count = 0
for m=1,#meshes do
vert_count += #meshes[m].vertices
face_count += #meshes[m].faces
end
print("tris:"..#triangles_to_render)
print("verts:"..vert_count)
print("faces:"..face_count)
print("BFC:"..(backface_culling and 'ON' or 'OFF').."(⬆️+🅾️)", 0, 117)
print("ROTATION-MODE:"..rotation_mode.."(⬇️+🅾️)", 0, 123)
end
function show_controls()
oprint("controls",47,8,0,7)
oprint("move:⬆️⬅️⬇️➡️",16,16,0,7)
oprint("look:click+drag+scroll",16,24,0,7)
oprint("render mode:⬅️/➡️+🅾️",16,32,0,7)
oprint("backface culling:⬆️+🅾️",16,40,0,7)
oprint("rotation mode:⬇️+🅾️",16,48,0,7)
oprint("debug info:❎+🅾️",16,56,0,7)
end
function oprint(t,x,y,c1,c2)
for i=0,2 do
for j=0,2 do
if not(i==1 and j==1) then
print(t,x+i,y+j,c1)
end
end
end
print(t,x+1,y+1,c2)
end