From f57c3a3516a9aab19424d062dc4425b083d60f0e Mon Sep 17 00:00:00 2001 From: Dario Manesku Date: Thu, 12 Feb 2015 02:47:28 +0100 Subject: [PATCH] Added latlong display type for imguiCube(). --- examples/18-ibl/ibl.cpp | 8 +- examples/common/imgui/fs_imgui_latlong.bin.h | 123 ++++++++++ examples/common/imgui/fs_imgui_latlong.sc | 38 +++ examples/common/imgui/imgui.cpp | 234 +++++++++++++------ examples/common/imgui/imgui.h | 14 +- examples/common/imgui/vs_imgui_latlong.bin.h | 84 +++++++ examples/common/imgui/vs_imgui_latlong.sc | 15 ++ 7 files changed, 446 insertions(+), 70 deletions(-) create mode 100644 examples/common/imgui/fs_imgui_latlong.bin.h create mode 100644 examples/common/imgui/fs_imgui_latlong.sc create mode 100644 examples/common/imgui/vs_imgui_latlong.bin.h create mode 100644 examples/common/imgui/vs_imgui_latlong.sc diff --git a/examples/18-ibl/ibl.cpp b/examples/18-ibl/ibl.cpp index 6c772bc1..13c2bd2b 100644 --- a/examples/18-ibl/ibl.cpp +++ b/examples/18-ibl/ibl.cpp @@ -285,7 +285,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) bool m_specularIbl; bool m_showDiffColorWheel; bool m_showSpecColorWheel; - bool m_crossCubemapPreview; + ImguiCubemap::Enum m_crossCubemapPreview; }; Settings settings; @@ -305,7 +305,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) settings.m_specularIbl = true; settings.m_showDiffColorWheel = true; settings.m_showSpecColorWheel = false; - settings.m_crossCubemapPreview = false; + settings.m_crossCubemapPreview = ImguiCubemap::Cross; float time = 0.0f; @@ -350,9 +350,9 @@ int _main_(int /*_argc*/, char** /*_argv*/) , "Grace" ) ); static float lod = 0.0f; - if (imguiCube(lightProbes[currentLightProbe].m_tex, lod, settings.m_crossCubemapPreview)) + if (imguiCube(lightProbes[currentLightProbe].m_tex, lod, settings.m_crossCubemapPreview, true) ) { - settings.m_crossCubemapPreview = !settings.m_crossCubemapPreview; + settings.m_crossCubemapPreview = ImguiCubemap::Enum( (settings.m_crossCubemapPreview+1) % ImguiCubemap::Count); } imguiSlider("Texture LOD", lod, float(0.0f), 10.1f, 0.1f); diff --git a/examples/common/imgui/fs_imgui_latlong.bin.h b/examples/common/imgui/fs_imgui_latlong.bin.h new file mode 100644 index 00000000..e98e50da --- /dev/null +++ b/examples/common/imgui/fs_imgui_latlong.bin.h @@ -0,0 +1,123 @@ +static const uint8_t fs_imgui_latlong_glsl[646] = +{ + 0x46, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x02, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima + 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x07, 0x01, 0x00, 0x00, // geLodEnabled.... + 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, // ...s_texColor... + 0x00, 0x01, 0x00, 0x4e, 0x02, 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, // ...N...varying h + 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // ighp vec2 v_texc + 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, // oord0;.uniform h + 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, // ighp vec4 u_imag + 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x3b, 0x0a, 0x75, 0x6e, 0x69, // eLodEnabled;.uni + 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // form lowp sample + 0x72, 0x43, 0x75, 0x62, 0x65, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // rCube s_texColor + 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, // ;.void main ().{ + 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x72, 0x65, // . highp vec3 re + 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, // sult_1;. highp + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, // float tmpvar_2;. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x76, 0x5f, // tmpvar_2 = (v_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x20, 0x2a, 0x20, 0x36, 0x2e, // texcoord0.x * 6. + 0x32, 0x38, 0x33, 0x31, 0x39, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, // 28319);. highp + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, // float tmpvar_3;. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x76, 0x5f, // tmpvar_3 = (v_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x79, 0x20, 0x2a, 0x20, 0x33, 0x2e, // texcoord0.y * 3. + 0x31, 0x34, 0x31, 0x35, 0x39, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, // 14159);. result + 0x5f, 0x31, 0x2e, 0x78, 0x20, 0x3d, 0x20, 0x28, 0x73, 0x69, 0x6e, 0x28, 0x74, 0x6d, 0x70, 0x76, // _1.x = (sin(tmpv + 0x61, 0x72, 0x5f, 0x33, 0x29, 0x20, 0x2a, 0x20, 0x63, 0x6f, 0x73, 0x28, 0x74, 0x6d, 0x70, 0x76, // ar_3) * cos(tmpv + 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, // ar_2));. result + 0x5f, 0x31, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x73, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, // _1.y = cos(tmpva + 0x72, 0x5f, 0x33, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, // r_3);. result_1 + 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x2d, 0x28, 0x73, 0x69, 0x6e, 0x28, 0x74, 0x6d, 0x70, 0x76, // .z = (-(sin(tmpv + 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x73, 0x69, 0x6e, 0x28, 0x74, 0x6d, 0x70, // ar_3)) * sin(tmp + 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, // var_2));. lowp + 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, // vec4 tmpvar_4;. + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, // tmpvar_4.xyz = + 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x75, 0x62, 0x65, 0x4c, 0x6f, 0x64, 0x20, 0x20, // textureCubeLod + 0x20, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x72, // (s_texColor, r + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x2c, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, // esult_1, u_image + 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x78, 0x29, 0x2e, 0x78, 0x79, // LodEnabled.x).xy + 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x77, 0x20, // z;. tmpvar_4.w + 0x3d, 0x20, 0x28, 0x30, 0x2e, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, 0x2e, 0x38, 0x20, 0x2a, 0x20, // = (0.2 + (0.8 * + 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, // u_imageLodEnable + 0x64, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, // d.y));. gl_Frag + 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, // Color = tmpvar_4 + 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // ;.}... +}; +static const uint8_t fs_imgui_latlong_dx9[553] = +{ + 0x46, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima + 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x15, 0x01, 0x00, 0x00, // geLodEnabled.... + 0x01, 0x00, 0x04, 0x02, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x30, 0x00, 0x43, 0x54, 0x41, 0x42, // ..........0.CTAB + 0x1c, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, // ................ + 0x1c, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, // ............D... + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........P....... + 0x60, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, // `...........t... + 0x00, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, // ....s_texColor.. + 0x04, 0x00, 0x0e, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, // u_imageLodEnable + 0x64, 0x00, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, // d............... + 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, // ....ps_3_0.Micro + 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, // soft (R) HLSL Sh + 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, // ader Compiler 9. + 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, 0x05, // 29.952.3111.Q... + 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x3f, 0xdb, 0x0f, 0xc9, 0x40, 0xdb, 0x0f, 0x49, 0xc0, // .......?...@..I. + 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x05, 0x02, 0x00, 0x0f, 0xa0, 0xcd, 0xcc, 0x4c, 0x3f, // ....Q.........L? + 0xcd, 0xcc, 0x4c, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, // ..L>............ + 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x98, // ................ + 0x00, 0x08, 0x0f, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0xa0, // ................ + 0x00, 0x00, 0x00, 0x90, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, // ................ + 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x55, 0xa0, // ..............U. + 0x01, 0x00, 0xaa, 0xa0, 0x25, 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x80, // ....%........... + 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x55, 0x90, 0x01, 0x00, 0x00, 0xa0, // ..........U..... + 0x01, 0x00, 0x00, 0xa0, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, // ................ + 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x55, 0xa0, // ..............U. + 0x01, 0x00, 0xaa, 0xa0, 0x25, 0x00, 0x00, 0x02, 0x02, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x80, // ....%........... + 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x80, 0x02, 0x00, 0x55, 0x80, // ..............U. + 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x80, 0x01, 0x00, 0x55, 0x80, 0x02, 0x00, 0x55, 0x81, // ..........U...U. + 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x02, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x02, // ................ + 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, // ........_....... + 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, 0x80, // ................ + 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0xa0, // ..............U. + 0x04, 0x00, 0x00, 0x04, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, 0xa0, // ..........U..... + 0x02, 0x00, 0x55, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ..U...... +}; +static const uint8_t fs_imgui_latlong_dx11[600] = +{ + 0x46, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima + 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x15, 0x00, 0x30, 0x0a, // geLodEnabled..0. + 0x01, 0x00, 0x30, 0x02, 0x44, 0x58, 0x42, 0x43, 0x89, 0x11, 0x25, 0xa6, 0xf5, 0x66, 0x12, 0x3f, // ..0.DXBC..%..f.? + 0xc0, 0x1f, 0x67, 0x9b, 0x6e, 0x4e, 0xac, 0x03, 0x01, 0x00, 0x00, 0x00, 0x30, 0x02, 0x00, 0x00, // ..g.nN......0... + 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, // ....,........... + 0x49, 0x53, 0x47, 0x4e, 0x50, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ISGNP........... + 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // 8............... + 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........D....... + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, // ................ + 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, // SV_POSITION.TEXC + 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, // OORD....OSGN,... + 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ ....... + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, // ................ + 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, // SV_TARGET...SHDR + 0x70, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, // p...@.......Y... + 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, // F. .........Z... + 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x30, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, // .`......X0...p.. + 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, // ....UU..b...2... + 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....e.... ...... + 0x68, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, 0x32, 0x00, 0x10, 0x00, // h.......8...2... + 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, // ....F........@.. + 0xdb, 0x0f, 0xc9, 0x40, 0xdb, 0x0f, 0x49, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...@..I@........ + 0x4d, 0x00, 0x00, 0x07, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, // M...B........... + 0x1a, 0x00, 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x06, // ....A.......M... + 0x32, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x16, 0x05, 0x10, 0x00, // 2............... + 0x00, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x06, 0x00, 0xd0, 0x00, 0x00, 0x62, 0x00, 0x10, 0x00, // ....M.......b... + 0x02, 0x00, 0x00, 0x00, 0x06, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, // ............8... + 0x82, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ........*....... + 0x1a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, // ........8....... + 0x02, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, // ................ + 0x02, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H........... + 0x86, 0x03, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ........F~...... + 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // .`........ ..... + 0xa3, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x72, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....6...r ...... + 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0x82, 0x20, 0x10, 0x00, // F.......2.... .. + 0x00, 0x00, 0x00, 0x00, 0x1a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, // ...... ......... + 0x01, 0x40, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3f, 0x01, 0x40, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3e, // .@....L?.@....L> + 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x40, 0x0a, // >.....@. +}; diff --git a/examples/common/imgui/fs_imgui_latlong.sc b/examples/common/imgui/fs_imgui_latlong.sc new file mode 100644 index 00000000..694e2dae --- /dev/null +++ b/examples/common/imgui/fs_imgui_latlong.sc @@ -0,0 +1,38 @@ +$input v_texcoord0 + +/* + * Copyright 2014-2015 Dario Manesku. All rights reserved. + * License: http://www.opensource.org/licenses/BSD-2-Clause + */ + +#include + +uniform vec4 u_imageLodEnabled; +SAMPLERCUBE(s_texColor, 0); + +#define u_imageLod u_imageLodEnabled.x +#define u_imageEnabled u_imageLodEnabled.y + +vec3 vecFromLatLong(vec2 _uv) +{ + float pi = 3.14159265; + float twoPi = 2.0*pi; + float phi = _uv.x * twoPi; + float theta = _uv.y *pi; + + vec3 result; + result.x = sin(theta)*cos(phi); + result.y = cos(theta); + result.z = -sin(theta)*sin(phi); + + return result; +} + +void main() +{ + vec3 dir = vecFromLatLong(v_texcoord0); + vec3 color = textureCubeLod(s_texColor, dir, u_imageLod).xyz; + float alpha = 0.2 + 0.8*u_imageEnabled; + + gl_FragColor = vec4(color, alpha); +} diff --git a/examples/common/imgui/imgui.cpp b/examples/common/imgui/imgui.cpp index 9df31fdc..805b60b0 100644 --- a/examples/common/imgui/imgui.cpp +++ b/examples/common/imgui/imgui.cpp @@ -41,6 +41,8 @@ #include "fs_imgui_texture.bin.h" #include "vs_imgui_cubemap.bin.h" #include "fs_imgui_cubemap.bin.h" +#include "vs_imgui_latlong.bin.h" +#include "fs_imgui_latlong.bin.h" #include "vs_imgui_image.bin.h" #include "fs_imgui_image.bin.h" #include "fs_imgui_image_swizz.bin.h" @@ -403,6 +405,7 @@ struct Imgui m_colorProgram.idx = bgfx::invalidHandle; m_textureProgram.idx = bgfx::invalidHandle; m_cubeMapProgram.idx = bgfx::invalidHandle; + m_latlongProgram.idx = bgfx::invalidHandle; m_imageProgram.idx = bgfx::invalidHandle; m_imageSwizzProgram.idx = bgfx::invalidHandle; } @@ -491,6 +494,8 @@ struct Imgui const bgfx::Memory* fs_imgui_texture; const bgfx::Memory* vs_imgui_cubemap; const bgfx::Memory* fs_imgui_cubemap; + const bgfx::Memory* vs_imgui_latlong; + const bgfx::Memory* fs_imgui_latlong; const bgfx::Memory* vs_imgui_image; const bgfx::Memory* fs_imgui_image; const bgfx::Memory* fs_imgui_image_swizz; @@ -504,6 +509,8 @@ struct Imgui fs_imgui_texture = bgfx::makeRef(fs_imgui_texture_dx9, sizeof(fs_imgui_texture_dx9) ); vs_imgui_cubemap = bgfx::makeRef(vs_imgui_cubemap_dx9, sizeof(vs_imgui_cubemap_dx9) ); fs_imgui_cubemap = bgfx::makeRef(fs_imgui_cubemap_dx9, sizeof(fs_imgui_cubemap_dx9) ); + vs_imgui_latlong = bgfx::makeRef(vs_imgui_latlong_dx9, sizeof(vs_imgui_latlong_dx9) ); + fs_imgui_latlong = bgfx::makeRef(fs_imgui_latlong_dx9, sizeof(fs_imgui_latlong_dx9) ); vs_imgui_image = bgfx::makeRef(vs_imgui_image_dx9, sizeof(vs_imgui_image_dx9) ); fs_imgui_image = bgfx::makeRef(fs_imgui_image_dx9, sizeof(fs_imgui_image_dx9) ); fs_imgui_image_swizz = bgfx::makeRef(fs_imgui_image_swizz_dx9, sizeof(fs_imgui_image_swizz_dx9) ); @@ -517,6 +524,8 @@ struct Imgui fs_imgui_texture = bgfx::makeRef(fs_imgui_texture_dx11, sizeof(fs_imgui_texture_dx11) ); vs_imgui_cubemap = bgfx::makeRef(vs_imgui_cubemap_dx11, sizeof(vs_imgui_cubemap_dx11) ); fs_imgui_cubemap = bgfx::makeRef(fs_imgui_cubemap_dx11, sizeof(fs_imgui_cubemap_dx11) ); + vs_imgui_latlong = bgfx::makeRef(vs_imgui_latlong_dx11, sizeof(vs_imgui_latlong_dx11) ); + fs_imgui_latlong = bgfx::makeRef(fs_imgui_latlong_dx11, sizeof(fs_imgui_latlong_dx11) ); vs_imgui_image = bgfx::makeRef(vs_imgui_image_dx11, sizeof(vs_imgui_image_dx11) ); fs_imgui_image = bgfx::makeRef(fs_imgui_image_dx11, sizeof(fs_imgui_image_dx11) ); fs_imgui_image_swizz = bgfx::makeRef(fs_imgui_image_swizz_dx11, sizeof(fs_imgui_image_swizz_dx11) ); @@ -529,6 +538,8 @@ struct Imgui fs_imgui_texture = bgfx::makeRef(fs_imgui_texture_glsl, sizeof(fs_imgui_texture_glsl) ); vs_imgui_cubemap = bgfx::makeRef(vs_imgui_cubemap_glsl, sizeof(vs_imgui_cubemap_glsl) ); fs_imgui_cubemap = bgfx::makeRef(fs_imgui_cubemap_glsl, sizeof(fs_imgui_cubemap_glsl) ); + vs_imgui_latlong = bgfx::makeRef(vs_imgui_latlong_glsl, sizeof(vs_imgui_latlong_glsl) ); + fs_imgui_latlong = bgfx::makeRef(fs_imgui_latlong_glsl, sizeof(fs_imgui_latlong_glsl) ); vs_imgui_image = bgfx::makeRef(vs_imgui_image_glsl, sizeof(vs_imgui_image_glsl) ); fs_imgui_image = bgfx::makeRef(fs_imgui_image_glsl, sizeof(fs_imgui_image_glsl) ); fs_imgui_image_swizz = bgfx::makeRef(fs_imgui_image_swizz_glsl, sizeof(fs_imgui_image_swizz_glsl) ); @@ -556,6 +567,12 @@ struct Imgui bgfx::destroyShader(vsh); bgfx::destroyShader(fsh); + vsh = bgfx::createShader(vs_imgui_latlong); + fsh = bgfx::createShader(fs_imgui_latlong); + m_latlongProgram = bgfx::createProgram(vsh, fsh); + bgfx::destroyShader(vsh); + bgfx::destroyShader(fsh); + vsh = bgfx::createShader(vs_imgui_image); fsh = bgfx::createShader(fs_imgui_image); m_imageProgram = bgfx::createProgram(vsh, fsh); @@ -596,6 +613,7 @@ struct Imgui bgfx::destroyProgram(m_colorProgram); bgfx::destroyProgram(m_textureProgram); bgfx::destroyProgram(m_cubeMapProgram); + bgfx::destroyProgram(m_latlongProgram); bgfx::destroyProgram(m_imageProgram); bgfx::destroyProgram(m_imageSwizzProgram); nvgDelete(m_nvg); @@ -1604,24 +1622,27 @@ struct Imgui const int32_t yy = area.m_widgetY; area.m_widgetY += _height + DEFAULT_SPACING; - const bool enabled = _enabled && isEnabled(m_areaId); - const bool over = enabled && inRect(xx, yy, _width, _height); - const bool res = buttonLogic(id, over); + if (screenQuad(xx, yy, _width, _height, _originBottomLeft) ) + { + const bool enabled = _enabled && isEnabled(m_areaId); + const bool over = enabled && inRect(xx, yy, _width, _height); + const bool res = buttonLogic(id, over); - const float lodEnabled[4] = { _lod, float(enabled), 0.0f, 0.0f }; + const float lodEnabled[4] = { _lod, float(enabled), 0.0f, 0.0f }; + bgfx::setUniform(u_imageLodEnabled, lodEnabled); + bgfx::setTexture(0, s_texColor, bgfx::isValid(_image) ? _image : m_missingTexture); + bgfx::setState(BGFX_STATE_RGB_WRITE + |BGFX_STATE_ALPHA_WRITE + |BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA) + ); + bgfx::setProgram(m_imageProgram); + setCurrentScissor(); + bgfx::submit(m_view); - screenQuad(xx, yy, _width, _height, _originBottomLeft); - bgfx::setUniform(u_imageLodEnabled, lodEnabled); - bgfx::setTexture(0, s_texColor, bgfx::isValid(_image) ? _image : m_missingTexture); - bgfx::setState(BGFX_STATE_RGB_WRITE - |BGFX_STATE_ALPHA_WRITE - |BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA) - ); - bgfx::setProgram(m_imageProgram); - setCurrentScissor(); - bgfx::submit(m_view); + return res; + } - return res; + return false; } bool image(bgfx::TextureHandle _image, float _lod, float _width, float _aspect, ImguiAlign::Enum _align, bool _enabled, bool _originBottomLeft) @@ -1664,29 +1685,32 @@ struct Imgui const int32_t yy = area.m_widgetY; area.m_widgetY += _height + DEFAULT_SPACING; - const bool enabled = _enabled && isEnabled(m_areaId); - const bool over = enabled && inRect(xx, yy, _width, _height); - const bool res = buttonLogic(id, over); + if (screenQuad(xx, yy, _width, _height) ) + { + const bool enabled = _enabled && isEnabled(m_areaId); + const bool over = enabled && inRect(xx, yy, _width, _height); + const bool res = buttonLogic(id, over); - screenQuad(xx, yy, _width, _height); + const float lodEnabled[4] = { _lod, float(enabled), 0.0f, 0.0f }; + bgfx::setUniform(u_imageLodEnabled, lodEnabled); - const float lodEnabled[4] = { _lod, float(enabled), 0.0f, 0.0f }; - bgfx::setUniform(u_imageLodEnabled, lodEnabled); + float swizz[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; + swizz[_channel] = 1.0f; + bgfx::setUniform(u_imageSwizzle, swizz); - float swizz[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; - swizz[_channel] = 1.0f; - bgfx::setUniform(u_imageSwizzle, swizz); + bgfx::setTexture(0, s_texColor, bgfx::isValid(_image) ? _image : m_missingTexture); + bgfx::setState(BGFX_STATE_RGB_WRITE + |BGFX_STATE_ALPHA_WRITE + |BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA) + ); + bgfx::setProgram(m_imageSwizzProgram); + setCurrentScissor(); + bgfx::submit(m_view); - bgfx::setTexture(0, s_texColor, bgfx::isValid(_image) ? _image : m_missingTexture); - bgfx::setState(BGFX_STATE_RGB_WRITE - |BGFX_STATE_ALPHA_WRITE - |BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA) - ); - bgfx::setProgram(m_imageSwizzProgram); - setCurrentScissor(); - bgfx::submit(m_view); + return res; + } - return res; + return false; } bool imageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, float _width, float _aspect, ImguiAlign::Enum _align, bool _enabled) @@ -1697,8 +1721,96 @@ struct Imgui return imageChannel(_image, _channel, _lod, int32_t(width), int32_t(height), _align, _enabled); } - bool cubeMap(bgfx::TextureHandle _cubemap, float _lod, bool _cross, ImguiAlign::Enum _align, bool _enabled) + bool latlong(bgfx::TextureHandle _cubemap, float _lod, ImguiAlign::Enum _align, bool _enabled) { + const uint32_t id = getId(); + + Area& area = getCurrentArea(); + int32_t xx; + int32_t width; + if (ImguiAlign::Left == _align) + { + xx = area.m_contentX + SCROLL_AREA_PADDING; + width = area.m_widgetW; + } + else if (ImguiAlign::LeftIndented == _align + || ImguiAlign::Right == _align) + { + xx = area.m_widgetX; + width = area.m_widgetW; + } + else //if (ImguiAlign::Center == _align + //|| ImguiAlign::CenterIndented == _align). + { + xx = area.m_widgetX; + width = area.m_widgetW - (area.m_widgetX-area.m_scissorX); + } + + const int32_t height = width/2; + const int32_t yy = area.m_widgetY; + area.m_widgetY += height + DEFAULT_SPACING; + + if (screenQuad(xx, yy, width, height, false) ) + { + const bool enabled = _enabled && isEnabled(m_areaId); + const bool over = enabled && inRect(xx, yy, width, height); + const bool res = buttonLogic(id, over); + + const float lodEnabled[4] = { _lod, float(enabled), 0.0f, 0.0f }; + bgfx::setUniform(u_imageLodEnabled, lodEnabled); + + bgfx::setTexture(0, s_texColor, _cubemap); + bgfx::setState(BGFX_STATE_RGB_WRITE + |BGFX_STATE_ALPHA_WRITE + |BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA) + ); + bgfx::setProgram(m_latlongProgram); + setCurrentScissor(); + bgfx::submit(m_view); + + return res; + } + + return false; + } + + bool cubeMap(bgfx::TextureHandle _cubemap, float _lod, bool _cross, bool _sameHeight, ImguiAlign::Enum _align, bool _enabled) + { + const uint32_t id = getId(); + + Area& area = getCurrentArea(); + int32_t xx; + int32_t width; + if (ImguiAlign::Left == _align) + { + xx = area.m_contentX + SCROLL_AREA_PADDING; + width = area.m_widgetW; + } + else if (ImguiAlign::LeftIndented == _align + || ImguiAlign::Right == _align) + { + xx = area.m_widgetX; + width = area.m_widgetW; + } + else //if (ImguiAlign::Center == _align + //|| ImguiAlign::CenterIndented == _align). + { + xx = area.m_widgetX; + width = area.m_widgetW - (area.m_widgetX-area.m_scissorX); + } + + const bool adjustHeight = (_cross && _sameHeight); + const bool fullHeight = (_cross && !_sameHeight); + + if (adjustHeight) + { + xx += width/6; + } + + const int32_t height = fullHeight ? (width*3)/4 : (width/2); + const int32_t yy = area.m_widgetY; + area.m_widgetY += height + DEFAULT_SPACING; + const uint32_t numVertices = 14; const uint32_t numIndices = 36; if (bgfx::checkAvailTransientBuffers(numVertices, PosNormalVertex::ms_decl, numIndices) ) @@ -1770,38 +1882,12 @@ struct Imgui indices += addQuad(indices, 10, 12, 13, 11); } - const uint32_t id = getId(); - - Area& area = getCurrentArea(); - int32_t xx; - int32_t width; - if (ImguiAlign::Left == _align) - { - xx = area.m_contentX + SCROLL_AREA_PADDING; - width = area.m_widgetW; - } - else if (ImguiAlign::LeftIndented == _align - || ImguiAlign::Right == _align) - { - xx = area.m_widgetX; - width = area.m_widgetW; - } - else //if (ImguiAlign::Center == _align - //|| ImguiAlign::CenterIndented == _align). - { - xx = area.m_widgetX; - width = area.m_widgetW - (area.m_widgetX-area.m_scissorX); - } - - const uint32_t height = _cross ? (width*3)/4 : (width/2); - const int32_t yy = area.m_widgetY; - area.m_widgetY += height + DEFAULT_SPACING; - const bool enabled = _enabled && isEnabled(m_areaId); const bool over = enabled && inRect(xx, yy, width, height); const bool res = buttonLogic(id, over); - const float scale = float(width/2)+0.25f; + const float widthf = float(width); + const float scale = adjustHeight ? (widthf+0.5f)/3.0f : (widthf*0.5f + 0.25f); float mtx[16]; bx::mtxSRT(mtx, scale, scale, 1.0f, 0.0f, 0.0f, 0.0f, float(xx), float(yy), 0.0f); @@ -1827,6 +1913,19 @@ struct Imgui return false; } + bool cubeMap(bgfx::TextureHandle _cubemap, float _lod, ImguiCubemap::Enum _display, bool _sameHeight, ImguiAlign::Enum _align, bool _enabled) + { + if (ImguiCubemap::Cross == _display + || ImguiCubemap::Hex == _display) + { + return cubeMap(_cubemap, _lod, (ImguiCubemap::Cross == _display), _sameHeight, _align, _enabled); + } + else //(ImguiCubemap::Latlong == _display). + { + return latlong(_cubemap, _lod, _align, _enabled); + } + } + bool collapse(const char* _text, const char* _subtext, bool _checked, bool _enabled) { const uint32_t id = getId(); @@ -2606,7 +2705,7 @@ struct Imgui #endif // USE_NANOVG_FONT } - void screenQuad(int32_t _x, int32_t _y, int32_t _width, uint32_t _height, bool _originBottomLeft = false) + bool screenQuad(int32_t _x, int32_t _y, int32_t _width, uint32_t _height, bool _originBottomLeft = false) { if (bgfx::checkAvailTransientVertexBuffer(6, PosUvVertex::ms_decl) ) { @@ -2660,7 +2759,11 @@ struct Imgui vertex[5].m_v = minv; bgfx::setVertexBuffer(&vb); + + return true; } + + return false; } void colorWheelWidget(float _rgb[3], bool _respectIndentation, float _size, bool _enabled) @@ -3064,6 +3167,7 @@ struct Imgui bgfx::ProgramHandle m_colorProgram; bgfx::ProgramHandle m_textureProgram; bgfx::ProgramHandle m_cubeMapProgram; + bgfx::ProgramHandle m_latlongProgram; bgfx::ProgramHandle m_imageProgram; bgfx::ProgramHandle m_imageSwizzProgram; bgfx::TextureHandle m_missingTexture; @@ -3358,9 +3462,9 @@ bool imguiImageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, return s_imgui.imageChannel(_image, _channel, _lod, _width, _aspect, _align, _enabled); } -bool imguiCube(bgfx::TextureHandle _cubemap, float _lod, bool _cross, ImguiAlign::Enum _align, bool _enabled) +bool imguiCube(bgfx::TextureHandle _cubemap, float _lod, ImguiCubemap::Enum _display, bool _sameHeight, ImguiAlign::Enum _align, bool _enabled) { - return s_imgui.cubeMap(_cubemap, _lod, _cross, _align, _enabled); + return s_imgui.cubeMap(_cubemap, _lod, _display, _sameHeight, _align, _enabled); } float imguiGetTextLength(const char* _text, ImguiFontHandle _handle) diff --git a/examples/common/imgui/imgui.h b/examples/common/imgui/imgui.h index faa2d4f3..01f3c90e 100644 --- a/examples/common/imgui/imgui.h +++ b/examples/common/imgui/imgui.h @@ -94,6 +94,18 @@ struct ImguiAlign }; }; +struct ImguiCubemap +{ + enum Enum + { + Cross, + Latlong, + Hex, + + Count, + }; +}; + struct ImguiBorder { enum Enum @@ -184,7 +196,7 @@ bool imguiImage(bgfx::TextureHandle _image, float _lod, int32_t _width, int32_t bool imguiImage(bgfx::TextureHandle _image, float _lod, float _scale, float _aspect, ImguiAlign::Enum _align = ImguiAlign::LeftIndented, bool _enabled = true, bool _originBottomLeft = false); bool imguiImageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align = ImguiAlign::LeftIndented, bool _enabled = true); bool imguiImageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, float _scale, float _aspect, ImguiAlign::Enum _align = ImguiAlign::LeftIndented, bool _enabled = true); -bool imguiCube(bgfx::TextureHandle _cubemap, float _lod = 0.0f, bool _cross = true, ImguiAlign::Enum _align = ImguiAlign::LeftIndented, bool _enabled = true); +bool imguiCube(bgfx::TextureHandle _cubemap, float _lod = 0.0f, ImguiCubemap::Enum _display = ImguiCubemap::Cross, bool _sameHeight = false, ImguiAlign::Enum _align = ImguiAlign::LeftIndented, bool _enabled = true); float imguiGetTextLength(const char* _text, ImguiFontHandle _handle); bool imguiMouseOverArea(); diff --git a/examples/common/imgui/vs_imgui_latlong.bin.h b/examples/common/imgui/vs_imgui_latlong.bin.h new file mode 100644 index 00000000..bb168300 --- /dev/null +++ b/examples/common/imgui/vs_imgui_latlong.bin.h @@ -0,0 +1,84 @@ +static const uint8_t vs_imgui_latlong_glsl[337] = +{ + 0x56, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH.o.><...u_mod + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x09, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... + 0x2c, 0x01, 0x00, 0x00, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, 0x69, // ,...attribute hi + 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, // ghp vec3 a_posit + 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, // ion;.attribute h + 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, // ighp vec2 a_texc + 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, // oord0;.varying h + 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // ighp vec2 v_texc + 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, // oord0;.uniform h + 0x69, 0x67, 0x68, 0x70, 0x20, 0x6d, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // ighp mat4 u_mode + 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, // lViewProj;.void + 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, // main ().{. high + 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, // p vec4 tmpvar_1; + 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, // . tmpvar_1.w = + 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, // 1.0;. tmpvar_1. + 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, // xyz = a_position + 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, // ;. gl_Position + 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, // = (u_modelViewPr + 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, // oj * tmpvar_1);. + 0x20, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, // v_texcoord0 = + 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, // a_texcoord0;.}.. + 0x00, // . +}; +static const uint8_t vs_imgui_latlong_dx9[319] = +{ + 0x56, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH.o.><...u_mod + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x09, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... + 0x1c, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // ........#.CTAB.. + 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, // ..W............. + 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, // ......P...0..... + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......@.......u_ + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x03, 0x00, // modelViewProj... + 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, // ..............vs + 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, // _3_0.Microsoft ( + 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, // R) HLSL Shader C + 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, // ompiler 9.29.952 + 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, // .3111........... + 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................ + 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, // ................ + 0x00, 0x80, 0x01, 0x00, 0x03, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, // ................ + 0xe4, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, // ....U........... + 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, // ................ + 0x00, 0x02, 0x01, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ............... +}; +static const uint8_t vs_imgui_latlong_dx11[518] = +{ + 0x56, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH.o.><...u_mod + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x09, 0x00, 0xe0, 0x09, 0x04, 0x00, // elViewProj...... + 0xdc, 0x01, 0x44, 0x58, 0x42, 0x43, 0xb0, 0x50, 0xdf, 0x0d, 0x1e, 0x85, 0x4e, 0xbe, 0xdd, 0xef, // ..DXBC.P....N... + 0x92, 0x24, 0x45, 0x46, 0x54, 0x49, 0x01, 0x00, 0x00, 0x00, 0xdc, 0x01, 0x00, 0x00, 0x03, 0x00, // .$EFTI.......... + 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xd8, 0x00, 0x00, 0x00, 0x49, 0x53, // ..,...........IS + 0x47, 0x4e, 0x4c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, // GNL...........8. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......A......... + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x50, 0x4f, // ..............PO + 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, // SITION.TEXCOORD. + 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x50, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, // ..OSGNP......... + 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, // ..8............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........D..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x0c, // ................ + 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, // ..SV_POSITION.TE + 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0xfc, 0x00, // XCOORD....SHDR.. + 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, // ..@...?...Y...F. + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x72, 0x10, // ........._...r. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x01, 0x00, // ......_...2..... + 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ..g.... ........ + 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0x32, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x68, 0x00, // ..e...2 ......h. + 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, // ......8......... + 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..V.......F. ... + 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, // ......2......... + 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, 0x00, 0x00, 0x00, 0x06, 0x10, // ..F. ........... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, // ......F.......2. + 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..........F. ... + 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa6, 0x1a, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, // ..............F. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, // ........... .... + 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..F.......F. ... + 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x32, 0x20, 0x10, 0x00, 0x01, 0x00, // ......6...2 .... + 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x02, // ..F.......>..... + 0x01, 0x00, 0x10, 0x00, 0x30, 0x0a, // ....0. +}; diff --git a/examples/common/imgui/vs_imgui_latlong.sc b/examples/common/imgui/vs_imgui_latlong.sc new file mode 100644 index 00000000..667fc3dc --- /dev/null +++ b/examples/common/imgui/vs_imgui_latlong.sc @@ -0,0 +1,15 @@ +$input a_position, a_texcoord0 +$output v_texcoord0 + +/* + * Copyright 2015 Dario Manesku. All rights reserved. + * License: http://www.opensource.org/licenses/BSD-2-Clause + */ + +#include + +void main() +{ + gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0) ); + v_texcoord0 = a_texcoord0; +}