MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / DrawImGuiDebug

Method DrawImGuiDebug

Source/Graphics/textures.cpp:286–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284}
285
286void Textures::DrawImGuiDebug() {
287 enum TexType {
288 kSimple,
289 kArray,
290 kCubemap,
291 kBuffer,
292 kUnknown
293 };
294
295 if (ImGui::TreeNode("Textures", "Textures: %d", (int)textures.size())) {
296 const char* color_tex_num = "\033FFFFFFFF";
297 const char* color_cubemap = "\03399ecffFF";
298 const char* color_array = "\03399ff87FF";
299 const char* color_simple = "\033d1d1d1FF";
300 const char* color_buffer = "\033bea0ffFF";
301 const char* color_default = "\033FFFFFFFF";
302 const char* color_label = "\0338dff87FF";
303 const char* color_value = "\033FFFFFFFF";
304 const char* color_enum = "\0339ccbd6FF";
305
306 const int kBufSize = 256;
307 char buf[kBufSize];
308 for (int i = 0, len = textures.size(); i < len; ++i) {
309 const Texture& tex = textures[i];
310 bool drawable = false;
311 TexType type;
312 if (tex.cube_map) {
313 FormatString(buf, kBufSize, "%s%d:%s cubemap", color_tex_num, i, color_cubemap);
314 type = kCubemap;
315 } else if (tex.num_slices > 1) {
316 FormatString(buf, kBufSize, "%s%d:%s texture array (%d slices)", color_tex_num, i, color_array, tex.num_slices);
317 type = kArray;
318 } else if (tex.sub_textures.size() == 1 && !tex.sub_textures[0].texture_name.empty()) {
319 FormatString(buf, kBufSize, "%s%d:%s %s", color_tex_num, i, color_simple, tex.sub_textures[0].texture_name.c_str());
320 drawable = true;
321 type = kSimple;
322 } else if (tex.gl_buffer_id != UNLOADED_ID) {
323 FormatString(buf, kBufSize, "%s%d:%s texture buffer", color_tex_num, i, color_buffer);
324 type = kBuffer;
325 } else if (tex.gl_texture_id != UNLOADED_ID) {
326 FormatString(buf, kBufSize, "%s%d:%s generated texture", color_tex_num, i, color_simple);
327 drawable = true;
328 type = kSimple;
329 } else {
330 FormatString(buf, kBufSize, "%s%d: unknown", color_tex_num, i);
331 type = kUnknown;
332 }
333 if (!tex.name.empty()) {
334 const char* color = color_default;
335 switch (type) {
336 case kSimple:
337 color = color_simple;
338 break;
339 case kArray:
340 color = color_array;
341 break;
342 case kCubemap:
343 color = color_cubemap;

Callers 1

DrawImGuiFunction · 0.80

Calls 13

FormatStringFunction · 0.85
TextClass · 0.85
CStringFromGLEnumFunction · 0.85
PushStyleColorFunction · 0.85
ImageClass · 0.85
PopStyleColorFunction · 0.85
EnsureInVRAMMethod · 0.80
CheckboxClass · 0.50
ImVec4Class · 0.50
ImVec2Function · 0.50
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected