Skip to content

Commit ea4feec

Browse files
Add vertex count and file size to profiler
File size is based on the size of the cached file. This represents roughly the cost paid when networking the meshes. In theory two controllers could have the same mesh and the file size wouldn't be twice that single file's. This reflects that.
1 parent d541211 commit ea4feec

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

lua/weapons/gmod_tool/stools/prop2mesh.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,14 +896,19 @@ local function BuildPanel_Profiler(self)
896896
root = tree:AddNode(root, "icon16/user.png"),
897897
num_mdls = 0,
898898
num_tris = 0,
899+
num_verts = 0,
899900
num_ctrl = 0,
900901
num_ents = 0,
902+
num_size = 0,
903+
seen_crc = {},
901904
}
902905

903906
sdata.node_mdls = sdata.root:AddNode("", "icon16/bullet_black.png")
904907
sdata.node_tris = sdata.root:AddNode("", "icon16/bullet_black.png")
908+
sdata.node_verts = sdata.root:AddNode("", "icon16/bullet_black.png")
905909
sdata.node_ctrl = sdata.root:AddNode("", "icon16/bullet_black.png")
906910
sdata.node_ents = sdata.root:AddNode("", "icon16/bullet_black.png")
911+
sdata.node_size = sdata.root:AddNode("", "icon16/bullet_black.png")
907912
sdata.root:SetExpanded(true, true)
908913

909914
struct[root] = sdata
@@ -922,11 +927,22 @@ local function BuildPanel_Profiler(self)
922927
if pcount and vcount then
923928
sdata.num_mdls = sdata.num_mdls + pcount
924929
sdata.num_tris = sdata.num_tris + vcount / 3
930+
sdata.num_verts = sdata.num_verts + vcount
931+
end
932+
933+
if info.crc and not sdata.seen_crc[info.crc] then
934+
sdata.seen_crc[info.crc] = true
935+
local zip = prop2mesh.getMeshData(info.crc)
936+
if zip then
937+
sdata.num_size = sdata.num_size + #zip
938+
end
925939
end
926940
end
927941

928942
sdata.node_mdls:SetText(string.format("%d total models", sdata.num_mdls))
929943
sdata.node_tris:SetText(string.format("%d total triangles", sdata.num_tris))
944+
sdata.node_verts:SetText(string.format("%d total vertices", sdata.num_verts))
945+
sdata.node_size:SetText(string.format("%s total file size", string.NiceSize(sdata.num_size)))
930946
end
931947
end
932948

0 commit comments

Comments
 (0)