Previous 199869 Revisions Next

r36035 Saturday 21st February, 2015 at 22:48:11 UTC by Vasantha Crabb
Merge branch 'build-faster' of https://github.com/ramiropolla/mame

Conflicts:
  src/osd/sdl/sdl.mak
[/branches/kale]makefile
[/branches/kale/3rdparty/bgfx].gitignore README.md
[/branches/kale/3rdparty/bgfx/3rdparty/ib-compress]readbitstream.h
[/branches/kale/3rdparty/bgfx/3rdparty/ocornut-imgui]imgui.cpp imgui.h
[/branches/kale/3rdparty/bgfx/examples/02-metaballs]metaballs.cpp
[/branches/kale/3rdparty/bgfx/examples/08-update]update.cpp
[/branches/kale/3rdparty/bgfx/examples/13-stencil]stencil.cpp
[/branches/kale/3rdparty/bgfx/examples/14-shadowvolumes]shadowvolumes.cpp
[/branches/kale/3rdparty/bgfx/examples/16-shadowmaps]shadowmaps.cpp
[/branches/kale/3rdparty/bgfx/examples/17-drawstress]drawstress.cpp
[/branches/kale/3rdparty/bgfx/examples/18-ibl]ibl.cpp
[/branches/kale/3rdparty/bgfx/examples/common]bgfx_utils.cpp common.h cube_atlas.cpp shaderlib.sh
[/branches/kale/3rdparty/bgfx/examples/common/entry]cmd.cpp cmd.h entry.cpp entry_osx.mm entry_p.h entry_x11.cpp input.cpp input.h
[/branches/kale/3rdparty/bgfx/examples/common/font]font_manager.cpp text_buffer_manager.cpp
[/branches/kale/3rdparty/bgfx/examples/common/imgui]fs_imgui_latlong.bin.h* fs_imgui_latlong.sc* imgui.cpp imgui.h ocornut_imgui.cpp vs_imgui_latlong.bin.h* vs_imgui_latlong.sc*
[/branches/kale/3rdparty/bgfx/examples/common/nanovg]fontstash.h nanovg_bgfx.cpp
[/branches/kale/3rdparty/bgfx/include]bgfx.c99.h bgfx.h bgfxplatform.h
[/branches/kale/3rdparty/bgfx/scripts]bgfx.lua
[/branches/kale/3rdparty/bgfx/src]bgfx.cpp bgfx_compute.sh bgfx_p.h glcontext_egl.cpp glcontext_egl.h glcontext_glx.cpp glcontext_glx.h glcontext_wgl.cpp glcontext_wgl.h glimports.h image.cpp image.h renderer_d3d11.cpp renderer_d3d12.cpp renderer_gl.cpp
[/branches/kale/3rdparty/bx/include/bx]macros.h
[/branches/kale/3rdparty/bx/tools/bin/darwin]genie
[/branches/kale/3rdparty/bx/tools/bin/linux]genie
[/branches/kale/3rdparty/bx/tools/bin/windows]genie.exe
[/branches/kale/3rdparty/genie]README.md
[/branches/kale/3rdparty/genie/build/gmake.darwin]genie.make
[/branches/kale/3rdparty/genie/build/gmake.linux]genie.make
[/branches/kale/3rdparty/genie/build/gmake.windows]genie.make
[/branches/kale/3rdparty/genie/src/actions/make]make_cpp.lua
[/branches/kale/3rdparty/genie/src/host]scripts.c
[/branches/kale/3rdparty/mongoose]LICENSE README.md mongoose.c
[/branches/kale/3rdparty/mongoose/docs]SSL.md
[/branches/kale/3rdparty/mongoose/examples/http_client]Makefile
[/branches/kale/3rdparty/sqlite3]sqlite3.c
[/branches/kale/hash]microvision.xml pencil2.xml uzebox.xml
[/branches/kale/src/build]build.mak flags_clang.mak flags_gcc.mak makelist.c makelist.py* verinfo.c verinfo.py*
[/branches/kale/src/emu]addrmap.h audit.c device.h diserial.c diserial.h fileio.c fileio.h input.c input.h ioport.c memory.c render.c render.h save.c save.h schedule.c sound.c tilemap.c
[/branches/kale/src/emu/bus/abckb]abc99.c
[/branches/kale/src/emu/bus/coco]coco_multi.c
[/branches/kale/src/emu/bus/isa]gblaster.c sblaster.c
[/branches/kale/src/emu/bus/pc_kbd]ec1841.c iskr1030.c pcat84.c pcxt83.c
[/branches/kale/src/emu/bus/rs232]keyboard.c
[/branches/kale/src/emu/cpu]cpu.mak
[/branches/kale/src/emu/cpu/amis2000]amis2000.c amis2000.h amis2000d.c amis2000op.inc
[/branches/kale/src/emu/cpu/i386]i386.h x87ops.inc
[/branches/kale/src/emu/cpu/i86]i186.c
[/branches/kale/src/emu/cpu/m6502]m6502.h
[/branches/kale/src/emu/cpu/m68000]m68000.h m68kcpu.c m68kcpu.h
[/branches/kale/src/emu/cpu/psx]dma.c
[/branches/kale/src/emu/cpu/ucom4]ucom4.c* ucom4.h* ucom4d.c* ucom4op.inc*
[/branches/kale/src/emu/debug]dvbpoints.c dvbpoints.h dvmemory.c dvmemory.h dvwpoints.c dvwpoints.h
[/branches/kale/src/emu/machine]6850acia.c i8251.c ins8250.c mc2661.c wd_fdc.c wozfdc.c z80dart.c
[/branches/kale/src/emu/sound]saa1099.c saa1099.h
[/branches/kale/src/emu/video]psx.c scn2674.c* scn2674.h* video.mak
[/branches/kale/src/lib]lib.mak
[/branches/kale/src/lib/formats]flex_dsk.c flex_dsk.h kaypro_dsk.c kaypro_dsk.h mbee_dsk.c mbee_dsk.h pc98_dsk.c trd_dsk.c trd_dsk.h
[/branches/kale/src/mame]mame.lst mame.mak
[/branches/kale/src/mame/audio]skydiver.c t5182.c t5182.h
[/branches/kale/src/mame/drivers]aleck64.c alg.c armedf.c bestleag.c bingor.c bloodbro.c bnstars.c buggychl.c cchance.c cclimber.c chaknpop.c champbas.c circus.c cops.c cyclemb.c d9final.c darkmist.c dcon.c dlair2.c dreamwld.c equites.c expro02.c exzisus.c fuukifg2.c fuukifg3.c galivan.c galpani2.c galpanic.c gladiatr.c gluck2.c goodejan.c gsword.c gunsmoke.c hornet.c igs011.c igs_m027.c iqblock.c jpmsys5.c liberate.c lindbergh.c manohman.c mastboy.c mcr.c megadrvb.c mitchell.c mpu4vid.c ms32.c mustache.c n8080.c namcops2.c naomi.c nbmj9195.c nmk16.c nwk-tr.c panicr.c peplus.c pipeline.c pirates.c pokechmp.c progolf.c quizo.c quizpani.c rabbit.c raiden2.c scotrsht.c segaorun.c segas16b.c segas32.c sengokmj.c shootout.c shougi.c sidearms.c sidepckt.c silvmil.c skeetsht.c skyarmy.c skydiver.c snowbros.c srmp5.c ssv.c st_mp100.c statriv2.c supduck.c tapatune.c taxidriv.c tecmo.c tecmo16.c tecmosys.c tehkanwc.c tmmjprd.c tnzs.c toki.c triforce.c vamphalf.c vball.c wc90.c welltris.c wink.c wrally.c wwfsstar.c xorworld.c xxmissio.c
[/branches/kale/src/mame/includes]armedf.h bloodbro.h chaknpop.h darkmist.h dcon.h exzisus.h fuukifg2.h fuukifg3.h galivan.h galpanic.h gladiatr.h gsword.h iqblock.h liberate.h mustache.h nb1414m4.h pirates.h quizpani.h scotrsht.h shootout.h sidepckt.h skydiver.h snowbros.h taxidriv.h tecmo.h tecmo16.h tecmosys.h tehkanwc.h tnzs.h toki.h vball.h wc90.h welltris.h wrally.h wwfsstar.h xorworld.h xxmissio.h
[/branches/kale/src/mame/layout]superbug.lay
[/branches/kale/src/mame/machine]315-5838_317-0229_comp.c 315-5881_crypt.c 315_5296.c chaknpop.c nb1414m4.c pgmcrypt.c pgmcrypt.h tait8741.c tecmosys.c tnzs.c wrally.c
[/branches/kale/src/mame/video]bloodbro.c buggychl.c chaknpop.c darkmist.c dcon.c decospr.c decospr.h exzisus.c fuukifg2.c fuukifg3.c galpani2.c galpanic.c gladiatr.c gsword.c iqblock.c kaneko_spr.c kaneko_spr.h liberate.c mustache.c pirates.c quizpani.c scn2674.c scn2674.h scotrsht.c shootout.c sidepckt.c skydiver.c taxidriv.c tecmo.c tecmo16.c tecmosys.c tehkanwc.c toki.c vball.c wc90.c welltris.c wrally.c wwfsstar.c xorworld.c xxmissio.c
[/branches/kale/src/mess]mess.lst mess.mak
[/branches/kale/src/mess/drivers]advision.c alesis.c alnchase.c* amaztron.c atm.c c65.c cnsector.c comp4.c edracula.c* elecdet.c hx20.c indiana.c kaypro.c mbee.c merlin.c ngen.c pc9801.c pcd.c pencil2.c pentagon.c prestige.c pt68k4.c samcoupe.c scorpion.c simon.c slicer.c spec128.c splitsec.c starwbc.c stopthie.c tb303.c* tc4.c* ti74.c ticalc1x.c tispeak.c tmtennis.c* uzebox.c wildfire.c zorba.c
[/branches/kale/src/mess/includes]alesis.h kaypro.h mbee.h
[/branches/kale/src/mess/layout]alnchase.lay* bankshot.lay* edracula.lay* tb303.lay* tc4.lay* tmtennis.lay* wildfire.lay
[/branches/kale/src/mess/machine]apollo.c beta.c beta.h kaypro.c mbee.c ngen_kb.c ngen_kb.h pc1512kb.c pc9801_86.c victor9kb.c wangpckb.c
[/branches/kale/src/mess/osd/windows]windows.mak
[/branches/kale/src/mess/tools/imgtool/modules]ti990hd.c
[/branches/kale/src/mess/video]mbee.c spectrum.c
[/branches/kale/src/osd/modules/debugger]debugosx.h debugosx.m debugqt.c debugwin.c
[/branches/kale/src/osd/modules/debugger/osx]breakpointsview.h* breakpointsview.m* consoleview.h* consoleview.m* debugcommandhistory.h* debugcommandhistory.m* debugconsole.h* debugconsole.m* debugosx.h* debugview.h* debugview.m* debugwindowhandler.h* debugwindowhandler.m* deviceinfoviewer.h* deviceinfoviewer.m* devicesviewer.h* devicesviewer.m* disassemblyview.h* disassemblyview.m* disassemblyviewer.h* disassemblyviewer.m* errorlogview.h* errorlogview.m* errorlogviewer.h* errorlogviewer.m* memoryview.h* memoryview.m* memoryviewer.h* memoryviewer.m* pointsviewer.h* pointsviewer.m* registersview.h* registersview.m* watchpointsview.h* watchpointsview.m*
[/branches/kale/src/osd/modules/debugger/qt]breakpointswindow.c* breakpointswindow.h* dasmwindow.c* dasmwindow.h* debuggerview.c* debuggerview.h* debugqtbreakpointswindow.c debugqtbreakpointswindow.h debugqtdasmwindow.c debugqtdasmwindow.h debugqtdeviceinformationwindow.c debugqtdeviceinformationwindow.h debugqtdeviceswindow.c debugqtdeviceswindow.h debugqtlogwindow.c debugqtlogwindow.h debugqtmainwindow.c debugqtmainwindow.h debugqtmemorywindow.c debugqtmemorywindow.h debugqtview.c debugqtview.h debugqtwindow.c debugqtwindow.h deviceinformationwindow.c* deviceinformationwindow.h* deviceswindow.c* deviceswindow.h* logwindow.c* logwindow.h* mainwindow.c* mainwindow.h* memorywindow.c* memorywindow.h* windowqt.c* windowqt.h*
[/branches/kale/src/osd/modules/debugger/win]consolewininfo.c* consolewininfo.h* debugbaseinfo.c* debugbaseinfo.h* debugviewinfo.c* debugviewinfo.h* debugwin.h* debugwininfo.c* debugwininfo.h* disasmbasewininfo.c* disasmbasewininfo.h* disasmviewinfo.c* disasmviewinfo.h* disasmwininfo.c* disasmwininfo.h* editwininfo.c* editwininfo.h* logwininfo.c* logwininfo.h* memoryviewinfo.c* memoryviewinfo.h* memorywininfo.c* memorywininfo.h* pointswininfo.c* pointswininfo.h* uimetrics.c* uimetrics.h*
[/branches/kale/src/osd/modules/sound]direct_sound.c js_sound.c sdl_sound.c
[/branches/kale/src/osd/osdmini]osdmini.mak
[/branches/kale/src/osd/sdl]draw13.c drawbgfx.c drawogl.c drawsdl.c input.c input.h osdsdl.h sdl.mak sdlmain.c testkeys.c video.c video.h window.c window.h
[/branches/kale/src/osd/windows]d3dcomm.h d3dhlsl.c d3dhlsl.h drawbgfx.c drawd3d.c drawd3d.h drawdd.c drawgdi.c drawnone.c input.c vconv.c video.c video.h window.c window.h windows.mak winmain.c winmain.h winprefix.h
[/branches/kale/src/tools]chdman.c unidasm.c
[/branches/kale/src/ume/osd/windows]windows.mak

branches/kale/3rdparty/bgfx/.gitignore
r244546r244547
44.git
55.svn
66tags
7src/renderer_d3d12.*
branches/kale/3rdparty/bgfx/3rdparty/ib-compress/readbitstream.h
r244546r244547
9595    }
9696}
9797
98
9998RBS_INLINE uint32_t ReadBitstream::Read( uint32_t bitCount )
10099{
101100    uint64_t mask   = ( uint64_t( 1 ) << bitCount ) - 1;
102    uint32_t result = static_cast< uint32_t >( ( m_bitBuffer >> ( 64 - m_bitsLeft ) & ( m_bitsLeft == 0 ? 0 : 0xFFFFFFFFFFFFFFFF ) ) & mask );
101    uint32_t result = static_cast< uint32_t >( ( m_bitBuffer >> ( 64 - m_bitsLeft ) & ( m_bitsLeft == 0 ? 0 : UINT64_C(0xFFFFFFFFFFFFFFFF) ) ) & mask );
103102
104103    if ( m_bitsLeft < bitCount )
105104    {
branches/kale/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp
r244546r244547
1// ImGui library v1.30
1// ImGui library v1.32 wip
22// See ImGui::ShowTestWindow() for sample code.
33// Read 'Programmer guide' below for notes on how to setup ImGui in your codebase.
44// Get latest version at https://github.com/ocornut/imgui
r244546r244547
1717 - SAMPLE CODE
1818 - FONT DATA
1919
20
20
2121 MISSION STATEMENT
2222 =================
2323
r244546r244547
3535 - doesn't look fancy, doesn't animate
3636 - limited layout features, intricate layouts are typically crafted in code
3737 - occasionally use statically sized buffers for string manipulations - won't crash, but some long text may be clipped
38 
3938
39
4040 END-USER GUIDE
4141 ==============
4242
r244546r244547
6666 - your code creates the UI, if your code doesn't run the UI is gone! == dynamic UI, no construction step, less data retention on your side, no state duplication, less sync, less errors.
6767 - call and read ImGui::ShowTestWindow() for user-side sample code
6868 - see examples/ folder for standalone sample applications.
69 - customization: use the style editor to tweak the look of the interface (e.g. if you want a more compact UI or a different color scheme), and report values in your code.
69 - customization: use the style editor or PushStyleColor/PushStyleVar to tweak the look of the interface (e.g. if you want a more compact UI or a different color scheme).
7070
71
7172 - getting started:
7273   - initialisation: call ImGui::GetIO() and fill the 'Settings' data.
73   - every frame:
74   - every frame:
7475      1/ in your mainloop or right after you got your keyboard/mouse info, call ImGui::GetIO() and fill the 'Input' data, then call ImGui::NewFrame().
7576      2/ use any ImGui function you want between NewFrame() and Render()
7677      3/ ImGui::Render() to render all the accumulated command-lists. it will call your RenderDrawListFn handler that you set in the IO structure.
r244546r244547
9192        unsigned char* pixels;
9293        int width, height, bytes_per_pixels;
9394        io.Fonts->GetTexDataAsRGBA32(pixels, &width, &height, &bytes_per_pixels);
94        // TODO: copy texture to graphics memory.
95        // TODO: copy texture to graphics memory.
9596        // TODO: store your texture pointer/identifier in 'io.Fonts->TexID'
9697
9798        // Application main loop
r244546r244547
99100        {
100101            // 1) get low-level input
101102            // e.g. on Win32, GetKeyboardState(), or poll your events, etc.
102           
103
103104            // 2) TODO: fill all fields of IO structure and call NewFrame
104105            ImGuiIO& io = ImGui::GetIO();
105            io.MousePos = ...
106            io.MousePos = mouse_pos;
107            io.MouseDown[0] = mouse_button_0;
106108            io.KeysDown[i] = ...
107109            ImGui::NewFrame();
108110
r244546r244547
118120            // swap video buffer, etc.
119121        }
120122
121   - after calling ImGui::NewFrame() you can read back 'io.WantCaptureMouse' and 'io.WantCaptureKeyboard' to tell
122     if ImGui wants to use your inputs. so typically can hide the mouse inputs from the rest of your application if ImGui is using it.
123   - after calling ImGui::NewFrame() you can read back 'io.WantCaptureMouse' and 'io.WantCaptureKeyboard' to tell if ImGui
124     wants to use your inputs. if it does you can discard/hide the inputs from the rest of your application.
123125
124
125126 API BREAKING CHANGES
126127 ====================
127128
128129 Occasionally introducing changes that are breaking the API. The breakage are generally minor and easy to fix.
129130 Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
130 
131
132 - 2015/02/10 (1.32) - renamed GetItemWidth() to CalcItemWidth() to clarify its evolving behavior
133 - 2015/02/08 (1.31) - renamed GetTextLineSpacing() to GetTextLineHeightWithSpacing()
134 - 2015/02/01 (1.31) - removed IO.MemReallocFn (unused)
131135 - 2015/01/19 (1.30) - renamed ImGuiStorage::GetIntPtr()/GetFloatPtr() to GetIntRef()/GetIntRef() because Ptr was conflicting with actual pointer storage functions.
132136 - 2015/01/11 (1.30) - big font/image API change! now loads TTF file. allow for multiple fonts. no need for a PNG loader.
133137              (1.30) - removed GetDefaultFontData(). uses io.Fonts->GetTextureData*() API to retrieve uncompressed pixels.
r244546r244547
167171   - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
168172
169173 If you are confused about the meaning or use of ID in ImGui:
170   - some widgets requires state to be carried over multiple frames (most typically ImGui often wants remember what is the "active" widget).
174   - many widgets requires state to be carried over multiple frames (most typically ImGui often wants remember what is the "active" widget).
171175     to do so they need an unique ID. unique ID are typically derived from a string label, an indice or a pointer.
172176     when you call Button("OK") the button shows "OK" and also use "OK" as an ID.
173177   - ID are uniquely scoped within Windows so no conflict can happen if you have two buttons called "OK" in two different Windows.
174     within a same Window, use PushID() / PopID() to easily create scopes and avoid ID conflicts.
178     within a same Window, use PushID() / PopID() to easily create scopes and avoid ID conflicts.
175179     so if you have a loop creating "multiple" items, you can use PushID() / PopID() with the index of each item, or their pointer, etc.
176180     some functions like TreeNode() implicitly creates a scope for you by calling PushID()
177181   - when dealing with trees, ID are important because you want to preserve the opened/closed state of tree nodes.
178182     depending on your use cases you may want to use strings, indices or pointers as ID. experiment and see what makes more sense!
179      e.g. When displaying a single object, using a static string as ID will preserve your node open/closed state when the targeted object change
183      e.g. When displaying a single object that may change over time, using a static string as ID will preserve your node open/closed state when the targeted object change
180184      e.g. When displaying a list of objects, using indices or pointers as ID will preserve the node open/closed state per object
181185   - when passing a label you can optionally specify extra unique ID information within the same string using "##". This helps solving the simpler collision cases.
182186      e.g. "Label" display "Label" and uses "Label" as ID
183187      e.g. "Label##Foobar" display "Label" and uses "Label##Foobar" as ID
184188      e.g. "##Foobar" display an empty label and uses "##Foobar" as ID
185   - read articles about the imgui principles (see web links) to understand the requirement and use of ID.
189   - read articles about immediate-mode ui principles (see web links) to understand the requirement and use of ID.
186190
187191 If you want to load a different font than the default (ProggyClean.ttf, size 13)
188192
r244546r244547
193197
194198     ImFont* font0 = io.Fonts->AddFontDefault();
195199     ImFont* font1 = io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels);
200     ImFont* font2 = io.Fonts->AddFontFromFileTTF("myfontfile2.ttf", size_in_pixels);
196201     io.Fonts->GetTexDataAsRGBA32() or GetTexDataAsAlpha8()
197202
198203 If you want to display Chinese, Japanese, Korean characters, pass custom Unicode ranges when loading a font:
r244546r244547
224229        // Set pointer to handler in ImGuiIO structure
225230        io.ImeSetInputScreenPosFn = ImImpl_ImeSetInputScreenPosFn;
226231
227 - tip: the construct 'IMGUI_ONCE_UPON_A_FRAME { ... }' will evaluate to a block of code only once a frame. You can use it to quickly add custom UI in the middle of a deep nested inner loop in your code.
228 - tip: you can call Render() multiple times (e.g for VR renders), up to you to communicate the extra state to your RenderDrawListFn function.
232 - tip: the construct 'IMGUI_ONCE_UPON_A_FRAME { ... }' will run the block of code only once a frame. You can use it to quickly add custom UI in the middle of a deep nested inner loop in your code.
229233 - tip: you can create widgets without a Begin()/End() block, they will go in an implicit window called "Debug"
234 - tip: you can call Begin() multiple times with the same name during the same frame, it will keep appending to the same window.
235 - tip: you can call Render() multiple times (e.g for VR renders).
230236 - tip: call and read the ShowTestWindow() code for more example of how to use ImGui!
231237
232238
r244546r244547
234240 ==================
235241
236242 - misc: merge or clarify ImVec4 / ImGuiAabb, they are essentially duplicate containers
237!- i/o: avoid requesting mouse capture if button held and initial click was out of reach for imgui
238243 - window: add horizontal scroll
239244 - window: fix resize grip rendering scaling along with Rounding style setting
240245 - window: autofit feedback loop when user relies on any dynamic layout (window width multiplier, column). maybe just clearly drop manual autofit?
241 - window: add a way for very transient windows (non-saved, temporary overlay over hundreds of objects) to "clean" up from the global window list.
246 - window: add a way for very transient windows (non-saved, temporary overlay over hundreds of objects) to "clean" up from the global window list.
242247 - window: allow resizing of child windows (possibly given min/max for each axis?)
243248 - window: background options for child windows, border option (disable rounding)
244249 - window: resizing from any sides? + mouse cursor directives for app.
250 - widgets: clicking on widget b while widget a should activate widget b (doesn't anymore because of hover capture)
245251 - widgets: display mode: widget-label, label-widget (aligned on column or using fixed size), label-newline-tab-widget etc.
246252 - widgets: clip text? hover clipped text shows it in a tooltip or in-place overlay
247 - main: considering adding EndFrame() - optional, else done in Render(). and Init()
253 - main: considering adding EndFrame()/Init(). some constructs are awkward in the implementation because of the lack of them.
248254 - main: IsItemHovered() returns true even if mouse is active on another widget (e.g. dragging outside of sliders). Maybe not a sensible default? Add parameter or alternate function?
249255 - main: IsItemHovered() make it more consistent for various type of widgets, widgets with multiple components, etc. also effectively IsHovered() region sometimes differs from hot region, e.g tree nodes
250256 - main: IsItemHovered() info stored in a stack? so that 'if TreeNode() { Text; TreePop; } if IsHovered' return the hover state of the TreeNode?
r244546r244547
256262 - input number: use mouse wheel to step up/down
257263 - input number: non-decimal input.
258264 - layout: horizontal layout helper (github issue #97)
265 - layout: more generic alignment state (left/right/centered) for single items?
259266 - layout: clean up the InputFloatN/SliderFloatN/ColorEdit4 layout code. item width should include frame padding.
260267 - columns: separator function or parameter that works within the column (currently Separator() bypass all columns)
261268 - columns: declare column set (each column: fixed size, %, fill, distribute default size among fills)
262269 - columns: columns header to act as button (~sort op) and allow resize/reorder
263270 - columns: user specify columns size
264271 - combo: turn child handling code into pop up helper
265 - list selection, concept of a selectable "block" (that can be multiple widgets)
266 - menubar, menus
272 - combo: contents should extends to fit label if combo widget is small
273 - listbox: multiple selection
274 - listbox: user may want to initial scroll to focus on the one selected value?
275 ! menubar, menus
267276 - tabs
268277 - gauge: various forms of gauge/loading bars widgets
269278 - color: better color editor.
270 - plot: make it easier for user to draw into the graph (e.g: draw basis, highlight certain points, 2d plots, multiple plots)
271 - plot: "smooth" automatic scale, user give an input 0.0(full user scale) 1.0(full derived from value)
279 - plot: make it easier for user to draw extra stuff into the graph (e.g: draw basis, highlight certain points, 2d plots, multiple plots)
280 - plot: "smooth" automatic scale over time, user give an input 0.0(full user scale) 1.0(full derived from value)
272281 - plot: add a helper e.g. Plot(char* label, float value, float time_span=2.0f) that stores values and Plot them for you - probably another function name. and/or automatically allow to plot ANY displayed value (more reliance on stable ID)
273 - file selection widget -> build the tool in our codebase to improve model-dialog idioms (may or not lead to ImGui changes)
282 - file selection widget -> build the tool in our codebase to improve model-dialog idioms
274283 - slider: allow using the [-]/[+] buttons used by InputFloat()/InputInt()
275284 - slider: initial absolute click is imprecise. change to relative movement slider? hide mouse cursor, allow more precise input using less screen-space.
276 - text edit: clean up the mess caused by converting UTF-8 <> wchar
277 - text edit: centered text for slider or input text to it matches typical positioning.
278 - text edit: flag to disable live update of the user buffer.
285 - text edit: clean up the mess caused by converting UTF-8 <> wchar. the code is rather ineficient right now.
286 - text edit: centered text for slider as input text so it matches typical positioning.
287 - text edit: flag to disable live update of the user buffer.
279288 - text edit: field resize behavior - field could stretch when being edited? hover tooltip shows more text?
280289 - text edit: add multi-line text edit
281290 - tree: add treenode/treepush int variants? because (void*) cast from int warns on some platforms/settings
282291 - settings: write more decent code to allow saving/loading new fields
283292 - settings: api for per-tool simple persistent data (bool,int,float) in .ini file
284 ! style: store rounded corners in texture to use 1 quad per corner (filled and wireframe).
285 - style: checkbox: padding for "active" color should be a multiplier of the
293 ! style: store rounded corners in texture to use 1 quad per corner (filled and wireframe). so rounding have minor cost.
294 - style: checkbox: padding for "active" color should be a multiplier of the
286295 - style: colorbox not always square?
287296 - log: LogButtons() options for specifying depth and/or hiding depth slider
288297 - log: have more control over the log scope (e.g. stop logging when leaving current tree node scope)
r244546r244547
299308 - misc: mark printf compiler attributes on relevant functions
300309 - misc: provide a way to compile out the entire implementation while providing a dummy API (e.g. #define IMGUI_DUMMY_IMPL)
301310 - misc: double-clicking on title bar to minimize isn't consistent, perhaps move to single-click on left-most collapse icon?
311 - style editor: have a more global HSV setter (e.g. alter hue on all elements). consider replacing active/hovered by offset in HSV space?
302312 - style editor: color child window height expressed in multiple of line height.
303313 - optimization/render: use indexed rendering to reduce vertex data cost (for remote/networked imgui)
304 - optimization/render: move clip-rect to vertex data? would allow merging all commands
305314 - optimization/render: merge command-lists with same clip-rect into one even if they aren't sequential? (as long as in-between clip rectangle don't overlap)?
306315 - optimization: turn some the various stack vectors into statically-sized arrays
307316 - optimization: better clipping for multi-component widgets
r244546r244547
320329#include <new>          // new (ptr)
321330
322331#ifdef _MSC_VER
323#pragma warning (disable: 4505) // unreferenced local function has been removed
332#pragma warning (disable: 4505) // unreferenced local function has been removed (stb stuff)
324333#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen
325334#endif
326335
r244546r244547
392401// Forward Declarations
393402//-------------------------------------------------------------------------
394403
395static bool         ButtonBehaviour(const ImGuiAabb& bb, const ImGuiID& id, bool* out_hovered, bool* out_held, bool allow_key_modifiers, bool repeat = false);
404struct ImGuiAabb;
405
406static bool         ButtonBehaviour(const ImGuiAabb& bb, const ImGuiID& id, bool* out_hovered, bool* out_held, bool allow_key_modifiers, bool repeat = false, bool pressed_on_click = false);
396407static void         LogText(const ImVec2& ref_pos, const char* text, const char* text_end = NULL);
397408
398static void         RenderText(ImVec2 pos, const char* text, const char* text_end = NULL, bool hide_text_after_hash = true, float wrap_width = 0.0f);
409static void         RenderText(ImVec2 pos, const char* text, const char* text_end = NULL, bool hide_text_after_hash = true);
410static void         RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end, float wrap_width);
411static void         RenderTextClipped(ImVec2 pos, const char* text, const char* text_end, const ImVec2* text_size_if_known, const ImVec2& clip_max);
399412static void         RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border = true, float rounding = 0.0f);
400413static void         RenderCollapseTriangle(ImVec2 p_min, bool opened, float scale = 1.0f, bool shadow = false);
401414
r244546r244547
463476    WindowPadding           = ImVec2(8,8);      // Padding within a window
464477    WindowMinSize           = ImVec2(32,32);    // Minimum window size
465478    WindowRounding          = 9.0f;             // Radius of window corners rounding. Set to 0.0f to have rectangular windows
479    ChildWindowRounding     = 0.0f;             // Radius of child window corners rounding. Set to 0.0f to have rectangular windows
466480    FramePadding            = ImVec2(4,3);      // Padding within a framed rectangle (used by most widgets)
467481    FrameRounding           = 0.0f;             // Radius of frame corners rounding. Set to 0.0f to have rectangular frames (used by most widgets).
468482    ItemSpacing             = ImVec2(8,4);      // Horizontal and vertical spacing between widgets/lines
r244546r244547
476490
477491    Colors[ImGuiCol_Text]                   = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
478492    Colors[ImGuiCol_WindowBg]               = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
493    Colors[ImGuiCol_ChildWindowBg]          = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
479494    Colors[ImGuiCol_Border]                 = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
480495    Colors[ImGuiCol_BorderShadow]           = ImVec4(0.00f, 0.00f, 0.00f, 0.60f);
481496    Colors[ImGuiCol_FrameBg]                = ImVec4(0.80f, 0.80f, 0.80f, 0.30f);   // Background of checkbox, radio button, plot, slider, text input
r244546r244547
496511    Colors[ImGuiCol_ButtonActive]           = ImVec4(0.80f, 0.50f, 0.50f, 1.00f);
497512    Colors[ImGuiCol_Header]                 = ImVec4(0.40f, 0.40f, 0.90f, 0.45f);
498513    Colors[ImGuiCol_HeaderHovered]          = ImVec4(0.45f, 0.45f, 0.90f, 0.80f);
499    Colors[ImGuiCol_HeaderActive]           = ImVec4(0.60f, 0.60f, 0.80f, 1.00f);
514    Colors[ImGuiCol_HeaderActive]           = ImVec4(0.53f, 0.53f, 0.87f, 0.80f);
500515    Colors[ImGuiCol_Column]                 = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
501516    Colors[ImGuiCol_ColumnHovered]          = ImVec4(0.60f, 0.40f, 0.40f, 1.00f);
502517    Colors[ImGuiCol_ColumnActive]           = ImVec4(0.80f, 0.50f, 0.50f, 1.00f);
r244546r244547
539554    // User functions
540555    RenderDrawListsFn = NULL;
541556    MemAllocFn = malloc;
542    MemReallocFn = realloc;
543557    MemFreeFn = free;
544558    GetClipboardTextFn = GetClipboardTextFn_DefaultImpl;   // Platform dependent default implementations
545559    SetClipboardTextFn = SetClipboardTextFn_DefaultImpl;
r244546r244547
600614static inline float  ImMax(float lhs, float rhs)                                { return lhs >= rhs ? lhs : rhs; }
601615static inline ImVec2 ImMin(const ImVec2& lhs, const ImVec2& rhs)                { return ImVec2(ImMin(lhs.x,rhs.x), ImMin(lhs.y,rhs.y)); }
602616static inline ImVec2 ImMax(const ImVec2& lhs, const ImVec2& rhs)                { return ImVec2(ImMax(lhs.x,rhs.x), ImMax(lhs.y,rhs.y)); }
603static inline float  ImClamp(float f, float mn, float mx)                       { return (f < mn) ? mn : (f > mx) ? mx : f; }
617static inline int    ImClamp(int v, int mn, int mx)                             { return (v < mn) ? mn : (v > mx) ? mx : v; }
618static inline float  ImClamp(float v, float mn, float mx)                       { return (v < mn) ? mn : (v > mx) ? mx : v; }
604619static inline ImVec2 ImClamp(const ImVec2& f, const ImVec2& mn, ImVec2 mx)      { return ImVec2(ImClamp(f.x,mn.x,mx.x), ImClamp(f.y,mn.y,mx.y)); }
605620static inline float  ImSaturate(float f)                                        { return (f < 0.0f) ? 0.0f : (f > 1.0f) ? 1.0f : f; }
606621static inline float  ImLerp(float a, float b, float t)                          { return a + (b - a) * t; }
r244546r244547
660675}
661676
662677// Pass data_size==0 for zero-terminated string
663static ImU32 ImCrc32(const void* data, size_t data_size, ImU32 seed = 0)
664{
678static ImU32 ImCrc32(const void* data, size_t data_size, ImU32 seed = 0)
679{
665680    static ImU32 crc32_lut[256] = { 0 };
666681    if (!crc32_lut[1])
667682    {
668683        const ImU32 polynomial = 0xEDB88320;
669        for (ImU32 i = 0; i < 256; i++)
670        {
671            ImU32 crc = i;
672            for (ImU32 j = 0; j < 8; j++)
673                crc = (crc >> 1) ^ (ImU32(-int(crc & 1)) & polynomial);
674            crc32_lut[i] = crc;
684        for (ImU32 i = 0; i < 256; i++)
685        {
686            ImU32 crc = i;
687            for (ImU32 j = 0; j < 8; j++)
688                crc = (crc >> 1) ^ (ImU32(-int(crc & 1)) & polynomial);
689            crc32_lut[i] = crc;
675690        }
676691    }
677    ImU32 crc = ~seed;
692    ImU32 crc = ~seed;
678693    const unsigned char* current = (const unsigned char*)data;
679694
680695    if (data_size > 0)
681696    {
682697        // Known size
683        while (data_size--)
684            crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ *current++];
698        while (data_size--)
699            crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ *current++];
685700    }
686701    else
687702    {
688703        // Zero-terminated string
689704        while (unsigned char c = *current++)
690            crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ c];
705            crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ c];
691706    }
692    return ~crc;
693}
707    return ~crc;
708}
694709
695710static size_t ImFormatString(char* buf, size_t buf_size, const char* fmt, ...)
696711{
r244546r244547
743758// Convert hsv floats ([0-1],[0-1],[0-1]) to rgb floats ([0-1],[0-1],[0-1]), from Foley & van Dam p593
744759// also http://en.wikipedia.org/wiki/HSL_and_HSV
745760void ImGui::ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b)
746{   
761{
747762    if (s == 0.0f)
748763    {
749764        // gray
r244546r244547
868883    bool                    LastItemHovered;
869884    ImVector<ImGuiWindow*>  ChildWindows;
870885    ImVector<bool>          AllowKeyboardFocus;
871    ImVector<float>         ItemWidth;
886    ImVector<float>         ItemWidth;           // 0.0: default, >0.0: width in pixels, <0.0: align xx pixels to the right of window
872887    ImVector<float>         TextWrapPos;
873888    ImGuiColorEditMode      ColorEditMode;
874889    ImGuiStorage*           StateStorage;
875    int                     OpenNextNode;
890    int                     OpenNextNode;        // FIXME: Reformulate this feature like SetNextWindowCollapsed() API
876891
877892    float                   ColumnsStartX;       // Start position from left of window (increased by TreePush/TreePop, etc.)
878893    float                   ColumnsOffsetX;      // Offset to the current column (if ColumnsCurrent > 0). FIXME: This and the above should be a stack to allow use cases like Tree->Column->Tree. Need revamp columns API.
r244546r244547
9861001
9871002    // Render
9881003    ImVector<ImDrawList*>   RenderDrawLists;
1004    ImVector<ImGuiWindow*>  RenderSortedWindows;
9891005
9901006    // Widget state
9911007    ImGuiTextEditState      InputTextState;
r244546r244547
10321048    }
10331049};
10341050
1035static ImGuiState   GImGui;
1051static ImGuiState   GImDefaultState;                            // Internal state storage
1052static ImGuiState*  GImGui = &GImDefaultState;                  // We access everything through this pointer. NB: this pointer is always assumed to be != NULL
10361053
10371054struct ImGuiWindow
10381055{
r244546r244547
10531070    bool                    SkipItems;                          // == Visible && !Collapsed
10541071    int                     AutoFitFrames;
10551072    bool                    AutoFitOnlyGrows;
1056    int                     SetWindowPosAllowFlags;             // bit ImGuiSetCondition_*** specify if SetWindowPos() call is allowed with this particular flag.
1057    int                     SetWindowSizeAllowFlags;            // bit ImGuiSetCondition_*** specify if SetWindowSize() call is allowed with this particular flag.
1058    int                     SetWindowCollapsedAllowFlags;       // bit ImGuiSetCondition_*** specify if SetWindowCollapsed() call is allowed with this particular flag.
1073    int                     SetWindowPosAllowFlags;             // bit ImGuiSetCondition_*** specify if SetWindowPos() call is allowed with this particular flag.
1074    int                     SetWindowSizeAllowFlags;            // bit ImGuiSetCondition_*** specify if SetWindowSize() call is allowed with this particular flag.
1075    int                     SetWindowCollapsedAllowFlags;       // bit ImGuiSetCondition_*** specify if SetWindowCollapsed() call is allowed with this particular flag.
10591076
10601077    ImGuiDrawContext        DC;
10611078    ImVector<ImGuiID>       IDStack;
1062    ImVector<ImVec4>        ClipRectStack;
1079    ImVector<ImVec4>        ClipRectStack;                      // Scissoring / clipping rectangle. x1, y1, x2, y2.
10631080    int                     LastFrameDrawn;
10641081    float                   ItemWidthDefault;
10651082    ImGuiStorage            StateStorage;
r244546r244547
10871104    void        FocusItemUnregister();
10881105
10891106    ImGuiAabb   Aabb() const                            { return ImGuiAabb(Pos, Pos+Size); }
1090    ImFont*     Font() const                            { return GImGui.Font; }
1091    float       FontSize() const                        { return GImGui.FontSize * FontWindowScale; }
1107    ImFont*     Font() const                            { return GImGui->Font; }
1108    float       FontSize() const                        { return GImGui->FontSize * FontWindowScale; }
10921109    ImVec2      CursorPos() const                       { return DC.CursorPos; }
1093    float       TitleBarHeight() const                  { return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0 : FontSize() + GImGui.Style.FramePadding.y * 2.0f; }
1110    float       TitleBarHeight() const                  { return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0 : FontSize() + GImGui->Style.FramePadding.y * 2.0f; }
10941111    ImGuiAabb   TitleBarAabb() const                    { return ImGuiAabb(Pos, Pos + ImVec2(SizeFull.x, TitleBarHeight())); }
1095    ImVec2      WindowPadding() const                   { return ((Flags & ImGuiWindowFlags_ChildWindow) && !(Flags & ImGuiWindowFlags_ShowBorders)) ? ImVec2(1,1) : GImGui.Style.WindowPadding; }
1096    ImU32       Color(ImGuiCol idx, float a=1.f) const  { ImVec4 c = GImGui.Style.Colors[idx]; c.w *= GImGui.Style.Alpha * a; return ImGui::ColorConvertFloat4ToU32(c); }
1097    ImU32       Color(const ImVec4& col) const          { ImVec4 c = col; c.w *= GImGui.Style.Alpha; return ImGui::ColorConvertFloat4ToU32(c); }
1112    ImVec2      WindowPadding() const                   { return ((Flags & ImGuiWindowFlags_ChildWindow) && !(Flags & ImGuiWindowFlags_ShowBorders)) ? ImVec2(1,1) : GImGui->Style.WindowPadding; }
1113    ImU32       Color(ImGuiCol idx, float a=1.f) const  { ImVec4 c = GImGui->Style.Colors[idx]; c.w *= GImGui->Style.Alpha * a; return ImGui::ColorConvertFloat4ToU32(c); }
1114    ImU32       Color(const ImVec4& col) const          { ImVec4 c = col; c.w *= GImGui->Style.Alpha; return ImGui::ColorConvertFloat4ToU32(c); }
10981115};
10991116
11001117static ImGuiWindow* GetCurrentWindow()
11011118{
1102    IM_ASSERT(GImGui.CurrentWindow != NULL);    // ImGui::NewFrame() hasn't been called yet?
1103    GImGui.CurrentWindow->Accessed = true;
1104    return GImGui.CurrentWindow;
1119    ImGuiState& g = *GImGui;
1120    IM_ASSERT(g.CurrentWindow != NULL);    // ImGui::NewFrame() hasn't been called yet?
1121    g.CurrentWindow->Accessed = true;
1122    return g.CurrentWindow;
11051123}
11061124
1107static void SetActiveId(ImGuiID id)
1125static void SetActiveId(ImGuiID id)
11081126{
1109    GImGui.ActiveId = id;
1127    ImGuiState& g = *GImGui;
1128    g.ActiveId = id;
11101129}
11111130
11121131static void RegisterAliveId(const ImGuiID& id)
11131132{
1114    if (GImGui.ActiveId == id)
1115        GImGui.ActiveIdIsAlive = true;
1133    ImGuiState& g = *GImGui;
1134    if (g.ActiveId == id)
1135        g.ActiveIdIsAlive = true;
11161136}
11171137
11181138//-----------------------------------------------------------------------------
r244546r244547
12431263    if (width < 0.0f)
12441264    {
12451265        ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true);
1246        width = ImMax(window->Pos.x + ImGui::GetContentRegionMax().x - window->DC.CursorPos.x - (label_size.x + GImGui.Style.ItemSpacing.x*4), 10.0f);
1266        width = ImMax(window->Pos.x + ImGui::GetContentRegionMax().x - window->DC.CursorPos.x - (label_size.x + GImGui->Style.ItemSpacing.x*4), 10.0f);
12471267    }
12481268    ImGui::PushItemWidth(width);
12491269    ImGui::InputText(label, InputBuf, IM_ARRAYSIZE(InputBuf));
r244546r244547
13221342
13231343//-----------------------------------------------------------------------------
13241344
1325// On some platform vsnprintf() takes va_list by reference and modifies it.
1345// On some platform vsnprintf() takes va_list by reference and modifies it.
13261346// va_copy is the 'correct' way to copy a va_list but Visual Studio prior to 2013 doesn't have it.
13271347#ifndef va_copy
13281348#define va_copy(dest, src) (dest = src)
r244546r244547
13631383ImGuiWindow::ImGuiWindow(const char* name)
13641384{
13651385    Name = ImStrdup(name);
1366    ID = GetID(name);
1386    ID = GetID(name);
13671387    IDStack.push_back(ID);
13681388
13691389    PosFloat = Pos = ImVec2(0.0f, 0.0f);
r244546r244547
14251445
14261446bool ImGuiWindow::FocusItemRegister(bool is_active, bool tab_stop)
14271447{
1428    ImGuiState& g = GImGui;
1448    ImGuiState& g = *GImGui;
14291449    ImGuiWindow* window = GetCurrentWindow();
14301450
14311451    const bool allow_keyboard_focus = window->DC.AllowKeyboardFocus.back();
r244546r244547
14591479
14601480void ImGuiWindow::AddToRenderList()
14611481{
1462    ImGuiState& g = GImGui;
1482    ImGuiState& g = *GImGui;
14631483
14641484    if (!DrawList->commands.empty() && !DrawList->vtx_buffer.empty())
14651485    {
r244546r244547
14701490    for (size_t i = 0; i < DC.ChildWindows.size(); i++)
14711491    {
14721492        ImGuiWindow* child = DC.ChildWindows[i];
1473        if (child->Visible)                 // clipped childs may have been marked not Visible
1493        if (child->Visible)                 // clipped children may have been marked not Visible
14741494            child->AddToRenderList();
14751495    }
14761496}
r244546r244547
14791499
14801500void* ImGui::MemAlloc(size_t sz)
14811501{
1482    return GImGui.IO.MemAllocFn(sz);
1502    return GImGui->IO.MemAllocFn(sz);
14831503}
14841504
14851505void ImGui::MemFree(void* ptr)
14861506{
1487    return GImGui.IO.MemFreeFn(ptr);
1507    return GImGui->IO.MemFreeFn(ptr);
14881508}
14891509
1490void* ImGui::MemRealloc(void* ptr, size_t sz)
1491{
1492    return GImGui.IO.MemReallocFn(ptr, sz);
1493}
1494   
14951510static ImGuiIniData* FindWindowSettings(const char* name)
14961511{
1497    ImGuiState& g = GImGui;
1512    ImGuiState& g = *GImGui;
14981513    for (size_t i = 0; i != g.Settings.size(); i++)
14991514    {
15001515        ImGuiIniData* ini = g.Settings[i];
r244546r244547
15121527    ini->Collapsed = false;
15131528    ini->Pos = ImVec2(FLT_MAX,FLT_MAX);
15141529    ini->Size = ImVec2(0,0);
1515    GImGui.Settings.push_back(ini);
1530    GImGui->Settings.push_back(ini);
15161531    return ini;
15171532}
15181533
r244546r244547
15201535// FIXME: Write something less rubbish
15211536static void LoadSettings()
15221537{
1523    ImGuiState& g = GImGui;
1538    ImGuiState& g = *GImGui;
15241539    const char* filename = g.IO.IniFilename;
15251540    if (!filename)
15261541        return;
r244546r244547
15371552        const char* line_end = line_start;
15381553        while (line_end < buf_end && *line_end != '\n' && *line_end != '\r')
15391554            line_end++;
1540       
1555
15411556        if (line_start[0] == '[' && line_end > line_start && line_end[-1] == ']')
15421557        {
15431558            char name[64];
r244546r244547
15661581
15671582static void SaveSettings()
15681583{
1569    ImGuiState& g = GImGui;
1584    ImGuiState& g = *GImGui;
15701585    const char* filename = g.IO.IniFilename;
15711586    if (!filename)
15721587        return;
r244546r244547
16051620
16061621static void MarkSettingsDirty()
16071622{
1608    ImGuiState& g = GImGui;
1623    ImGuiState& g = *GImGui;
16091624
16101625    if (g.SettingsDirtyTimer <= 0.0f)
16111626        g.SettingsDirtyTimer = g.IO.IniSavingRate;
16121627}
16131628
1629// Internal state access - if you want to share ImGui state between modules (e.g. DLL) or allocate it yourself
1630// Note that we still point to some static data and members (such as GFontAtlas), so the state instance you end up using will point to the static data within its module
1631void* ImGui::GetInternalState()
1632{
1633    return GImGui;
1634}
1635
1636size_t ImGui::GetInternalStateSize()
1637{
1638    return sizeof(ImGuiState);
1639}
1640
1641void ImGui::SetInternalState(void* state, bool construct)
1642{
1643    if (construct)
1644        new (state) ImGuiState();
1645
1646    GImGui = (ImGuiState*)state;
1647}
1648
16141649ImGuiIO& ImGui::GetIO()
16151650{
1616    return GImGui.IO;
1651    return GImGui->IO;
16171652}
16181653
16191654ImGuiStyle& ImGui::GetStyle()
16201655{
1621    return GImGui.Style;
1656    return GImGui->Style;
16221657}
16231658
16241659void ImGui::NewFrame()
16251660{
1626    ImGuiState& g = GImGui;
1661    ImGuiState& g = *GImGui;
16271662
16281663    // Check user data
16291664    IM_ASSERT(g.IO.DeltaTime > 0.0f);
r244546r244547
17021737    else
17031738        g.HoveredRootWindow = FindHoveredWindow(g.IO.MousePos, true);
17041739
1705    // Are we using inputs? Tell user so they can capture/discard them.
1706    g.IO.WantCaptureMouse = (g.HoveredWindow != NULL) || (g.ActiveId != 0);
1740    // Are we using inputs? Tell user so they can capture/discard the inputs away from the rest of their application.
1741    // When clicking outside of a window we assume the click is owned by the application and won't request capture.
1742    int mouse_earliest_button_down = -1;
1743    for (int i = 0; i < IM_ARRAYSIZE(g.IO.MouseDown); i++)
1744    {
1745        if (g.IO.MouseClicked[i])
1746            g.IO.MouseDownOwned[i] = (g.HoveredWindow != NULL);
1747        if (g.IO.MouseDown[i])
1748            if (mouse_earliest_button_down == -1 || g.IO.MouseClickedTime[mouse_earliest_button_down] > g.IO.MouseClickedTime[i])
1749                mouse_earliest_button_down = i;
1750    }
1751    bool mouse_owned_by_application = mouse_earliest_button_down != -1 && !g.IO.MouseDownOwned[mouse_earliest_button_down];
1752    g.IO.WantCaptureMouse = (!mouse_owned_by_application && g.HoveredWindow != NULL) || (g.ActiveId != 0);
17071753    g.IO.WantCaptureKeyboard = (g.ActiveId != 0);
17081754
1755    // If mouse was first clicked outside of ImGui bounds we also cancel out hovering.
1756    if (mouse_owned_by_application)
1757        g.HoveredWindow = g.HoveredRootWindow = NULL;
1758
17091759    // Scale & Scrolling
17101760    if (g.HoveredWindow && g.IO.MouseWheel != 0.0f)
17111761    {
r244546r244547
17561806
17571807    // No window should be open at the beginning of the frame.
17581808    // But in order to allow the user to call NewFrame() multiple times without calling Render(), we are doing an explicit clear.
1759    g.CurrentWindowStack.clear();
1809    g.CurrentWindowStack.resize(0);
17601810
17611811    // Create implicit window - we will only render it if the user has added something to it.
17621812    ImGui::Begin("Debug", NULL, ImVec2(400,400));
r244546r244547
17651815// NB: behaviour of ImGui after Shutdown() is not tested/guaranteed at the moment. This function is merely here to free heap allocations.
17661816void ImGui::Shutdown()
17671817{
1768    ImGuiState& g = GImGui;
1818    ImGuiState& g = *GImGui;
17691819    if (!g.Initialized)
17701820        return;
17711821
r244546r244547
18141864    g.Initialized = false;
18151865}
18161866
1867// FIXME: Add a more explicit sort order in the window structure.
1868static int ChildWindowComparer(const void* lhs, const void* rhs)
1869{
1870    const ImGuiWindow* a = *(const ImGuiWindow**)lhs;
1871    const ImGuiWindow* b = *(const ImGuiWindow**)rhs;
1872    if (int d = (a->Flags & ImGuiWindowFlags_Tooltip) - (b->Flags & ImGuiWindowFlags_Tooltip))
1873        return d;
1874    if (int d = (a->Flags & ImGuiWindowFlags_ComboBox) - (b->Flags & ImGuiWindowFlags_ComboBox))
1875        return d;
1876    return 0;
1877}
1878
18171879static void AddWindowToSortedBuffer(ImGuiWindow* window, ImVector<ImGuiWindow*>& sorted_windows)
18181880{
18191881    sorted_windows.push_back(window);
18201882    if (window->Visible)
18211883    {
1822        for (size_t i = 0; i < window->DC.ChildWindows.size(); i++)
1884        const size_t count = window->DC.ChildWindows.size();
1885        if (count > 1)
1886            qsort(window->DC.ChildWindows.begin(), count, sizeof(ImGuiWindow*), ChildWindowComparer);
1887        for (size_t i = 0; i < count; i++)
18231888        {
18241889            ImGuiWindow* child = window->DC.ChildWindows[i];
18251890            if (child->Visible)
r244546r244547
18351900    ImVec4 cr = clip_rect;
18361901    if (clipped && !window->ClipRectStack.empty())
18371902    {
1838        // Clip to new clip rect
1903        // Clip with existing clip rect
18391904        const ImVec4 cur_cr = window->ClipRectStack.back();
18401905        cr = ImVec4(ImMax(cr.x, cur_cr.x), ImMax(cr.y, cur_cr.y), ImMin(cr.z, cur_cr.z), ImMin(cr.w, cur_cr.w));
18411906    }
r244546r244547
18531918
18541919void ImGui::Render()
18551920{
1856    ImGuiState& g = GImGui;
1921    ImGuiState& g = *GImGui;
18571922    IM_ASSERT(g.Initialized);                       // Forgot to call ImGui::NewFrame()
18581923
18591924    const bool first_render_of_the_frame = (g.FrameCountRendered != g.FrameCount);
18601925    g.FrameCountRendered = g.FrameCount;
1861   
1926
18621927    if (first_render_of_the_frame)
18631928    {
18641929        // Hide implicit window if it hasn't been used
1865        IM_ASSERT(g.CurrentWindowStack.size() == 1);    // Mismatched Begin/End
1930        IM_ASSERT(g.CurrentWindowStack.size() == 1);    // Mismatched Begin/End
18661931        if (g.CurrentWindow && !g.CurrentWindow->Accessed)
18671932            g.CurrentWindow->Visible = false;
18681933        ImGui::End();
18691934
1870        // Select window for move/focus when we're done with all our widgets (we only consider non-childs windows here)
1935        // Select window for move/focus when we're done with all our widgets (we only consider non-child windows here)
18711936        if (g.ActiveId == 0 && g.HoveredId == 0 && g.HoveredRootWindow != NULL && g.IO.MouseClicked[0])
18721937            SetActiveId(g.HoveredRootWindow->GetID("#MOVE"));
18731938
18741939        // Sort the window list so that all child windows are after their parent
18751940        // We cannot do that on FocusWindow() because childs may not exist yet
1876        ImVector<ImGuiWindow*> sorted_windows;
1877        sorted_windows.reserve(g.Windows.size());
1941        g.RenderSortedWindows.resize(0);
1942        g.RenderSortedWindows.reserve(g.Windows.size());
18781943        for (size_t i = 0; i != g.Windows.size(); i++)
18791944        {
18801945            ImGuiWindow* window = g.Windows[i];
18811946            if (window->Flags & ImGuiWindowFlags_ChildWindow)           // if a child is visible its parent will add it
18821947                if (window->Visible)
18831948                    continue;
1884            AddWindowToSortedBuffer(window, sorted_windows);
1949            AddWindowToSortedBuffer(window, g.RenderSortedWindows);
18851950        }
1886        IM_ASSERT(g.Windows.size() == sorted_windows.size());           // We done something wrong
1887        g.Windows.swap(sorted_windows);
1951        IM_ASSERT(g.Windows.size() == g.RenderSortedWindows.size());    // we done something wrong
1952        g.Windows.swap(g.RenderSortedWindows);
18881953
18891954        // Clear data for next frame
18901955        g.IO.MouseWheel = 0.0f;
r244546r244547
19532018// Pass text data straight to log (without being displayed)
19542019void ImGui::LogText(const char* fmt, ...)
19552020{
1956    ImGuiState& g = GImGui;
2021    ImGuiState& g = *GImGui;
19572022    if (!g.LogEnabled)
19582023        return;
19592024
r244546r244547
19712036}
19722037
19732038// Internal version that takes a position to decide on newline placement and pad items according to their depth.
2039// We split text into individual lines to add current tree level padding
19742040static void LogText(const ImVec2& ref_pos, const char* text, const char* text_end)
19752041{
1976    ImGuiState& g = GImGui;
2042    ImGuiState& g = *GImGui;
19772043    ImGuiWindow* window = GetCurrentWindow();
19782044
19792045    if (!text_end)
r244546r244547
20302096        wrap_pos_x = ImGui::GetContentRegionMax().x;
20312097    if (wrap_pos_x > 0.0f)
20322098        wrap_pos_x += window->Pos.x; // wrap_pos_x is provided is window local space
2033   
2099
20342100    const float wrap_width = wrap_pos_x > 0.0f ? ImMax(wrap_pos_x - pos.x, 0.00001f) : 0.0f;
20352101    return wrap_width;
20362102}
20372103
2038// Internal ImGui function to render text (called from ImGui::Text(), ImGui::TextUnformatted(), etc.)
2039// RenderText() calls ImDrawList::AddText() calls ImBitmapFont::RenderText()
2040static void RenderText(ImVec2 pos, const char* text, const char* text_end, bool hide_text_after_hash, float wrap_width)
2104// Internal ImGui functions to render text
2105// RenderText***() functions calls ImDrawList::AddText() calls ImBitmapFont::RenderText()
2106static void RenderText(ImVec2 pos, const char* text, const char* text_end, bool hide_text_after_hash)
20412107{
2042    ImGuiState& g = GImGui;
2108    ImGuiState& g = *GImGui;
20432109    ImGuiWindow* window = GetCurrentWindow();
20442110
20452111    // Hide anything after a '##' string
r244546r244547
20592125    if (text_len > 0)
20602126    {
20612127        // Render
2062        window->DrawList->AddText(window->Font(), window->FontSize(), pos, window->Color(ImGuiCol_Text), text, text + text_len, wrap_width);
2128        window->DrawList->AddText(window->Font(), window->FontSize(), pos, window->Color(ImGuiCol_Text), text, text_display_end);
20632129
2064        // Log as text. We split text into individual lines to add current tree level padding
2130        // Log as text
20652131        if (g.LogEnabled)
20662132            LogText(pos, text, text_display_end);
20672133    }
20682134}
20692135
2136static void RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end, float wrap_width)
2137{
2138    ImGuiState& g = *GImGui;
2139    ImGuiWindow* window = GetCurrentWindow();
2140
2141    if (!text_end)
2142        text_end = text + strlen(text); // FIXME-OPT
2143
2144    const int text_len = (int)(text_end - text);
2145    if (text_len > 0)
2146    {
2147        // Render
2148        window->DrawList->AddText(window->Font(), window->FontSize(), pos, window->Color(ImGuiCol_Text), text, text_end, wrap_width);
2149
2150        // Log as text
2151        if (g.LogEnabled)
2152            LogText(pos, text, text_end);
2153    }
2154}
2155
2156static void RenderTextClipped(ImVec2 pos, const char* text, const char* text_end, const ImVec2* text_size_if_known, const ImVec2& clip_max)
2157{
2158    ImGuiState& g = *GImGui;
2159    ImGuiWindow* window = GetCurrentWindow();
2160
2161    // Hide anything after a '##' string
2162    const char* text_display_end = FindTextDisplayEnd(text, text_end);
2163    const int text_len = (int)(text_display_end - text);
2164    if (text_len > 0)
2165    {
2166        const ImVec2 text_size = text_size_if_known ? *text_size_if_known : ImGui::CalcTextSize(text, text_display_end, false, 0.0f);
2167
2168        // Perform CPU side clipping for single clipped element to avoid using scissor state
2169        const bool need_clipping = (pos.x + text_size.x >= clip_max.x) || (pos.y + text_size.y >= clip_max.y);
2170
2171        // Render
2172        window->DrawList->AddText(window->Font(), window->FontSize(), pos, window->Color(ImGuiCol_Text), text, text_display_end, 0.0f, need_clipping ? &clip_max : NULL);
2173
2174        // Log as text
2175        if (g.LogEnabled)
2176            LogText(pos, text, text_display_end);
2177    }
2178}
2179
20702180// Render a rectangle shaped with optional rounding and borders
20712181static void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border, float rounding)
20722182{
r244546r244547
21042214        b = center + ImVec2(-0.500f,0.866f)*r;
21052215        c = center + ImVec2(-0.500f,-0.866f)*r;
21062216    }
2107   
2217
21082218    if (shadow && (window->Flags & ImGuiWindowFlags_ShowBorders) != 0)
21092219        window->DrawList->AddTriangleFilled(a+ImVec2(2,2), b+ImVec2(2,2), c+ImVec2(2,2), window->Color(ImGuiCol_BorderShadow));
21102220    window->DrawList->AddTriangleFilled(a, b, c, window->Color(ImGuiCol_Border));
21112221}
21122222
21132223// Calculate text size. Text can be multi-line. Optionally ignore text after a ## marker.
2114// CalcTextSize("") should return ImVec2(0.0f, GImGui.FontSize)
2224// CalcTextSize("") should return ImVec2(0.0f, GImGui->FontSize)
21152225ImVec2 ImGui::CalcTextSize(const char* text, const char* text_end, bool hide_text_after_double_hash, float wrap_width)
21162226{
21172227    ImGuiWindow* window = GetCurrentWindow();
r244546r244547
21272237    ImVec2 text_size = font->CalcTextSizeA(font_size, FLT_MAX, wrap_width, text, text_display_end, NULL);
21282238
21292239    // Cancel out character spacing for the last character of a line (it is baked into glyph->XAdvance field)
2130    const float font_scale = font_size / font->FontSize;
2240    const float font_scale = font_size / font->FontSize;
21312241    const float character_spacing_x = 1.0f * font_scale;
21322242    if (text_size.x > 0.0f)
21332243        text_size.x -= character_spacing_x;
r244546r244547
21352245    return text_size;
21362246}
21372247
2248// Helper to calculate coarse clipping of large list of evenly sized items.
2249// If you are displaying thousands of items and you have a random access to the list, you can perform clipping yourself to save on CPU.
2250// {
2251//    float item_height = ImGui::GetTextLineHeightWithSpacing();
2252//    int display_start, display_end;
2253//    ImGui::CalcListClipping(count, item_height, &display_start, &display_end);            // calculate how many to clip/display
2254//    ImGui::SetCursorPosY(ImGui::GetCursorPosY() + (display_start) * item_height);         // advance cursor
2255//    for (int i = display_start; i < display_end; i++)                                     // display only visible items
2256//        // TODO: display visible item
2257//    ImGui::SetCursorPosY(ImGui::GetCursorPosY() + (count - display_end) * item_height);   // advance cursor
2258// }
2259void ImGui::CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end)
2260{
2261    ImGuiState& g = *GImGui;
2262    ImGuiWindow* window = GetCurrentWindow();
2263
2264    if (g.LogEnabled)
2265    {
2266        // If logging is active, do not perform any clipping
2267        *out_items_display_start = 0;
2268        *out_items_display_end = items_count;
2269        return;
2270    }
2271
2272    const ImVec2 pos = window->DC.CursorPos;
2273    const ImVec4 clip_rect = window->ClipRectStack.back();
2274    const float clip_y1 = clip_rect.y;
2275    const float clip_y2 = clip_rect.w;
2276
2277    int start = (int)((clip_y1 - pos.y) / items_height);
2278    int end = (int)((clip_y2 - pos.y) / items_height);
2279    start = ImClamp(start, 0, items_count);
2280    end = ImClamp(end + 1, start, items_count);
2281
2282    *out_items_display_start = start;
2283    *out_items_display_end = end;
2284}
2285
21382286// Find window given position, search front-to-back
21392287static ImGuiWindow* FindHoveredWindow(ImVec2 pos, bool excluding_childs)
21402288{
2141    ImGuiState& g = GImGui;
2289    ImGuiState& g = *GImGui;
21422290    for (int i = (int)g.Windows.size()-1; i >= 0; i--)
21432291    {
21442292        ImGuiWindow* window = g.Windows[(size_t)i];
r244546r244547
21582306// NB- Expand the aabb to be generous on imprecise inputs systems (g.Style.TouchExtraPadding)
21592307static bool IsMouseHoveringBox(const ImGuiAabb& box)
21602308{
2161    ImGuiState& g = GImGui;
2309    ImGuiState& g = *GImGui;
21622310    ImGuiWindow* window = GetCurrentWindow();
21632311
21642312    // Clip
r244546r244547
21812329
21822330bool ImGui::IsMouseHoveringWindow()
21832331{
2184    ImGuiState& g = GImGui;
2332    ImGuiState& g = *GImGui;
21852333    ImGuiWindow* window = GetCurrentWindow();
21862334    return g.HoveredWindow == window;
21872335}
21882336
21892337bool ImGui::IsMouseHoveringAnyWindow()
21902338{
2191    ImGuiState& g = GImGui;
2339    ImGuiState& g = *GImGui;
21922340    return g.HoveredWindow != NULL;
21932341}
21942342
r244546r244547
21992347
22002348static bool IsKeyPressedMap(ImGuiKey key, bool repeat)
22012349{
2202    ImGuiState& g = GImGui;
2350    ImGuiState& g = *GImGui;
22032351    const int key_index = g.IO.KeyMap[key];
22042352    return ImGui::IsKeyPressed(key_index, repeat);
22052353}
22062354
22072355bool ImGui::IsKeyPressed(int key_index, bool repeat)
22082356{
2209    ImGuiState& g = GImGui;
2357    ImGuiState& g = *GImGui;
22102358    IM_ASSERT(key_index >= 0 && key_index < IM_ARRAYSIZE(g.IO.KeysDown));
22112359    const float t = g.IO.KeysDownTime[key_index];
22122360    if (t == 0.0f)
r244546r244547
22242372
22252373bool ImGui::IsMouseClicked(int button, bool repeat)
22262374{
2227    ImGuiState& g = GImGui;
2375    ImGuiState& g = *GImGui;
22282376    IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
22292377    const float t = g.IO.MouseDownTime[button];
22302378    if (t == 0.0f)
r244546r244547
22422390
22432391bool ImGui::IsMouseDoubleClicked(int button)
22442392{
2245    ImGuiState& g = GImGui;
2393    ImGuiState& g = *GImGui;
22462394    IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
22472395    return g.IO.MouseDoubleClicked[button];
22482396}
22492397
22502398ImVec2 ImGui::GetMousePos()
22512399{
2252    return GImGui.IO.MousePos;
2400    return GImGui->IO.MousePos;
22532401}
22542402
22552403bool ImGui::IsItemHovered()
r244546r244547
22602408
22612409bool ImGui::IsItemActive()
22622410{
2263    ImGuiState& g = GImGui;
2411    ImGuiState& g = *GImGui;
22642412    if (g.ActiveId)
22652413    {
22662414        ImGuiWindow* window = GetCurrentWindow();
r244546r244547
22842432// Tooltip is stored and turned into a BeginTooltip()/EndTooltip() sequence at the end of the frame. Each call override previous value.
22852433void ImGui::SetTooltipV(const char* fmt, va_list args)
22862434{
2287    ImGuiState& g = GImGui;
2435    ImGuiState& g = *GImGui;
22882436    ImFormatStringV(g.Tooltip, IM_ARRAYSIZE(g.Tooltip), fmt, args);
22892437}
22902438
r244546r244547
22982446
22992447float ImGui::GetTime()
23002448{
2301    return GImGui.Time;
2449    return GImGui->Time;
23022450}
23032451
23042452int ImGui::GetFrameCount()
23052453{
2306    return GImGui.FrameCount;
2454    return GImGui->FrameCount;
23072455}
23082456
23092457void ImGui::BeginTooltip()
23102458{
2311    ImGuiState& g = GImGui;
2459    ImGuiState& g = *GImGui;
23122460    ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_Tooltip;
23132461    ImGui::Begin("##Tooltip", NULL, ImVec2(0,0), g.Style.Colors[ImGuiCol_TooltipBg].w, window_flags);
23142462}
r244546r244547
23192467    ImGui::End();
23202468}
23212469
2470void ImGui::BeginChild(ImGuiID id, ImVec2 size, bool border, ImGuiWindowFlags extra_flags)
2471{
2472    char str_id[32];
2473    ImFormatString(str_id, IM_ARRAYSIZE(str_id), "child_%x", id);
2474    ImGui::BeginChild(str_id, size, border, extra_flags);
2475}
2476
23222477void ImGui::BeginChild(const char* str_id, ImVec2 size, bool border, ImGuiWindowFlags extra_flags)
23232478{
2324    ImGuiState& g = GImGui;
2479    ImGuiState& g = *GImGui;
23252480    ImGuiWindow* window = GetCurrentWindow();
23262481
23272482    ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_ChildWindow;
r244546r244547
23472502    char title[256];
23482503    ImFormatString(title, IM_ARRAYSIZE(title), "%s.%s", window->Name, str_id);
23492504
2350    const float alpha = (flags & ImGuiWindowFlags_ComboBox) ? 1.0f : 0.0f;
2505    const float alpha = 1.0f;
23512506    ImGui::Begin(title, NULL, size, alpha, flags);
23522507
23532508    if (!(window->Flags & ImGuiWindowFlags_ShowBorders))
r244546r244547
23712526            sz.x = 0;
23722527        if (window->Flags & ImGuiWindowFlags_ChildWindowAutoFitY)
23732528            sz.y = 0;
2374       
2529
23752530        ImGui::End();
23762531        ItemSize(sz);
23772532    }
23782533}
23792534
2535// Helper to create a child window / scrolling region that looks like a normal widget frame.
2536void ImGui::BeginChildFrame(ImGuiID id, const ImVec2& size)
2537{
2538    ImGuiState& g = *GImGui;
2539    const ImGuiStyle& style = g.Style;
2540    ImGui::PushStyleColor(ImGuiCol_ChildWindowBg, style.Colors[ImGuiCol_FrameBg]);
2541    ImGui::PushStyleVar(ImGuiStyleVar_ChildWindowRounding, style.FrameRounding);
2542    ImGui::BeginChild(id, size);
2543}
2544
2545void ImGui::EndChildFrame()
2546{
2547    ImGui::EndChild();
2548    ImGui::PopStyleVar();
2549    ImGui::PopStyleColor();
2550}
2551
23802552static ImGuiWindow* FindWindowByName(const char* name)
23812553{
23822554    // FIXME-OPT: Consider optimizing this (e.g. sorted hashes to window pointers)
2383    ImGuiState& g = GImGui;
2555    ImGuiState& g = *GImGui;
23842556    for (size_t i = 0; i != g.Windows.size(); i++)
23852557        if (strcmp(g.Windows[i]->Name, name) == 0)
23862558            return g.Windows[i];
r244546r244547
23892561
23902562static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags)
23912563{
2392    ImGuiState& g = GImGui;
2564    ImGuiState& g = *GImGui;
23932565
23942566    // Create window the first time
23952567    ImGuiWindow* window = (ImGuiWindow*)ImGui::MemAlloc(sizeof(ImGuiWindow));
r244546r244547
24352607    return window;
24362608}
24372609
2438// Push a new ImGui window to add widgets to.
2610// Push a new ImGui window to add widgets to.
24392611// - A default window called "Debug" is automatically stacked at the beginning of every frame.
24402612// - This can be called multiple times during the frame with the same window name to append content to the same window.
24412613// - The window name is used as a unique identifier to preserve window information across frames (and save rudimentary information to the .ini file). Note that you can use ## to append unique data that isn't displayed, e.g. "My window##1" will use "My window##1" as unique window ID but display "My window" to the user.
r244546r244547
24442616// - Passing non-zero 'size' is roughly equivalent to calling SetNextWindowSize(size, ImGuiSetCondition_FirstUseEver) prior to calling Begin().
24452617bool ImGui::Begin(const char* name, bool* p_opened, ImVec2 size, float fill_alpha, ImGuiWindowFlags flags)
24462618{
2447    ImGuiState& g = GImGui;
2619    ImGuiState& g = *GImGui;
24482620    const ImGuiStyle& style = g.Style;
24492621    IM_ASSERT(g.Initialized);                       // Forgot to call ImGui::NewFrame()
24502622    IM_ASSERT(name != NULL);                        // Must pass a name
r244546r244547
26122784        // Collapse window by double-clicking on title bar
26132785        if (!(window->Flags & ImGuiWindowFlags_NoTitleBar))
26142786        {
2615            if (g.HoveredWindow == window && IsMouseHoveringBox(title_bar_aabb) && g.IO.MouseDoubleClicked[0])
2787            if (!(window->Flags & ImGuiWindowFlags_NoCollapse) && g.HoveredWindow == window && IsMouseHoveringBox(title_bar_aabb) && g.IO.MouseDoubleClicked[0])
26162788            {
26172789                window->Collapsed = !window->Collapsed;
26182790                if (!(window->Flags & ImGuiWindowFlags_NoSavedSettings))
r244546r244547
26252797            window->Collapsed = false;
26262798        }
26272799
2800        const float window_rounding = (window->Flags & ImGuiWindowFlags_ChildWindow) ? style.ChildWindowRounding : style.WindowRounding;
26282801        if (window->Collapsed)
26292802        {
26302803            // Draw title bar only
26312804            window->Size = title_bar_aabb.GetSize();
2632            window->DrawList->AddRectFilled(title_bar_aabb.GetTL(), title_bar_aabb.GetBR(), window->Color(ImGuiCol_TitleBgCollapsed), style.WindowRounding);
2805            window->DrawList->AddRectFilled(title_bar_aabb.GetTL(), title_bar_aabb.GetBR(), window->Color(ImGuiCol_TitleBgCollapsed), window_rounding);
26332806            if (window->Flags & ImGuiWindowFlags_ShowBorders)
26342807            {
2635                window->DrawList->AddRect(title_bar_aabb.GetTL()+ImVec2(1,1), title_bar_aabb.GetBR()+ImVec2(1,1), window->Color(ImGuiCol_BorderShadow), style.WindowRounding);
2636                window->DrawList->AddRect(title_bar_aabb.GetTL(), title_bar_aabb.GetBR(), window->Color(ImGuiCol_Border), style.WindowRounding);
2808                window->DrawList->AddRect(title_bar_aabb.GetTL()+ImVec2(1,1), title_bar_aabb.GetBR()+ImVec2(1,1), window->Color(ImGuiCol_BorderShadow), window_rounding);
2809                window->DrawList->AddRect(title_bar_aabb.GetTL(), title_bar_aabb.GetBR(), window->Color(ImGuiCol_Border), window_rounding);
26372810            }
26382811        }
26392812        else
r244546r244547
26962869                title_bar_aabb = window->TitleBarAabb();
26972870            }
26982871
2699            // Title bar + Window box
2872            // Scrollbar
2873            window->ScrollbarY = (window->SizeContentsFit.y > window->Size.y) && !(window->Flags & ImGuiWindowFlags_NoScrollbar);
2874
2875            // Window background
27002876            if (fill_alpha > 0.0f)
27012877            {
27022878                if ((window->Flags & ImGuiWindowFlags_ComboBox) != 0)
2703                    window->DrawList->AddRectFilled(window->Pos, window->Pos+window->Size, window->Color(ImGuiCol_ComboBg, fill_alpha), 0);
2879                    window->DrawList->AddRectFilled(window->Pos, window->Pos+window->Size, window->Color(ImGuiCol_ComboBg, fill_alpha), window_rounding);
27042880                else if ((window->Flags & ImGuiWindowFlags_Tooltip) != 0)
2705                    window->DrawList->AddRectFilled(window->Pos, window->Pos+window->Size, window->Color(ImGuiCol_TooltipBg, fill_alpha), style.WindowRounding);
2881                    window->DrawList->AddRectFilled(window->Pos, window->Pos+window->Size, window->Color(ImGuiCol_TooltipBg, fill_alpha), window_rounding);
2882                else if ((window->Flags & ImGuiWindowFlags_ChildWindow) != 0)
2883                    window->DrawList->AddRectFilled(window->Pos, window->Pos+window->Size-ImVec2(window->ScrollbarY?style.ScrollBarWidth:0.0f,0.0f), window->Color(ImGuiCol_ChildWindowBg, fill_alpha), window_rounding, window->ScrollbarY ? (1|8) : (0xF));
27062884                else
2707                    window->DrawList->AddRectFilled(window->Pos, window->Pos+window->Size, window->Color(ImGuiCol_WindowBg, fill_alpha), style.WindowRounding);
2885                    window->DrawList->AddRectFilled(window->Pos, window->Pos+window->Size, window->Color(ImGuiCol_WindowBg, fill_alpha), window_rounding);
27082886            }
27092887
2888            // Title bar
27102889            if (!(window->Flags & ImGuiWindowFlags_NoTitleBar))
2711                window->DrawList->AddRectFilled(title_bar_aabb.GetTL(), title_bar_aabb.GetBR(), window->Color(ImGuiCol_TitleBg), style.WindowRounding, 1|2);
2890                window->DrawList->AddRectFilled(title_bar_aabb.GetTL(), title_bar_aabb.GetBR(), window->Color(ImGuiCol_TitleBg), window_rounding, 1|2);
27122891
27132892            // Borders
27142893            if (window->Flags & ImGuiWindowFlags_ShowBorders)
27152894            {
2716                const float rounding = (window->Flags & ImGuiWindowFlags_ComboBox) ? 0.0f : style.WindowRounding;
2717                window->DrawList->AddRect(window->Pos+ImVec2(1,1), window->Pos+window->Size+ImVec2(1,1), window->Color(ImGuiCol_BorderShadow), rounding);
2718                window->DrawList->AddRect(window->Pos, window->Pos+window->Size, window->Color(ImGuiCol_Border), rounding);
2895                window->DrawList->AddRect(window->Pos+ImVec2(1,1), window->Pos+window->Size+ImVec2(1,1), window->Color(ImGuiCol_BorderShadow), window_rounding);
2896                window->DrawList->AddRect(window->Pos, window->Pos+window->Size, window->Color(ImGuiCol_Border), window_rounding);
27192897                if (!(window->Flags & ImGuiWindowFlags_NoTitleBar))
27202898                    window->DrawList->AddLine(title_bar_aabb.GetBL(), title_bar_aabb.GetBR(), window->Color(ImGuiCol_Border));
27212899            }
27222900
27232901            // Scrollbar
2724            window->ScrollbarY = (window->SizeContentsFit.y > window->Size.y) && !(window->Flags & ImGuiWindowFlags_NoScrollbar);
27252902            if (window->ScrollbarY)
27262903            {
27272904                ImGuiAabb scrollbar_bb(window->Aabb().Max.x - style.ScrollBarWidth, title_bar_aabb.Max.y+1, window->Aabb().Max.x, window->Aabb().Max.y-1);
r244546r244547
27432920                    {
27442921                        g.HoveredId = scrollbar_id;
27452922                        const float pos_y_norm = ImSaturate((g.IO.MousePos.y - (scrollbar_bb.Min.y + grab_size_y*0.5f)) / (scrollbar_bb.GetHeight() - grab_size_y)) * (1.0f - grab_size_y_norm);
2746                        window->ScrollY = pos_y_norm * window->SizeContentsFit.y;
2923                        window->ScrollY = (float)(int)(pos_y_norm * window->SizeContentsFit.y);
27472924                        window->NextScrollY = window->ScrollY;
27482925                    }
27492926                }
r244546r244547
27522929                const float pos_y_norm = ImSaturate(window->ScrollY / ImMax(0.0f, window->SizeContentsFit.y));
27532930                const ImU32 grab_col = window->Color(held ? ImGuiCol_ScrollbarGrabActive : hovered ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab);
27542931                window->DrawList->AddRectFilled(
2755                    ImVec2(scrollbar_bb.Min.x, ImLerp(scrollbar_bb.Min.y, scrollbar_bb.Max.y, pos_y_norm)),
2932                    ImVec2(scrollbar_bb.Min.x, ImLerp(scrollbar_bb.Min.y, scrollbar_bb.Max.y, pos_y_norm)),
27562933                    ImVec2(scrollbar_bb.Max.x, ImLerp(scrollbar_bb.Min.y, scrollbar_bb.Max.y, pos_y_norm + grab_size_y_norm)), grab_col);
27572934            }
27582935
r244546r244547
27602937            // (after the input handling so we don't have a frame of latency)
27612938            if (!(window->Flags & ImGuiWindowFlags_NoResize))
27622939            {
2763                const float r = style.WindowRounding;
2940                const float r = window_rounding;
27642941                const ImVec2 br = window->Aabb().GetBR();
27652942                if (r == 0.0f)
27662943                {
r244546r244547
27852962        window->DC.CurrentLineHeight = window->DC.PrevLineHeight = 0.0f;
27862963        window->DC.LogLineHeight = window->DC.CursorPos.y - 9999.0f;
27872964        window->DC.ChildWindows.resize(0);
2788        window->DC.ItemWidth.resize(0);
2965        window->DC.ItemWidth.resize(0);
27892966        window->DC.ItemWidth.push_back(window->ItemWidthDefault);
27902967        window->DC.AllowKeyboardFocus.resize(0);
27912968        window->DC.AllowKeyboardFocus.push_back(true);
r244546r244547
28082985        // Title bar
28092986        if (!(window->Flags & ImGuiWindowFlags_NoTitleBar))
28102987        {
2811            RenderCollapseTriangle(window->Pos + style.FramePadding, !window->Collapsed, 1.0f, true);
28122988            if (p_opened != NULL)
28132989                CloseWindowButton(p_opened);
28142990
2991            ImVec2 text_min = window->Pos + style.FramePadding;
2992            if (!(window->Flags & ImGuiWindowFlags_NoCollapse))
2993            {
2994                RenderCollapseTriangle(window->Pos + style.FramePadding, !window->Collapsed, 1.0f, true);
2995                text_min.x += window->FontSize() + style.ItemInnerSpacing.x;
2996            }
2997
28152998            const ImVec2 text_size = CalcTextSize(name, NULL, true);
2816            const ImVec2 text_min = window->Pos + style.FramePadding + ImVec2(window->FontSize() + style.ItemInnerSpacing.x, 0.0f);
2817            const ImVec2 text_max = window->Pos + ImVec2(window->Size.x - (p_opened ? (title_bar_aabb.GetHeight()-3) : style.FramePadding.x), style.FramePadding.y + text_size.y);
2818            const bool clip_title = text_size.x > (text_max.x - text_min.x);    // only push a clip rectangle if we need to, because it may turn into a separate draw call
2819            if (clip_title)
2820                PushClipRect(ImVec4(text_min.x, text_min.y, text_max.x, text_max.y));
2821            RenderText(text_min, name);
2822            if (clip_title)
2823                PopClipRect();
2999            const ImVec2 text_max = window->Pos + ImVec2(window->Size.x - (p_opened ? (title_bar_aabb.GetHeight()-3) : style.FramePadding.x), style.FramePadding.y*2 + text_size.y);
3000            RenderTextClipped(text_min, name, NULL, &text_size, text_max);
28243001        }
28253002    }
28263003
r244546r244547
28593036
28603037void ImGui::End()
28613038{
2862    ImGuiState& g = GImGui;
3039    ImGuiState& g = *GImGui;
28633040    ImGuiWindow* window = g.CurrentWindow;
28643041
28653042    ImGui::Columns(1, "#CloseColumns");
r244546r244547
28803057// Moving window to front of display (which happens to be back of our sorted list)
28813058static void FocusWindow(ImGuiWindow* window)
28823059{
2883    ImGuiState& g = GImGui;
3060    ImGuiState& g = *GImGui;
28843061    g.FocusedWindow = window;
28853062
28863063    if (g.Windows.back() == window)
r244546r244547
28983075void ImGui::PushItemWidth(float item_width)
28993076{
29003077    ImGuiWindow* window = GetCurrentWindow();
2901    item_width = (float)(int)item_width;
2902    window->DC.ItemWidth.push_back(item_width > 0.0f ? item_width : window->ItemWidthDefault);
3078    window->DC.ItemWidth.push_back(item_width == 0.0f ? window->ItemWidthDefault : item_width);
29033079}
29043080
29053081void ImGui::PopItemWidth()
r244546r244547
29083084    window->DC.ItemWidth.pop_back();
29093085}
29103086
2911float ImGui::GetItemWidth()
3087float ImGui::CalcItemWidth()
29123088{
29133089    ImGuiWindow* window = GetCurrentWindow();
2914    return window->DC.ItemWidth.back();
3090    float w = window->DC.ItemWidth.back();
3091    if (w < 0.0f)
3092    {
3093        // Align to a right-side limit. We include 1 frame padding in the calculation because this is how the width is always used (we add 2 frame padding to it), but we could move that responsibility to the widget as well.
3094        ImGuiState& g = *GImGui;
3095        w = -w;
3096        float width_to_right_edge = window->Pos.x + ImGui::GetContentRegionMax().x - window->DC.CursorPos.x;
3097        w = ImMax(1.0f, width_to_right_edge - w - g.Style.FramePadding.x * 2.0f);
3098    }
3099    w = (float)(int)w;
3100    return w;
29153101}
29163102
29173103static void SetFont(ImFont* font)
29183104{
2919    ImGuiState& g = GImGui;
3105    ImGuiState& g = *GImGui;
29203106
29213107    IM_ASSERT(font && font->IsLoaded());
29223108    IM_ASSERT(font->Scale > 0.0f);
r244546r244547
29293115
29303116void ImGui::PushFont(ImFont* font)
29313117{
2932    ImGuiState& g = GImGui;
3118    ImGuiState& g = *GImGui;
29333119
29343120    if (!font)
29353121        font = g.IO.Fonts->Fonts[0];
r244546r244547
29413127
29423128void  ImGui::PopFont()
29433129{
2944    ImGuiState& g = GImGui;
3130    ImGuiState& g = *GImGui;
29453131
29463132    g.CurrentWindow->DrawList->PopTextureID();
29473133    g.FontStack.pop_back();
r244546r244547
29743160
29753161void ImGui::PushStyleColor(ImGuiCol idx, const ImVec4& col)
29763162{
2977    ImGuiState& g = GImGui;
3163    ImGuiState& g = *GImGui;
29783164
29793165    ImGuiColMod backup;
29803166    backup.Col = idx;
r244546r244547
29853171
29863172void ImGui::PopStyleColor(int count)
29873173{
2988    ImGuiState& g = GImGui;
3174    ImGuiState& g = *GImGui;
29893175
29903176    while (count > 0)
29913177    {
r244546r244547
29983184
29993185static float* GetStyleVarFloatAddr(ImGuiStyleVar idx)
30003186{
3001    ImGuiState& g = GImGui;
3187    ImGuiState& g = *GImGui;
30023188    switch (idx)
30033189    {
30043190    case ImGuiStyleVar_Alpha: return &g.Style.Alpha;
30053191    case ImGuiStyleVar_WindowRounding: return &g.Style.WindowRounding;
3192    case ImGuiStyleVar_ChildWindowRounding: return &g.Style.ChildWindowRounding;
30063193    case ImGuiStyleVar_FrameRounding: return &g.Style.FrameRounding;
30073194    case ImGuiStyleVar_TreeNodeSpacing: return &g.Style.TreeNodeSpacing;
30083195    }
r244546r244547
30113198
30123199static ImVec2* GetStyleVarVec2Addr(ImGuiStyleVar idx)
30133200{
3014    ImGuiState& g = GImGui;
3201    ImGuiState& g = *GImGui;
30153202    switch (idx)
30163203    {
30173204    case ImGuiStyleVar_WindowPadding: return &g.Style.WindowPadding;
r244546r244547
30243211
30253212void ImGui::PushStyleVar(ImGuiStyleVar idx, float val)
30263213{
3027    ImGuiState& g = GImGui;
3214    ImGuiState& g = *GImGui;
30283215
30293216    float* pvar = GetStyleVarFloatAddr(idx);
30303217    IM_ASSERT(pvar != NULL); // Called function with wrong-type? Variable is not a float.
r244546r244547
30383225
30393226void ImGui::PushStyleVar(ImGuiStyleVar idx, const ImVec2& val)
30403227{
3041    ImGuiState& g = GImGui;
3228    ImGuiState& g = *GImGui;
30423229
30433230    ImVec2* pvar = GetStyleVarVec2Addr(idx);
30443231    IM_ASSERT(pvar != NULL); // Called function with wrong-type? Varialble is not a ImVec2.
r244546r244547
30513238
30523239void ImGui::PopStyleVar(int count)
30533240{
3054    ImGuiState& g = GImGui;
3241    ImGuiState& g = *GImGui;
30553242
30563243    while (count > 0)
30573244    {
r244546r244547
30723259    {
30733260    case ImGuiCol_Text: return "Text";
30743261    case ImGuiCol_WindowBg: return "WindowBg";
3262    case ImGuiCol_ChildWindowBg: return "ChildWindowBg";
30753263    case ImGuiCol_Border: return "Border";
30763264    case ImGuiCol_BorderShadow: return "BorderShadow";
30773265    case ImGuiCol_FrameBg: return "FrameBg";
r244546r244547
31153303
31163304bool ImGui::GetWindowIsFocused()
31173305{
3118    ImGuiState& g = GImGui;
3306    ImGuiState& g = *GImGui;
31193307    ImGuiWindow* window = GetCurrentWindow();
31203308    return g.FocusedWindow == window;
31213309}
r244546r244547
31923380
31933381void ImGui::SetNextWindowPos(const ImVec2& pos, ImGuiSetCondition cond)
31943382{
3195    ImGuiState& g = GImGui;
3383    ImGuiState& g = *GImGui;
31963384    g.SetNextWindowPosVal = pos;
31973385    g.SetNextWindowPosCond = cond ? cond : ImGuiSetCondition_Always;
31983386}
31993387
32003388void ImGui::SetNextWindowSize(const ImVec2& size, ImGuiSetCondition cond)
32013389{
3202    ImGuiState& g = GImGui;
3390    ImGuiState& g = *GImGui;
32033391    g.SetNextWindowSizeVal = size;
32043392    g.SetNextWindowSizeCond = cond ? cond : ImGuiSetCondition_Always;
32053393}
32063394
32073395void ImGui::SetNextWindowCollapsed(bool collapsed, ImGuiSetCondition cond)
32083396{
3209    ImGuiState& g = GImGui;
3397    ImGuiState& g = *GImGui;
32103398    g.SetNextWindowCollapsedVal = collapsed;
32113399    g.SetNextWindowCollapsedCond = cond ? cond : ImGuiSetCondition_Always;
32123400}
r244546r244547
32143402ImVec2 ImGui::GetContentRegionMax()
32153403{
32163404    ImGuiWindow* window = GetCurrentWindow();
3217
3218    ImVec2 m = window->Size - window->WindowPadding();
3405    ImVec2 mx = window->Size - window->WindowPadding();
32193406    if (window->DC.ColumnsCount != 1)
32203407    {
3221        m.x = GetColumnOffset(window->DC.ColumnsCurrent + 1);
3222        m.x -= GImGui.Style.WindowPadding.x;
3408        mx.x = ImGui::GetColumnOffset(window->DC.ColumnsCurrent + 1);
3409        mx.x -= GImGui->Style.WindowPadding.x;
32233410    }
32243411    else
32253412    {
32263413        if (window->ScrollbarY)
3227            m.x -= GImGui.Style.ScrollBarWidth;
3414            mx.x -= GImGui->Style.ScrollBarWidth;
32283415    }
3229
3230    return m;
3416    return mx;
32313417}
32323418
32333419ImVec2 ImGui::GetWindowContentRegionMin()
r244546r244547
32413427    ImGuiWindow* window = GetCurrentWindow();
32423428    ImVec2 m = window->Size - window->WindowPadding();
32433429    if (window->ScrollbarY)
3244        m.x -= GImGui.Style.ScrollBarWidth;
3430        m.x -= GImGui->Style.ScrollBarWidth;
32453431    return m;
32463432}
32473433
r244546r244547
32513437    return window->FontSize();
32523438}
32533439
3254float ImGui::GetTextLineSpacing()
3440float ImGui::GetTextLineHeightWithSpacing()
32553441{
3256    ImGuiState& g = GImGui;
3442    ImGuiState& g = *GImGui;
32573443    ImGuiWindow* window = GetCurrentWindow();
32583444    return window->FontSize() + g.Style.ItemSpacing.y;
32593445}
r244546r244547
32903476    return window->DC.CursorPos - window->Pos;
32913477}
32923478
3479float ImGui::GetCursorPosX()
3480{
3481    return ImGui::GetCursorPos().x;
3482}
3483
3484float ImGui::GetCursorPosY()
3485{
3486    return ImGui::GetCursorPos().y;
3487}
3488
32933489void ImGui::SetCursorPos(const ImVec2& pos)
32943490{
32953491    ImGuiWindow* window = GetCurrentWindow();
32963492    window->DC.CursorPos = window->Pos + pos;
3493    window->SizeContentsFit = ImMax(window->SizeContentsFit, pos + ImVec2(0.0f, window->ScrollY));
32973494}
32983495
32993496void ImGui::SetCursorPosX(float x)
33003497{
33013498    ImGuiWindow* window = GetCurrentWindow();
33023499    window->DC.CursorPos.x = window->Pos.x + x;
3500    window->SizeContentsFit.x = ImMax(window->SizeContentsFit.x, x);
33033501}
33043502
33053503void ImGui::SetCursorPosY(float y)
33063504{
33073505    ImGuiWindow* window = GetCurrentWindow();
33083506    window->DC.CursorPos.y = window->Pos.y + y;
3507    window->SizeContentsFit.y = ImMax(window->SizeContentsFit.y, y + window->ScrollY);
33093508}
33103509
33113510ImVec2 ImGui::GetCursorScreenPos()
r244546r244547
33963595
33973596void ImGui::TextUnformatted(const char* text, const char* text_end)
33983597{
3399    ImGuiState& g = GImGui;
3598    ImGuiState& g = *GImGui;
34003599    ImGuiWindow* window = GetCurrentWindow();
34013600    if (window->SkipItems)
34023601        return;
r244546r244547
34123611    {
34133612        // Long text!
34143613        // Perform manual coarse clipping to optimize for long multi-line text
3415        // From this point we will only compute the width of lines that are visible.
3416        // Optimization only available when word-wrapping is disabled.
3614        // From this point we will only compute the width of lines that are visible. Optimization only available when word-wrapping is disabled.
3615        // We also don't vertically center the text within the line full height, which is unlikely to matter because we are likely the biggest and only item on the line.
34173616        const char* line = text;
34183617        const float line_height = ImGui::GetTextLineHeight();
34193618        const ImVec2 start_pos = window->DC.CursorPos;
r244546r244547
34903689        if (!ItemAdd(bb, NULL))
34913690            return;
34923691
3493        // Render
3494        // We don't hide text after ## in this end-user function.
3495        RenderText(bb.Min, text_begin, text_end, false, wrap_width);
3692        // Render (we don't hide text after ## in this end-user function)
3693        RenderTextWrapped(bb.Min, text_begin, text_end, wrap_width);
34963694    }
34973695}
34983696
34993697void ImGui::AlignFirstTextHeightToWidgets()
35003698{
3501    ImGuiState& g = GImGui;
3699    ImGuiState& g = *GImGui;
35023700    ImGuiWindow* window = GetCurrentWindow();
35033701    if (window->SkipItems)
35043702        return;
r244546r244547
35113709// Add a label+text combo aligned to other label+value widgets
35123710void ImGui::LabelTextV(const char* label, const char* fmt, va_list args)
35133711{
3514    ImGuiState& g = GImGui;
3712    ImGuiState& g = *GImGui;
35153713    ImGuiWindow* window = GetCurrentWindow();
35163714    if (window->SkipItems)
35173715        return;
35183716    const ImGuiStyle& style = g.Style;
3519    const float w = window->DC.ItemWidth.back();
3717    const float w = ImGui::CalcItemWidth();
35203718
35213719    static char buf[1024];
3522    const char* text_begin = &buf[0];
3523    const char* text_end = text_begin + ImFormatStringV(buf, IM_ARRAYSIZE(buf), fmt, args);
3720    const char* value_text_begin = &buf[0];
3721    const char* value_text_end = value_text_begin + ImFormatStringV(buf, IM_ARRAYSIZE(buf), fmt, args);
35243722
35253723    const ImVec2 text_size = CalcTextSize(label, NULL, true);
35263724    const ImGuiAabb value_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w + style.FramePadding.x*2, text_size.y));
r244546r244547
35303728        return;
35313729
35323730    // Render
3533    RenderText(value_bb.Min, text_begin, text_end);
3731    RenderTextClipped(value_bb.Min, value_text_begin, value_text_end, NULL, value_bb.Max);
35343732    RenderText(ImVec2(value_bb.Max.x + style.ItemInnerSpacing.x, value_bb.Min.y), label);
35353733}
35363734
r244546r244547
35443742
35453743static bool IsHovered(const ImGuiAabb& bb, const ImGuiID& id)
35463744{
3547    ImGuiState& g = GImGui;
3745    ImGuiState& g = *GImGui;
35483746    if (g.HoveredId == 0)
35493747    {
35503748        ImGuiWindow* window = GetCurrentWindow();
r244546r244547
35543752    return false;
35553753}
35563754
3557static bool ButtonBehaviour(const ImGuiAabb& bb, const ImGuiID& id, bool* out_hovered, bool* out_held, bool allow_key_modifiers, bool repeat)
3755static bool ButtonBehaviour(const ImGuiAabb& bb, const ImGuiID& id, bool* out_hovered, bool* out_held, bool allow_key_modifiers, bool repeat, bool pressed_on_click)
35583756{
3559    ImGuiState& g = GImGui;
3757    ImGuiState& g = *GImGui;
35603758    ImGuiWindow* window = GetCurrentWindow();
35613759
35623760    const bool hovered = IsHovered(bb, id);
r244546r244547
35683766        {
35693767            if (g.IO.MouseClicked[0])
35703768            {
3571                SetActiveId(id);
3769                if (pressed_on_click)
3770                {
3771                    pressed = true;
3772                    SetActiveId(0);
3773                }
3774                else
3775                {
3776                    SetActiveId(id);
3777                }
35723778                FocusWindow(window);
35733779            }
35743780            else if (repeat && g.ActiveId && ImGui::IsMouseClicked(0, true))
r244546r244547
36013807
36023808bool ImGui::Button(const char* label, const ImVec2& size_arg, bool repeat_when_held)
36033809{
3604    ImGuiState& g = GImGui;
3810    ImGuiState& g = *GImGui;
36053811    ImGuiWindow* window = GetCurrentWindow();
36063812    if (window->SkipItems)
36073813        return false;
r244546r244547
36113817    const ImVec2 text_size = CalcTextSize(label, NULL, true);
36123818
36133819    const ImVec2 size(size_arg.x != 0.0f ? size_arg.x : text_size.x, size_arg.y != 0.0f ? size_arg.y : text_size.y);
3614
36153820    const ImGuiAabb bb(window->DC.CursorPos, window->DC.CursorPos + size + style.FramePadding*2.0f);
36163821    ItemSize(bb);
36173822    if (!ItemAdd(bb, &id))
r244546r244547
36243829    const ImU32 col = window->Color((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
36253830    RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
36263831
3627    if (size.x < text_size.x || size.y < text_size.y)
3628        PushClipRect(ImVec4(bb.Min.x+style.FramePadding.x, bb.Min.y+style.FramePadding.y, bb.Max.x, bb.Max.y-style.FramePadding.y));        // Allow extra to draw over the horizontal padding to make it visible that text doesn't fit
3629    const ImVec2 off = ImVec2(ImMax(0.0f, size.x - text_size.x) * 0.5f, ImMax(0.0f, size.y - text_size.y) * 0.5f);
3630    RenderText(bb.Min + style.FramePadding + off, label);
3631    if (size.x < text_size.x || size.y < text_size.y)
3632        PopClipRect();
3832    const ImVec2 off = ImVec2(ImMax(0.0f, size.x - text_size.x) * 0.5f, ImMax(0.0f, size.y - text_size.y) * 0.5f);  // Center (only applies if we explicitly gave a size bigger than the text size, which isn't the common path)
3833    RenderTextClipped(bb.Min + style.FramePadding + off, label, NULL, &text_size, bb.Max);                          // Render clip (only applies if we explicitly gave a size smaller than the text size, which isn't the commmon path)
36333834
36343835    return pressed;
36353836}
r244546r244547
36373838// Small buttons fits within text without additional spacing.
36383839bool ImGui::SmallButton(const char* label)
36393840{
3640    ImGuiState& g = GImGui;
3841    ImGuiState& g = *GImGui;
36413842    ImGuiWindow* window = GetCurrentWindow();
36423843    if (window->SkipItems)
36433844        return false;
r244546r244547
37403941// frame_padding = 0: no framing
37413942// frame_padding > 0: set framing size
37423943// The color used are the button colors.
3743bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, int frame_padding, const ImVec4& bg_col)
3944bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, int frame_padding, const ImVec4& bg_col, const ImVec4& tint_col)
37443945{
3745    ImGuiState& g = GImGui;
3946    ImGuiState& g = *GImGui;
37463947    ImGuiWindow* window = GetCurrentWindow();
37473948    if (window->SkipItems)
37483949        return false;
r244546r244547
37573958
37583959    const ImVec2 padding = (frame_padding >= 0) ? ImVec2((float)frame_padding, (float)frame_padding) : style.FramePadding;
37593960    const ImGuiAabb bb(window->DC.CursorPos, window->DC.CursorPos + size + padding*2);
3760    const ImGuiAabb image_bb(window->DC.CursorPos + padding, window->DC.CursorPos + padding + size);
3961    const ImGuiAabb image_bb(window->DC.CursorPos + padding, window->DC.CursorPos + padding + size);
37613962    ItemSize(bb);
37623963    if (!ItemAdd(bb, &id))
37633964        return false;
r244546r244547
37713972        RenderFrame(bb.Min, bb.Max, col);
37723973    if (bg_col.w > 0.0f)
37733974        window->DrawList->AddRectFilled(image_bb.Min, image_bb.Max, window->Color(bg_col));
3774    window->DrawList->AddImage(user_texture_id, image_bb.Min, image_bb.Max, uv0, uv1);
3975    window->DrawList->AddImage(user_texture_id, image_bb.Min, image_bb.Max, uv0, uv1, window->Color(tint_col));
37753976
37763977    return pressed;
37773978}
r244546r244547
37793980// Start logging ImGui output to TTY
37803981void ImGui::LogToTTY(int max_depth)
37813982{
3782    ImGuiState& g = GImGui;
3983    ImGuiState& g = *GImGui;
37833984    ImGuiWindow* window = GetCurrentWindow();
37843985    if (g.LogEnabled)
37853986        return;
r244546r244547
37943995// Start logging ImGui output to given file
37953996void ImGui::LogToFile(int max_depth, const char* filename)
37963997{
3797    ImGuiState& g = GImGui;
3998    ImGuiState& g = *GImGui;
37983999    ImGuiWindow* window = GetCurrentWindow();
37994000    if (g.LogEnabled)
38004001        return;
r244546r244547
38174018void ImGui::LogToClipboard(int max_depth)
38184019{
38194020    ImGuiWindow* window = GetCurrentWindow();
3820    ImGuiState& g = GImGui;
4021    ImGuiState& g = *GImGui;
38214022    if (g.LogEnabled)
38224023        return;
38234024
r244546r244547
38304031
38314032void ImGui::LogFinish()
38324033{
3833    ImGuiState& g = GImGui;
4034    ImGuiState& g = *GImGui;
38344035    if (!g.LogEnabled)
38354036        return;
38364037
r244546r244547
38554056// Helper to display logging buttons
38564057void ImGui::LogButtons()
38574058{
3858    ImGuiState& g = GImGui;
4059    ImGuiState& g = *GImGui;
38594060
38604061    ImGui::PushID("LogButtons");
38614062    const bool log_to_tty = ImGui::Button("Log To TTY");
3862    ImGui::SameLine();     
4063    ImGui::SameLine();
38634064    const bool log_to_file = ImGui::Button("Log To File");
38644065    ImGui::SameLine();
38654066    const bool log_to_clipboard = ImGui::Button("Log To Clipboard");
r244546r244547
38834084
38844085bool ImGui::CollapsingHeader(const char* label, const char* str_id, const bool display_frame, const bool default_open)
38854086{
3886    ImGuiState& g = GImGui;
4087    ImGuiState& g = *GImGui;
38874088    ImGuiWindow* window = GetCurrentWindow();
38884089    if (window->SkipItems)
38894090        return false;
r244546r244547
39294130
39304131    // When logging is enabled, if automatically expand tree nodes (but *NOT* collapsing headers.. seems like sensible behaviour).
39314132    // NB- If we are above max depth we still allow manually opened nodes to be logged.
3932    if (!display_frame)
4133    if (!display_frame)
39334134        if (g.LogEnabled && window->DC.TreeDepth < g.LogAutoExpandMaxDepth)
39344135            opened = true;
39354136
r244546r244547
39814182// Text with a little bullet aligned to the typical tree node.
39824183void ImGui::BulletTextV(const char* fmt, va_list args)
39834184{
3984    ImGuiState& g = GImGui;
4185    ImGuiState& g = *GImGui;
39854186    ImGuiWindow* window = GetCurrentWindow();
39864187    if (window->SkipItems)
39874188        return;
3988   
4189
39894190    const ImGuiStyle& style = g.Style;
39904191
39914192    static char buf[1024];
r244546r244547
41424343
41434344    float ref_v = *v;
41444345    if (op)
4145        if (sscanf(GImGui.InputTextState.InitialText, "%f", &ref_v) < 1)
4346        if (sscanf(GImGui->InputTextState.InitialText, "%f", &ref_v) < 1)
41464347            return;
41474348
41484349    float op_v = 0.0f;
r244546r244547
41674368// Adjust display_format to decorate the value with a prefix or a suffix.
41684369bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, const char* display_format, float power)
41694370{
4170    ImGuiState& g = GImGui;
4371    ImGuiState& g = *GImGui;
41714372    ImGuiWindow* window = GetCurrentWindow();
41724373    if (window->SkipItems)
41734374        return false;
41744375
41754376    const ImGuiStyle& style = g.Style;
41764377    const ImGuiID id = window->GetID(label);
4177    const float w = window->DC.ItemWidth.back();
4378    const float w = ImGui::CalcItemWidth();
41784379
41794380    if (!display_format)
41804381        display_format = "%.3f";
r244546r244547
43034504            if (!is_unbound)
43044505            {
43054506                const float normalized_pos = ImClamp((g.IO.MousePos.x - slider_effective_x1) / slider_effective_w, 0.0f, 1.0f);
4306               
4507
43074508                // Linear slider
43084509                //float new_value = ImLerp(v_min, v_max, normalized_pos);
43094510
r244546r244547
44074608// Add multiple sliders on 1 line for compact edition of multiple components
44084609static bool SliderFloatN(const char* label, float v[3], int components, float v_min, float v_max, const char* display_format, float power)
44094610{
4410    ImGuiState& g = GImGui;
4611    ImGuiState& g = *GImGui;
44114612    ImGuiWindow* window = GetCurrentWindow();
44124613    if (window->SkipItems)
44134614        return false;
44144615
44154616    const ImGuiStyle& style = g.Style;
4416    const float w_full = window->DC.ItemWidth.back();
4617    const float w_full = ImGui::CalcItemWidth();
44174618    const float w_item_one  = ImMax(1.0f, (float)(int)((w_full - (style.FramePadding.x*2.0f + style.ItemInnerSpacing.x)*(components-1)) / (float)components));
44184619    const float w_item_last = ImMax(1.0f, (float)(int)(w_full - (w_item_one + style.FramePadding.x*2.0f + style.ItemInnerSpacing.x)*(components-1)));
44194620
r244546r244547
44574658
44584659static bool SliderIntN(const char* label, int v[3], int components, int v_min, int v_max, const char* display_format)
44594660{
4460    ImGuiState& g = GImGui;
4661    ImGuiState& g = *GImGui;
44614662    ImGuiWindow* window = GetCurrentWindow();
44624663    if (window->SkipItems)
44634664        return false;
44644665
44654666    const ImGuiStyle& style = g.Style;
4466    const float w_full = window->DC.ItemWidth.back();
4667    const float w_full = ImGui::CalcItemWidth();
44674668    const float w_item_one  = ImMax(1.0f, (float)(int)((w_full - (style.FramePadding.x*2.0f + style.ItemInnerSpacing.x)*(components-1)) / (float)components));
44684669    const float w_item_last = ImMax(1.0f, (float)(int)(w_full - (w_item_one + style.FramePadding.x*2.0f + style.ItemInnerSpacing.x)*(components-1)));
44694670
r244546r244547
45134714
45144715static void Plot(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size)
45154716{
4516    ImGuiState& g = GImGui;
4717    ImGuiState& g = *GImGui;
45174718    ImGuiWindow* window = GetCurrentWindow();
45184719    if (window->SkipItems)
45194720        return;
r244546r244547
45224723
45234724    const ImVec2 text_size = ImGui::CalcTextSize(label, NULL, true);
45244725    if (graph_size.x == 0.0f)
4525        graph_size.x = window->DC.ItemWidth.back();
4726        graph_size.x = ImGui::CalcItemWidth();
45264727    if (graph_size.y == 0.0f)
45274728        graph_size.y = text_size.y;
45284729
r244546r244547
45634764        const float t = ImClamp((g.IO.MousePos.x - graph_bb.Min.x) / (graph_bb.Max.x - graph_bb.Min.x), 0.0f, 0.9999f);
45644765        const int v_idx = (int)(t * (values_count + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0)));
45654766        IM_ASSERT(v_idx >= 0 && v_idx < values_count);
4566       
4767
45674768        const float v0 = values_getter(data, (v_idx + values_offset) % values_count);
45684769        const float v1 = values_getter(data, (v_idx + 1 + values_offset) % values_count);
45694770        if (plot_type == ImGuiPlotType_Lines)
r244546r244547
46464847
46474848bool ImGui::Checkbox(const char* label, bool* v)
46484849{
4649    ImGuiState& g = GImGui;
4850    ImGuiState& g = *GImGui;
46504851    ImGuiWindow* window = GetCurrentWindow();
46514852    if (window->SkipItems)
46524853        return false;
r244546r244547
47044905
47054906bool ImGui::RadioButton(const char* label, bool active)
47064907{
4707    ImGuiState& g = GImGui;
4908    ImGuiState& g = *GImGui;
47084909    ImGuiWindow* window = GetCurrentWindow();
47094910    if (window->SkipItems)
47104911        return false;
r244546r244547
48355036#endif
48365037
48375038void ImGuiTextEditState::OnKeyPressed(int key)
4838{
4839    stb_textedit_key(this, &StbState, key);
4840    CursorAnimReset();
5039{
5040    stb_textedit_key(this, &StbState, key);
5041    CursorAnimReset();
48415042}
48425043
48435044void ImGuiTextEditState::UpdateScrollOffset()
r244546r244547
48465047    const float scroll_x_increment = Width * 0.25f;
48475048    const float cursor_offset_x = Font->CalcTextSizeW(FontSize, FLT_MAX, Text, Text+StbState.cursor, NULL).x;
48485049    if (ScrollX > cursor_offset_x)
4849        ScrollX = ImMax(0.0f, cursor_offset_x - scroll_x_increment);   
5050        ScrollX = ImMax(0.0f, cursor_offset_x - scroll_x_increment);
48505051    else if (ScrollX < cursor_offset_x - Width)
48515052        ScrollX = cursor_offset_x - Width + scroll_x_increment;
48525053}
r244546r244547
49025103    const float clip_end = (text_end[0] != '\0' && text_end > text_start) ? symbol_w : 0.0f;
49035104
49045105    // Draw text
4905    RenderText(pos+ImVec2(clip_begin,0), text_start+(clip_begin>0.0f?1:0), text_end-(clip_end>0.0f?1:0), false);//, &text_params_with_clipping);
5106    RenderText(pos+ImVec2(clip_begin,0), text_start+(clip_begin>0.0f?1:0), text_end-(clip_end>0.0f?1:0), false);
49065107
49075108    // Draw the clip symbol
49085109    const char s[2] = {symbol_c,'\0'};
r244546r244547
49145115
49155116bool ImGui::InputFloat(const char* label, float *v, float step, float step_fast, int decimal_precision, ImGuiInputTextFlags extra_flags)
49165117{
4917    ImGuiState& g = GImGui;
5118    ImGuiState& g = *GImGui;
49185119    ImGuiWindow* window = GetCurrentWindow();
49195120    if (window->SkipItems)
49205121        return false;
49215122
49225123    const ImGuiStyle& style = g.Style;
4923    const float w = window->DC.ItemWidth.back();
5124    const float w = ImGui::CalcItemWidth();
49245125    const ImVec2 text_size = CalcTextSize(label, NULL, true);
49255126    const ImGuiAabb frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, text_size.y) + style.FramePadding*2.0f);
49265127
r244546r244547
50265227    if (c < 128 && c != ' ' && !isprint((int)(c & 0xFF)))
50275228        return true;
50285229
5230    if (c >= 0xE000 && c <= 0xF8FF) // Filter private Unicode range. I don't imagine anybody would want to input them. GLFW on OSX seems to send private characters for special keys like arrow keys.
5231        return true;
5232
50295233    if (flags & ImGuiInputTextFlags_CharsDecimal)
50305234        if (!(c >= '0' && c <= '9') && (c != '.') && (c != '-') && (c != '+') && (c != '*') && (c != '/'))
50315235            return true;
r244546r244547
50405244// Edit a string of text
50415245bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags, void (*callback)(ImGuiTextEditCallbackData*), void* user_data)
50425246{
5043    ImGuiState& g = GImGui;
5247    ImGuiState& g = *GImGui;
50445248    ImGuiWindow* window = GetCurrentWindow();
50455249    if (window->SkipItems)
50465250        return false;
r244546r244547
50495253    const ImGuiStyle& style = g.Style;
50505254
50515255    const ImGuiID id = window->GetID(label);
5052    const float w = window->DC.ItemWidth.back();
5256    const float w = ImGui::CalcItemWidth();
50535257
50545258    const ImVec2 text_size = CalcTextSize(label, NULL, true);
50555259    const ImGuiAabb frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, text_size.y) + style.FramePadding*2.0f);
r244546r244547
50815285            ImTextStrFromUtf8(edit_state.Text, IM_ARRAYSIZE(edit_state.Text), buf, NULL);
50825286            edit_state.ScrollX = 0.0f;
50835287            edit_state.Width = w;
5084            stb_textedit_initialize_state(&edit_state.StbState, true);
5288            stb_textedit_initialize_state(&edit_state.StbState, true);
50855289            edit_state.CursorAnimReset();
50865290            edit_state.LastCursorPos = ImVec2(-1.f,-1.f);
50875291
r244546r244547
51105314        edit_state.BufSize = buf_size < IM_ARRAYSIZE(edit_state.Text) ? buf_size : IM_ARRAYSIZE(edit_state.Text);
51115315        edit_state.Font = window->Font();
51125316        edit_state.FontSize = window->FontSize();
5113   
5317
51145318        const float mx = g.IO.MousePos.x - frame_bb.Min.x - style.FramePadding.x;
51155319        const float my = window->FontSize()*0.5f;   // Flatten mouse because we are doing a single-line edit
51165320
r244546r244547
52865490            }
52875491        }
52885492    }
5289   
5493
52905494    RenderFrame(frame_bb.Min, frame_bb.Max, window->Color(ImGuiCol_FrameBg), true, style.FrameRounding);
52915495
52925496    const ImVec2 font_off_up = ImVec2(0.0f,window->FontSize()+1.0f);    // FIXME: those offsets are part of the style or font API
r244546r244547
53155519        // Draw blinking cursor
53165520        if (g.InputTextState.CursorIsVisible())
53175521            window->DrawList->AddRect(cursor_pos - font_off_up + ImVec2(0,2), cursor_pos + font_off_dn - ImVec2(0,3), window->Color(ImGuiCol_Text));
5318       
5522
53195523        // Notify OS of text input position
53205524        if (io.ImeSetInputScreenPosFn && ImLengthSqr(edit_state.LastCursorPos - cursor_pos) > 0.0001f)
53215525            io.ImeSetInputScreenPosFn((int)cursor_pos.x - 1, (int)(cursor_pos.y - window->FontSize()));   // -1 x offset so that Windows IME can cover our cursor. Bit of an extra nicety.
r244546r244547
53335537
53345538static bool InputFloatN(const char* label, float* v, int components, int decimal_precision)
53355539{
5336    ImGuiState& g = GImGui;
5540    ImGuiState& g = *GImGui;
53375541    ImGuiWindow* window = GetCurrentWindow();
53385542    if (window->SkipItems)
53395543        return false;
53405544
53415545    const ImGuiStyle& style = g.Style;
5342    const float w_full = window->DC.ItemWidth.back();
5546    const float w_full = ImGui::CalcItemWidth();
53435547    const float w_item_one  = ImMax(1.0f, (float)(int)((w_full - (style.FramePadding.x*2.0f + style.ItemInnerSpacing.x) * (components-1)) / (float)components));
53445548    const float w_item_last = ImMax(1.0f, (float)(int)(w_full - (w_item_one + style.FramePadding.x*2.0f + style.ItemInnerSpacing.x) * (components-1)));
53455549
r244546r244547
53815585    return InputFloatN(label, v, 4, decimal_precision);
53825586}
53835587
5384static bool Combo_ArrayGetter(void* data, int idx, const char** out_text)
5588static bool Items_ArrayGetter(void* data, int idx, const char** out_text)
53855589{
53865590    const char** items = (const char**)data;
53875591    if (out_text)
r244546r244547
53895593    return true;
53905594}
53915595
5392// Combo box helper allowing to pass an array of strings.
5393bool ImGui::Combo(const char* label, int* current_item, const char** items, int items_count, int popup_height_items)
5596static bool Items_SingleStringGetter(void* data, int idx, const char** out_text)
53945597{
5395    const bool value_changed = Combo(label, current_item, Combo_ArrayGetter, (void*)items, items_count, popup_height_items);
5396    return value_changed;
5397}
5398
5399static bool Combo_StringListGetter(void* data, int idx, const char** out_text)
5400{
5401    // FIXME-OPT: we could precompute the indices to fasten this. But only 1 active combo means the waste is limited.
5598    // FIXME-OPT: we could pre-compute the indices to fasten this. But only 1 active combo means the waste is limited.
54025599    const char* items_separated_by_zeros = (const char*)data;
54035600    int items_count = 0;
54045601    const char* p = items_separated_by_zeros;
r244546r244547
54165613    return true;
54175614}
54185615
5616// Combo box helper allowing to pass an array of strings.
5617bool ImGui::Combo(const char* label, int* current_item, const char** items, int items_count, int height_in_items)
5618{
5619    const bool value_changed = Combo(label, current_item, Items_ArrayGetter, (void*)items, items_count, height_in_items);
5620    return value_changed;
5621}
5622
54195623// Combo box helper allowing to pass all items in a single string.
5420bool ImGui::Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int popup_height_items)
5624bool ImGui::Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int height_in_items)
54215625{
54225626    int items_count = 0;
5423    const char* p = items_separated_by_zeros;
5627    const char* p = items_separated_by_zeros;       // FIXME-OPT: Avoid computing this
54245628    while (*p)
54255629    {
54265630        p += strlen(p) + 1;
54275631        items_count++;
54285632    }
5429    bool value_changed = Combo(label, current_item, Combo_StringListGetter, (void*)items_separated_by_zeros, items_count, popup_height_items);
5633    bool value_changed = Combo(label, current_item, Items_SingleStringGetter, (void*)items_separated_by_zeros, items_count, height_in_items);
54305634    return value_changed;
54315635}
54325636
54335637// Combo box function.
5434bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(void*, int, const char**), void* data, int items_count, int popup_height_items)
5638bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(void*, int, const char**), void* data, int items_count, int height_in_items)
54355639{
5436    ImGuiState& g = GImGui;
5640    ImGuiState& g = *GImGui;
54375641    ImGuiWindow* window = GetCurrentWindow();
54385642    if (window->SkipItems)
54395643        return false;
54405644
54415645    const ImGuiStyle& style = g.Style;
54425646    const ImGuiID id = window->GetID(label);
5443    const float w = window->DC.ItemWidth.back();
5647    const float w = ImGui::CalcItemWidth();
54445648
54455649    const ImVec2 text_size = CalcTextSize(label, NULL, true);
54465650    const ImGuiAabb frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, text_size.y) + style.FramePadding*2.0f);
r244546r244547
54535657    const bool hovered = IsHovered(frame_bb, id);
54545658
54555659    bool value_changed = false;
5660    const ImGuiAabb value_bb(frame_bb.Min, frame_bb.Max - ImVec2(arrow_size, 0.0f));
54565661    RenderFrame(frame_bb.Min, frame_bb.Max, window->Color(ImGuiCol_FrameBg), true, style.FrameRounding);
54575662    RenderFrame(ImVec2(frame_bb.Max.x-arrow_size, frame_bb.Min.y), frame_bb.Max, window->Color(hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button), true, style.FrameRounding);   // FIXME-ROUNDING
54585663    RenderCollapseTriangle(ImVec2(frame_bb.Max.x-arrow_size, frame_bb.Min.y) + style.FramePadding, true);
r244546r244547
54615666    {
54625667        const char* item_text;
54635668        if (items_getter(data, *current_item, &item_text))
5464            RenderText(frame_bb.Min + style.FramePadding, item_text, NULL, false);
5669            RenderTextClipped(frame_bb.Min + style.FramePadding, item_text, NULL, NULL, value_bb.Max);
54655670    }
54665671
54675672    // Empty text doesn't add padding
r244546r244547
54845689                FocusWindow(window);
54855690        }
54865691    }
5487   
5692
54885693    if (g.ActiveComboID == id)
54895694    {
5695        // Size default to hold ~7 items
5696        if (height_in_items < 0)
5697            height_in_items = 7;
5698
54905699        const ImVec2 backup_pos = ImGui::GetCursorPos();
54915700        const float popup_off_x = 0.0f;//style.ItemInnerSpacing.x;
5492        const float popup_height = (text_size.y + style.ItemSpacing.y) * ImMin(items_count, popup_height_items) + style.WindowPadding.y;
5701        const float popup_height = (text_size.y + style.ItemSpacing.y) * ImMin(items_count, height_in_items) + style.WindowPadding.y;
54935702        const ImGuiAabb popup_aabb(ImVec2(frame_bb.Min.x+popup_off_x, frame_bb.Max.y), ImVec2(frame_bb.Max.x+popup_off_x, frame_bb.Max.y + popup_height));
54945703        ImGui::SetCursorPos(popup_aabb.Min - window->Pos);
54955704
54965705        const ImGuiWindowFlags flags = ImGuiWindowFlags_ComboBox | ((window->Flags & ImGuiWindowFlags_ShowBorders) ? ImGuiWindowFlags_ShowBorders : 0);
54975706        ImGui::BeginChild("#ComboBox", popup_aabb.GetSize(), false, flags);
5498        ImGuiWindow* child_window = GetCurrentWindow();
54995707        ImGui::Spacing();
55005708
55015709        bool combo_item_active = false;
5502        combo_item_active |= (g.ActiveId == child_window->GetID("#SCROLLY"));
5710        combo_item_active |= (g.ActiveId == GetCurrentWindow()->GetID("#SCROLLY"));
55035711
55045712        // Display items
5505        for (int item_idx = 0; item_idx < items_count; item_idx++)
5713        for (int i = 0; i < items_count; i++)
55065714        {
5507            const float item_h = child_window->FontSize();
5508            const float spacing_up = (float)(int)(style.ItemSpacing.y/2);
5509            const float spacing_dn = style.ItemSpacing.y - spacing_up;
5510            const ImGuiAabb item_aabb(ImVec2(popup_aabb.Min.x, child_window->DC.CursorPos.y - spacing_up), ImVec2(popup_aabb.Max.x, child_window->DC.CursorPos.y + item_h + spacing_dn));
5511            const ImGuiID item_id = child_window->GetID((void*)(intptr_t)item_idx);
5512
5513            bool item_hovered, item_held;
5514            bool item_pressed = ButtonBehaviour(item_aabb, item_id, &item_hovered, &item_held, true);
5515            bool item_selected = (item_idx == *current_item);
5516
5517            if (item_hovered || item_selected)
5518            {
5519                const ImU32 col = window->Color((item_held && item_hovered) ? ImGuiCol_HeaderActive : item_hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
5520                RenderFrame(item_aabb.Min, item_aabb.Max, col, false);
5521            }
5522
5715            ImGui::PushID((void*)(intptr_t)i);
5716            const bool item_selected = (i == *current_item);
55235717            const char* item_text;
5524            if (!items_getter(data, item_idx, &item_text))
5718            if (!items_getter(data, i, &item_text))
55255719                item_text = "*Unknown item*";
5526            ImGui::TextUnformatted(item_text);
5527           
5528            if (item_selected)
5720            if (ImGui::Selectable(item_text, item_selected))
55295721            {
5530                if (menu_toggled)
5531                    ImGui::SetScrollPosHere();
5532            }
5533            if (item_pressed)
5534            {
55355722                SetActiveId(0);
55365723                g.ActiveComboID = 0;
55375724                value_changed = true;
5538                *current_item = item_idx;
5725                *current_item = i;
55395726            }
5540
5541            combo_item_active |= (g.ActiveId == item_id);
5727            if (item_selected && menu_toggled)
5728                ImGui::SetScrollPosHere();
5729            combo_item_active |= ImGui::IsItemActive();
5730            ImGui::PopID();
55425731        }
55435732        ImGui::EndChild();
55445733        ImGui::SetCursorPos(backup_pos);
5545       
5734
55465735        if (!combo_item_active && g.ActiveId != 0)
55475736            g.ActiveComboID = 0;
55485737    }
r244546r244547
55525741    return value_changed;
55535742}
55545743
5744// Tip: pass an empty label (e.g. "##dummy") then you can use the space to draw other text or image.
5745// But you need to make sure the ID is unique, e.g. enclose calls in PushID/PopID.
5746bool ImGui::Selectable(const char* label, bool selected, const ImVec2& size_arg)
5747{
5748    ImGuiState& g = *GImGui;
5749    ImGuiWindow* window = GetCurrentWindow();
5750    if (window->SkipItems)
5751        return false;
5752
5753    const ImGuiStyle& style = g.Style;
5754    const ImGuiID id = window->GetID(label);
5755    const ImVec2 text_size = CalcTextSize(label, NULL, true);
5756
5757    const float w = window->Pos.x + ImGui::GetContentRegionMax().x - window->DC.CursorPos.x;
5758    const ImVec2 size(size_arg.x != 0.0f ? size_arg.x : w, size_arg.y != 0.0f ? size_arg.y : text_size.y);
5759    const ImGuiAabb bb(window->DC.CursorPos, window->DC.CursorPos + size);
5760    ItemSize(bb);
5761
5762    // Selectables are meant to be tightly packed together. So for both rendering and collision we extend to compensate for spacing.
5763    ImGuiAabb bb_with_spacing = bb;
5764    const float spacing_L = (float)(int)(style.ItemSpacing.x * 0.5f);
5765    const float spacing_U = (float)(int)(style.ItemSpacing.y * 0.5f);
5766    const float spacing_R = style.ItemSpacing.x - spacing_L;
5767    const float spacing_D = style.ItemSpacing.y - spacing_U;
5768    bb_with_spacing.Min.x -= spacing_L;
5769    bb_with_spacing.Min.y -= spacing_U;
5770    bb_with_spacing.Max.x += spacing_R;
5771    bb_with_spacing.Max.y += spacing_D;
5772    if (!ItemAdd(bb_with_spacing, &id))
5773        return false;
5774
5775    bool hovered, held;
5776    bool pressed = ButtonBehaviour(bb_with_spacing, id, &hovered, &held, true, false, false);
5777
5778    // Render
5779    if (hovered || selected)
5780    {
5781        const ImU32 col = window->Color((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
5782        RenderFrame(bb_with_spacing.Min, bb_with_spacing.Max, col, false, style.FrameRounding);
5783    }
5784
5785    //const ImVec2 off = ImVec2(ImMax(0.0f, size.x - text_size.x) * 0.5f, ImMax(0.0f, size.y - text_size.y) * 0.5f);
5786    RenderTextClipped(bb.Min, label, NULL, &text_size, bb_with_spacing.Max);
5787
5788    return pressed;
5789}
5790
5791bool ImGui::Selectable(const char* label, bool* p_selected, const ImVec2& size_arg)
5792{
5793    if (ImGui::Selectable(label, *p_selected, size_arg))
5794    {
5795        *p_selected = !*p_selected;
5796        return true;
5797    }
5798    return false;
5799}
5800
5801// Helper to calculate the size of a listbox and display a label on the right.
5802// Tip: To have a list filling the entire window width, PushItemWidth(-1) and pass an empty label "##empty"
5803bool ImGui::ListBoxHeader(const char* label, const ImVec2& size_arg)
5804{
5805    ImGuiWindow* window = GetCurrentWindow();
5806    if (window->SkipItems)
5807        return false;
5808
5809    const ImGuiStyle& style = ImGui::GetStyle();
5810    const ImGuiID id = ImGui::GetID(label);
5811    const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true);
5812
5813    // Size default to hold ~7 items. Fractional number of items helps seeing that we can scroll down/up without looking at scrollbar.
5814    ImVec2 size;
5815    size.x = (size_arg.x != 0.0f) ? size_arg.x : ImGui::CalcItemWidth() + style.FramePadding.x * 2.0f;
5816    size.y = (size_arg.y != 0.0f) ? size_arg.y : ImGui::GetTextLineHeightWithSpacing() * 7.4f + style.ItemSpacing.y;
5817    const ImVec2 frame_size = ImVec2(size.x, ImMax(size.y, label_size.y));
5818    const ImGuiAabb frame_bb(window->DC.CursorPos, window->DC.CursorPos + frame_size);
5819
5820    if (label_size.x > 0)
5821        RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
5822
5823    ImGui::BeginChildFrame(id, frame_bb.GetSize());
5824    return true;
5825}
5826
5827bool ImGui::ListBoxHeader(const char* label, int items_count, int height_in_items)
5828{
5829    // Size default to hold ~7 items. Fractional number of items helps seeing that we can scroll down/up without looking at scrollbar.
5830    // However we don't add +0.40f if items_count <= height_in_items. It is slightly dodgy, because it means a dynamic list of items will make the widget resize occasionally when it crosses that size.
5831    // I am expecting that someone will come and complain about this behavior in a remote future, then we can advise on a better solution.
5832    if (height_in_items < 0)
5833        height_in_items = ImMin(items_count, 7);
5834    float height_in_items_f = height_in_items < items_count ? (height_in_items + 0.40f) : (height_in_items + 0.00f);
5835
5836    // We include ItemSpacing.y so that a list sized for the exact number of items doesn't make a scrollbar appears. We could also enforce that by passing a flag to BeginChild().
5837    ImVec2 size;
5838    size.x = 0.0f;
5839    size.y = ImGui::GetTextLineHeightWithSpacing() * height_in_items_f + ImGui::GetStyle().ItemSpacing.y;
5840    return ImGui::ListBoxHeader(label, size);
5841}
5842
5843void ImGui::ListBoxFooter()
5844{
5845    ImGui::EndChildFrame();
5846}
5847
5848bool ImGui::ListBox(const char* label, int* current_item, const char** items, int items_count, int height_items)
5849{
5850    const bool value_changed = ListBox(label, current_item, Items_ArrayGetter, (void*)items, items_count, height_items);
5851    return value_changed;
5852}
5853
5854bool ImGui::ListBox(const char* label, int* current_item, bool (*items_getter)(void*, int, const char**), void* data, int items_count, int height_in_items)
5855{
5856    if (!ImGui::ListBoxHeader(label, items_count, height_in_items))
5857        return false;
5858
5859    bool value_changed = false;
5860    for (int i = 0; i < items_count; i++)
5861    {
5862        const bool item_selected = (i == *current_item);
5863        const char* item_text;
5864        if (!items_getter(data, i, &item_text))
5865            item_text = "*Unknown item*";
5866
5867        ImGui::PushID(i);
5868        if (ImGui::Selectable(item_text, item_selected))
5869        {
5870            *current_item = i;
5871            value_changed = true;
5872        }
5873        ImGui::PopID();
5874    }
5875
5876    ImGui::ListBoxFooter();
5877    return value_changed;
5878}
5879
55555880// A little colored square. Return true when clicked.
55565881bool ImGui::ColorButton(const ImVec4& col, bool small_height, bool outline_border)
55575882{
5558    ImGuiState& g = GImGui;
5883    ImGuiState& g = *GImGui;
55595884    ImGuiWindow* window = GetCurrentWindow();
55605885    if (window->SkipItems)
55615886        return false;
r244546r244547
56025927// Use CTRL-Click to input value and TAB to go to next item.
56035928bool ImGui::ColorEdit4(const char* label, float col[4], bool alpha)
56045929{
5605    ImGuiState& g = GImGui;
5930    ImGuiState& g = *GImGui;
56065931    ImGuiWindow* window = GetCurrentWindow();
56075932    if (window->SkipItems)
56085933        return false;
56095934
56105935    const ImGuiStyle& style = g.Style;
56115936    const ImGuiID id = window->GetID(label);
5612    const float w_full = window->DC.ItemWidth.back();
5937    const float w_full = ImGui::CalcItemWidth();
56135938    const float square_sz = (window->FontSize() + style.FramePadding.x * 2.0f);
56145939
56155940    ImGuiColorEditMode edit_mode = window->DC.ColorEditMode;
r244546r244547
56816006            value_changed |= ImGui::InputText("##Text", buf, IM_ARRAYSIZE(buf), ImGuiInputTextFlags_CharsHexadecimal);
56826007            ImGui::PopItemWidth();
56836008            char* p = buf;
5684            while (*p == '#' || *p == ' ' || *p == '\t')
6009            while (*p == '#' || *p == ' ' || *p == '\t')
56856010                p++;
56866011
56876012            // Treat at unsigned (%X is unsigned)
r244546r244547
57856110// Advance cursor given item size.
57866111static void ItemSize(ImVec2 size, ImVec2* adjust_vertical_offset)
57876112{
5788    ImGuiState& g = GImGui;
6113    ImGuiState& g = *GImGui;
57896114    ImGuiWindow* window = GetCurrentWindow();
57906115    if (window->SkipItems)
57916116        return;
r244546r244547
58046129    window->DC.CurrentLineHeight = 0.0f;
58056130}
58066131
5807static void ItemSize(const ImGuiAabb& aabb, ImVec2* adjust_start_offset)
5808{
5809    ItemSize(aabb.GetSize(), adjust_start_offset);
6132static void ItemSize(const ImGuiAabb& aabb, ImVec2* adjust_start_offset)
6133{
6134    ItemSize(aabb.GetSize(), adjust_start_offset);
58106135}
58116136
58126137static bool IsClipped(const ImGuiAabb& bb)
58136138{
5814    ImGuiState& g = GImGui;
6139    ImGuiState& g = *GImGui;
58156140    ImGuiWindow* window = GetCurrentWindow();
58166141
58176142    if (!bb.Overlaps(ImGuiAabb(window->ClipRectStack.back())) && !g.LogEnabled)
r244546r244547
58466171//      spacing_w >= 0  : enforce spacing
58476172void ImGui::SameLine(int column_x, int spacing_w)
58486173{
5849    ImGuiState& g = GImGui;
6174    ImGuiState& g = *GImGui;
58506175    ImGuiWindow* window = GetCurrentWindow();
58516176    if (window->SkipItems)
58526177        return;
5853   
6178
58546179    float x, y;
58556180    if (column_x != 0)
58566181    {
r244546r244547
58706195
58716196void ImGui::NextColumn()
58726197{
5873    ImGuiState& g = GImGui;
6198    ImGuiState& g = *GImGui;
58746199    ImGuiWindow* window = GetCurrentWindow();
58756200    if (window->SkipItems)
58766201        return;
r244546r244547
59006225    }
59016226}
59026227
6228// FIMXE-OPT: This is called too often. We need to cache offset for active columns set.
59036229float ImGui::GetColumnOffset(int column_index)
59046230{
5905    ImGuiState& g = GImGui;
6231    ImGuiState& g = *GImGui;
59066232    ImGuiWindow* window = GetCurrentWindow();
59076233    if (column_index < 0)
59086234        column_index = window->DC.ColumnsCurrent;
r244546r244547
59186244
59196245void ImGui::SetColumnOffset(int column_index, float offset)
59206246{
5921    ImGuiState& g = GImGui;
6247    ImGuiState& g = *GImGui;
59226248    ImGuiWindow* window = GetCurrentWindow();
59236249    if (column_index < 0)
59246250        column_index = window->DC.ColumnsCurrent;
r244546r244547
59516277
59526278void ImGui::Columns(int columns_count, const char* id, bool border)
59536279{
5954    ImGuiState& g = GImGui;
6280    ImGuiState& g = *GImGui;
59556281    ImGuiWindow* window = GetCurrentWindow();
59566282    if (window->SkipItems)
59576283        return;
r244546r244547
59756301        for (int i = 1; i < window->DC.ColumnsCount; i++)
59766302        {
59776303            float x = window->Pos.x + GetColumnOffset(i);
5978           
6304
59796305            const ImGuiID column_id = window->DC.ColumnsSetID + ImGuiID(i);
59806306            const ImGuiAabb column_aabb(ImVec2(x-4,y1),ImVec2(x+4,y2));
59816307
r244546r244547
60196345
60206346void ImGui::TreePush(const char* str_id)
60216347{
6022    ImGuiState& g = GImGui;
6348    ImGuiState& g = *GImGui;
60236349    ImGuiWindow* window = GetCurrentWindow();
60246350    window->DC.ColumnsStartX += g.Style.TreeNodeSpacing;
60256351    window->DC.CursorPos.x = window->Pos.x + window->DC.ColumnsStartX + window->DC.ColumnsOffsetX;
r244546r244547
60296355
60306356void ImGui::TreePush(const void* ptr_id)
60316357{
6032    ImGuiState& g = GImGui;
6358    ImGuiState& g = *GImGui;
60336359    ImGuiWindow* window = GetCurrentWindow();
60346360    window->DC.ColumnsStartX += g.Style.TreeNodeSpacing;
60356361    window->DC.CursorPos.x = window->Pos.x + window->DC.ColumnsStartX + window->DC.ColumnsOffsetX;
r244546r244547
60396365
60406366void ImGui::TreePop()
60416367{
6042    ImGuiState& g = GImGui;
6368    ImGuiState& g = *GImGui;
60436369    ImGuiWindow* window = GetCurrentWindow();
60446370    window->DC.ColumnsStartX -= g.Style.TreeNodeSpacing;
60456371    window->DC.CursorPos.x = window->Pos.x + window->DC.ColumnsStartX + window->DC.ColumnsOffsetX;
r244546r244547
61516477    }
61526478}
61536479
6480// Scissoring. The values in clip_rect are x1, y1, x2, y2.
61546481void ImDrawList::PushClipRect(const ImVec4& clip_rect)
61556482{
61566483    clip_rect_stack.push_back(clip_rect);
r244546r244547
62066533{
62076534    vtx_write->pos = pos;
62086535    vtx_write->col = col;
6209    vtx_write->uv = GImGui.FontTexUvWhitePixel;
6536    vtx_write->uv = GImGui->FontTexUvWhitePixel;
62106537    vtx_write++;
62116538}
62126539
r244546r244547
62616588        }
62626589        circle_vtx_builds = true;
62636590    }
6264   
6591
62656592    if (tris)
62666593    {
62676594        ReserveVertices((unsigned int)(a_max-a_min) * 3);
r244546r244547
63416668        AddVtx(ImVec2(a.x+r,a.y), col);
63426669        AddVtx(ImVec2(b.x-r,b.y), col);
63436670        AddVtx(ImVec2(a.x+r,b.y), col);
6344       
6671
63456672        float top_y = (rounding_corners & 1) ? a.y+r : a.y;
63466673        float bot_y = (rounding_corners & 8) ? b.y-r : b.y;
63476674        AddVtx(ImVec2(a.x,top_y), col);
r244546r244547
64126739    }
64136740}
64146741
6415void ImDrawList::AddText(ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end, float wrap_width)
6742void ImDrawList::AddText(ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end, float wrap_width, const ImVec2* cpu_clip_max)
64166743{
64176744    if ((col >> 24) == 0)
64186745        return;
r244546r244547
64286755    const size_t vtx_begin = vtx_buffer.size();
64296756    ReserveVertices(vtx_count_max);
64306757
6431    font->RenderText(font_size, pos, col, clip_rect_stack.back(), text_begin, text_end, vtx_write, wrap_width);
6758    font->RenderText(font_size, pos, col, clip_rect_stack.back(), text_begin, text_end, vtx_write, wrap_width, cpu_clip_max);
64326759
64336760    // give back unused vertices
64346761    vtx_buffer.resize((size_t)(vtx_write - &vtx_buffer.front()));
r244546r244547
65166843
65176844void    ImFontAtlas::Clear()
65186845{
6519    ClearInputData();
6846    ClearInputData();
65206847    ClearTexData();
65216848    for (size_t i = 0; i < Fonts.size(); i++)
65226849    {
r244546r244547
66556982        IM_ASSERT(data.OutFont && !data.OutFont->IsLoaded());
66566983        const int font_offset = stbtt_GetFontOffsetForIndex((unsigned char*)data.TTFData, data.FontNo);
66576984        IM_ASSERT(font_offset >= 0);
6658        if (!stbtt_InitFont(&data.FontInfo, (unsigned char*)data.TTFData, font_offset))
6985        if (!stbtt_InitFont(&data.FontInfo, (unsigned char*)data.TTFData, font_offset))
66596986            return false;
66606987
66616988        if (!data.GlyphRanges)
r244546r244547
66787005
66797006    // Pack our extra data rectangle first, so it will be on the upper-left corner of our texture (UV will have small values).
66807007    stbrp_rect extra_rect;
6681    extra_rect.w = (int)TEX_ATLAS_SIZE.x;
6682    extra_rect.h = (int)TEX_ATLAS_SIZE.y;
7008    extra_rect.w = (stbrp_coord)TEX_ATLAS_SIZE.x;
7009    extra_rect.h = (stbrp_coord)TEX_ATLAS_SIZE.y;
66837010    stbrp_pack_rects((stbrp_context*)spc.pack_info, &extra_rect, 1);
66847011    TexExtraDataPos = ImVec2(extra_rect.x, extra_rect.y);
66857012
r244546r244547
69007227{
69017228    // Store the 1946 ideograms code points as successive offsets from the initial unicode codepoint 0x4E00. Each offset has an implicit +1.
69027229    // This encoding helps us reduce the source code size.
6903    static const short offsets_from_0x4E00[] =
7230    static const short offsets_from_0x4E00[] =
69047231    {
69057232        -1,0,1,3,0,0,0,0,1,0,5,1,1,0,7,4,6,10,0,1,9,9,7,1,3,19,1,10,7,1,0,1,0,5,1,0,6,4,2,6,0,0,12,6,8,0,3,5,0,1,0,9,0,0,8,1,1,3,4,5,13,0,0,8,2,17,
69067233        4,3,1,1,9,6,0,0,0,2,1,3,2,22,1,9,11,1,13,1,3,12,0,5,9,2,0,6,12,5,3,12,4,1,2,16,1,1,4,6,5,3,0,6,13,15,5,12,8,14,0,0,6,15,3,6,0,18,8,1,6,14,1,
r244546r244547
69417268        0x0020, 0x00FF, // Basic Latin + Latin Supplement
69427269        0x3040, 0x309F, // Hiragana, Katakana
69437270        0xFF00, 0xFFEF, // Half-width characters
6944        0,
7271        0,
69457272    };
69467273    if (!ranges_unpacked)
69477274    {
r244546r244547
70077334            *out_char = c;
70087335            return 1;
70097336        }
7010        if ((*str & 0xe0) == 0xc0)
7337        if ((*str & 0xe0) == 0xc0)
70117338        {
70127339            if (in_text_end && in_text_end - (const char*)str < 2) return -1;
70137340            if (*str < 0xc2) return -1;
r244546r244547
70177344            *out_char = c;
70187345            return 2;
70197346        }
7020        if ((*str & 0xf0) == 0xe0)
7347        if ((*str & 0xf0) == 0xe0)
70217348        {
70227349            if (in_text_end && in_text_end - (const char*)str < 3) return -1;
70237350            if (*str == 0xe0 && (str[1] < 0xa0 || str[1] > 0xbf)) return -1;
r244546r244547
70307357            *out_char = c;
70317358            return 3;
70327359        }
7033        if ((*str & 0xf8) == 0xf0)
7360        if ((*str & 0xf8) == 0xf0)
70347361        {
70357362            if (in_text_end && in_text_end - (const char*)str < 4) return -1;
70367363            if (*str > 0xf4) return -1;
r244546r244547
70887415    {
70897416        size_t i = 0;
70907417        size_t n = buf_size;
7091        if (c < 0x80)
7418        if (c < 0x80)
70927419        {
70937420            if (i+1 > n) return 0;
70947421            buf[i++] = (char)c;
70957422            return 1;
7096        }
7097        else if (c < 0x800)
7423        }
7424        else if (c < 0x800)
70987425        {
70997426            if (i+2 > n) return 0;
71007427            buf[i++] = (char)(0xc0 + (c >> 6));
r244546r244547
71047431        else if (c >= 0xdc00 && c < 0xe000)
71057432        {
71067433            return 0;
7107        }
7108        else if (c >= 0xd800 && c < 0xdc00)
7434        }
7435        else if (c >= 0xd800 && c < 0xdc00)
71097436        {
71107437            if (i+4 > n) return 0;
71117438            buf[i++] = (char)(0xf0 + (c >> 18));
r244546r244547
72877614        unsigned int c;
72887615        const int bytes_count = ImTextCharFromUtf8(&c, s, text_end);
72897616        s += bytes_count > 0 ? bytes_count : 1;
7290       
7617
72917618        if (c == '\n')
72927619        {
72937620            text_size.x = ImMax(text_size.x, line_width);
r244546r244547
72957622            line_width = 0.0f;
72967623            continue;
72977624        }
7298       
7625
72997626        float char_width = 0.0f;
73007627        if (const Glyph* glyph = FindGlyph((unsigned short)c))
73017628            char_width = glyph->XAdvance * scale;
r244546r244547
73427669            line_width = 0.0f;
73437670            continue;
73447671        }
7345       
7672
73467673        float char_width = 0.0f;
73477674        if (const Glyph* glyph = FindGlyph((unsigned short)c))
73487675            char_width = glyph->XAdvance * scale;
r244546r244547
73667693    return text_size;
73677694}
73687695
7369void ImFont::RenderText(float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect_ref, const char* text_begin, const char* text_end, ImDrawVert*& out_vertices, float wrap_width) const
7696void ImFont::RenderText(float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect_ref, const char* text_begin, const char* text_end, ImDrawVert*& out_vertices, float wrap_width, const ImVec2* cpu_clip_max) const
73707697{
73717698    if (!text_end)
73727699        text_end = text_begin + strlen(text_begin);
r244546r244547
73817708    const bool word_wrap_enabled = (wrap_width > 0.0f);
73827709    const char* word_wrap_eol = NULL;
73837710
7384    const ImVec4 clip_rect = clip_rect_ref;
7711    ImVec4 clip_rect = clip_rect_ref;
7712    if (cpu_clip_max)
7713    {
7714        clip_rect.z = ImMin(clip_rect.z, cpu_clip_max->x);
7715        clip_rect.w = ImMin(clip_rect.w, cpu_clip_max->y);
7716    }
73857717    float x = pos.x;
73867718    float y = pos.y;
73877719
r244546r244547
74337765            if (c != ' ' && c != '\t')
74347766            {
74357767                // Clipping on Y is more likely
7436                const float y1 = (float)(y + glyph->YOffset * scale);
7437                const float y2 = (float)(y1 + glyph->Height * scale);
7768                float y1 = (float)(y + glyph->YOffset * scale);
7769                float y2 = (float)(y1 + glyph->Height * scale);
74387770                if (y1 <= clip_rect.w && y2 >= clip_rect.y)
74397771                {
7440                    const float x1 = (float)(x + glyph->XOffset * scale);
7441                    const float x2 = (float)(x1 + glyph->Width * scale);
7772                    float x1 = (float)(x + glyph->XOffset * scale);
7773                    float x2 = (float)(x1 + glyph->Width * scale);
74427774                    if (x1 <= clip_rect.z && x2 >= clip_rect.x)
74437775                    {
74447776                        // Render a character
7445                        const float u0 = glyph->U0;
7446                        const float v0 = glyph->V0;
7447                        const float u1 = glyph->U1;
7448                        const float v1 = glyph->V1;
7777                        float u1 = glyph->U0;
7778                        float v1 = glyph->V0;
7779                        float u2 = glyph->U1;
7780                        float v2 = glyph->V1;
74497781
7782                        // CPU side clipping used to fit text in their frame when the frame is too small. Only does clipping for axis aligned quad and in the "max" direction (bottom-right)
7783                        if (cpu_clip_max)
7784                        {
7785                            if (x2 > cpu_clip_max->x)
7786                            {
7787                                const float clip_tx = (cpu_clip_max->x - x1) / (x2 - x1);
7788                                x2 = cpu_clip_max->x;
7789                                u2 = u1 + clip_tx * (u2 - u1);
7790                            }
7791                            if (y2 > cpu_clip_max->y)
7792                            {
7793                                const float clip_ty = (cpu_clip_max->y - y1) / (y2 - y1);
7794                                y2 = cpu_clip_max->y;
7795                                v2 = v1 + clip_ty * (v2 - v1);
7796                            }
7797                        }
7798
74507799                        out_vertices[0].pos = ImVec2(x1, y1);
7451                        out_vertices[0].uv  = ImVec2(u0, v0);
7800                        out_vertices[0].uv  = ImVec2(u1, v1);
74527801                        out_vertices[0].col = col;
74537802
74547803                        out_vertices[1].pos = ImVec2(x2, y1);
7455                        out_vertices[1].uv  = ImVec2(u1, v0);
7804                        out_vertices[1].uv  = ImVec2(u2, v1);
74567805                        out_vertices[1].col = col;
74577806
74587807                        out_vertices[2].pos = ImVec2(x2, y2);
7459                        out_vertices[2].uv  = ImVec2(u1, v1);
7808                        out_vertices[2].uv  = ImVec2(u2, v2);
74607809                        out_vertices[2].col = col;
74617810
74627811                        out_vertices[3] = out_vertices[0];
74637812                        out_vertices[4] = out_vertices[2];
74647813
74657814                        out_vertices[5].pos = ImVec2(x1, y2);
7466                        out_vertices[5].uv  = ImVec2(u0, v1);
7815                        out_vertices[5].uv  = ImVec2(u1, v2);
74677816                        out_vertices[5].col = col;
74687817
74697818                        out_vertices += 6;
r244546r244547
74947843        ImGui::MemFree(buf_local);
74957844        buf_local = NULL;
74967845    }
7497    if (!OpenClipboard(NULL))
7846    if (!OpenClipboard(NULL))
74987847        return NULL;
7499    HANDLE buf_handle = GetClipboardData(CF_TEXT);
7848    HANDLE buf_handle = GetClipboardData(CF_TEXT);
75007849    if (buf_handle == NULL)
75017850        return NULL;
75027851    if (char* buf_global = (char*)GlobalLock(buf_handle))
75037852        buf_local = ImStrdup(buf_global);
7504    GlobalUnlock(buf_handle);
7505    CloseClipboard();
7853    GlobalUnlock(buf_handle);
7854    CloseClipboard();
75067855    return buf_local;
75077856}
75087857
r244546r244547
75137862        return;
75147863    const char* text_end = text + strlen(text);
75157864    const int buf_length = (int)(text_end - text) + 1;
7516    HGLOBAL buf_handle = GlobalAlloc(GMEM_MOVEABLE, (SIZE_T)buf_length * sizeof(char));
7865    HGLOBAL buf_handle = GlobalAlloc(GMEM_MOVEABLE, (SIZE_T)buf_length * sizeof(char));
75177866    if (buf_handle == NULL)
75187867        return;
7519    char* buf_global = (char *)GlobalLock(buf_handle);
7868    char* buf_global = (char *)GlobalLock(buf_handle);
75207869    memcpy(buf_global, text, (size_t)(text_end - text));
75217870    buf_global[text_end - text] = 0;
7522    GlobalUnlock(buf_handle);
7871    GlobalUnlock(buf_handle);
75237872    EmptyClipboard();
75247873    SetClipboardData(CF_TEXT, buf_handle);
75257874    CloseClipboard();
r244546r244547
75307879// Local ImGui-only clipboard implementation, if user hasn't defined better clipboard handlers
75317880static const char*  GetClipboardTextFn_DefaultImpl()
75327881{
7533    return GImGui.PrivateClipboard;
7882    return GImGui->PrivateClipboard;
75347883}
75357884
75367885// Local ImGui-only clipboard implementation, if user hasn't defined better clipboard handlers
75377886static void SetClipboardTextFn_DefaultImpl(const char* text)
75387887{
7539    if (GImGui.PrivateClipboard)
7888    ImGuiState& g = *GImGui;
7889    if (g.PrivateClipboard)
75407890    {
7541        ImGui::MemFree(GImGui.PrivateClipboard);
7542        GImGui.PrivateClipboard = NULL;
7891        ImGui::MemFree(g.PrivateClipboard);
7892        g.PrivateClipboard = NULL;
75437893    }
75447894    const char* text_end = text + strlen(text);
7545    GImGui.PrivateClipboard = (char*)ImGui::MemAlloc((size_t)(text_end - text) + 1);
7546    memcpy(GImGui.PrivateClipboard, text, (size_t)(text_end - text));
7547    GImGui.PrivateClipboard[(size_t)(text_end - text)] = 0;
7895    g.PrivateClipboard = (char*)ImGui::MemAlloc((size_t)(text_end - text) + 1);
7896    memcpy(g.PrivateClipboard, text, (size_t)(text_end - text));
7897    g.PrivateClipboard[(size_t)(text_end - text)] = 0;
75487898}
75497899
75507900#endif
r244546r244547
75557905
75567906void ImGui::ShowUserGuide()
75577907{
7558    ImGuiState& g = GImGui;
7908    ImGuiState& g = *GImGui;
75597909
75607910    ImGui::BulletText("Double-click on title bar to collapse window.");
75617911    ImGui::BulletText("Click and drag on lower right corner to resize window.");
r244546r244547
75797929
75807930void ImGui::ShowStyleEditor(ImGuiStyle* ref)
75817931{
7582    ImGuiState& g = GImGui;
7932    ImGuiState& g = *GImGui;
75837933    ImGuiStyle& style = g.Style;
75847934
75857935    const ImGuiStyle def; // Default style
r244546r244547
76007950        ImGui::SliderFloat("Alpha", &style.Alpha, 0.20f, 1.0f, "%.2f");                 // Not exposing zero here so user doesn't "lose" the UI. But application code could have a toggle to switch between zero and non-zero.
76017951        ImGui::SliderFloat2("WindowPadding", (float*)&style.WindowPadding, 0.0f, 20.0f, "%.0f");
76027952        ImGui::SliderFloat("WindowRounding", &style.WindowRounding, 0.0f, 16.0f, "%.0f");
7953        ImGui::SliderFloat("ChildWindowRounding", &style.ChildWindowRounding, 0.0f, 16.0f, "%.0f");
76037954        ImGui::SliderFloat2("FramePadding", (float*)&style.FramePadding, 0.0f, 20.0f, "%.0f");
76047955        ImGui::SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 16.0f, "%.0f");
76057956        ImGui::SliderFloat2("ItemSpacing", (float*)&style.ItemSpacing, 0.0f, 20.0f, "%.0f");
r244546r244547
76878038    static bool no_resize = false;
76888039    static bool no_move = false;
76898040    static bool no_scrollbar = false;
8041    static bool no_collapse = false;
76908042    static float fill_alpha = 0.65f;
76918043
7692    const ImGuiWindowFlags layout_flags = (no_titlebar ? ImGuiWindowFlags_NoTitleBar : 0) | (no_border ? 0 : ImGuiWindowFlags_ShowBorders) | (no_resize ? ImGuiWindowFlags_NoResize : 0) | (no_move ? ImGuiWindowFlags_NoMove : 0) | (no_scrollbar ? ImGuiWindowFlags_NoScrollbar : 0);
7693    if (!ImGui::Begin("ImGui Test", opened, ImVec2(550,680), fill_alpha, layout_flags))
8044    // Demonstrate the various window flags. Typically you would just use the default.
8045    ImGuiWindowFlags window_flags = 0;
8046    if (no_titlebar)  window_flags |= ImGuiWindowFlags_NoTitleBar;
8047    if (!no_border)   window_flags |= ImGuiWindowFlags_ShowBorders;
8048    if (no_resize)    window_flags |= ImGuiWindowFlags_NoResize;
8049    if (no_move)      window_flags |= ImGuiWindowFlags_NoMove;
8050    if (no_scrollbar) window_flags |= ImGuiWindowFlags_NoScrollbar;
8051    if (no_collapse)  window_flags |= ImGuiWindowFlags_NoCollapse;
8052    if (!ImGui::Begin("ImGui Test", opened, ImVec2(550,680), fill_alpha, window_flags))
76948053    {
76958054        // Early out if the window is collapsed, as an optimization.
76968055        ImGui::End();
r244546r244547
77018060    ImGui::Text("ImGui says hello.");
77028061    //ImGui::Text("MousePos (%g, %g)", ImGui::GetIO().MousePos.x, ImGui::GetIO().MousePos.y);
77038062    //ImGui::Text("MouseWheel %d", ImGui::GetIO().MouseWheel);
8063    //ImGui::Text("WantCaptureMouse: %d", ImGui::GetIO().WantCaptureMouse);
8064    //ImGui::Text("WantCaptureKeyboard: %d", ImGui::GetIO().WantCaptureKeyboard);
77048065
77058066    ImGui::Spacing();
77068067    if (ImGui::CollapsingHeader("Help"))
r244546r244547
77138074    {
77148075        ImGui::Checkbox("no titlebar", &no_titlebar); ImGui::SameLine(150);
77158076        ImGui::Checkbox("no border", &no_border); ImGui::SameLine(300);
7716        ImGui::Checkbox("no resize", &no_resize);
8077        ImGui::Checkbox("no resize", &no_resize);
77178078        ImGui::Checkbox("no move", &no_move); ImGui::SameLine(150);
7718        ImGui::Checkbox("no scrollbar", &no_scrollbar);
8079        ImGui::Checkbox("no scrollbar", &no_scrollbar); ImGui::SameLine(300);
8080        ImGui::Checkbox("no collapse", &no_collapse);
77198081        ImGui::SliderFloat("fill alpha", &fill_alpha, 0.0f, 1.0f);
77208082
77218083        if (ImGui::TreeNode("Style"))
r244546r244547
77638125        if (ImGui::Button("Button")) { printf("Clicked\n"); a ^= 1; }
77648126        if (a)
77658127        {
7766            ImGui::SameLine();
8128            ImGui::SameLine();
77678129            ImGui::Text("Thanks for clicking me!");
77688130        }
77698131
r244546r244547
78418203            ImGui::TreePop();
78428204        }
78438205
8206        if (ImGui::TreeNode("Clipping"))
8207        {
8208            static ImVec2 size(80, 20);
8209            ImGui::TextWrapped("On a per-widget basis we are occasionally clipping text if it won't fit in its frame.");
8210            ImGui::SliderFloat2("size", (float*)&size, 5.0f, 200.0f);
8211            ImGui::Button("Line 1 hello\nLine 2 clip me!", size);
8212            ImGui::TextWrapped("Otherwise we are doing coarser clipping + passing a scissor rectangle to the renderer. The system is designed to try minimizing both execution and rendering cost.");
8213            ImGui::TreePop();
8214        }
8215
78448216        if (ImGui::TreeNode("Images"))
78458217        {
78468218            ImGui::TextWrapped("Below we are displaying the font texture (which is the only texture we have access to in this demo). Use the 'ImTextureID' type as storage to pass pointers or identifier to your own texture data. Hover the texture for a zoomed view!");
r244546r244547
78788250            ImGui::TreePop();
78798251        }
78808252
8253        if (ImGui::TreeNode("Selectables"))
8254        {
8255            if (ImGui::TreeNode("Basic"))
8256            {
8257                static bool selected[3] = { false, true, false };
8258                ImGui::Selectable("1. I am selectable", &selected[0]);
8259                ImGui::Selectable("2. I am selectable", &selected[1]);
8260                ImGui::Text("3. I am normal text");
8261                ImGui::Selectable("4. I am selectable", &selected[2]);
8262                ImGui::TreePop();
8263            }
8264            if (ImGui::TreeNode("Rendering more text into the same block"))
8265            {
8266                static bool selected[3] = { false, false, false };
8267                ImGui::Selectable("main.c", &selected[0]);    ImGui::SameLine(300); ImGui::Text(" 2,345 bytes");
8268                ImGui::Selectable("Hello.cpp", &selected[1]); ImGui::SameLine(300); ImGui::Text("12,345 bytes");
8269                ImGui::Selectable("Hello.h", &selected[2]);   ImGui::SameLine(300); ImGui::Text(" 2,345 bytes");
8270                ImGui::TreePop();
8271            }
8272            if (ImGui::TreeNode("Grid"))
8273            {
8274                static bool selected[16] = { true, false, false, false, false, true, false, false, false, false, true, false, false, false, false, true };
8275                for (int i = 0; i < 16; i++)
8276                {
8277                    ImGui::PushID(i);
8278                    if (ImGui::Selectable("Me", &selected[i], ImVec2(50,50)))
8279                    {
8280                        int x = i % 4, y = i / 4;
8281                        if (x > 0) selected[i - 1] ^= 1;
8282                        if (x < 3) selected[i + 1] ^= 1;
8283                        if (y > 0) selected[i - 4] ^= 1;
8284                        if (y < 3) selected[i + 4] ^= 1;
8285                    }
8286                    if ((i % 4) < 3) ImGui::SameLine();
8287                    ImGui::PopID();
8288                }
8289                ImGui::TreePop();
8290            }
8291            ImGui::TreePop();
8292        }
8293
78818294        static bool check = true;
78828295        ImGui::Checkbox("checkbox", &check);
78838296
r244546r244547
79748387        static float col2[4] = { 0.4f,0.7f,0.0f,0.5f };
79758388        ImGui::ColorEdit3("color 1", col1);
79768389        ImGui::ColorEdit4("color 2", col2);
8390
8391        const char* listbox_items[] = { "Apple", "Banana", "Cherry", "Kiwi", "Mango", "Orange", "Pineapple", "Strawberry", "Watermelon" };
8392        static int listbox_item_current = 1;
8393        ImGui::ListBox("listbox\n(single select)", &listbox_item_current, listbox_items, IM_ARRAYSIZE(listbox_items), 4);
8394
8395        //ImGui::PushItemWidth(-1);
8396        //ImGui::ListBox("##listbox2", &listbox_item_current2, listbox_items, IM_ARRAYSIZE(listbox_items), 4);
8397        //ImGui::PopItemWidth();
79778398    }
79788399
79798400    if (ImGui::CollapsingHeader("Graphs widgets"))
r244546r244547
79828403        ImGui::PlotLines("Frame Times", arr, IM_ARRAYSIZE(arr));
79838404
79848405        static bool pause;
7985        static ImVector<float> values; if (values.empty()) { values.resize(100); memset(&values.front(), 0, values.size()*sizeof(float)); }
7986        static size_t values_offset = 0;
7987        if (!pause)
7988        {
8406        static ImVector<float> values; if (values.empty()) { values.resize(100); memset(&values.front(), 0, values.size()*sizeof(float)); }
8407        static size_t values_offset = 0;
8408        if (!pause)
8409        {
79898410            // create dummy data at fixed 60 hz rate
79908411            static float refresh_time = -1.0f;
79918412            if (ImGui::GetTime() > refresh_time + 1.0f/60.0f)
79928413            {
79938414                refresh_time = ImGui::GetTime();
79948415                static float phase = 0.0f;
7995                values[values_offset] = cosf(phase);
7996                values_offset = (values_offset+1)%values.size();
7997                phase += 0.10f*values_offset;
8416                values[values_offset] = cosf(phase);
8417                values_offset = (values_offset+1)%values.size();
8418                phase += 0.10f*values_offset;
79988419            }
79998420        }
80008421        ImGui::PlotLines("Frame Times", &values.front(), (int)values.size(), (int)values_offset, "avg 0.0", -1.0f, 1.0f, ImVec2(0,70));
r244546r244547
80498470        ImGui::Text("Without border");
80508471        static int line = 50;
80518472        bool goto_line = ImGui::Button("Goto");
8052        ImGui::SameLine();
8473        ImGui::SameLine();
80538474        ImGui::PushItemWidth(100);
80548475        goto_line |= ImGui::InputInt("##Line", &line, 0, 0, ImGuiInputTextFlags_EnterReturnsTrue);
80558476        ImGui::PopItemWidth();
r244546r244547
80668487
80678488        ImGui::SameLine();
80688489
8490        ImGui::PushStyleVar(ImGuiStyleVar_ChildWindowRounding, 5.0f);
80698491        ImGui::BeginChild("Sub2", ImVec2(0,300), true);
80708492        ImGui::Text("With border");
80718493        ImGui::Columns(2);
r244546r244547
80788500            ImGui::Button(buf);
80798501        }
80808502        ImGui::EndChild();
8503        ImGui::PopStyleVar();
80818504    }
80828505
80838506    if (ImGui::CollapsingHeader("Columns"))
r244546r244547
81118534
81128535        // Create multiple items in a same cell because switching to next column
81138536        static int e = 0;
8114        ImGui::Text("Hello");
8537        ImGui::Text("Hello");
81158538        ImGui::Button("Banana");
8116        ImGui::RadioButton("radio a", &e, 0);
8539        ImGui::RadioButton("radio a", &e, 0);
81178540        ImGui::NextColumn();
81188541
8119        ImGui::Text("ImGui");
8542        ImGui::Text("ImGui");
81208543        ImGui::Button("Apple");
81218544        ImGui::RadioButton("radio b", &e, 1);
81228545        ImGui::Text("An extra line here.");
81238546        ImGui::NextColumn();
8124       
8547
81258548        ImGui::Text("World!");
81268549        ImGui::Button("Corniflower");
81278550        ImGui::RadioButton("radio c", &e, 2);
r244546r244547
81438566        ImGui::Columns(1);
81448567
81458568        ImGui::Separator();
8146       
8569
8570        ImGui::Columns(2, "tree items");
8571        if (ImGui::TreeNode("Hello")) { ImGui::BulletText("World"); ImGui::TreePop(); } ImGui::NextColumn();
8572        if (ImGui::TreeNode("Bonjour")) { ImGui::BulletText("Monde"); ImGui::TreePop(); }
8573        ImGui::Columns(1);
8574        ImGui::Separator();
8575
81478576        ImGui::Columns(2, "word wrapping");
81488577        ImGui::TextWrapped("The quick brown fox jumps over the lazy dog.");
81498578        ImGui::Text("Hello Left");
r244546r244547
82278656            bool focus_3 = ImGui::Button("Focus on 3");
82288657            int has_focus = 0;
82298658            static char buf[128] = "click on a button to set focus";
8230           
8659
82318660            if (focus_1) ImGui::SetKeyboardFocusHere();
82328661            ImGui::InputText("1", buf, IM_ARRAYSIZE(buf));
82338662            if (ImGui::IsItemActive()) has_focus = 1;
8234           
8663
82358664            if (focus_2) ImGui::SetKeyboardFocusHere();
82368665            ImGui::InputText("2", buf, IM_ARRAYSIZE(buf));
82378666            if (ImGui::IsItemActive()) has_focus = 2;
r244546r244547
82438672            ImGui::PopAllowKeyboardFocus();
82448673            if (has_focus)
82458674                ImGui::Text("Item with focus: %d", has_focus);
8246            else
8675            else
82478676                ImGui::Text("Item with focus: <none>");
82488677            ImGui::TreePop();
82498678        }
r244546r244547
83048733    ImGui::SetWindowPos(ImVec2(10,10));
83058734    ImGui::Text("Simple overlay\non the top-left side of the screen.");
83068735    ImGui::Separator();
8307    ImGui::Text("Mouse Position: (%.1f,%.1f)", ImGui::GetIO().MousePos.x, ImGui::GetIO().MousePos.y);
8736    ImGui::Text("Mouse Position: (%.1f,%.1f)", ImGui::GetIO().MousePos.x, ImGui::GetIO().MousePos.y);
83088737
83098738    ImGui::End();
83108739}
r244546r244547
83338762
83348763    // Here we are using InvisibleButton() as a convenience to 1) advance the cursor and 2) allows us to use IsItemHovered()
83358764    // However you can draw directly and poll mouse/keyboard by yourself. You can manipulate the cursor using GetCursorPos() and SetCursorPos().
8336    // If you only use the ImDrawList API, you can notify the owner window of its extends by using SetCursorPos(max) followed by an empty Text("") statement.
8765    // If you only use the ImDrawList API, you can notify the owner window of its extends by using SetCursorPos(max).
83378766    ImVec2 canvas_pos = ImGui::GetCursorScreenPos();            // ImDrawList API uses screen coordinates!
83388767    ImVec2 canvas_size = ImVec2(ImMax(50.0f,ImGui::GetWindowContentRegionMax().x-ImGui::GetCursorPos().x), ImMax(50.0f,ImGui::GetWindowContentRegionMax().y-ImGui::GetCursorPos().y));    // Resize canvas what's available
83398768    draw_list->AddRect(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), 0xFFFFFFFF);
r244546r244547
83918820    ~ExampleAppConsole()
83928821    {
83938822        ClearLog();
8394        for (size_t i = 0; i < Items.size(); i++)
8395            ImGui::MemFree(History[i]);
8823        for (size_t i = 0; i < Items.size(); i++)
8824            ImGui::MemFree(History[i]);
83968825    }
83978826
83988827    void    ClearLog()
83998828    {
8400        for (size_t i = 0; i < Items.size(); i++)
8401            ImGui::MemFree(Items[i]);
8829        for (size_t i = 0; i < Items.size(); i++)
8830            ImGui::MemFree(Items[i]);
84028831        Items.clear();
84038832        ScrollToBottom = true;
84048833    }
r244546r244547
84288857        // TODO: display from bottom
84298858        // TODO: clip manually
84308859
8431        if (ImGui::SmallButton("Add Dummy Text")) AddLog("some text\nsome more text\ndisplay very important message here!\n"); ImGui::SameLine();
8432        if (ImGui::SmallButton("Add Dummy Error")) AddLog("[error] something went wrong"); ImGui::SameLine();
8860        if (ImGui::SmallButton("Add Dummy Text")) { AddLog("%d some text", Items.size()); AddLog("some more text"); AddLog("display very important message here!"); } ImGui::SameLine();
8861        if (ImGui::SmallButton("Add Dummy Error")) AddLog("[error] something went wrong"); ImGui::SameLine();
84338862        if (ImGui::SmallButton("Clear")) ClearLog();
84348863        ImGui::Separator();
84358864
r244546r244547
84418870        ImGui::Separator();
84428871
84438872        // Display every line as a separate entry so we can change their color or add custom widgets. If you only want raw text you can use ImGui::TextUnformatted(log.begin(), log.end());
8444        // NB- if you have lots of text this approach may be too inefficient. You can seek and display only the lines that are on display using a technique similar to what TextUnformatted() does,
8445        // or faster if your entries are already stored into a table.
8446        ImGui::BeginChild("ScrollingRegion", ImVec2(0,-ImGui::GetTextLineSpacing()*2));
8873        // NB- if you have thousands of entries this approach may be too inefficient. You can seek and display only the lines that are visible - CalcListClipping() is a helper to compute this information.
8874        // If your items are of variable size you may want to implement code similar to what CalcListClipping() does. Or split your data into fixed height items to allow random-seeking into your list.
8875        ImGui::BeginChild("ScrollingRegion", ImVec2(0,-ImGui::GetTextLineHeightWithSpacing()*2));
84478876        ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4,1)); // Tighten spacing
84488877        for (size_t i = 0; i < Items.size(); i++)
84498878        {
r244546r244547
86379066        return;
86389067    }
86399068
9069    static int test_type = 0;
86409070    static ImGuiTextBuffer log;
86419071    static int lines = 0;
86429072    ImGui::Text("Printing unusually long amount of text.");
9073    ImGui::Combo("Test type", &test_type, "Single call to TextUnformatted()\0Multiple calls to Text(), clipped manually\0Multiple calls to Text(), not clipped");
86439074    ImGui::Text("Buffer contents: %d lines, %d bytes", lines, log.size());
86449075    if (ImGui::Button("Clear")) { log.clear(); lines = 0; }
86459076    ImGui::SameLine();
r244546r244547
86509081        lines += 1000;
86519082    }
86529083    ImGui::BeginChild("Log");
8653    ImGui::TextUnformatted(log.begin(), log.end());
9084    switch (test_type)
9085    {
9086    case 0:
9087        // Single call to TextUnformatted() with a big buffer
9088        ImGui::TextUnformatted(log.begin(), log.end());
9089        break;
9090    case 1:
9091        // Multiple calls to Text(), manually coarsely clipped - demonstrate how to use the CalcListClipping() helper.
9092        ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0,0));
9093        int display_start, display_end;
9094        ImGui::CalcListClipping(lines, ImGui::GetTextLineHeight(), &display_start, &display_end);
9095        ImGui::SetCursorPosY(ImGui::GetCursorPosY() + (display_start) * ImGui::GetTextLineHeight());
9096        for (int i = display_start; i < display_end; i++)
9097            ImGui::Text("%i The quick brown fox jumps over the lazy dog\n", i);
9098        ImGui::SetCursorPosY(ImGui::GetCursorPosY() + (lines - display_end) * ImGui::GetTextLineHeight());
9099        ImGui::PopStyleVar();
9100        break;
9101    case 2:
9102        // Multiple calls to Text(), not clipped
9103        ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0,0));
9104        for (int i = 0; i < lines; i++)
9105            ImGui::Text("%i The quick brown fox jumps over the lazy dog\n", i);
9106        ImGui::PopStyleVar();
9107        break;
9108    }
86549109    ImGui::EndChild();
8655
86569110    ImGui::End();
86579111}
86589112
r244546r244547
87489202        buflen -= blocklen;
87499203        blocklen = 5552;
87509204    }
8751    return (s2 << 16) + s1;
9205    return (unsigned int)(s2 << 16) + (unsigned int)s1;
87529206}
87539207
87549208static unsigned int stb_decompress(unsigned char *output, unsigned char *i, unsigned int length)
r244546r244547
87649218    i += 16;
87659219
87669220    stb__dout = output;
8767    while (1) {
9221    for (;;) {
87689222        unsigned char *old_i = i;
87699223        i = stb_decompress_token(i);
87709224        if (i == old_i) {
r244546r244547
87799233                return 0;
87809234            }
87819235        }
8782        assert(stb__dout <= output + olen);
9236        assert(stb__dout <= output + olen);
87839237        if (stb__dout > output + olen)
87849238            return 0;
87859239    }
r244546r244547
87889242static const unsigned int proggy_clean_ttf_compressed_size = 9583;
87899243static const unsigned int proggy_clean_ttf_compressed_data[9584/4] =
87909244{
8791    0x0000bc57, 0x00000000, 0xf8a00000, 0x00000400, 0x00010037, 0x000c0000, 0x00030080, 0x2f534f40, 0x74eb8832, 0x01000090, 0x2c158248, 0x616d634e,
8792    0x23120270, 0x03000075, 0x241382a0, 0x74766352, 0x82178220, 0xfc042102, 0x02380482, 0x66796c67, 0x5689af12, 0x04070000, 0x80920000, 0x64616568,
8793    0xd36691d7, 0xcc201b82, 0x36210382, 0x27108268, 0xc3014208, 0x04010000, 0x243b0f82, 0x78746d68, 0x807e008a, 0x98010000, 0x06020000, 0x61636f6c,
8794    0xd8b0738c, 0x82050000, 0x0402291e, 0x7078616d, 0xda00ae01, 0x28201f82, 0x202c1082, 0x656d616e, 0x96bb5925, 0x84990000, 0x9e2c1382, 0x74736f70,
8795    0xef83aca6, 0x249b0000, 0xd22c3382, 0x70657270, 0x12010269, 0xf4040000, 0x08202f82, 0x012ecb84, 0x553c0000, 0x0f5fd5e9, 0x0300f53c, 0x00830008,
8796    0x7767b722, 0x002b3f82, 0xa692bd00, 0xfe0000d7, 0x83800380, 0x21f1826f, 0x00850002, 0x41820120, 0x40fec026, 0x80030000, 0x05821083, 0x07830120,
8797    0x0221038a, 0x24118200, 0x90000101, 0x82798200, 0x00022617, 0x00400008, 0x2009820a, 0x82098276, 0x82002006, 0x9001213b, 0x0223c883, 0x828a02bc,
8798    0x858f2010, 0xc5012507, 0x00023200, 0x04210083, 0x91058309, 0x6c412b03, 0x40007374, 0xac200000, 0x00830008, 0x01000523, 0x834d8380, 0x80032103,
8799    0x012101bf, 0x23b88280, 0x00800000, 0x0b830382, 0x07820120, 0x83800021, 0x88012001, 0x84002009, 0x2005870f, 0x870d8301, 0x2023901b, 0x83199501,
8800    0x82002015, 0x84802000, 0x84238267, 0x88002027, 0x8561882d, 0x21058211, 0x13880000, 0x01800022, 0x05850d85, 0x0f828020, 0x03208384, 0x03200582,
8801    0x47901b84, 0x1b850020, 0x1f821d82, 0x3f831d88, 0x3f410383, 0x84058405, 0x210982cd, 0x09830000, 0x03207789, 0xf38a1384, 0x01203782, 0x13872384,
8802    0x0b88c983, 0x0d898f84, 0x00202982, 0x23900383, 0x87008021, 0x83df8301, 0x86118d03, 0x863f880d, 0x8f35880f, 0x2160820f, 0x04830300, 0x1c220382,
8803    0x05820100, 0x4c000022, 0x09831182, 0x04001c24, 0x11823000, 0x0800082e, 0x00000200, 0xff007f00, 0xffffac20, 0x00220982, 0x09848100, 0xdf216682,
8804    0x843586d5, 0x06012116, 0x04400684, 0xa58120d7, 0x00b127d8, 0x01b88d01, 0x2d8685ff, 0xc100c621, 0xf4be0801, 0x9e011c01, 0x88021402, 0x1403fc02,
8805    0x9c035803, 0x1404de03, 0x50043204, 0xa2046204, 0x66051605, 0x1206bc05, 0xd6067406, 0x7e073807, 0x4e08ec07, 0x96086c08, 0x1009d008, 0x88094a09,
8806    0x800a160a, 0x560b040b, 0x2e0cc80b, 0xea0c820c, 0xa40d5e0d, 0x500eea0d, 0x280f960e, 0x1210b00f, 0xe0107410, 0xb6115211, 0x6e120412, 0x4c13c412,
8807    0xf613ac13, 0xae145814, 0x4015ea14, 0xa6158015, 0x1216b815, 0xc6167e16, 0x8e173417, 0x5618e017, 0xee18ba18, 0x96193619, 0x481ad419, 0xf01a9c1a,
8808    0xc81b5c1b, 0x4c1c041c, 0xea1c961c, 0x921d2a1d, 0x401ed21d, 0xe01e8e1e, 0x761f241f, 0xa61fa61f, 0x01821020, 0x8a202e34, 0xc820b220, 0x74211421,
8809    0xee219821, 0x86226222, 0x01820c23, 0x83238021, 0x23983c01, 0x24d823b0, 0x244a2400, 0x24902468, 0x250625ae, 0x25822560, 0x26f825f8, 0x82aa2658,
8810    0xd8be0801, 0x9a274027, 0x68280a28, 0x0e29a828, 0xb8292029, 0x362af829, 0x602a602a, 0x2a2b022b, 0xac2b5e2b, 0x202ce62b, 0x9a2c342c, 0x5c2d282d,
8811    0xaa2d782d, 0x262ee82d, 0x262fa62e, 0xf42fb62f, 0xc8305e30, 0xb4313e31, 0x9e321e32, 0x82331e33, 0x5c34ee33, 0x3a35ce34, 0xd4358635, 0x72362636,
8812    0x7637e636, 0x3a38d837, 0x1239a638, 0xae397439, 0x9a3a2e3a, 0x7c3b063b, 0x3a3ce83b, 0x223d963c, 0xec3d863d, 0xc63e563e, 0x9a3f2a3f, 0x6a401240,
8813    0x3641d040, 0x0842a241, 0x7a424042, 0xf042b842, 0xcc436243, 0x8a442a44, 0x5845ee44, 0xe245b645, 0xb4465446, 0x7a471447, 0x5448da47, 0x4049c648,
8814    0x15462400, 0x034d0808, 0x0b000700, 0x13000f00, 0x1b001700, 0x23001f00, 0x2b002700, 0x33002f00, 0x3b003700, 0x43003f00, 0x4b004700, 0x53004f00,
8815    0x5b005700, 0x63005f00, 0x6b006700, 0x73006f00, 0x7b007700, 0x83007f00, 0x8b008700, 0x00008f00, 0x15333511, 0x20039631, 0x20178205, 0xd3038221,
8816    0x20739707, 0x25008580, 0x028080fc, 0x05be8080, 0x04204a85, 0x05ce0685, 0x0107002a, 0x02000080, 0x00000400, 0x250d8b41, 0x33350100, 0x03920715,
8817    0x13820320, 0x858d0120, 0x0e8d0320, 0xff260d83, 0x00808000, 0x54820106, 0x04800223, 0x845b8c80, 0x41332059, 0x078b068f, 0x82000121, 0x82fe2039,
8818    0x84802003, 0x83042004, 0x23598a0e, 0x00180000, 0x03210082, 0x42ab9080, 0x73942137, 0x2013bb41, 0x8f978205, 0x2027a39b, 0x20b68801, 0x84b286fd,
8819    0x91c88407, 0x41032011, 0x11a51130, 0x15000027, 0x80ff8000, 0x11af4103, 0x841b0341, 0x8bd983fd, 0x9be99bc9, 0x8343831b, 0x21f1821f, 0xb58300ff,
8820    0x0f84e889, 0xf78a0484, 0x8000ff22, 0x0020eeb3, 0x14200082, 0x2130ef41, 0xeb431300, 0x4133200a, 0xd7410ecb, 0x9a07200b, 0x2027871b, 0x21238221,
8821    0xe7828080, 0xe784fd20, 0xe8848020, 0xfe808022, 0x08880d85, 0xba41fd20, 0x82248205, 0x85eab02a, 0x008022e7, 0x2cd74200, 0x44010021, 0xd34406eb,
8822    0x44312013, 0xcf8b0eef, 0x0d422f8b, 0x82332007, 0x0001212f, 0x8023cf82, 0x83000180, 0x820583de, 0x830682d4, 0x820020d4, 0x82dc850a, 0x20e282e9,
8823    0xb2ff85fe, 0x010327e9, 0x02000380, 0x0f440400, 0x0c634407, 0x68825982, 0x85048021, 0x260a825d, 0x010b0000, 0x4400ff00, 0x2746103f, 0x08d74209,
8824    0x4d440720, 0x0eaf4406, 0xc3441d20, 0x23078406, 0xff800002, 0x04845b83, 0x8d05b241, 0x1781436f, 0x6b8c87a5, 0x1521878e, 0x06474505, 0x01210783,
8825    0x84688c00, 0x8904828e, 0x441e8cf7, 0x0b270cff, 0x80008000, 0x45030003, 0xfb430fab, 0x080f4107, 0x410bf942, 0xd34307e5, 0x070d4207, 0x80800123,
8826    0x205d85fe, 0x849183fe, 0x20128404, 0x82809702, 0x00002217, 0x41839a09, 0x6b4408cf, 0x0733440f, 0x3b460720, 0x82798707, 0x97802052, 0x0000296f,
8827    0xff800004, 0x01800100, 0x0021ef89, 0x0a914625, 0x410a4d41, 0x00250ed4, 0x00050000, 0x056d4280, 0x210a7b46, 0x21481300, 0x46ed8512, 0x00210bd1,
8828    0x89718202, 0x21738877, 0x2b850001, 0x00220582, 0x87450a00, 0x0ddb4606, 0x41079b42, 0x9d420c09, 0x0b09420b, 0x8d820720, 0x9742fc84, 0x42098909,
8829    0x00241e0f, 0x00800014, 0x0b47da82, 0x0833442a, 0x49078d41, 0x2f450f13, 0x42278f17, 0x01200751, 0x22063742, 0x44808001, 0x20450519, 0x88068906,
8830    0x83fe2019, 0x4203202a, 0x1a941a58, 0x00820020, 0xe7a40e20, 0x420ce146, 0x854307e9, 0x0fcb4713, 0xff20a182, 0xfe209b82, 0x0c867f8b, 0x0021aea4,
8831    0x219fa40f, 0x7d41003b, 0x07194214, 0xbf440520, 0x071d4206, 0x6941a590, 0x80802309, 0x028900ff, 0xa9a4b685, 0xc5808021, 0x449b82ab, 0x152007eb,
8832    0x42134d46, 0x61440a15, 0x051e4208, 0x222b0442, 0x47001100, 0xfd412913, 0x17194714, 0x410f5b41, 0x02220773, 0x09428080, 0x21a98208, 0xd4420001,
8833    0x481c840d, 0x00232bc9, 0x42120000, 0xe74c261b, 0x149d4405, 0x07209d87, 0x410db944, 0x14421c81, 0x42fd2005, 0x80410bd2, 0x203d8531, 0x06874100,
8834    0x48256f4a, 0xcb420c95, 0x13934113, 0x44075d44, 0x044c0855, 0x00ff2105, 0xfe228185, 0x45448000, 0x22c5b508, 0x410c0000, 0x7b412087, 0x1bb74514,
8835    0x32429c85, 0x0a574805, 0x21208943, 0x8ba01300, 0x440dfb4e, 0x77431437, 0x245b4113, 0x200fb145, 0x41108ffe, 0x80203562, 0x00200082, 0x46362b42,
8836    0x1742178d, 0x4527830f, 0x0f830b2f, 0x4a138146, 0x802409a1, 0xfe8000ff, 0x94419982, 0x09294320, 0x04000022, 0x49050f4f, 0xcb470a63, 0x48032008,
8837    0x2b48067b, 0x85022008, 0x82638338, 0x00002209, 0x05af4806, 0x900e9f49, 0x84c5873f, 0x214285bd, 0x064900ff, 0x0c894607, 0x00000023, 0x4903820a,
8838    0x714319f3, 0x0749410c, 0x8a07a145, 0x02152507, 0xfe808000, 0x74490386, 0x8080211b, 0x0c276f82, 0x00018000, 0x48028003, 0x2b2315db, 0x43002f00,
8839    0x6f82142f, 0x44011521, 0x93510da7, 0x20e68508, 0x06494d80, 0x8e838020, 0x06821286, 0x124bff20, 0x25f3830c, 0x03800080, 0xe74a0380, 0x207b8715,
8840    0x876b861d, 0x4a152007, 0x07870775, 0xf6876086, 0x8417674a, 0x0a0021f2, 0x431c9743, 0x8d421485, 0x200b830b, 0x06474d03, 0x71828020, 0x04510120,
8841    0x42da8606, 0x1f831882, 0x001a0022, 0xff4d0082, 0x0b0f532c, 0x0d449b94, 0x4e312007, 0x074f12e7, 0x0bf3490b, 0xbb412120, 0x413f820a, 0xef490857,
8842    0x80002313, 0xe2830001, 0x6441fc20, 0x8b802006, 0x00012108, 0xfd201582, 0x492c9b48, 0x802014ff, 0x51084347, 0x0f4327f3, 0x17bf4a14, 0x201b7944,
8843    0x06964201, 0x134ffe20, 0x20d6830b, 0x25d78280, 0xfd800002, 0x05888000, 0x9318dc41, 0x21d282d4, 0xdb481800, 0x0dff542a, 0x45107743, 0xe14813f5,
8844    0x0f034113, 0x83135d45, 0x47b28437, 0xe4510e73, 0x21f58e06, 0x2b8400fd, 0x1041fcac, 0x08db4b0b, 0x421fdb41, 0xdf4b18df, 0x011d210a, 0x420af350,
8845    0x6e8308af, 0xac85cb86, 0x1e461082, 0x82b7a407, 0x411420a3, 0xa34130ab, 0x178f4124, 0x41139741, 0x86410d93, 0x82118511, 0x057243d8, 0x8941d9a4,
8846    0x3093480c, 0x4a13474f, 0xfb5016a9, 0x07ad4108, 0x4a0f9d42, 0xfe200fad, 0x4708aa41, 0x83482dba, 0x288f4d06, 0xb398c3bb, 0x44267b41, 0xb34439d7,
8847    0x0755410f, 0x200ebb45, 0x0f5f4215, 0x20191343, 0x06df5301, 0xf04c0220, 0x2ba64d07, 0x82050841, 0x430020ce, 0xa78f3627, 0x5213ff42, 0x2f970bc1,
8848    0x4305ab55, 0xa084111b, 0x450bac45, 0x5f4238b8, 0x010c2106, 0x0220ed82, 0x441bb344, 0x875010af, 0x0737480f, 0x490c5747, 0x0c840c03, 0x4c204b42,
8849    0x8ba905d7, 0x8b948793, 0x510c0c51, 0xfb4b24b9, 0x1b174107, 0x5709d74c, 0xd1410ca5, 0x079d480f, 0x201ff541, 0x06804780, 0x7d520120, 0x80002205,
8850    0x20a983fe, 0x47bb83fe, 0x1b8409b4, 0x81580220, 0x4e00202c, 0x4f41282f, 0x0eab4f17, 0x57471520, 0x0e0f4808, 0x8221e041, 0x3e1b4a8b, 0x4407175d,
8851    0x1b4b071f, 0x4a0f8b07, 0x174a0703, 0x0ba5411b, 0x430fb141, 0x0120057b, 0xfc20dd82, 0x4a056047, 0xf4850c0c, 0x01221982, 0x02828000, 0x1a5d088b,
8852    0x20094108, 0x8c0e3941, 0x4900200e, 0x7744434f, 0x200b870b, 0x0e4b5a33, 0x2b41f78b, 0x8b138307, 0x0b9f450b, 0x2406f741, 0xfd808001, 0x09475a00,
8853    0x84000121, 0x5980200e, 0x85450e5d, 0x832c8206, 0x4106831e, 0x00213814, 0x28b34810, 0x410c2f4b, 0x5f4a13d7, 0x0b2b4113, 0x6e43a883, 0x11174b05,
8854    0x4b066a45, 0xcc470541, 0x5000202b, 0xcb472f4b, 0x44b59f0f, 0xc5430b5b, 0x0d654907, 0x21065544, 0xd6828080, 0xfe201982, 0x8230ec4a, 0x120025c2,
8855    0x80ff8000, 0x4128d74d, 0x3320408b, 0x410a9f50, 0xdb822793, 0x822bd454, 0x61134b2e, 0x410b214a, 0xad4117c9, 0x0001211f, 0x4206854f, 0x4b430596,
8856    0x06bb5530, 0x2025cf46, 0x0ddd5747, 0x500ea349, 0x0f840fa7, 0x5213c153, 0x634e08d1, 0x0bbe4809, 0x59316e4d, 0x5b50053f, 0x203f6323, 0x5117eb46,
8857    0x94450a63, 0x246e410a, 0x63410020, 0x0bdb5f2f, 0x4233ab44, 0x39480757, 0x112d4a07, 0x7241118f, 0x000e2132, 0x9f286f41, 0x0f8762c3, 0x33350723,
8858    0x094e6415, 0x2010925f, 0x067252fe, 0xd0438020, 0x63a68225, 0x11203a4f, 0x480e6360, 0x5748131f, 0x079b521f, 0x200e2f43, 0x864b8315, 0x113348e7,
8859    0x85084e48, 0x06855008, 0x5880fd21, 0x7c420925, 0x0c414824, 0x37470c86, 0x1b8b422b, 0x5b0a8755, 0x23410c21, 0x0b83420b, 0x5a082047, 0xf482067f,
8860    0xa80b4c47, 0x0c0021cf, 0x20207b42, 0x0fb74100, 0x420b8744, 0xeb43076f, 0x0f6f420b, 0x4261fe20, 0x439aa00c, 0x215034e3, 0x0ff9570f, 0x4b1f2d5d,
8861    0x2d5d0c6f, 0x09634d0b, 0x1f51b8a0, 0x620f200c, 0xaf681e87, 0x24f94d07, 0x4e0f4945, 0xfe200c05, 0x22139742, 0x57048080, 0x23950c20, 0x97601585,
8862    0x4813201f, 0xad620523, 0x200f8f0f, 0x9e638f15, 0x00002181, 0x41342341, 0x0f930f0b, 0x210b4b62, 0x978f0001, 0xfe200f84, 0x8425c863, 0x2704822b,
8863    0x80000a00, 0x00038001, 0x610e9768, 0x834514bb, 0x0bc3430f, 0x2107e357, 0x80848080, 0x4400fe21, 0x2e410983, 0x00002a1a, 0x00000700, 0x800380ff,
8864    0x0fdf5800, 0x59150021, 0xd142163d, 0x0c02410c, 0x01020025, 0x65800300, 0x00240853, 0x1d333501, 0x15220382, 0x35420001, 0x44002008, 0x376406d7,
8865    0x096f6b19, 0x480bc142, 0x8f4908a7, 0x211f8b1f, 0x9e830001, 0x0584fe20, 0x4180fd21, 0x11850910, 0x8d198259, 0x000021d4, 0x5a08275d, 0x275d1983,
8866    0x06d9420e, 0x9f08b36a, 0x0f7d47b5, 0x8d8a2f8b, 0x4c0e0b57, 0xe7410e17, 0x42d18c1a, 0xb351087a, 0x1ac36505, 0x4b4a2f20, 0x0b9f450d, 0x430beb53,
8867    0xa7881015, 0xa5826a83, 0x80200f82, 0x86185a65, 0x4100208e, 0x176c3367, 0x0fe7650b, 0x4a17ad4b, 0x0f4217ed, 0x112e4206, 0x41113a42, 0xf7423169,
8868    0x0cb34737, 0x560f8b46, 0xa75407e5, 0x5f01200f, 0x31590c48, 0x80802106, 0x42268841, 0x0020091e, 0x4207ef64, 0x69461df7, 0x138d4114, 0x820f5145,
8869    0x53802090, 0xff200529, 0xb944b183, 0x417e8505, 0x00202561, 0x15210082, 0x42378200, 0x9b431cc3, 0x004f220d, 0x0dd54253, 0x4213f149, 0x7d41133b,
8870    0x42c9870b, 0x802010f9, 0x420b2c42, 0x8f441138, 0x267c4408, 0x600cb743, 0x8f4109d3, 0x05ab701d, 0x83440020, 0x3521223f, 0x0b794733, 0xfb62fe20,
8871    0x4afd2010, 0xaf410ae7, 0x25ce8525, 0x01080000, 0x7b6b0000, 0x0973710b, 0x82010021, 0x49038375, 0x33420767, 0x052c4212, 0x58464b85, 0x41fe2005,
8872    0x50440c27, 0x000c2209, 0x1cb36b80, 0x9b06df44, 0x0f93566f, 0x52830220, 0xfe216e8d, 0x200f8200, 0x0fb86704, 0xb057238d, 0x050b5305, 0x7217eb47,
8873    0xbd410b6b, 0x0f214610, 0x871f9956, 0x1e91567e, 0x2029b741, 0x20008200, 0x18b7410a, 0x27002322, 0x41095543, 0x0f8f0fb3, 0x41000121, 0x889d111c,
8874    0x14207b82, 0x00200382, 0x73188761, 0x475013a7, 0x6e33200c, 0x234e0ea3, 0x9b138313, 0x08e54d17, 0x9711094e, 0x2ee74311, 0x4908875e, 0xd75d1f1f,
8875    0x19ab5238, 0xa2084d48, 0x63a7a9b3, 0x55450b83, 0x0fd74213, 0x440d814c, 0x4f481673, 0x05714323, 0x13000022, 0x412e1f46, 0xdf493459, 0x21c7550f,
8876    0x8408215f, 0x201d49cb, 0xb1103043, 0x0f0d65d7, 0x452b8d41, 0x594b0f8d, 0x0b004605, 0xb215eb46, 0x000a24d7, 0x47000080, 0x002118cf, 0x06436413,
8877    0x420bd750, 0x2b500743, 0x076a470c, 0x4105c050, 0xd942053f, 0x0d00211a, 0x5f44779c, 0x0ce94805, 0x51558186, 0x14a54c0b, 0x49082b41, 0x0a4b0888,
8878    0x8080261f, 0x0d000000, 0x20048201, 0x1deb6a03, 0x420cb372, 0x07201783, 0x4306854d, 0x8b830c59, 0x59093c74, 0x0020250f, 0x67070f4a, 0x2341160b,
8879    0x00372105, 0x431c515d, 0x554e17ef, 0x0e5d6b05, 0x41115442, 0xb74a1ac1, 0x2243420a, 0x5b4f878f, 0x7507200f, 0x384b086f, 0x09d45409, 0x0020869a,
8880    0x12200082, 0xab460382, 0x10075329, 0x54138346, 0xaf540fbf, 0x1ea75413, 0x9a0c9e54, 0x0f6b44c1, 0x41000021, 0x47412a4f, 0x07374907, 0x5310bf76,
8881    0xff2009b4, 0x9a09a64c, 0x8200208d, 0x34c34500, 0x970fe141, 0x1fd74b0f, 0x440a3850, 0x206411f0, 0x27934609, 0x470c5d41, 0x555c2947, 0x1787540f,
8882    0x6e0f234e, 0x7d540a1b, 0x1d736b08, 0x0026a088, 0x80000e00, 0x9b5200ff, 0x08ef4318, 0x450bff77, 0x1d4d0b83, 0x081f7006, 0xcb691b86, 0x4b022008,
8883    0xc34b0b33, 0x1d0d4a0c, 0x8025a188, 0x0b000000, 0x52a38201, 0xbf7d0873, 0x0c234511, 0x8f0f894a, 0x4101200f, 0x0c880c9d, 0x2b418ea1, 0x06c74128,
8884    0x66181341, 0x7b4c0bb9, 0x0c06630b, 0xfe200c87, 0x9ba10882, 0x27091765, 0x01000008, 0x02800380, 0x48113f4e, 0x29430cf5, 0x09a75a0b, 0x31618020,
8885    0x6d802009, 0x61840e33, 0x8208bf51, 0x0c637d61, 0x7f092379, 0x4f470f4b, 0x1797510c, 0x46076157, 0xf5500fdf, 0x0f616910, 0x1171fe20, 0x82802006,
8886    0x08696908, 0x41127a4c, 0x3f4a15f3, 0x01042607, 0x0200ff00, 0x1cf77700, 0xff204185, 0x00235b8d, 0x43100000, 0x3b22243f, 0x3b4d3f00, 0x0b937709,
8887    0xad42f18f, 0x0b1f420f, 0x51084b43, 0x8020104a, 0xb557ff83, 0x052b7f2a, 0x0280ff22, 0x250beb78, 0x00170013, 0xbf6d2500, 0x07db760e, 0x410e2b7f,
8888    0x00230e4f, 0x49030000, 0x0582055b, 0x07000326, 0x00000b00, 0x580bcd46, 0x00200cdd, 0x57078749, 0x8749160f, 0x0f994f0a, 0x41134761, 0x01200b31,
8889    0xeb796883, 0x0b41500b, 0x0e90b38e, 0x202e7b51, 0x05d95801, 0x41080570, 0x1d530fc9, 0x0b937a0f, 0xaf8eb387, 0xf743b98f, 0x07c74227, 0x80000523,
8890    0x0fcb4503, 0x430ca37b, 0x7782077f, 0x8d0a9947, 0x08af4666, 0xeb798020, 0x6459881e, 0xc3740bbf, 0x0feb6f0b, 0x20072748, 0x052b6102, 0x435e0584,
8891    0x7d088308, 0x03200afd, 0x92109e41, 0x28aa8210, 0x80001500, 0x80030000, 0x0fdb5805, 0x209f4018, 0xa7418d87, 0x0aa3440f, 0x20314961, 0x073a52ff,
8892    0x6108505d, 0x43181051, 0x00223457, 0xe7820500, 0x50028021, 0x81410d33, 0x063d7108, 0xdb41af84, 0x4d888205, 0x00201198, 0x463d835f, 0x152106d7,
8893    0x0a355a33, 0x6917614e, 0x75411f4d, 0x184b8b07, 0x1809c344, 0x21091640, 0x0b828000, 0x42808021, 0x26790519, 0x86058605, 0x2428422d, 0x22123b42,
8894    0x42000080, 0xf587513b, 0x7813677b, 0xaf4d139f, 0x00ff210c, 0x5e0a1d57, 0x3b421546, 0x01032736, 0x02000380, 0x41180480, 0x2f420f07, 0x0c624807,
8895    0x00000025, 0x18000103, 0x83153741, 0x430120c3, 0x042106b2, 0x088d4d00, 0x2f830620, 0x1810434a, 0x18140345, 0x8507fb41, 0x5ee582ea, 0x0023116c,
8896    0x8d000600, 0x053b56af, 0xa6554fa2, 0x0d704608, 0x40180d20, 0x47181a43, 0xd37b07ff, 0x0b79500c, 0x420fd745, 0x47450bd9, 0x8471830a, 0x095a777e,
8897    0x84137542, 0x82002013, 0x2f401800, 0x0007213b, 0x4405e349, 0x0d550ff3, 0x16254c0c, 0x820ffe4a, 0x0400218a, 0x89066f41, 0x106b414f, 0xc84d0120,
8898    0x80802206, 0x0c9a4b03, 0x00100025, 0x68000200, 0x9d8c2473, 0x44134344, 0xf36a0f33, 0x4678860f, 0x1b440a25, 0x41988c0a, 0x80201879, 0x43079b5e,
8899    0x4a18080b, 0x0341190b, 0x1259530c, 0x43251552, 0x908205c8, 0x0cac4018, 0x86000421, 0x0e504aa2, 0x0020b891, 0xfb450082, 0x51132014, 0x8f5205f3,
8900    0x35052108, 0x8505cb59, 0x0f6d4f70, 0x82150021, 0x29af5047, 0x4f004b24, 0x75795300, 0x1b595709, 0x460b6742, 0xbf4b0f0d, 0x5743870b, 0xcb6d1461,
8901    0x08f64505, 0x4e05ab6c, 0x334126c3, 0x0bcb6b0d, 0x1811034d, 0x4111ef4b, 0x814f1ce5, 0x20af8227, 0x07fd7b80, 0x41188e84, 0xef410f33, 0x80802429,
8902    0x410d0000, 0xa34205ab, 0x76b7881c, 0xff500b89, 0x0741430f, 0x20086f4a, 0x209d8200, 0x234c18fd, 0x05d4670a, 0x4509af51, 0x9642078d, 0x189e831d,
8903    0x7c1cc74b, 0xcd4c07b9, 0x0e7c440f, 0x8b7b0320, 0x21108210, 0xc76c8080, 0x03002106, 0x6b23bf41, 0xc549060b, 0x7946180b, 0x0ff7530f, 0x17ad4618,
8904    0x200ecd45, 0x208c83fd, 0x5e0488fe, 0x032009c6, 0x420d044e, 0x0d8f0d7f, 0x00820020, 0x18001021, 0x6d273b45, 0xfd4c0c93, 0xcf451813, 0x0fe5450f,
8905    0x5a47c382, 0x820a8b0a, 0x282b4998, 0x410a8b5b, 0x4b232583, 0x54004f00, 0x978f0ce3, 0x500f1944, 0xa95f1709, 0x0280220b, 0x05ba7080, 0xa1530682,
8906    0x06324c13, 0x91412582, 0x05536e2c, 0x63431020, 0x0f434706, 0x8c11374c, 0x176143d7, 0x4d0f454c, 0xd3680bed, 0x0bee4d17, 0x212b9a41, 0x0f530a00,
8907    0x140d531c, 0x43139143, 0x95610e8d, 0x0f094415, 0x4205fb56, 0x1b4205cf, 0x17015225, 0x5e0c477f, 0xaf6e0aeb, 0x0ff36218, 0x04849a84, 0x0a454218,
8908    0x9c430420, 0x23c6822b, 0x04000102, 0x45091b4b, 0xf05f0955, 0x82802007, 0x421c2023, 0x5218282b, 0x7b53173f, 0x0fe7480c, 0x74173b7f, 0x47751317,
8909    0x634d1807, 0x0f6f430f, 0x24086547, 0xfc808002, 0x0b3c7f80, 0x10840120, 0x188d1282, 0x20096b43, 0x0fc24403, 0x00260faf, 0x0180000b, 0x3f500280,
8910    0x18002019, 0x450b4941, 0xf3530fb9, 0x18002010, 0x8208a551, 0x06234d56, 0xcb58a39b, 0xc3421805, 0x1313461e, 0x0f855018, 0xd34b0120, 0x6cfe2008,
8911    0x574f0885, 0x09204114, 0x07000029, 0x00008000, 0x44028002, 0x01420f57, 0x10c95c10, 0x11184c18, 0x80221185, 0x7f421e00, 0x00732240, 0x09cd4977,
8912    0x6d0b2b42, 0x4f180f8f, 0x8f5a0bcb, 0x9b0f830f, 0x0fb9411f, 0x230b5756, 0x00fd8080, 0x82060745, 0x000121d5, 0x8e0fb277, 0x4a8d4211, 0x24061c53,
8913    0x04000007, 0x12275280, 0x430c954c, 0x80201545, 0x200f764f, 0x20008200, 0x20ce8308, 0x09534f02, 0x660edf64, 0x73731771, 0xe7411807, 0x20a2820c,
8914    0x13b64404, 0x8f5d6682, 0x1d6b4508, 0x0cff4d18, 0x3348c58f, 0x0fc34c07, 0x31558b84, 0x8398820f, 0x17514712, 0x240b0e46, 0x80000a00, 0x093b4502,
8915    0x420f9759, 0xa54c0bf1, 0x0f2b470c, 0x410d314b, 0x2584170c, 0x73b30020, 0xb55fe782, 0x204d8410, 0x08e043fe, 0x4f147e41, 0x022008ab, 0x4b055159,
8916    0x2950068f, 0x00022208, 0x48511880, 0x82002009, 0x00112300, 0x634dff00, 0x24415f27, 0x180f6d43, 0x4d0b5d45, 0x4d5f05ef, 0x01802317, 0x56188000,
8917    0xa7840807, 0xc6450220, 0x21ca8229, 0x4b781a00, 0x3359182c, 0x0cf3470f, 0x180bef46, 0x420b0354, 0xff470b07, 0x4515200a, 0x9758239b, 0x4a80200c,
8918    0xd2410a26, 0x05fb4a08, 0x4b05e241, 0x03200dc9, 0x92290941, 0x00002829, 0x00010900, 0x5b020001, 0x23201363, 0x460d776a, 0xef530fdb, 0x209a890c,
8919    0x13fc4302, 0x00008024, 0xc4820104, 0x08820220, 0x20086b5b, 0x18518700, 0x8408d349, 0x0da449a1, 0x00080024, 0x7b690280, 0x4c438b1a, 0x01220f63,
8920    0x4c878000, 0x5c149c53, 0xfb430868, 0x2f56181e, 0x0ccf7b1b, 0x0f075618, 0x2008e347, 0x14144104, 0x00207f83, 0x00207b82, 0x201adf47, 0x16c35a13,
8921    0x540fdf47, 0x802006c8, 0x5418f185, 0x29430995, 0x00002419, 0x58001600, 0x5720316f, 0x4d051542, 0x4b7b1b03, 0x138f4707, 0xb747b787, 0x4aab8213,
8922    0x058305fc, 0x20115759, 0x82128401, 0x0a0b44e8, 0x46800121, 0xe64210d0, 0x82129312, 0x4bffdffe, 0x3b41171b, 0x9b27870f, 0x808022ff, 0x085c68fe,
8923    0x41800021, 0x01410b20, 0x001a213a, 0x47480082, 0x11374e12, 0x56130b4c, 0xdf4b0c65, 0x0b0f590b, 0x0f574c18, 0x830feb4b, 0x075f480f, 0x480b4755,
8924    0x40490b73, 0x80012206, 0x09d74280, 0x80fe8022, 0x80210e86, 0x056643ff, 0x10820020, 0x420b2646, 0x0b58391a, 0xd74c1808, 0x078b4e22, 0x2007f55f,
8925    0x4b491807, 0x83802017, 0x65aa82a7, 0x3152099e, 0x068b7616, 0x9b431220, 0x09bb742c, 0x500e376c, 0x8342179b, 0x0a4d5d0f, 0x8020a883, 0x180cd349,
8926    0x2016bb4b, 0x14476004, 0x84136c43, 0x08cf7813, 0x4f4c0520, 0x156f420f, 0x20085f42, 0x6fd3be03, 0xd4d30803, 0xa7411420, 0x004b222c, 0x0d3b614f,
8927    0x3f702120, 0x1393410a, 0x8f132745, 0x47421827, 0x41e08209, 0xb05e2bb9, 0x18b7410c, 0x18082647, 0x4107a748, 0xeb8826bf, 0x0ca76018, 0x733ecb41,
8928    0xd0410d83, 0x43ebaf2a, 0x0420067f, 0x721dab4c, 0x472005bb, 0x4105d341, 0x334844cb, 0x20dba408, 0x47d6ac00, 0x034e3aef, 0x0f8f421b, 0x930f134d,
8929    0x3521231f, 0xb7421533, 0x42f5ad0a, 0x1e961eaa, 0x17000022, 0x4c367b50, 0x7d491001, 0x0bf5520f, 0x4c18fda7, 0xb8460c55, 0x83fe2005, 0x00fe25b9,
8930    0x80000180, 0x9e751085, 0x261b5c12, 0x82110341, 0x001123fb, 0x4518fe80, 0xf38c2753, 0x6d134979, 0x295107a7, 0xaf5f180f, 0x0fe3660c, 0x180b6079,
8931    0x2007bd5f, 0x9aab9103, 0x2f4d1811, 0x05002109, 0x44254746, 0x1d200787, 0x450bab75, 0x4f180f57, 0x4f181361, 0x3b831795, 0xeb4b0120, 0x0b734805,
8932    0x84078f48, 0x2e1b47bc, 0x00203383, 0xaf065f45, 0x831520d7, 0x130f51a7, 0x1797bf97, 0x2b47d783, 0x18fe2005, 0x4a18a44f, 0xa64d086d, 0x1ab0410d,
8933    0x6205a258, 0xdbab069f, 0x4f06f778, 0xa963081d, 0x133b670a, 0x8323d141, 0x13195b23, 0x530f5e70, 0xe5ad0824, 0x58001421, 0x1f472b4b, 0x47bf410c,
8934    0x82000121, 0x83fe20cb, 0x07424404, 0x68068243, 0xd7ad0d3d, 0x00010d26, 0x80020000, 0x4a1c6f43, 0x23681081, 0x10a14f13, 0x8a070e57, 0x430a848f,
8935    0x7372243e, 0x4397a205, 0xb56c1021, 0x43978f0f, 0x64180505, 0x99aa0ff2, 0x0e000022, 0x20223341, 0x094b4f37, 0x074a3320, 0x2639410a, 0xfe208e84,
8936    0x8b0e0048, 0x508020a3, 0x9e4308fe, 0x073f4115, 0xe3480420, 0x0c9b5f1b, 0x7c137743, 0x9a95185b, 0x6122b148, 0x979b08df, 0x0fe36c18, 0x48109358,
8937    0x23441375, 0x0ffd5c0b, 0x180fc746, 0x2011d157, 0x07e95702, 0x58180120, 0x18770ac3, 0x51032008, 0x7d4118e3, 0x80802315, 0x3b4c1900, 0xbb5a1830,
8938    0x0ceb6109, 0x5b0b3d42, 0x4f181369, 0x4f180b8d, 0x4f180f75, 0x355a1b81, 0x200d820d, 0x18e483fd, 0x4528854f, 0x89420846, 0x1321411f, 0x44086b60,
8939    0x07421d77, 0x107d4405, 0x4113fd41, 0x5a181bf1, 0x4f180db3, 0x8021128f, 0x20f68280, 0x44a882fe, 0x334d249a, 0x052f6109, 0x1520c3a7, 0xef4eb783,
8940    0x4ec39b1b, 0xc4c90ee7, 0x20060b4d, 0x256f4905, 0x4d0cf761, 0xcf9b1f13, 0xa213d74e, 0x0e1145d4, 0x50135b42, 0xcb4e398f, 0x20d79f27, 0x08865d80,
8941    0x186d5018, 0xa90f7142, 0x067342d7, 0x3f450420, 0x65002021, 0xe3560771, 0x24d38f23, 0x15333531, 0x0eb94d01, 0x451c9f41, 0x384322fb, 0x00092108,
8942    0x19af6b18, 0x6e0c6f5a, 0xbd770bfb, 0x22bb7718, 0x20090f57, 0x25e74204, 0x4207275a, 0xdb5408ef, 0x1769450f, 0x1b1b5518, 0x210b1f57, 0x5e4c8001,
8943    0x55012006, 0x802107f1, 0x0a306a80, 0x45808021, 0x0d850b88, 0x31744f18, 0x1808ec54, 0x2009575b, 0x45ffa505, 0x1b420c73, 0x180f9f0f, 0x4a0cf748,
8944    0x501805b2, 0x00210f40, 0x4d118f80, 0xd6823359, 0x072b5118, 0x314ad7aa, 0x8fc79f08, 0x45d78b1f, 0xfe20058f, 0x23325118, 0x7b54d9b5, 0x9fc38f46,
8945    0x10bb410f, 0x41077b42, 0xc1410faf, 0x27cf441d, 0x46051b4f, 0x04200683, 0x2121d344, 0x8f530043, 0x8fcf9f0e, 0x21df8c1f, 0x50188000, 0x5d180e52,
8946    0xfd201710, 0x4405c341, 0xd68528e3, 0x20071f6b, 0x1b734305, 0x6b080957, 0x7d422b1f, 0x67002006, 0x7f8317b1, 0x2024cb48, 0x08676e00, 0x8749a39b,
8947    0x18132006, 0x410a6370, 0x8f490b47, 0x7e1f8f13, 0x551805c3, 0x4c180915, 0xfe200e2f, 0x244d5d18, 0x270bcf44, 0xff000019, 0x04800380, 0x5f253342,
8948    0xff520df7, 0x13274c18, 0x5542dd93, 0x0776181b, 0xf94a1808, 0x084a4c0c, 0x4308ea5b, 0xde831150, 0x7900fd21, 0x00492c1e, 0x060f4510, 0x17410020,
8949    0x0ce74526, 0x6206b341, 0x1f561083, 0x9d6c181b, 0x08a0500e, 0x112e4118, 0x60000421, 0xbf901202, 0x4408e241, 0xc7ab0513, 0xb40f0950, 0x055943c7,
8950    0x4f18ff20, 0xc9ae1cad, 0x32b34f18, 0x7a180120, 0x3d520a05, 0x53d1b40a, 0x80200813, 0x1b815018, 0x832bf86f, 0x67731847, 0x297f4308, 0x6418d54e,
8951    0x734213f7, 0x056b4b27, 0xdba5fe20, 0x1828aa4e, 0x2031a370, 0x06cb6101, 0x2040ad41, 0x07365300, 0x2558d985, 0x83fe200c, 0x0380211c, 0x542c4743,
8952    0x052006b7, 0x6021df45, 0x897b0707, 0x18d3c010, 0x20090e70, 0x1d5843ff, 0x540a0e44, 0x002126c5, 0x322f7416, 0x636a5720, 0x0f317409, 0x610fe159,
8953    0x294617e7, 0x08555213, 0x2006a75d, 0x6cec84fd, 0xfb5907be, 0x3a317405, 0x83808021, 0x180f20ea, 0x4626434a, 0x531818e3, 0xdb59172d, 0x0cbb460c,
8954    0x2013d859, 0x18b94502, 0x8f46188d, 0x77521842, 0x0a184e38, 0x9585fd20, 0x6a180684, 0xc64507e9, 0x51cbb230, 0xd3440cf3, 0x17ff6a0f, 0x450f5b42,
8955    0x276407c1, 0x4853180a, 0x21ccb010, 0xcf580013, 0x0c15442d, 0x410a1144, 0x1144359d, 0x5cfe2006, 0xa1410a43, 0x2bb64519, 0x2f5b7618, 0xb512b745,
8956    0x0cfd6fd1, 0x42089f59, 0xb8450c70, 0x0000232d, 0x50180900, 0xb9491ae3, 0x0fc37610, 0x01210f83, 0x0f3b4100, 0xa01b2742, 0x0ccd426f, 0x6e8f6f94,
8957    0x9c808021, 0xc7511870, 0x17c74b08, 0x9b147542, 0x44fe2079, 0xd5480c7e, 0x95ef861d, 0x101b597b, 0xf5417594, 0x9f471808, 0x86868d0e, 0x3733491c,
8958    0x690f4d6d, 0x43440b83, 0x1ba94c0b, 0x660cd16b, 0x802008ae, 0x74126448, 0xcb4f38a3, 0x2cb74b0b, 0x47137755, 0xe3971777, 0x1b5d0120, 0x057a4108,
8959    0x6e08664d, 0x17421478, 0x11af4208, 0x850c3f42, 0x08234f0c, 0x4321eb4a, 0xf3451095, 0x0f394e0f, 0x4310eb45, 0xc09707b1, 0x54431782, 0xaec08d1d,
8960    0x0f434dbb, 0x9f0c0b45, 0x0a3b4dbb, 0x4618bdc7, 0x536032eb, 0x17354213, 0x4d134169, 0xc7a30c2f, 0x4e254342, 0x174332cf, 0x43cdae17, 0x6b4706e4,
8961    0x0e16430d, 0x530b5542, 0x2f7c26bb, 0x13075f31, 0x43175342, 0x60181317, 0x6550114e, 0x28624710, 0x58070021, 0x59181683, 0x2d540cf5, 0x05d5660c,
8962    0x20090c7b, 0x0e157e02, 0x8000ff2b, 0x14000080, 0x80ff8000, 0x27137e03, 0x336a4b20, 0x0f817107, 0x13876e18, 0x730f2f7e, 0x2f450b75, 0x6d02200b,
8963    0x6d66094c, 0x4b802009, 0x15820a02, 0x2f45fe20, 0x5e032006, 0x00202fd9, 0x450af741, 0xeb412e0f, 0x0ff3411f, 0x420a8b65, 0xf7410eae, 0x1c664810,
8964    0x540e1145, 0xbfa509f3, 0x42302f58, 0x80200c35, 0xcb066c47, 0x4b1120c1, 0x41492abb, 0x34854110, 0xa7097b72, 0x251545c7, 0x4b2c7f56, 0xc5b40bab,
8965    0x940cd54e, 0x2e6151c8, 0x09f35f18, 0x4b420420, 0x09677121, 0x8f24f357, 0x1b5418e1, 0x08915a1f, 0x3143d894, 0x22541805, 0x1b9b4b0e, 0x8c0d3443,
8966    0x1400240d, 0x18ff8000, 0x582e6387, 0xf99b2b3b, 0x8807a550, 0x17a14790, 0x2184fd20, 0x5758fe20, 0x2354882c, 0x15000080, 0x5e056751, 0x334c2c2f,
8967    0x97c58f0c, 0x1fd7410f, 0x0d4d4018, 0x4114dc41, 0x04470ed6, 0x0dd54128, 0x00820020, 0x02011523, 0x22008700, 0x86480024, 0x0001240a, 0x8682001a,
8968    0x0002240b, 0x866c000e, 0x8a03200b, 0x8a042017, 0x0005220b, 0x22218614, 0x84060000, 0x86012017, 0x8212200f, 0x250b8519, 0x000d0001, 0x0b850031,
8969    0x07000224, 0x0b862600, 0x11000324, 0x0b862d00, 0x238a0420, 0x0a000524, 0x17863e00, 0x17840620, 0x01000324, 0x57820904, 0x0b85a783, 0x0b85a785,
8970    0x0b85a785, 0x22000325, 0x85007a00, 0x85a7850b, 0x85a7850b, 0x22a7850b, 0x82300032, 0x00342201, 0x0805862f, 0x35003131, 0x54207962, 0x74736972,
8971    0x47206e61, 0x6d6d6972, 0x65527265, 0x616c7567, 0x58545472, 0x6f725020, 0x43796767, 0x6e61656c, 0x30325454, 0x822f3430, 0x35313502, 0x79006200,
8972    0x54002000, 0x69007200, 0x74007300, 0x6e006100, 0x47200f82, 0x6d240f84, 0x65006d00, 0x52200982, 0x67240582, 0x6c007500, 0x72201d82, 0x54222b82,
8973    0x23825800, 0x19825020, 0x67006f22, 0x79220182, 0x1b824300, 0x3b846520, 0x1f825420, 0x41000021, 0x1422099b, 0x0b410000, 0x87088206, 0x01012102,
8974    0x78080982, 0x01020101, 0x01040103, 0x01060105, 0x01080107, 0x010a0109, 0x010c010b, 0x010e010d, 0x0110010f, 0x01120111, 0x01140113, 0x01160115,
8975    0x01180117, 0x011a0119, 0x011c011b, 0x011e011d, 0x0020011f, 0x00040003, 0x00060005, 0x00080007, 0x000a0009, 0x000c000b, 0x000e000d, 0x0010000f,
8976    0x00120011, 0x00140013, 0x00160015, 0x00180017, 0x001a0019, 0x001c001b, 0x001e001d, 0x08bb821f, 0x22002142, 0x24002300, 0x26002500, 0x28002700,
8977    0x2a002900, 0x2c002b00, 0x2e002d00, 0x30002f00, 0x32003100, 0x34003300, 0x36003500, 0x38003700, 0x3a003900, 0x3c003b00, 0x3e003d00, 0x40003f00,
8978    0x42004100, 0x4b09f382, 0x00450044, 0x00470046, 0x00490048, 0x004b004a, 0x004d004c, 0x004f004e, 0x00510050, 0x00530052, 0x00550054, 0x00570056,
8979    0x00590058, 0x005b005a, 0x005d005c, 0x005f005e, 0x01610060, 0x01220121, 0x01240123, 0x01260125, 0x01280127, 0x012a0129, 0x012c012b, 0x012e012d,
8980    0x0130012f, 0x01320131, 0x01340133, 0x01360135, 0x01380137, 0x013a0139, 0x013c013b, 0x013e013d, 0x0140013f, 0x00ac0041, 0x008400a3, 0x00bd0085,
8981    0x00e80096, 0x008e0086, 0x009d008b, 0x00a400a9, 0x008a00ef, 0x008300da, 0x00f20093, 0x008d00f3, 0x00880097, 0x00de00c3, 0x009e00f1, 0x00f500aa,
8982    0x00f600f4, 0x00ad00a2, 0x00c700c9, 0x006200ae, 0x00900063, 0x00cb0064, 0x00c80065, 0x00cf00ca, 0x00cd00cc, 0x00e900ce, 0x00d30066, 0x00d100d0,
8983    0x006700af, 0x009100f0, 0x00d400d6, 0x006800d5, 0x00ed00eb, 0x006a0089, 0x006b0069, 0x006c006d, 0x00a0006e, 0x0071006f, 0x00720070, 0x00750073,
8984    0x00760074, 0x00ea0077, 0x007a0078, 0x007b0079, 0x007c007d, 0x00a100b8, 0x007e007f, 0x00810080, 0x00ee00ec, 0x6e750eba, 0x646f6369, 0x78302365,
8985    0x31303030, 0x32200e8d, 0x33200e8d, 0x34200e8d, 0x35200e8d, 0x36200e8d, 0x37200e8d, 0x38200e8d, 0x39200e8d, 0x61200e8d, 0x62200e8d, 0x63200e8d,
8986    0x64200e8d, 0x65200e8d, 0x66200e8d, 0x31210e8c, 0x8d0e8d30, 0x8d3120ef, 0x8d3120ef, 0x8d3120ef, 0x8d3120ef, 0x8d3120ef, 0x8d3120ef, 0x8d3120ef,
8987    0x8d3120ef, 0x8d3120ef, 0x8d3120ef, 0x8d3120ef, 0x8d3120ef, 0x8d3120ef, 0x66312def, 0x6c656406, 0x04657465, 0x6f727545, 0x3820ec8c, 0x3820ec8d,
8988    0x3820ec8d, 0x3820ec8d, 0x3820ec8d, 0x3820ec8d, 0x3820ec8d, 0x3820ec8d, 0x3820ec8d, 0x3820ec8d, 0x3820ec8d, 0x3820ec8d, 0x3820ec8d, 0x3820ec8d,
8989    0x3820ec8d, 0x200ddc41, 0x0ddc4139, 0xef8d3920, 0xef8d3920, 0xef8d3920, 0xef8d3920, 0xef8d3920, 0xef8d3920, 0xef8d3920, 0xef8d3920, 0xef8d3920,
8990    0xef8d3920, 0xef8d3920, 0xef8d3920, 0xef8d3920, 0xef8d3920, 0x00663923, 0x48fa0500, 0x00f762f9,
9245    0x0000bc57, 0x00000000, 0xf8a00000, 0x00000400, 0x00010037, 0x000c0000, 0x00030080, 0x2f534f40, 0x74eb8832, 0x01000090, 0x2c158248, 0x616d634e,
9246    0x23120270, 0x03000075, 0x241382a0, 0x74766352, 0x82178220, 0xfc042102, 0x02380482, 0x66796c67, 0x5689af12, 0x04070000, 0x80920000, 0x64616568,
9247    0xd36691d7, 0xcc201b82, 0x36210382, 0x27108268, 0xc3014208, 0x04010000, 0x243b0f82, 0x78746d68, 0x807e008a, 0x98010000, 0x06020000, 0x61636f6c,
9248    0xd8b0738c, 0x82050000, 0x0402291e, 0x7078616d, 0xda00ae01, 0x28201f82, 0x202c1082, 0x656d616e, 0x96bb5925, 0x84990000, 0x9e2c1382, 0x74736f70,
9249    0xef83aca6, 0x249b0000, 0xd22c3382, 0x70657270, 0x12010269, 0xf4040000, 0x08202f82, 0x012ecb84, 0x553c0000, 0x0f5fd5e9, 0x0300f53c, 0x00830008,
9250    0x7767b722, 0x002b3f82, 0xa692bd00, 0xfe0000d7, 0x83800380, 0x21f1826f, 0x00850002, 0x41820120, 0x40fec026, 0x80030000, 0x05821083, 0x07830120,
9251    0x0221038a, 0x24118200, 0x90000101, 0x82798200, 0x00022617, 0x00400008, 0x2009820a, 0x82098276, 0x82002006, 0x9001213b, 0x0223c883, 0x828a02bc,
9252    0x858f2010, 0xc5012507, 0x00023200, 0x04210083, 0x91058309, 0x6c412b03, 0x40007374, 0xac200000, 0x00830008, 0x01000523, 0x834d8380, 0x80032103,
9253    0x012101bf, 0x23b88280, 0x00800000, 0x0b830382, 0x07820120, 0x83800021, 0x88012001, 0x84002009, 0x2005870f, 0x870d8301, 0x2023901b, 0x83199501,
9254    0x82002015, 0x84802000, 0x84238267, 0x88002027, 0x8561882d, 0x21058211, 0x13880000, 0x01800022, 0x05850d85, 0x0f828020, 0x03208384, 0x03200582,
9255    0x47901b84, 0x1b850020, 0x1f821d82, 0x3f831d88, 0x3f410383, 0x84058405, 0x210982cd, 0x09830000, 0x03207789, 0xf38a1384, 0x01203782, 0x13872384,
9256    0x0b88c983, 0x0d898f84, 0x00202982, 0x23900383, 0x87008021, 0x83df8301, 0x86118d03, 0x863f880d, 0x8f35880f, 0x2160820f, 0x04830300, 0x1c220382,
9257    0x05820100, 0x4c000022, 0x09831182, 0x04001c24, 0x11823000, 0x0800082e, 0x00000200, 0xff007f00, 0xffffac20, 0x00220982, 0x09848100, 0xdf216682,
9258    0x843586d5, 0x06012116, 0x04400684, 0xa58120d7, 0x00b127d8, 0x01b88d01, 0x2d8685ff, 0xc100c621, 0xf4be0801, 0x9e011c01, 0x88021402, 0x1403fc02,
9259    0x9c035803, 0x1404de03, 0x50043204, 0xa2046204, 0x66051605, 0x1206bc05, 0xd6067406, 0x7e073807, 0x4e08ec07, 0x96086c08, 0x1009d008, 0x88094a09,
9260    0x800a160a, 0x560b040b, 0x2e0cc80b, 0xea0c820c, 0xa40d5e0d, 0x500eea0d, 0x280f960e, 0x1210b00f, 0xe0107410, 0xb6115211, 0x6e120412, 0x4c13c412,
9261    0xf613ac13, 0xae145814, 0x4015ea14, 0xa6158015, 0x1216b815, 0xc6167e16, 0x8e173417, 0x5618e017, 0xee18ba18, 0x96193619, 0x481ad419, 0xf01a9c1a,
9262    0xc81b5c1b, 0x4c1c041c, 0xea1c961c, 0x921d2a1d, 0x401ed21d, 0xe01e8e1e, 0x761f241f, 0xa61fa61f, 0x01821020, 0x8a202e34, 0xc820b220, 0x74211421,
9263    0xee219821, 0x86226222, 0x01820c23, 0x83238021, 0x23983c01, 0x24d823b0, 0x244a2400, 0x24902468, 0x250625ae, 0x25822560, 0x26f825f8, 0x82aa2658,
9264    0xd8be0801, 0x9a274027, 0x68280a28, 0x0e29a828, 0xb8292029, 0x362af829, 0x602a602a, 0x2a2b022b, 0xac2b5e2b, 0x202ce62b, 0x9a2c342c, 0x5c2d282d,
9265    0xaa2d782d, 0x262ee82d, 0x262fa62e, 0xf42fb62f, 0xc8305e30, 0xb4313e31, 0x9e321e32, 0x82331e33, 0x5c34ee33, 0x3a35ce34, 0xd4358635, 0x72362636,
9266    0x7637e636, 0x3a38d837, 0x1239a638, 0xae397439, 0x9a3a2e3a, 0x7c3b063b, 0x3a3ce83b, 0x223d963c, 0xec3d863d, 0xc63e563e, 0x9a3f2a3f, 0x6a401240,
9267    0x3641d040, 0x0842a241, 0x7a424042, 0xf042b842, 0xcc436243, 0x8a442a44, 0x5845ee44, 0xe245b645, 0xb4465446, 0x7a471447, 0x5448da47, 0x4049c648,
9268    0x15462400, 0x034d0808, 0x0b000700, 0x13000f00, 0x1b001700, 0x23001f00, 0x2b002700, 0x33002f00, 0x3b003700, 0x43003f00, 0x4b004700, 0x53004f00,
9269    0x5b005700, 0x63005f00, 0x6b006700, 0x73006f00, 0x7b007700, 0x83007f00, 0x8b008700, 0x00008f00, 0x15333511, 0x20039631, 0x20178205, 0xd3038221,
9270    0x20739707, 0x25008580, 0x028080fc, 0x05be8080, 0x04204a85, 0x05ce0685, 0x0107002a, 0x02000080, 0x00000400, 0x250d8b41, 0x33350100, 0x03920715,
9271    0x13820320, 0x858d0120, 0x0e8d0320, 0xff260d83, 0x00808000, 0x54820106, 0x04800223, 0x845b8c80, 0x41332059, 0x078b068f, 0x82000121, 0x82fe2039,
9272    0x84802003, 0x83042004, 0x23598a0e, 0x00180000, 0x03210082, 0x42ab9080, 0x73942137, 0x2013bb41, 0x8f978205, 0x2027a39b, 0x20b68801, 0x84b286fd,
9273    0x91c88407, 0x41032011, 0x11a51130, 0x15000027, 0x80ff8000, 0x11af4103, 0x841b0341, 0x8bd983fd, 0x9be99bc9, 0x8343831b, 0x21f1821f, 0xb58300ff,
9274    0x0f84e889, 0xf78a0484, 0x8000ff22, 0x0020eeb3, 0x14200082, 0x2130ef41, 0xeb431300, 0x4133200a, 0xd7410ecb, 0x9a07200b, 0x2027871b, 0x21238221,
9275    0xe7828080, 0xe784fd20, 0xe8848020, 0xfe808022, 0x08880d85, 0xba41fd20, 0x82248205, 0x85eab02a, 0x008022e7, 0x2cd74200, 0x44010021, 0xd34406eb,
9276    0x44312013, 0xcf8b0eef, 0x0d422f8b, 0x82332007, 0x0001212f, 0x8023cf82, 0x83000180, 0x820583de, 0x830682d4, 0x820020d4, 0x82dc850a, 0x20e282e9,
9277    0xb2ff85fe, 0x010327e9, 0x02000380, 0x0f440400, 0x0c634407, 0x68825982, 0x85048021, 0x260a825d, 0x010b0000, 0x4400ff00, 0x2746103f, 0x08d74209,
9278    0x4d440720, 0x0eaf4406, 0xc3441d20, 0x23078406, 0xff800002, 0x04845b83, 0x8d05b241, 0x1781436f, 0x6b8c87a5, 0x1521878e, 0x06474505, 0x01210783,
9279    0x84688c00, 0x8904828e, 0x441e8cf7, 0x0b270cff, 0x80008000, 0x45030003, 0xfb430fab, 0x080f4107, 0x410bf942, 0xd34307e5, 0x070d4207, 0x80800123,
9280    0x205d85fe, 0x849183fe, 0x20128404, 0x82809702, 0x00002217, 0x41839a09, 0x6b4408cf, 0x0733440f, 0x3b460720, 0x82798707, 0x97802052, 0x0000296f,
9281    0xff800004, 0x01800100, 0x0021ef89, 0x0a914625, 0x410a4d41, 0x00250ed4, 0x00050000, 0x056d4280, 0x210a7b46, 0x21481300, 0x46ed8512, 0x00210bd1,
9282    0x89718202, 0x21738877, 0x2b850001, 0x00220582, 0x87450a00, 0x0ddb4606, 0x41079b42, 0x9d420c09, 0x0b09420b, 0x8d820720, 0x9742fc84, 0x42098909,
9283    0x00241e0f, 0x00800014, 0x0b47da82, 0x0833442a, 0x49078d41, 0x2f450f13, 0x42278f17, 0x01200751, 0x22063742, 0x44808001, 0x20450519, 0x88068906,
9284    0x83fe2019, 0x4203202a, 0x1a941a58, 0x00820020, 0xe7a40e20, 0x420ce146, 0x854307e9, 0x0fcb4713, 0xff20a182, 0xfe209b82, 0x0c867f8b, 0x0021aea4,
9285    0x219fa40f, 0x7d41003b, 0x07194214, 0xbf440520, 0x071d4206, 0x6941a590, 0x80802309, 0x028900ff, 0xa9a4b685, 0xc5808021, 0x449b82ab, 0x152007eb,
9286    0x42134d46, 0x61440a15, 0x051e4208, 0x222b0442, 0x47001100, 0xfd412913, 0x17194714, 0x410f5b41, 0x02220773, 0x09428080, 0x21a98208, 0xd4420001,
9287    0x481c840d, 0x00232bc9, 0x42120000, 0xe74c261b, 0x149d4405, 0x07209d87, 0x410db944, 0x14421c81, 0x42fd2005, 0x80410bd2, 0x203d8531, 0x06874100,
9288    0x48256f4a, 0xcb420c95, 0x13934113, 0x44075d44, 0x044c0855, 0x00ff2105, 0xfe228185, 0x45448000, 0x22c5b508, 0x410c0000, 0x7b412087, 0x1bb74514,
9289    0x32429c85, 0x0a574805, 0x21208943, 0x8ba01300, 0x440dfb4e, 0x77431437, 0x245b4113, 0x200fb145, 0x41108ffe, 0x80203562, 0x00200082, 0x46362b42,
9290    0x1742178d, 0x4527830f, 0x0f830b2f, 0x4a138146, 0x802409a1, 0xfe8000ff, 0x94419982, 0x09294320, 0x04000022, 0x49050f4f, 0xcb470a63, 0x48032008,
9291    0x2b48067b, 0x85022008, 0x82638338, 0x00002209, 0x05af4806, 0x900e9f49, 0x84c5873f, 0x214285bd, 0x064900ff, 0x0c894607, 0x00000023, 0x4903820a,
9292    0x714319f3, 0x0749410c, 0x8a07a145, 0x02152507, 0xfe808000, 0x74490386, 0x8080211b, 0x0c276f82, 0x00018000, 0x48028003, 0x2b2315db, 0x43002f00,
9293    0x6f82142f, 0x44011521, 0x93510da7, 0x20e68508, 0x06494d80, 0x8e838020, 0x06821286, 0x124bff20, 0x25f3830c, 0x03800080, 0xe74a0380, 0x207b8715,
9294    0x876b861d, 0x4a152007, 0x07870775, 0xf6876086, 0x8417674a, 0x0a0021f2, 0x431c9743, 0x8d421485, 0x200b830b, 0x06474d03, 0x71828020, 0x04510120,
9295    0x42da8606, 0x1f831882, 0x001a0022, 0xff4d0082, 0x0b0f532c, 0x0d449b94, 0x4e312007, 0x074f12e7, 0x0bf3490b, 0xbb412120, 0x413f820a, 0xef490857,
9296    0x80002313, 0xe2830001, 0x6441fc20, 0x8b802006, 0x00012108, 0xfd201582, 0x492c9b48, 0x802014ff, 0x51084347, 0x0f4327f3, 0x17bf4a14, 0x201b7944,
9297    0x06964201, 0x134ffe20, 0x20d6830b, 0x25d78280, 0xfd800002, 0x05888000, 0x9318dc41, 0x21d282d4, 0xdb481800, 0x0dff542a, 0x45107743, 0xe14813f5,
9298    0x0f034113, 0x83135d45, 0x47b28437, 0xe4510e73, 0x21f58e06, 0x2b8400fd, 0x1041fcac, 0x08db4b0b, 0x421fdb41, 0xdf4b18df, 0x011d210a, 0x420af350,
9299    0x6e8308af, 0xac85cb86, 0x1e461082, 0x82b7a407, 0x411420a3, 0xa34130ab, 0x178f4124, 0x41139741, 0x86410d93, 0x82118511, 0x057243d8, 0x8941d9a4,
9300    0x3093480c, 0x4a13474f, 0xfb5016a9, 0x07ad4108, 0x4a0f9d42, 0xfe200fad, 0x4708aa41, 0x83482dba, 0x288f4d06, 0xb398c3bb, 0x44267b41, 0xb34439d7,
9301    0x0755410f, 0x200ebb45, 0x0f5f4215, 0x20191343, 0x06df5301, 0xf04c0220, 0x2ba64d07, 0x82050841, 0x430020ce, 0xa78f3627, 0x5213ff42, 0x2f970bc1,
9302    0x4305ab55, 0xa084111b, 0x450bac45, 0x5f4238b8, 0x010c2106, 0x0220ed82, 0x441bb344, 0x875010af, 0x0737480f, 0x490c5747, 0x0c840c03, 0x4c204b42,
9303    0x8ba905d7, 0x8b948793, 0x510c0c51, 0xfb4b24b9, 0x1b174107, 0x5709d74c, 0xd1410ca5, 0x079d480f, 0x201ff541, 0x06804780, 0x7d520120, 0x80002205,
9304    0x20a983fe, 0x47bb83fe, 0x1b8409b4, 0x81580220, 0x4e00202c, 0x4f41282f, 0x0eab4f17, 0x57471520, 0x0e0f4808, 0x8221e041, 0x3e1b4a8b, 0x4407175d,
9305    0x1b4b071f, 0x4a0f8b07, 0x174a0703, 0x0ba5411b, 0x430fb141, 0x0120057b, 0xfc20dd82, 0x4a056047, 0xf4850c0c, 0x01221982, 0x02828000, 0x1a5d088b,
9306    0x20094108, 0x8c0e3941, 0x4900200e, 0x7744434f, 0x200b870b, 0x0e4b5a33, 0x2b41f78b, 0x8b138307, 0x0b9f450b, 0x2406f741, 0xfd808001, 0x09475a00,
9307    0x84000121, 0x5980200e, 0x85450e5d, 0x832c8206, 0x4106831e, 0x00213814, 0x28b34810, 0x410c2f4b, 0x5f4a13d7, 0x0b2b4113, 0x6e43a883, 0x11174b05,
9308    0x4b066a45, 0xcc470541, 0x5000202b, 0xcb472f4b, 0x44b59f0f, 0xc5430b5b, 0x0d654907, 0x21065544, 0xd6828080, 0xfe201982, 0x8230ec4a, 0x120025c2,
9309    0x80ff8000, 0x4128d74d, 0x3320408b, 0x410a9f50, 0xdb822793, 0x822bd454, 0x61134b2e, 0x410b214a, 0xad4117c9, 0x0001211f, 0x4206854f, 0x4b430596,
9310    0x06bb5530, 0x2025cf46, 0x0ddd5747, 0x500ea349, 0x0f840fa7, 0x5213c153, 0x634e08d1, 0x0bbe4809, 0x59316e4d, 0x5b50053f, 0x203f6323, 0x5117eb46,
9311    0x94450a63, 0x246e410a, 0x63410020, 0x0bdb5f2f, 0x4233ab44, 0x39480757, 0x112d4a07, 0x7241118f, 0x000e2132, 0x9f286f41, 0x0f8762c3, 0x33350723,
9312    0x094e6415, 0x2010925f, 0x067252fe, 0xd0438020, 0x63a68225, 0x11203a4f, 0x480e6360, 0x5748131f, 0x079b521f, 0x200e2f43, 0x864b8315, 0x113348e7,
9313    0x85084e48, 0x06855008, 0x5880fd21, 0x7c420925, 0x0c414824, 0x37470c86, 0x1b8b422b, 0x5b0a8755, 0x23410c21, 0x0b83420b, 0x5a082047, 0xf482067f,
9314    0xa80b4c47, 0x0c0021cf, 0x20207b42, 0x0fb74100, 0x420b8744, 0xeb43076f, 0x0f6f420b, 0x4261fe20, 0x439aa00c, 0x215034e3, 0x0ff9570f, 0x4b1f2d5d,
9315    0x2d5d0c6f, 0x09634d0b, 0x1f51b8a0, 0x620f200c, 0xaf681e87, 0x24f94d07, 0x4e0f4945, 0xfe200c05, 0x22139742, 0x57048080, 0x23950c20, 0x97601585,
9316    0x4813201f, 0xad620523, 0x200f8f0f, 0x9e638f15, 0x00002181, 0x41342341, 0x0f930f0b, 0x210b4b62, 0x978f0001, 0xfe200f84, 0x8425c863, 0x2704822b,
9317    0x80000a00, 0x00038001, 0x610e9768, 0x834514bb, 0x0bc3430f, 0x2107e357, 0x80848080, 0x4400fe21, 0x2e410983, 0x00002a1a, 0x00000700, 0x800380ff,
9318    0x0fdf5800, 0x59150021, 0xd142163d, 0x0c02410c, 0x01020025, 0x65800300, 0x00240853, 0x1d333501, 0x15220382, 0x35420001, 0x44002008, 0x376406d7,
9319    0x096f6b19, 0x480bc142, 0x8f4908a7, 0x211f8b1f, 0x9e830001, 0x0584fe20, 0x4180fd21, 0x11850910, 0x8d198259, 0x000021d4, 0x5a08275d, 0x275d1983,
9320    0x06d9420e, 0x9f08b36a, 0x0f7d47b5, 0x8d8a2f8b, 0x4c0e0b57, 0xe7410e17, 0x42d18c1a, 0xb351087a, 0x1ac36505, 0x4b4a2f20, 0x0b9f450d, 0x430beb53,
9321    0xa7881015, 0xa5826a83, 0x80200f82, 0x86185a65, 0x4100208e, 0x176c3367, 0x0fe7650b, 0x4a17ad4b, 0x0f4217ed, 0x112e4206, 0x41113a42, 0xf7423169,
9322    0x0cb34737, 0x560f8b46, 0xa75407e5, 0x5f01200f, 0x31590c48, 0x80802106, 0x42268841, 0x0020091e, 0x4207ef64, 0x69461df7, 0x138d4114, 0x820f5145,
9323    0x53802090, 0xff200529, 0xb944b183, 0x417e8505, 0x00202561, 0x15210082, 0x42378200, 0x9b431cc3, 0x004f220d, 0x0dd54253, 0x4213f149, 0x7d41133b,
9324    0x42c9870b, 0x802010f9, 0x420b2c42, 0x8f441138, 0x267c4408, 0x600cb743, 0x8f4109d3, 0x05ab701d, 0x83440020, 0x3521223f, 0x0b794733, 0xfb62fe20,
9325    0x4afd2010, 0xaf410ae7, 0x25ce8525, 0x01080000, 0x7b6b0000, 0x0973710b, 0x82010021, 0x49038375, 0x33420767, 0x052c4212, 0x58464b85, 0x41fe2005,
9326    0x50440c27, 0x000c2209, 0x1cb36b80, 0x9b06df44, 0x0f93566f, 0x52830220, 0xfe216e8d, 0x200f8200, 0x0fb86704, 0xb057238d, 0x050b5305, 0x7217eb47,
9327    0xbd410b6b, 0x0f214610, 0x871f9956, 0x1e91567e, 0x2029b741, 0x20008200, 0x18b7410a, 0x27002322, 0x41095543, 0x0f8f0fb3, 0x41000121, 0x889d111c,
9328    0x14207b82, 0x00200382, 0x73188761, 0x475013a7, 0x6e33200c, 0x234e0ea3, 0x9b138313, 0x08e54d17, 0x9711094e, 0x2ee74311, 0x4908875e, 0xd75d1f1f,
9329    0x19ab5238, 0xa2084d48, 0x63a7a9b3, 0x55450b83, 0x0fd74213, 0x440d814c, 0x4f481673, 0x05714323, 0x13000022, 0x412e1f46, 0xdf493459, 0x21c7550f,
9330    0x8408215f, 0x201d49cb, 0xb1103043, 0x0f0d65d7, 0x452b8d41, 0x594b0f8d, 0x0b004605, 0xb215eb46, 0x000a24d7, 0x47000080, 0x002118cf, 0x06436413,
9331    0x420bd750, 0x2b500743, 0x076a470c, 0x4105c050, 0xd942053f, 0x0d00211a, 0x5f44779c, 0x0ce94805, 0x51558186, 0x14a54c0b, 0x49082b41, 0x0a4b0888,
9332    0x8080261f, 0x0d000000, 0x20048201, 0x1deb6a03, 0x420cb372, 0x07201783, 0x4306854d, 0x8b830c59, 0x59093c74, 0x0020250f, 0x67070f4a, 0x2341160b,
9333    0x00372105, 0x431c515d, 0x554e17ef, 0x0e5d6b05, 0x41115442, 0xb74a1ac1, 0x2243420a, 0x5b4f878f, 0x7507200f, 0x384b086f, 0x09d45409, 0x0020869a,
9334    0x12200082, 0xab460382, 0x10075329, 0x54138346, 0xaf540fbf, 0x1ea75413, 0x9a0c9e54, 0x0f6b44c1, 0x41000021, 0x47412a4f, 0x07374907, 0x5310bf76,
9335    0xff2009b4, 0x9a09a64c, 0x8200208d, 0x34c34500, 0x970fe141, 0x1fd74b0f, 0x440a3850, 0x206411f0, 0x27934609, 0x470c5d41, 0x555c2947, 0x1787540f,
9336    0x6e0f234e, 0x7d540a1b, 0x1d736b08, 0x0026a088, 0x80000e00, 0x9b5200ff, 0x08ef4318, 0x450bff77, 0x1d4d0b83, 0x081f7006, 0xcb691b86, 0x4b022008,
9337    0xc34b0b33, 0x1d0d4a0c, 0x8025a188, 0x0b000000, 0x52a38201, 0xbf7d0873, 0x0c234511, 0x8f0f894a, 0x4101200f, 0x0c880c9d, 0x2b418ea1, 0x06c74128,
9338    0x66181341, 0x7b4c0bb9, 0x0c06630b, 0xfe200c87, 0x9ba10882, 0x27091765, 0x01000008, 0x02800380, 0x48113f4e, 0x29430cf5, 0x09a75a0b, 0x31618020,
9339    0x6d802009, 0x61840e33, 0x8208bf51, 0x0c637d61, 0x7f092379, 0x4f470f4b, 0x1797510c, 0x46076157, 0xf5500fdf, 0x0f616910, 0x1171fe20, 0x82802006,
9340    0x08696908, 0x41127a4c, 0x3f4a15f3, 0x01042607, 0x0200ff00, 0x1cf77700, 0xff204185, 0x00235b8d, 0x43100000, 0x3b22243f, 0x3b4d3f00, 0x0b937709,
9341    0xad42f18f, 0x0b1f420f, 0x51084b43, 0x8020104a, 0xb557ff83, 0x052b7f2a, 0x0280ff22, 0x250beb78, 0x00170013, 0xbf6d2500, 0x07db760e, 0x410e2b7f,
9342    0x00230e4f, 0x49030000, 0x0582055b, 0x07000326, 0x00000b00, 0x580bcd46, 0x00200cdd, 0x57078749, 0x8749160f, 0x0f994f0a, 0x41134761, 0x01200b31,
9343    0xeb796883, 0x0b41500b, 0x0e90b38e, 0x202e7b51, 0x05d95801, 0x41080570, 0x1d530fc9, 0x0b937a0f, 0xaf8eb387, 0xf743b98f, 0x07c74227, 0x80000523,
9344    0x0fcb4503, 0x430ca37b, 0x7782077f, 0x8d0a9947, 0x08af4666, 0xeb798020, 0x6459881e, 0xc3740bbf, 0x0feb6f0b, 0x20072748, 0x052b6102, 0x435e0584,
9345    0x7d088308, 0x03200afd, 0x92109e41, 0x28aa8210, 0x80001500, 0x80030000, 0x0fdb5805, 0x209f4018, 0xa7418d87, 0x0aa3440f, 0x20314961, 0x073a52ff,
9346    0x6108505d, 0x43181051, 0x00223457, 0xe7820500, 0x50028021, 0x81410d33, 0x063d7108, 0xdb41af84, 0x4d888205, 0x00201198, 0x463d835f, 0x152106d7,
9347    0x0a355a33, 0x6917614e, 0x75411f4d, 0x184b8b07, 0x1809c344, 0x21091640, 0x0b828000, 0x42808021, 0x26790519, 0x86058605, 0x2428422d, 0x22123b42,
9348    0x42000080, 0xf587513b, 0x7813677b, 0xaf4d139f, 0x00ff210c, 0x5e0a1d57, 0x3b421546, 0x01032736, 0x02000380, 0x41180480, 0x2f420f07, 0x0c624807,
9349    0x00000025, 0x18000103, 0x83153741, 0x430120c3, 0x042106b2, 0x088d4d00, 0x2f830620, 0x1810434a, 0x18140345, 0x8507fb41, 0x5ee582ea, 0x0023116c,
9350    0x8d000600, 0x053b56af, 0xa6554fa2, 0x0d704608, 0x40180d20, 0x47181a43, 0xd37b07ff, 0x0b79500c, 0x420fd745, 0x47450bd9, 0x8471830a, 0x095a777e,
9351    0x84137542, 0x82002013, 0x2f401800, 0x0007213b, 0x4405e349, 0x0d550ff3, 0x16254c0c, 0x820ffe4a, 0x0400218a, 0x89066f41, 0x106b414f, 0xc84d0120,
9352    0x80802206, 0x0c9a4b03, 0x00100025, 0x68000200, 0x9d8c2473, 0x44134344, 0xf36a0f33, 0x4678860f, 0x1b440a25, 0x41988c0a, 0x80201879, 0x43079b5e,
9353    0x4a18080b, 0x0341190b, 0x1259530c, 0x43251552, 0x908205c8, 0x0cac4018, 0x86000421, 0x0e504aa2, 0x0020b891, 0xfb450082, 0x51132014, 0x8f5205f3,
9354    0x35052108, 0x8505cb59, 0x0f6d4f70, 0x82150021, 0x29af5047, 0x4f004b24, 0x75795300, 0x1b595709, 0x460b6742, 0xbf4b0f0d, 0x5743870b, 0xcb6d1461,
9355    0x08f64505, 0x4e05ab6c, 0x334126c3, 0x0bcb6b0d, 0x1811034d, 0x4111ef4b, 0x814f1ce5, 0x20af8227, 0x07fd7b80, 0x41188e84, 0xef410f33, 0x80802429,
9356    0x410d0000, 0xa34205ab, 0x76b7881c, 0xff500b89, 0x0741430f, 0x20086f4a, 0x209d8200, 0x234c18fd, 0x05d4670a, 0x4509af51, 0x9642078d, 0x189e831d,
9357    0x7c1cc74b, 0xcd4c07b9, 0x0e7c440f, 0x8b7b0320, 0x21108210, 0xc76c8080, 0x03002106, 0x6b23bf41, 0xc549060b, 0x7946180b, 0x0ff7530f, 0x17ad4618,
9358    0x200ecd45, 0x208c83fd, 0x5e0488fe, 0x032009c6, 0x420d044e, 0x0d8f0d7f, 0x00820020, 0x18001021, 0x6d273b45, 0xfd4c0c93, 0xcf451813, 0x0fe5450f,
9359    0x5a47c382, 0x820a8b0a, 0x282b4998, 0x410a8b5b, 0x4b232583, 0x54004f00, 0x978f0ce3, 0x500f1944, 0xa95f1709, 0x0280220b, 0x05ba7080, 0xa1530682,
9360    0x06324c13, 0x91412582, 0x05536e2c, 0x63431020, 0x0f434706, 0x8c11374c, 0x176143d7, 0x4d0f454c, 0xd3680bed, 0x0bee4d17, 0x212b9a41, 0x0f530a00,
9361    0x140d531c, 0x43139143, 0x95610e8d, 0x0f094415, 0x4205fb56, 0x1b4205cf, 0x17015225, 0x5e0c477f, 0xaf6e0aeb, 0x0ff36218, 0x04849a84, 0x0a454218,
9362    0x9c430420, 0x23c6822b, 0x04000102, 0x45091b4b, 0xf05f0955, 0x82802007, 0x421c2023, 0x5218282b, 0x7b53173f, 0x0fe7480c, 0x74173b7f, 0x47751317,
9363    0x634d1807, 0x0f6f430f, 0x24086547, 0xfc808002, 0x0b3c7f80, 0x10840120, 0x188d1282, 0x20096b43, 0x0fc24403, 0x00260faf, 0x0180000b, 0x3f500280,
9364    0x18002019, 0x450b4941, 0xf3530fb9, 0x18002010, 0x8208a551, 0x06234d56, 0xcb58a39b, 0xc3421805, 0x1313461e, 0x0f855018, 0xd34b0120, 0x6cfe2008,
9365    0x574f0885, 0x09204114, 0x07000029, 0x00008000, 0x44028002, 0x01420f57, 0x10c95c10, 0x11184c18, 0x80221185, 0x7f421e00, 0x00732240, 0x09cd4977,
9366    0x6d0b2b42, 0x4f180f8f, 0x8f5a0bcb, 0x9b0f830f, 0x0fb9411f, 0x230b5756, 0x00fd8080, 0x82060745, 0x000121d5, 0x8e0fb277, 0x4a8d4211, 0x24061c53,
9367    0x04000007, 0x12275280, 0x430c954c, 0x80201545, 0x200f764f, 0x20008200, 0x20ce8308, 0x09534f02, 0x660edf64, 0x73731771, 0xe7411807, 0x20a2820c,
9368    0x13b64404, 0x8f5d6682, 0x1d6b4508, 0x0cff4d18, 0x3348c58f, 0x0fc34c07, 0x31558b84, 0x8398820f, 0x17514712, 0x240b0e46, 0x80000a00, 0x093b4502,
9369    0x420f9759, 0xa54c0bf1, 0x0f2b470c, 0x410d314b, 0x2584170c, 0x73b30020, 0xb55fe782, 0x204d8410, 0x08e043fe, 0x4f147e41, 0x022008ab, 0x4b055159,
9370    0x2950068f, 0x00022208, 0x48511880, 0x82002009, 0x00112300, 0x634dff00, 0x24415f27, 0x180f6d43, 0x4d0b5d45, 0x4d5f05ef, 0x01802317, 0x56188000,
9371    0xa7840807, 0xc6450220, 0x21ca8229, 0x4b781a00, 0x3359182c, 0x0cf3470f, 0x180bef46, 0x420b0354, 0xff470b07, 0x4515200a, 0x9758239b, 0x4a80200c,
9372    0xd2410a26, 0x05fb4a08, 0x4b05e241, 0x03200dc9, 0x92290941, 0x00002829, 0x00010900, 0x5b020001, 0x23201363, 0x460d776a, 0xef530fdb, 0x209a890c,
9373    0x13fc4302, 0x00008024, 0xc4820104, 0x08820220, 0x20086b5b, 0x18518700, 0x8408d349, 0x0da449a1, 0x00080024, 0x7b690280, 0x4c438b1a, 0x01220f63,
9374    0x4c878000, 0x5c149c53, 0xfb430868, 0x2f56181e, 0x0ccf7b1b, 0x0f075618, 0x2008e347, 0x14144104, 0x00207f83, 0x00207b82, 0x201adf47, 0x16c35a13,
9375    0x540fdf47, 0x802006c8, 0x5418f185, 0x29430995, 0x00002419, 0x58001600, 0x5720316f, 0x4d051542, 0x4b7b1b03, 0x138f4707, 0xb747b787, 0x4aab8213,
9376    0x058305fc, 0x20115759, 0x82128401, 0x0a0b44e8, 0x46800121, 0xe64210d0, 0x82129312, 0x4bffdffe, 0x3b41171b, 0x9b27870f, 0x808022ff, 0x085c68fe,
9377    0x41800021, 0x01410b20, 0x001a213a, 0x47480082, 0x11374e12, 0x56130b4c, 0xdf4b0c65, 0x0b0f590b, 0x0f574c18, 0x830feb4b, 0x075f480f, 0x480b4755,
9378    0x40490b73, 0x80012206, 0x09d74280, 0x80fe8022, 0x80210e86, 0x056643ff, 0x10820020, 0x420b2646, 0x0b58391a, 0xd74c1808, 0x078b4e22, 0x2007f55f,
9379    0x4b491807, 0x83802017, 0x65aa82a7, 0x3152099e, 0x068b7616, 0x9b431220, 0x09bb742c, 0x500e376c, 0x8342179b, 0x0a4d5d0f, 0x8020a883, 0x180cd349,
9380    0x2016bb4b, 0x14476004, 0x84136c43, 0x08cf7813, 0x4f4c0520, 0x156f420f, 0x20085f42, 0x6fd3be03, 0xd4d30803, 0xa7411420, 0x004b222c, 0x0d3b614f,
9381    0x3f702120, 0x1393410a, 0x8f132745, 0x47421827, 0x41e08209, 0xb05e2bb9, 0x18b7410c, 0x18082647, 0x4107a748, 0xeb8826bf, 0x0ca76018, 0x733ecb41,
9382    0xd0410d83, 0x43ebaf2a, 0x0420067f, 0x721dab4c, 0x472005bb, 0x4105d341, 0x334844cb, 0x20dba408, 0x47d6ac00, 0x034e3aef, 0x0f8f421b, 0x930f134d,
9383    0x3521231f, 0xb7421533, 0x42f5ad0a, 0x1e961eaa, 0x17000022, 0x4c367b50, 0x7d491001, 0x0bf5520f, 0x4c18fda7, 0xb8460c55, 0x83fe2005, 0x00fe25b9,
9384    0x80000180, 0x9e751085, 0x261b5c12, 0x82110341, 0x001123fb, 0x4518fe80, 0xf38c2753, 0x6d134979, 0x295107a7, 0xaf5f180f, 0x0fe3660c, 0x180b6079,
9385    0x2007bd5f, 0x9aab9103, 0x2f4d1811, 0x05002109, 0x44254746, 0x1d200787, 0x450bab75, 0x4f180f57, 0x4f181361, 0x3b831795, 0xeb4b0120, 0x0b734805,
9386    0x84078f48, 0x2e1b47bc, 0x00203383, 0xaf065f45, 0x831520d7, 0x130f51a7, 0x1797bf97, 0x2b47d783, 0x18fe2005, 0x4a18a44f, 0xa64d086d, 0x1ab0410d,
9387    0x6205a258, 0xdbab069f, 0x4f06f778, 0xa963081d, 0x133b670a, 0x8323d141, 0x13195b23, 0x530f5e70, 0xe5ad0824, 0x58001421, 0x1f472b4b, 0x47bf410c,
9388    0x82000121, 0x83fe20cb, 0x07424404, 0x68068243, 0xd7ad0d3d, 0x00010d26, 0x80020000, 0x4a1c6f43, 0x23681081, 0x10a14f13, 0x8a070e57, 0x430a848f,
9389    0x7372243e, 0x4397a205, 0xb56c1021, 0x43978f0f, 0x64180505, 0x99aa0ff2, 0x0e000022, 0x20223341, 0x094b4f37, 0x074a3320, 0x2639410a, 0xfe208e84,
9390    0x8b0e0048, 0x508020a3, 0x9e4308fe, 0x073f4115, 0xe3480420, 0x0c9b5f1b, 0x7c137743, 0x9a95185b, 0x6122b148, 0x979b08df, 0x0fe36c18, 0x48109358,
9391    0x23441375, 0x0ffd5c0b, 0x180fc746, 0x2011d157, 0x07e95702, 0x58180120, 0x18770ac3, 0x51032008, 0x7d4118e3, 0x80802315, 0x3b4c1900, 0xbb5a1830,
9392    0x0ceb6109, 0x5b0b3d42, 0x4f181369, 0x4f180b8d, 0x4f180f75, 0x355a1b81, 0x200d820d, 0x18e483fd, 0x4528854f, 0x89420846, 0x1321411f, 0x44086b60,
9393    0x07421d77, 0x107d4405, 0x4113fd41, 0x5a181bf1, 0x4f180db3, 0x8021128f, 0x20f68280, 0x44a882fe, 0x334d249a, 0x052f6109, 0x1520c3a7, 0xef4eb783,
9394    0x4ec39b1b, 0xc4c90ee7, 0x20060b4d, 0x256f4905, 0x4d0cf761, 0xcf9b1f13, 0xa213d74e, 0x0e1145d4, 0x50135b42, 0xcb4e398f, 0x20d79f27, 0x08865d80,
9395    0x186d5018, 0xa90f7142, 0x067342d7, 0x3f450420, 0x65002021, 0xe3560771, 0x24d38f23, 0x15333531, 0x0eb94d01, 0x451c9f41, 0x384322fb, 0x00092108,
9396    0x19af6b18, 0x6e0c6f5a, 0xbd770bfb, 0x22bb7718, 0x20090f57, 0x25e74204, 0x4207275a, 0xdb5408ef, 0x1769450f, 0x1b1b5518, 0x210b1f57, 0x5e4c8001,
9397    0x55012006, 0x802107f1, 0x0a306a80, 0x45808021, 0x0d850b88, 0x31744f18, 0x1808ec54, 0x2009575b, 0x45ffa505, 0x1b420c73, 0x180f9f0f, 0x4a0cf748,
9398    0x501805b2, 0x00210f40, 0x4d118f80, 0xd6823359, 0x072b5118, 0x314ad7aa, 0x8fc79f08, 0x45d78b1f, 0xfe20058f, 0x23325118, 0x7b54d9b5, 0x9fc38f46,
9399    0x10bb410f, 0x41077b42, 0xc1410faf, 0x27cf441d, 0x46051b4f, 0x04200683, 0x2121d344, 0x8f530043, 0x8fcf9f0e, 0x21df8c1f, 0x50188000, 0x5d180e52,
9400    0xfd201710, 0x4405c341, 0xd68528e3, 0x20071f6b, 0x1b734305, 0x6b080957, 0x7d422b1f, 0x67002006, 0x7f8317b1, 0x2024cb48, 0x08676e00, 0x8749a39b,
9401    0x18132006, 0x410a6370, 0x8f490b47, 0x7e1f8f13, 0x551805c3, 0x4c180915, 0xfe200e2f, 0x244d5d18, 0x270bcf44, 0xff000019, 0x04800380, 0x5f253342,
9402    0xff520df7, 0x13274c18, 0x5542dd93, 0x0776181b, 0xf94a1808, 0x084a4c0c, 0x4308ea5b, 0xde831150, 0x7900fd21, 0x00492c1e, 0x060f4510, 0x17410020,
9403    0x0ce74526, 0x6206b341, 0x1f561083, 0x9d6c181b, 0x08a0500e, 0x112e4118, 0x60000421, 0xbf901202, 0x4408e241, 0xc7ab0513, 0xb40f0950, 0x055943c7,
9404    0x4f18ff20, 0xc9ae1cad, 0x32b34f18, 0x7a180120, 0x3d520a05, 0x53d1b40a, 0x80200813, 0x1b815018, 0x832bf86f, 0x67731847, 0x297f4308, 0x6418d54e,
9405    0x734213f7, 0x056b4b27, 0xdba5fe20, 0x1828aa4e, 0x2031a370, 0x06cb6101, 0x2040ad41, 0x07365300, 0x2558d985, 0x83fe200c, 0x0380211c, 0x542c4743,
9406    0x052006b7, 0x6021df45, 0x897b0707, 0x18d3c010, 0x20090e70, 0x1d5843ff, 0x540a0e44, 0x002126c5, 0x322f7416, 0x636a5720, 0x0f317409, 0x610fe159,
9407    0x294617e7, 0x08555213, 0x2006a75d, 0x6cec84fd, 0xfb5907be, 0x3a317405, 0x83808021, 0x180f20ea, 0x4626434a, 0x531818e3, 0xdb59172d, 0x0cbb460c,
9408    0x2013d859, 0x18b94502, 0x8f46188d, 0x77521842, 0x0a184e38, 0x9585fd20, 0x6a180684, 0xc64507e9, 0x51cbb230, 0xd3440cf3, 0x17ff6a0f, 0x450f5b42,
9409    0x276407c1, 0x4853180a, 0x21ccb010, 0xcf580013, 0x0c15442d, 0x410a1144, 0x1144359d, 0x5cfe2006, 0xa1410a43, 0x2bb64519, 0x2f5b7618, 0xb512b745,
9410    0x0cfd6fd1, 0x42089f59, 0xb8450c70, 0x0000232d, 0x50180900, 0xb9491ae3, 0x0fc37610, 0x01210f83, 0x0f3b4100, 0xa01b2742, 0x0ccd426f, 0x6e8f6f94,
9411    0x9c808021, 0xc7511870, 0x17c74b08, 0x9b147542, 0x44fe2079, 0xd5480c7e, 0x95ef861d, 0x101b597b, 0xf5417594, 0x9f471808, 0x86868d0e, 0x3733491c,
9412    0x690f4d6d, 0x43440b83, 0x1ba94c0b, 0x660cd16b, 0x802008ae, 0x74126448, 0xcb4f38a3, 0x2cb74b0b, 0x47137755, 0xe3971777, 0x1b5d0120, 0x057a4108,
9413    0x6e08664d, 0x17421478, 0x11af4208, 0x850c3f42, 0x08234f0c, 0x4321eb4a, 0xf3451095, 0x0f394e0f, 0x4310eb45, 0xc09707b1, 0x54431782, 0xaec08d1d,
9414    0x0f434dbb, 0x9f0c0b45, 0x0a3b4dbb, 0x4618bdc7, 0x536032eb, 0x17354213, 0x4d134169, 0xc7a30c2f, 0x4e254342, 0x174332cf, 0x43cdae17, 0x6b4706e4,
9415    0x0e16430d, 0x530b5542, 0x2f7c26bb, 0x13075f31, 0x43175342, 0x60181317, 0x6550114e, 0x28624710, 0x58070021, 0x59181683, 0x2d540cf5, 0x05d5660c,
9416    0x20090c7b, 0x0e157e02, 0x8000ff2b, 0x14000080, 0x80ff8000, 0x27137e03, 0x336a4b20, 0x0f817107, 0x13876e18, 0x730f2f7e, 0x2f450b75, 0x6d02200b,
9417    0x6d66094c, 0x4b802009, 0x15820a02, 0x2f45fe20, 0x5e032006, 0x00202fd9, 0x450af741, 0xeb412e0f, 0x0ff3411f, 0x420a8b65, 0xf7410eae, 0x1c664810,
9418    0x540e1145, 0xbfa509f3, 0x42302f58, 0x80200c35, 0xcb066c47, 0x4b1120c1, 0x41492abb, 0x34854110, 0xa7097b72, 0x251545c7, 0x4b2c7f56, 0xc5b40bab,
9419    0x940cd54e, 0x2e6151c8, 0x09f35f18, 0x4b420420, 0x09677121, 0x8f24f357, 0x1b5418e1, 0x08915a1f, 0x3143d894, 0x22541805, 0x1b9b4b0e, 0x8c0d3443,
9420    0x1400240d, 0x18ff8000, 0x582e6387, 0xf99b2b3b, 0x8807a550, 0x17a14790, 0x2184fd20, 0x5758fe20, 0x2354882c, 0x15000080, 0x5e056751, 0x334c2c2f,
9421    0x97c58f0c, 0x1fd7410f, 0x0d4d4018, 0x4114dc41, 0x04470ed6, 0x0dd54128, 0x00820020, 0x02011523, 0x22008700, 0x86480024, 0x0001240a, 0x8682001a,
9422    0x0002240b, 0x866c000e, 0x8a03200b, 0x8a042017, 0x0005220b, 0x22218614, 0x84060000, 0x86012017, 0x8212200f, 0x250b8519, 0x000d0001, 0x0b850031,
9423    0x07000224, 0x0b862600, 0x11000324, 0x0b862d00, 0x238a0420, 0x0a000524, 0x17863e00, 0x17840620, 0x01000324, 0x57820904, 0x0b85a783, 0x0b85a785,
9424    0x0b85a785, 0x22000325, 0x85007a00, 0x85a7850b, 0x85a7850b, 0x22a7850b, 0x82300032, 0x00342201, 0x0805862f, 0x35003131, 0x54207962, 0x74736972,
9425    0x47206e61, 0x6d6d6972, 0x65527265, 0x616c7567, 0x58545472, 0x6f725020, 0x43796767, 0x6e61656c, 0x30325454, 0x822f3430, 0x35313502, 0x79006200,
9426    0x54002000, 0x69007200, 0x74007300, 0x6e006100, 0x47200f82, 0x6d240f84, 0x65006d00, 0x52200982, 0x67240582, 0x6c007500, 0x72201d82, 0x54222b82,
9427    0x23825800, 0x19825020, 0x67006f22, 0x79220182, 0x1b824300, 0x3b846520, 0x1f825420, 0x41000021, 0x1422099b, 0x0b410000, 0x87088206, 0x01012102,
9428    0x78080982, 0x01020101, 0x01040103, 0x01060105, 0x01080107, 0x010a0109, 0x010c010b, 0x010e010d, 0x0110010f, 0x01120111, 0x01140113, 0x01160115,
9429    0x01180117, 0x011a0119, 0x011c011b, 0x011e011d, 0x0020011f, 0x00040003, 0x00060005, 0x00080007, 0x000a0009, 0x000c000b, 0x000e000d, 0x0010000f,
9430    0x00120011, 0x00140013, 0x00160015, 0x00180017, 0x001a0019, 0x001c001b, 0x001e001d, 0x08bb821f, 0x22002142, 0x24002300, 0x26002500, 0x28002700,
9431    0x2a002900, 0x2c002b00, 0x2e002d00, 0x30002f00, 0x32003100, 0x34003300, 0x36003500, 0x38003700, 0x3a003900, 0x3c003b00, 0x3e003d00, 0x40003f00,
9432    0x42004100, 0x4b09f382, 0x00450044, 0x00470046, 0x00490048, 0x004b004a, 0x004d004c, 0x004f004e, 0x00510050, 0x00530052, 0x00550054, 0x00570056,
9433    0x00590058, 0x005b005a, 0x005d005c, 0x005f005e, 0x01610060, 0x01220121, 0x01240123, 0x01260125, 0x01280127, 0x012a0129, 0x012c012b, 0x012e012d,
9434    0x0130012f, 0x01320131, 0x01340133, 0x01360135, 0x01380137, 0x013a0139, 0x013c013b, 0x013e013d, 0x0140013f, 0x00ac0041, 0x008400a3, 0x00bd0085,
9435    0x00e80096, 0x008e0086, 0x009d008b, 0x00a400a9, 0x008a00ef, 0x008300da, 0x00f20093, 0x008d00f3, 0x00880097, 0x00de00c3, 0x009e00f1, 0x00f500aa,
9436    0x00f600f4, 0x00ad00a2, 0x00c700c9, 0x006200ae, 0x00900063, 0x00cb0064, 0x00c80065, 0x00cf00ca, 0x00cd00cc, 0x00e900ce, 0x00d30066, 0x00d100d0,
9437    0x006700af, 0x009100f0, 0x00d400d6, 0x006800d5, 0x00ed00eb, 0x006a0089, 0x006b0069, 0x006c006d, 0x00a0006e, 0x0071006f, 0x00720070, 0x00750073,
9438    0x00760074, 0x00ea0077, 0x007a0078, 0x007b0079, 0x007c007d, 0x00a100b8, 0x007e007f, 0x00810080, 0x00ee00ec, 0x6e750eba, 0x646f6369, 0x78302365,
9439    0x31303030, 0x32200e8d, 0x33200e8d, 0x34200e8d, 0x35200e8d, 0x36200e8d, 0x37200e8d, 0x38200e8d, 0x39200e8d, 0x61200e8d, 0x62200e8d, 0x63200e8d,
9440    0x64200e8d, 0x65200e8d, 0x66200e8d, 0x31210e8c, 0x8d0e8d30, 0x8d3120ef, 0x8d3120ef, 0x8d3120ef, 0x8d3120ef, 0x8d3120ef, 0x8d3120ef, 0x8d3120ef,
9441    0x8d3120ef, 0x8d3120ef, 0x8d3120ef, 0x8d3120ef, 0x8d3120ef, 0x8d3120ef, 0x66312def, 0x6c656406, 0x04657465, 0x6f727545, 0x3820ec8c, 0x3820ec8d,
9442    0x3820ec8d, 0x3820ec8d, 0x3820ec8d, 0x3820ec8d, 0x3820ec8d, 0x3820ec8d, 0x3820ec8d, 0x3820ec8d, 0x3820ec8d, 0x3820ec8d, 0x3820ec8d, 0x3820ec8d,
9443    0x3820ec8d, 0x200ddc41, 0x0ddc4139, 0xef8d3920, 0xef8d3920, 0xef8d3920, 0xef8d3920, 0xef8d3920, 0xef8d3920, 0xef8d3920, 0xef8d3920, 0xef8d3920,
9444    0xef8d3920, 0xef8d3920, 0xef8d3920, 0xef8d3920, 0xef8d3920, 0x00663923, 0x48fa0500, 0x00f762f9,
89919445};
89929446
89939447static void GetDefaultCompressedFontDataTTF(const void** ttf_compressed_data, unsigned int* ttf_compressed_size)
branches/kale/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h
r244546r244547
1// ImGui library v1.30
2// See .cpp file for commentary.
1// ImGui library v1.32 wip
2// See .cpp file for documentation.
33// See ImGui::ShowTestWindow() for sample code.
44// Read 'Programmer guide' in .cpp for notes on how to setup ImGui in your codebase.
55// Get latest version at https://github.com/ocornut/imgui
r244546r244547
4343typedef int ImGuiWindowFlags;       // enum ImGuiWindowFlags_
4444typedef int ImGuiSetCondition;      // enum ImGuiSetCondition_
4545typedef int ImGuiInputTextFlags;    // enum ImGuiInputTextFlags_
46struct ImGuiTextEditCallbackData;   // for advanced uses of InputText()
46struct ImGuiTextEditCallbackData;   // for advanced uses of InputText()
4747
4848struct ImVec2
4949{
r244546r244547
6969
7070namespace ImGui
7171{
72    // Proxy functions to access the MemAllocFn/MemFreeFn/MemReallocFn pointers in ImGui::GetIO(). The only reason they exist here is to allow ImVector<> to compile inline.
72    // Proxy functions to access the MemAllocFn/MemFreeFn pointers in ImGui::GetIO(). The only reason they exist here is to allow ImVector<> to compile inline.
7373    IMGUI_API void*       MemAlloc(size_t sz);
7474    IMGUI_API void        MemFree(void* ptr);
75    IMGUI_API void*       MemRealloc(void* ptr, size_t sz);
7675}
7776
78// std::vector<> like class to avoid dragging dependencies (also: windows implementation of STL with debug enabled is absurdly slow, so let's bypass it so our code runs fast in debug).
77// std::vector<> like class to avoid dragging dependencies (also: windows implementation of STL with debug enabled is absurdly slow, so let's bypass it so our code runs fast in debug).
7978// Use '#define ImVector std::vector' if you want to use the STL type or your own type.
8079// Our implementation does NOT call c++ constructors! because the data types we use don't need them (but that could be added as well). Only provide the minimum functionalities we need.
8180#ifndef ImVector
r244546r244547
115114    inline const value_type&    back() const                    { IM_ASSERT(Size > 0); return Data[Size-1]; }
116115    inline void                 swap(ImVector<T>& rhs)          { const size_t rhs_size = rhs.Size; rhs.Size = Size; Size = rhs_size; const size_t rhs_cap = rhs.Capacity; rhs.Capacity = Capacity; Capacity = rhs_cap; value_type* rhs_data = rhs.Data; rhs.Data = Data; Data = rhs_data; }
117116
118    inline void                 reserve(size_t new_capacity)    { Data = (value_type*)ImGui::MemRealloc(Data, new_capacity * sizeof(value_type)); Capacity = new_capacity; }
119117    inline void                 resize(size_t new_size)         { if (new_size > Capacity) reserve(new_size); Size = new_size; }
118    inline void                 reserve(size_t new_capacity)
119    {
120        if (new_capacity <= Capacity) return;
121        T* new_data = (value_type*)ImGui::MemAlloc(new_capacity * sizeof(value_type));
122        memcpy(new_data, Data, Size * sizeof(value_type));
123        ImGui::MemFree(Data);
124        Data = new_data;
125        Capacity = new_capacity;
126    }
120127
121128    inline void                 push_back(const value_type& v)  { if (Size == Capacity) reserve(Capacity ? Capacity * 2 : 4); Data[Size++] = v; }
122129    inline void                 pop_back()                      { IM_ASSERT(Size > 0); Size--; }
r244546r244547
152159    IMGUI_API bool          Begin(const char* name = "Debug", bool* p_opened = NULL, ImVec2 size = ImVec2(0,0), float fill_alpha = -1.0f, ImGuiWindowFlags flags = 0);// return false when window is collapsed, so you can early out in your code. passing 'bool* p_opened' displays a Close button on the upper-right corner of the window, the pointed value will be set to false when the button is pressed.
153160    IMGUI_API void          End();
154161    IMGUI_API void          BeginChild(const char* str_id, ImVec2 size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0);                         // size==0.0f: use remaining window size, size<0.0f: use remaining window size minus abs(size). on each axis.
162    IMGUI_API void          BeginChild(ImGuiID id, ImVec2 size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0);                                 // "
155163    IMGUI_API void          EndChild();
156164    IMGUI_API bool          GetWindowIsFocused();
157    IMGUI_API ImVec2        GetContentRegionMax();                                              // window or current column boundaries
158    IMGUI_API ImVec2        GetWindowContentRegionMin();                                        // window boundaries
165    IMGUI_API ImVec2        GetContentRegionMax();                                              // window or current column boundaries, in windows coordinates
166    IMGUI_API ImVec2        GetWindowContentRegionMin();                                        // window boundaries, in windows coordinates
159167    IMGUI_API ImVec2        GetWindowContentRegionMax();
160168    IMGUI_API ImDrawList*   GetWindowDrawList();                                                // get rendering command-list if you want to append your own draw primitives.
161169    IMGUI_API ImFont*       GetWindowFont();
162    IMGUI_API float         GetWindowFontSize();
170    IMGUI_API float         GetWindowFontSize();                                                // size (also height in pixels) of current font with current scale applied
163171    IMGUI_API void          SetWindowFontScale(float scale);                                    // per-window font scale. Adjust IO.FontGlobalScale if you want to scale all windows.
164172    IMGUI_API ImVec2        GetWindowPos();                                                     // you should rarely need/care about the window position, but it can be useful if you want to do your own drawing.
165173    IMGUI_API ImVec2        GetWindowSize();                                                    // get current window position.
166174    IMGUI_API float         GetWindowWidth();
167175    IMGUI_API bool          GetWindowCollapsed();
168    IMGUI_API void          SetWindowPos(const ImVec2& pos, ImGuiSetCondition cond = 0);        // set current window position - call within Begin()/End().
169    IMGUI_API void          SetWindowSize(const ImVec2& size, ImGuiSetCondition cond = 0);      // set current window size. set to ImVec2(0,0) to force an auto-fit
170    IMGUI_API void          SetWindowCollapsed(bool collapsed, ImGuiSetCondition cond = 0);     // set current window collapsed state.
171176    IMGUI_API void          SetNextWindowPos(const ImVec2& pos, ImGuiSetCondition cond = 0);    // set next window position - call before Begin().
172    IMGUI_API void          SetNextWindowSize(const ImVec2& size, ImGuiSetCondition cond = 0);  // set next window size. set to ImVec2(0,0) to force an auto-fit
177    IMGUI_API void          SetNextWindowSize(const ImVec2& size, ImGuiSetCondition cond = 0);  // set next window size. set to ImVec2(0,0) to force an auto-fit.
173178    IMGUI_API void          SetNextWindowCollapsed(bool collapsed, ImGuiSetCondition cond = 0); // set next window collapsed state.
179    IMGUI_API void          SetWindowPos(const ImVec2& pos, ImGuiSetCondition cond = 0);        // set current window position - call within Begin()/End(). may incur tearing.
180    IMGUI_API void          SetWindowSize(const ImVec2& size, ImGuiSetCondition cond = 0);      // set current window size. set to ImVec2(0,0) to force an auto-fit. may incur tearing.
181    IMGUI_API void          SetWindowCollapsed(bool collapsed, ImGuiSetCondition cond = 0);     // set current window collapsed state.
174182
175183    IMGUI_API void          SetScrollPosHere();                                                 // adjust scrolling position to center into the current cursor position.
176184    IMGUI_API void          SetKeyboardFocusHere(int offset = 0);                               // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget.
r244546r244547
187195    IMGUI_API void          PopStyleVar(int count = 1);
188196
189197    // Parameters stacks (current window)
190    IMGUI_API void          PushItemWidth(float item_width);                                    // width of items for the common item+label case. default to ~2/3 of windows width.
198    IMGUI_API void          PushItemWidth(float item_width);                                    // width of items for the common item+label case, pixels. 0.0f = default to ~2/3 of windows width, >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -0.01f always align width to the right side)
191199    IMGUI_API void          PopItemWidth();
192    IMGUI_API float         GetItemWidth();
200    IMGUI_API float         CalcItemWidth();                                                    // width of item given pushed settings and current cursor position
193201    IMGUI_API void          PushAllowKeyboardFocus(bool v);                                     // allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets.
194202    IMGUI_API void          PopAllowKeyboardFocus();
195203    IMGUI_API void          PushTextWrapPos(float wrap_pos_x = 0.0f);                           // word-wrapping for Text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space.
r244546r244547
211219    IMGUI_API void          SetColumnOffset(int column_index, float offset);
212220    IMGUI_API float         GetColumnWidth(int column_index = -1);
213221    IMGUI_API ImVec2        GetCursorPos();                                                     // cursor position is relative to window position
222    IMGUI_API float         GetCursorPosX();                                                    // "
223    IMGUI_API float         GetCursorPosY();                                                    // "
214224    IMGUI_API void          SetCursorPos(const ImVec2& pos);                                    // "
215225    IMGUI_API void          SetCursorPosX(float x);                                             // "
216226    IMGUI_API void          SetCursorPosY(float y);                                             // "
217227    IMGUI_API ImVec2        GetCursorScreenPos();                                               // cursor position in absolute screen coordinates (0..io.DisplaySize)
218228    IMGUI_API void          SetCursorScreenPos(const ImVec2& pos);                              // cursor position in absolute screen coordinates (0..io.DisplaySize)
219229    IMGUI_API void          AlignFirstTextHeightToWidgets();                                    // call once if the first item on the line is a Text() item and you want to vertically lower it to match subsequent (bigger) widgets.
220    IMGUI_API float         GetTextLineSpacing();
221    IMGUI_API float         GetTextLineHeight();
230    IMGUI_API float         GetTextLineHeight();                                                // height of font == GetWindowFontSize()
231    IMGUI_API float         GetTextLineHeightWithSpacing();                                     // spacing (in pixels) between 2 consecutive lines of text == GetWindowFontSize() + GetStyle().ItemSpacing.y
222232
223233    // ID scopes
224234    // If you are creating repeated widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them.
r244546r244547
238248    IMGUI_API void          TextWrapped(const char* fmt, ...);                                  // shortcut for PushTextWrapPos(0.0f); Text(fmt, ...); PopTextWrapPos();
239249    IMGUI_API void          TextWrappedV(const char* fmt, va_list args);
240250    IMGUI_API void          TextUnformatted(const char* text, const char* text_end = NULL);     // doesn't require null terminated string if 'text_end' is specified. no copy done to any bounded stack buffer, recommended for long chunks of text.
241    IMGUI_API void          LabelText(const char* label, const char* fmt, ...);                 // display text+label aligned the same way as value+label widgets
251    IMGUI_API void          LabelText(const char* label, const char* fmt, ...);                 // display text+label aligned the same way as value+label widgets
242252    IMGUI_API void          LabelTextV(const char* label, const char* fmt, va_list args);
243253    IMGUI_API void          BulletText(const char* fmt, ...);
244254    IMGUI_API void          BulletTextV(const char* fmt, va_list args);
r244546r244547
246256    IMGUI_API bool          SmallButton(const char* label);
247257    IMGUI_API bool          InvisibleButton(const char* str_id, const ImVec2& size);
248258    IMGUI_API void          Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0), const ImVec2& uv1 = ImVec2(1,1), const ImVec4& tint_col = ImVec4(1,1,1,1), const ImVec4& border_col = ImVec4(0,0,0,0));
249    IMGUI_API bool          ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0),  const ImVec2& uv1 = ImVec2(1,1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0,0,0,1));    // <0 frame_padding uses default frame padding settings. 0 for no paddnig.
259    IMGUI_API bool          ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0),  const ImVec2& uv1 = ImVec2(1,1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0,0,0,1), const ImVec4& tint_col = ImVec4(1,1,1,1));    // <0 frame_padding uses default frame padding settings. 0 for no paddnig.
250260    IMGUI_API bool          CollapsingHeader(const char* label, const char* str_id = NULL, const bool display_frame = true, const bool default_open = false);
251261    IMGUI_API bool          SliderFloat(const char* label, float* v, float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);     // adjust display_format to decorate the value with a prefix or a suffix. Use power!=1.0 for logarithmic sliders.
252262    IMGUI_API bool          SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
r244546r244547
271281    IMGUI_API bool          InputFloat3(const char* label, float v[3], int decimal_precision = -1);
272282    IMGUI_API bool          InputFloat4(const char* label, float v[4], int decimal_precision = -1);
273283    IMGUI_API bool          InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags extra_flags = 0);
274    IMGUI_API bool          Combo(const char* label, int* current_item, const char** items, int items_count, int popup_height_items = 7);
275    IMGUI_API bool          Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int popup_height_items = 7);      // separate items with \0, end item-list with \0\0
276    IMGUI_API bool          Combo(const char* label, int* current_item, bool (*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int popup_height_items = 7);
284    IMGUI_API bool          Combo(const char* label, int* current_item, const char** items, int items_count, int height_in_items = -1);
285    IMGUI_API bool          Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int height_in_items = -1);      // separate items with \0, end item-list with \0\0
286    IMGUI_API bool          Combo(const char* label, int* current_item, bool (*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1);
277287    IMGUI_API bool          ColorButton(const ImVec4& col, bool small_height = false, bool outline_border = true);
278288    IMGUI_API bool          ColorEdit3(const char* label, float col[3]);
279289    IMGUI_API bool          ColorEdit4(const char* label, float col[4], bool show_alpha = true);
r244546r244547
288298    IMGUI_API void          TreePop();
289299    IMGUI_API void          OpenNextNode(bool open);                                            // force open/close the next TreeNode or CollapsingHeader
290300
301    // Selectable / Lists
302    IMGUI_API bool          Selectable(const char* label, bool selected, const ImVec2& size = ImVec2(0,0));
303    IMGUI_API bool          Selectable(const char* label, bool* p_selected, const ImVec2& size = ImVec2(0,0));
304    IMGUI_API bool          ListBox(const char* label, int* current_item, const char** items, int items_count, int height_in_items = -1);
305    IMGUI_API bool          ListBox(const char* label, int* current_item, bool (*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1);
306    IMGUI_API bool          ListBoxHeader(const char* label, const ImVec2& size = ImVec2(0,0)); // use if you want to reimplement ListBox() will custom data or interactions. make sure to call ListBoxFooter() afterwards.
307    IMGUI_API bool          ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // "
308    IMGUI_API void          ListBoxFooter();                                                    // terminate the scrolling region
309
291310    // Value() Helpers: output single value in "name: value" format. Tip: freely declare your own within the ImGui namespace!
292311    IMGUI_API void          Value(const char* prefix, bool b);
293312    IMGUI_API void          Value(const char* prefix, int v);
r244546r244547
322341    IMGUI_API int           GetFrameCount();
323342    IMGUI_API const char*   GetStyleColName(ImGuiCol idx);
324343    IMGUI_API ImVec2        CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);
344    IMGUI_API void          CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end);    // helper to manually clip large list of items. see comments in implementation.
325345
346    IMGUI_API void          BeginChildFrame(ImGuiID id, const ImVec2& size);                    // helper to create a child window / scrolling region that looks like a normal widget frame.
347    IMGUI_API void          EndChildFrame();
348
326349    IMGUI_API ImU32         ColorConvertFloat4ToU32(const ImVec4& in);
327350    IMGUI_API void          ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v);
328351    IMGUI_API void          ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b);
329352
353    // Internal state access - if you want to share ImGui state between modules (e.g. DLL) or allocate it yourself
354    IMGUI_API void*         GetInternalState();
355    IMGUI_API size_t        GetInternalStateSize();
356    IMGUI_API void          SetInternalState(void* state, bool construct = false);
357
330358    // Obsolete (will be removed)
331359    IMGUI_API void          GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size);
332360
r244546r244547
336364enum ImGuiWindowFlags_
337365{
338366    // Default: 0
339    ImGuiWindowFlags_ShowBorders            = 1 << 0,
340    ImGuiWindowFlags_NoTitleBar             = 1 << 1,
341    ImGuiWindowFlags_NoResize               = 1 << 2,
342    ImGuiWindowFlags_NoMove                 = 1 << 3,
343    ImGuiWindowFlags_NoScrollbar            = 1 << 4,
344    ImGuiWindowFlags_NoScrollWithMouse      = 1 << 5,
345    ImGuiWindowFlags_AlwaysAutoResize       = 1 << 6,
346    ImGuiWindowFlags_NoSavedSettings        = 1 << 7,   // Never load/save settings in .ini file
347    ImGuiWindowFlags_ChildWindow            = 1 << 8,   // For internal use by BeginChild()
348    ImGuiWindowFlags_ChildWindowAutoFitX    = 1 << 9,   // For internal use by BeginChild()
349    ImGuiWindowFlags_ChildWindowAutoFitY    = 1 << 10,  // For internal use by BeginChild()
350    ImGuiWindowFlags_ComboBox               = 1 << 11,  // For internal use by ComboBox()
351    ImGuiWindowFlags_Tooltip                = 1 << 12   // For internal use by Render() when using Tooltip
367    ImGuiWindowFlags_NoTitleBar             = 1 << 0,   // Disable title-bar
368    ImGuiWindowFlags_NoResize               = 1 << 1,   // Disable user resizing with the lower-right grip
369    ImGuiWindowFlags_NoMove                 = 1 << 2,   // Disable user moving the window
370    ImGuiWindowFlags_NoScrollbar            = 1 << 3,   // Disable scroll bar (window can still scroll with mouse or programatically)
371    ImGuiWindowFlags_NoScrollWithMouse      = 1 << 4,   // Disable user scrolling with mouse wheel
372    ImGuiWindowFlags_NoCollapse             = 1 << 5,   // Disable user collapsing window by double-clicking on it
373    ImGuiWindowFlags_AlwaysAutoResize       = 1 << 6,   // Resize every window to its content every frame
374    ImGuiWindowFlags_ShowBorders            = 1 << 7,   // Show borders around windows and items
375    ImGuiWindowFlags_NoSavedSettings        = 1 << 8,   // Never load/save settings in .ini file
376    // [Internal]
377    ImGuiWindowFlags_ChildWindow            = 1 << 9,   // For internal use by BeginChild()
378    ImGuiWindowFlags_ChildWindowAutoFitX    = 1 << 10,  // For internal use by BeginChild()
379    ImGuiWindowFlags_ChildWindowAutoFitY    = 1 << 11,  // For internal use by BeginChild()
380    ImGuiWindowFlags_ComboBox               = 1 << 12,  // For internal use by ComboBox()
381    ImGuiWindowFlags_Tooltip                = 1 << 13   // For internal use by BeginTooltip()
352382};
353383
354384// Flags for ImGui::InputText()
r244546r244547
393423{
394424    ImGuiCol_Text,
395425    ImGuiCol_WindowBg,
426    ImGuiCol_ChildWindowBg,
396427    ImGuiCol_Border,
397428    ImGuiCol_BorderShadow,
398429    ImGuiCol_FrameBg,               // Background of checkbox, radio button, plot, slider, text input
r244546r244547
436467// NB: the enum only refers to fields of ImGuiStyle() which makes sense to be pushed/poped in UI code. Feel free to add others.
437468enum ImGuiStyleVar_
438469{
439    ImGuiStyleVar_Alpha,             // float
440    ImGuiStyleVar_WindowPadding,     // ImVec2
441    ImGuiStyleVar_WindowRounding,    // float
442    ImGuiStyleVar_FramePadding,      // ImVec2
443    ImGuiStyleVar_FrameRounding,     // float
444    ImGuiStyleVar_ItemSpacing,       // ImVec2
445    ImGuiStyleVar_ItemInnerSpacing,  // ImVec2
446    ImGuiStyleVar_TreeNodeSpacing    // float
470    ImGuiStyleVar_Alpha,               // float
471    ImGuiStyleVar_WindowPadding,       // ImVec2
472    ImGuiStyleVar_WindowRounding,      // float
473    ImGuiStyleVar_ChildWindowRounding, // float
474    ImGuiStyleVar_FramePadding,        // ImVec2
475    ImGuiStyleVar_FrameRounding,       // float
476    ImGuiStyleVar_ItemSpacing,         // ImVec2
477    ImGuiStyleVar_ItemInnerSpacing,    // ImVec2
478    ImGuiStyleVar_TreeNodeSpacing      // float
447479};
448480
449481// Enumeration for ColorEditMode()
r244546r244547
471503    ImVec2      WindowPadding;              // Padding within a window
472504    ImVec2      WindowMinSize;              // Minimum window size
473505    float       WindowRounding;             // Radius of window corners rounding. Set to 0.0f to have rectangular windows
506    float       ChildWindowRounding;        // Radius of child window corners rounding. Set to 0.0f to have rectangular windows
474507    ImVec2      FramePadding;               // Padding within a framed rectangle (used by most widgets)
475508    float       FrameRounding;              // Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets).
476509    ImVec2      ItemSpacing;                // Horizontal and vertical spacing between widgets/lines
r244546r244547
514547    // User Functions
515548    //------------------------------------------------------------------
516549
517    // REQUIRED: rendering function.
550    // REQUIRED: rendering function.
518551    // See example code if you are unsure of how to implement this.
519    void        (*RenderDrawListsFn)(ImDrawList** const draw_lists, int count);     
552    void        (*RenderDrawListsFn)(ImDrawList** const draw_lists, int count);
520553
521554    // Optional: access OS clipboard (default to use native Win32 clipboard on Windows, otherwise use a ImGui private clipboard)
522555    // Override to access OS clipboard on other architectures.
523556    const char* (*GetClipboardTextFn)();
524557    void        (*SetClipboardTextFn)(const char* text);
525558
526    // Optional: override memory allocations (default to posix malloc/realloc/free)
559    // Optional: override memory allocations (default to posix malloc/free). MemFreeFn() may be called with a NULL pointer.
527560    void*       (*MemAllocFn)(size_t sz);
528    void*       (*MemReallocFn)(void* ptr, size_t sz);
529561    void        (*MemFreeFn)(void* ptr);
530562
531563    // Optional: notify OS Input Method Editor of the screen position of your cursor for text input position (e.g. when using Japanese/Chinese inputs in Windows)
r244546r244547
537569
538570    ImVec2      MousePos;                   // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.)
539571    bool        MouseDown[5];               // Mouse buttons. ImGui itself only uses button 0 (left button) but you can use others as storage for convenience.
540    float       MouseWheel;                 // Mouse wheel: 1 unit scrolls about 5 lines text.
572    float       MouseWheel;                 // Mouse wheel: 1 unit scrolls about 5 lines text.
541573    bool        MouseDrawCursor;            // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor).
542574    bool        KeyCtrl;                    // Keyboard modifier pressed: Control
543575    bool        KeyShift;                   // Keyboard modifier pressed: Shift
r244546r244547
558590    // [Internal] ImGui will maintain those fields for you
559591    //------------------------------------------------------------------
560592
561    ImVec2      MousePosPrev;
562    ImVec2      MouseDelta;
563    bool        MouseClicked[5];
564    ImVec2      MouseClickedPos[5];
565    float       MouseClickedTime[5];
566    bool        MouseDoubleClicked[5];
567    float       MouseDownTime[5];
568    float       KeysDownTime[512];
593    ImVec2      MousePosPrev;               //
594    ImVec2      MouseDelta;                 // Mouse delta. Note that this is zero if either current or previous position are negative to allow mouse enabling/disabling.
595    bool        MouseClicked[5];            // Mouse button went from !Down to Down
596    ImVec2      MouseClickedPos[5];         // Position at time of clicking
597    float       MouseClickedTime[5];        // Time of last click (used to figure out double-click)
598    bool        MouseDoubleClicked[5];      // Has mouse button been double-clicked?
599    bool        MouseDownOwned[5];          // Track if button was clicked inside a window. We don't request mouse capture from the application if click started outside ImGui bounds.
600    float       MouseDownTime[5];           // Time the mouse button has been down
601    float       KeysDownTime[512];          // Time the keyboard key has been down
569602
570603    IMGUI_API   ImGuiIO();
571604};
r244546r244547
647680// - You want to store custom debug data easily without adding or editing structures in your code.
648681struct ImGuiStorage
649682{
650    struct Pair
651    {
652        ImGuiID key;
653        union { int val_i; float val_f; void* val_p; };       
654        Pair(ImGuiID _key, int _val_i) { key = _key; val_i = _val_i; }
655        Pair(ImGuiID _key, float _val_f) { key = _key; val_f = _val_f; }
656        Pair(ImGuiID _key, void* _val_p) { key = _key; val_p = _val_p; }
683    struct Pair
684    {
685        ImGuiID key;
686        union { int val_i; float val_f; void* val_p; };
687        Pair(ImGuiID _key, int _val_i) { key = _key; val_i = _val_i; }
688        Pair(ImGuiID _key, float _val_f) { key = _key; val_f = _val_f; }
689        Pair(ImGuiID _key, void* _val_p) { key = _key; val_p = _val_p; }
657690    };
658691    ImVector<Pair>    Data;
659692
r244546r244547
668701    IMGUI_API void*   GetVoidPtr(ImGuiID key) const; // default_val is NULL
669702    IMGUI_API void    SetVoidPtr(ImGuiID key, void* val);
670703
671    // - Get***Ref() functions finds pair, insert on demand if missing, return pointer. Useful if you intend to do Get+Set.
704    // - Get***Ref() functions finds pair, insert on demand if missing, return pointer. Useful if you intend to do Get+Set.
672705    // - References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer.
673706    // - A typical use case where this is convenient:
674707    //      float* pvar = ImGui::GetFloatRef(key); ImGui::SliderFloat("var", pvar, 0, 100.0f); some_var += *pvar;
r244546r244547
683716// Shared state of InputText(), passed to callback when a ImGuiInputTextFlags_Callback* flag is used.
684717struct ImGuiTextEditCallbackData
685718{
686    ImGuiKey            EventKey;       // Key pressed (Up/Down/TAB)        // Read-only   
719    ImGuiKey            EventKey;       // Key pressed (Up/Down/TAB)        // Read-only
687720    char*               Buf;            // Current text                     // Read-write (pointed data only)
688721    size_t              BufSize;        //                                  // Read-only
689722    bool                BufDirty;       // Set if you modify Buf directly   // Write
r244546r244547
704737{
705738    ImVec4              Value;
706739
707    ImColor(int r, int g, int b, int a = 255)                       { Value.x = r / 255.0f; Value.y = g / 255.0f; Value.z = b / 255.0f; Value.w = a / 255.0f; }
740    ImColor(int r, int g, int b, int a = 255)                       { Value.x = (float)r / 255.0f; Value.y = (float)g / 255.0f; Value.z = (float)b / 255.0f; Value.w = (float)a / 255.0f; }
708741    ImColor(float r, float g, float b, float a = 1.0f)              { Value.x = r; Value.y = g; Value.z = b; Value.w = a; }
709742    ImColor(const ImVec4& col)                                      { Value = col; }
710743
r244546r244547
769802
770803    // [Internal to ImGui]
771804    ImVector<ImVec4>        clip_rect_stack;    // [Internal]
772    ImVector<ImTextureID>   texture_id_stack;   // [Internal]
805    ImVector<ImTextureID>   texture_id_stack;   // [Internal]
773806    ImDrawVert*             vtx_write;          // [Internal] point within vtx_buffer after each add command (to avoid using the ImVector<> operators too much)
774807
775808    ImDrawList() { Clear(); }
776809    IMGUI_API void  Clear();
777    IMGUI_API void  PushClipRect(const ImVec4& clip_rect);
810    IMGUI_API void  PushClipRect(const ImVec4& clip_rect);          // Scissoring. The values are x1, y1, x2, y2.
778811    IMGUI_API void  PopClipRect();
779812    IMGUI_API void  PushTextureID(const ImTextureID& texture_id);
780813    IMGUI_API void  PopTextureID();
781814
782    // Primitives   
815    // Primitives
783816    IMGUI_API void  AddLine(const ImVec2& a, const ImVec2& b, ImU32 col);
784817    IMGUI_API void  AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F);
785818    IMGUI_API void  AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F);
r244546r244547
787820    IMGUI_API void  AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
788821    IMGUI_API void  AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
789822    IMGUI_API void  AddArc(const ImVec2& center, float rad, ImU32 col, int a_min, int a_max, bool tris = false, const ImVec2& third_point_offset = ImVec2(0,0));
790    IMGUI_API void  AddText(ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL, float wrap_width = 0.0f);
823    IMGUI_API void  AddText(ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL, float wrap_width = 0.0f, const ImVec2* cpu_clip_max = NULL);
791824    IMGUI_API void  AddImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv0, const ImVec2& uv1, ImU32 col = 0xFFFFFFFF);
792825
793826    // Advanced
r244546r244547
892925    // 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.
893926    IMGUI_API ImVec2                CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end = NULL, const char** remaining = NULL) const; // utf8
894927    IMGUI_API ImVec2                CalcTextSizeW(float size, float max_width, const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining = NULL) const;                 // wchar
895    IMGUI_API void                  RenderText(float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, ImDrawVert*& out_vertices, float wrap_width = 0.0f) const;
928    IMGUI_API void                  RenderText(float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, ImDrawVert*& out_vertices, float wrap_width = 0.0f, const ImVec2* cpu_clip_max = NULL) const;
896929    IMGUI_API const char*           CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const;
897930};
898931
branches/kale/3rdparty/bgfx/README.md
r244546r244547
5252http://airmech.com/ AirMech is a free-to-play futuristic action real-time
5353strategy video game developed and published by Carbon Games.
5454
55http://theengine.co/ Loom Game Engine developed by The Engine Company. Loom
55http://loomsdk.com/ Loom Game Engine developed by The Engine Company. Loom
5656is a powerful 2D game engine with live reloading of code and assets, a friendly
57scripting language, and an efficient command-line workflow. Here is video where
58they explain why they choose bgfx over alternatives: 
59<a href="https://www.youtube.com/watch?feature=player_embedded&v=PHY_XHkMGIM&t=1m53s" target="_blank"><img src="https://img.youtube.com/vi/PHY_XHkMGIM/0.jpg" alt="Why did you choose bgfx?" width="240" height="180" border="10" /></a>
57scripting language, and an efficient command-line workflow.
6058
6159https://github.com/dariomanesku/cmftStudio cmftStudio - cubemap filtering tool. 
6260![cmftStudio](https://github.com/dariomanesku/cmftStudio/raw/master/screenshots/cmftStudio_small.jpg)
r244546r244547
7169how it currently looks. 
7270![mac_screenshot](https://raw.githubusercontent.com/emoon/ProDBG/master/data/screens/mac_screenshot.png)
7371
72
73http://www.dogbytegames.com/ Dogbyte Games is an indie mobile developer studio
74focusing on racing games.
75
7476Examples
7577--------
7678
r244546r244547
306308Building
307309--------
308310
311Steps bellow are for default build system inside bgfx repository. There is
312alterative way to build bgfx and examples with [fips](https://github.com/floooh/fips-bgfx/#fips-bgfx).
313
309314### Prerequisites
310315
311316Windows users download GnuWin32 utilities from: 
r244546r244547
741746Kai Jourdan ([@questor](https://github.com/questor)) - 23-vectordisplay example 
742747Stanlo Slasinski ([@stanlo](https://github.com/stanlo)) - 24-nbody example 
743748Daniel Collin ([@emoon](https://github.com/emoon)) - Port of Ocornut's ImGui
744  to bgfx.
749  to bgfx. 
750Andre Weissflog ([@floooh](https://github.com/floooh)) - Alternative build
751system fips.
745752
746753[License (BSD 2-clause)](https://github.com/bkaradzic/bgfx/blob/master/LICENSE)
747754-------------------------------------------------------------------------------
branches/kale/3rdparty/bgfx/examples/02-metaballs/metaballs.cpp
r244546r244547
495495      break;
496496
497497   case bgfx::RendererType::Direct3D11:
498   case bgfx::RendererType::Direct3D12:
498499      vs_metaballs = bgfx::makeRef(vs_metaballs_dx11, sizeof(vs_metaballs_dx11) );
499500      fs_metaballs = bgfx::makeRef(fs_metaballs_dx11, sizeof(fs_metaballs_dx11) );
500501      break;
r244546r244547
544545
545546      float at[3]  = { 0.0f, 0.0f,   0.0f };
546547      float eye[3] = { 0.0f, 0.0f, -50.0f };
547     
548
548549      // Set view and projection matrix for view 0.
549550      const bgfx::HMD* hmd = bgfx::getHMD();
550551      if (NULL != hmd)
r244546r244547
598599      }
599600
600601      profUpdate = bx::getHPCounter();
601     
602
602603      for (uint32_t zz = 0; zz < DIMS; ++zz)
603604      {
604605         for (uint32_t yy = 0; yy < DIMS; ++yy)
r244546r244547
690691                  -DIMS*0.5f + float(zz)
691692               };
692693
693               const Grid* val[8] = {
694               const Grid* val[8] = {
694695                  &grid[xoffset+zpitch+ypitch  ],
695696                  &grid[xoffset+zpitch+ypitch+1],
696697                  &grid[xoffset+ypitch+1       ],
r244546r244547
735736      bgfx::dbgTextPrintf(1, 7, 0x0f, " Triangulate: % 7.3f[ms]", double(profTriangulate)*toMs);
736737      bgfx::dbgTextPrintf(1, 8, 0x0f, "       Frame: % 7.3f[ms]", double(frameTime)*toMs);
737738
738      // Advance to next frame. Rendering thread will be kicked to
739      // Advance to next frame. Rendering thread will be kicked to
739740      // process submitted rendering primitives.
740741      bgfx::frame();
741742   }
branches/kale/3rdparty/bgfx/examples/08-update/update.cpp
r244546r244547
8484    9, 10, 11,
8585
8686   12, 14, 13, // 6
87   14, 15, 13,
87   14, 15, 13,
8888
8989   16, 18, 17, // 8
9090   18, 19, 17,
r244546r244547
9696static void updateTextureCubeRectBgra8(bgfx::TextureHandle _handle, uint8_t _side, uint32_t _x, uint32_t _y, uint32_t _width, uint32_t _height, uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a = 0xff)
9797{
9898   bgfx::TextureInfo ti;
99   bgfx::calcTextureSize(ti, _width, _height, 1, 1, bgfx::TextureFormat::BGRA8);
99   bgfx::calcTextureSize(ti, _width, _height, 1, 1, false, bgfx::TextureFormat::BGRA8);
100100
101101   const bgfx::Memory* mem = bgfx::alloc(ti.storageSize);
102102   uint8_t* data = (uint8_t*)mem->data;
r244546r244547
285285
286286      float at[3] = { 0.0f, 0.0f, 0.0f };
287287      float eye[3] = { 0.0f, 0.0f, -5.0f };
288     
288
289289      float view[16];
290290      float proj[16];
291291      bx::mtxLookAt(view, eye, at);
r244546r244547
394394         bgfx::submit(1);
395395      }
396396
397      // Advance to next frame. Rendering thread will be kicked to
397      // Advance to next frame. Rendering thread will be kicked to
398398      // process submitted rendering primitives.
399399      bgfx::frame();
400400   }
branches/kale/3rdparty/bgfx/examples/13-stencil/stencil.cpp
r244546r244547
146146   1, 3, 2,
147147};
148148
149static const char* s_shaderPath = NULL;
150149static bool s_flipV = false;
151150static uint32_t s_viewMask = 0;
152151static uint32_t s_clearMask = 0;
r244546r244547
857856   // for each renderer.
858857   switch (bgfx::getRendererType() )
859858   {
860   default:
861   case bgfx::RendererType::Direct3D9:
862      s_shaderPath = "shaders/dx9/";
863      break;
864
865   case bgfx::RendererType::Direct3D11:
866      s_shaderPath = "shaders/dx11/";
867      break;
868
869859   case bgfx::RendererType::OpenGL:
870      s_shaderPath = "shaders/glsl/";
860   case bgfx::RendererType::OpenGLES:
871861      s_flipV = true;
872862      break;
873863
874   case bgfx::RendererType::OpenGLES:
875      s_shaderPath = "shaders/gles/";
876      s_flipV = true;
864   default:
877865      break;
878866   }
879867
branches/kale/3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp
r244546r244547
111111   1, 3, 2,
112112};
113113
114static const char* s_shaderPath = NULL;
115114static bool s_oglNdc = false;
116115static float s_texelHalf = 0.0f;
117116
r244546r244547
18721871   // for each renderer.
18731872   switch (bgfx::getRendererType() )
18741873   {
1875   default:
18761874   case bgfx::RendererType::Direct3D9:
1877      s_shaderPath = "shaders/dx9/";
18781875      s_texelHalf = 0.5f;
18791876      break;
18801877
1881   case bgfx::RendererType::Direct3D11:
1882      s_shaderPath = "shaders/dx11/";
1883      break;
1884
18851878   case bgfx::RendererType::OpenGL:
1886      s_shaderPath = "shaders/glsl/";
1879   case bgfx::RendererType::OpenGLES:
18871880      s_oglNdc = true;
18881881      break;
18891882
1890   case bgfx::RendererType::OpenGLES:
1891      s_shaderPath = "shaders/gles/";
1892      s_oglNdc = true;
1883   default:
18931884      break;
18941885   }
18951886
branches/kale/3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp
r244546r244547
220220   1, 3, 2,
221221};
222222
223static const char* s_shaderPath = NULL;
224223static bool s_flipV = false;
225224static float s_texelHalf = 0.0f;
226225
r244546r244547
13331332   // for each renderer.
13341333   switch (bgfx::getRendererType() )
13351334   {
1336   default:
13371335   case bgfx::RendererType::Direct3D9:
1338      s_shaderPath = "shaders/dx9/";
13391336      s_texelHalf = 0.5f;
13401337      break;
13411338
1342   case bgfx::RendererType::Direct3D11:
1343      s_shaderPath = "shaders/dx11/";
1344      break;
1345
13461339   case bgfx::RendererType::OpenGL:
1347      s_shaderPath = "shaders/glsl/";
1340   case bgfx::RendererType::OpenGLES:
13481341      s_flipV = true;
13491342      break;
13501343
1351   case bgfx::RendererType::OpenGLES:
1352      s_shaderPath = "shaders/gles/";
1353      s_flipV = true;
1344   default:
13541345      break;
13551346   }
13561347
branches/kale/3rdparty/bgfx/examples/17-drawstress/drawstress.cpp
r244546r244547
280280         break;
281281
282282      case bgfx::RendererType::Direct3D11:
283      case bgfx::RendererType::Direct3D12:
283284         vs_drawstress = bgfx::makeRef(vs_drawstress_dx11, sizeof(vs_drawstress_dx11) );
284285         fs_drawstress = bgfx::makeRef(fs_drawstress_dx11, sizeof(fs_drawstress_dx11) );
285286         break;
branches/kale/3rdparty/bgfx/examples/18-ibl/ibl.cpp
r244546r244547
285285      bool m_specularIbl;
286286      bool m_showDiffColorWheel;
287287      bool m_showSpecColorWheel;
288      bool m_crossCubemapPreview;
288      ImguiCubemap::Enum m_crossCubemapPreview;
289289   };
290290
291291   Settings settings;
r244546r244547
305305   settings.m_specularIbl = true;
306306   settings.m_showDiffColorWheel = true;
307307   settings.m_showSpecColorWheel = false;
308   settings.m_crossCubemapPreview = false;
308   settings.m_crossCubemapPreview = ImguiCubemap::Cross;
309309
310310   float time = 0.0f;
311311
r244546r244547
324324         );
325325
326326      static int32_t rightScrollArea = 0;
327      imguiBeginScrollArea("Settings", width - 256 - 10, 10, 256, 590, &rightScrollArea);
327      imguiBeginScrollArea("Settings", width - 256 - 10, 10, 256, 540, &rightScrollArea);
328328
329329      imguiLabel("Shade:");
330330      imguiSeparator();
r244546r244547
350350                                          , "Grace"
351351                                          ) );
352352      static float lod = 0.0f;
353      if (imguiCube(lightProbes[currentLightProbe].m_tex, lod, settings.m_crossCubemapPreview))
353      if (imguiCube(lightProbes[currentLightProbe].m_tex, lod, settings.m_crossCubemapPreview, true) )
354354      {
355         settings.m_crossCubemapPreview = !settings.m_crossCubemapPreview;
355         settings.m_crossCubemapPreview = ImguiCubemap::Enum( (settings.m_crossCubemapPreview+1) % ImguiCubemap::Count);
356356      }
357357      imguiSlider("Texture LOD", lod, float(0.0f), 10.1f, 0.1f);
358358
branches/kale/3rdparty/bgfx/examples/common/bgfx_utils.cpp
r244546r244547
55
66#include <string.h> // strlen
77
8#include "common.h"
9
810#include <tinystl/allocator.h>
911#include <tinystl/vector.h>
1012#include <tinystl/string.h>
r244546r244547
6971   switch (bgfx::getRendererType() )
7072   {
7173   case bgfx::RendererType::Direct3D11:
74   case bgfx::RendererType::Direct3D12:
7275      shaderPath = "shaders/dx11/";
7376      break;
7477
branches/kale/3rdparty/bgfx/examples/common/common.h
r244546r244547
33 * License: http://www.opensource.org/licenses/BSD-2-Clause
44 */
55
6#ifndef COMMON_H_HEADER_GUARD
7#define COMMON_H_HEADER_GUARD
8
69#include <bx/timer.h>
710#include <bx/fpumath.h>
811
912#include "entry/entry.h"
13
14#endif // COMMON_H_HEADER_GUARD
branches/kale/3rdparty/bgfx/examples/common/cube_atlas.cpp
r244546r244547
6060      int32_t width; //< The line _width. The ending coordinate (inclusive) will be x+width-1.
6161   };
6262
63   
64   uint32_t m_width;            //< width (in pixels) of the underlying texture   
63
64   uint32_t m_width;            //< width (in pixels) of the underlying texture
6565   uint32_t m_height;           //< height (in pixels) of the underlying texture
6666   uint32_t m_usedSpace;        //< Surface used in squared pixel
6767   std::vector<Node> m_skyline; //< node of the skyline algorithm
r244546r244547
326326      break;
327327
328328   case bgfx::RendererType::Direct3D11:
329   case bgfx::RendererType::Direct3D12:
329330      m_texelOffset[0] = texelHalf;
330331      m_texelOffset[1] = texelHalf;
331332      break;
branches/kale/3rdparty/bgfx/examples/common/entry/cmd.cpp
r244546r244547
77#include <stdint.h>
88#include <stdlib.h> // size_t
99#include <string.h> // strlen
10
11#include <bx/allocator.h>
1012#include <bx/hash.h>
1113#include <bx/tokenizecmd.h>
1214
1315#include "dbg.h"
1416#include "cmd.h"
17#include "entry_p.h"
1518
1619#include <tinystl/allocator.h>
1720#include <tinystl/string.h>
r244546r244547
8992   CmdLookup m_lookup;
9093};
9194
92static CmdContext s_cmdContext;
95static CmdContext* s_cmdContext;
9396
97void cmdInit()
98{
99   s_cmdContext = BX_NEW(entry::getAllocator(), CmdContext);
100}
101
102void cmdShutdown()
103{
104   BX_DELETE(entry::getAllocator(), s_cmdContext);
105}
106
94107void cmdAdd(const char* _name, ConsoleFn _fn, void* _userData)
95108{
96   s_cmdContext.add(_name, _fn, _userData);
109   s_cmdContext->add(_name, _fn, _userData);
97110}
98111
99112void cmdExec(const char* _cmd)
100113{
101   s_cmdContext.exec(_cmd);
114   s_cmdContext->exec(_cmd);
102115}
branches/kale/3rdparty/bgfx/examples/common/entry/cmd.h
r244546r244547
99struct CmdContext;
1010typedef int (*ConsoleFn)(CmdContext* _context, void* _userData, int _argc, char const* const* _argv);
1111
12///
13void cmdInit();
14
15///
16void cmdShutdown();
17
18///
1219void cmdAdd(const char* _name, ConsoleFn _fn, void* _userData = NULL);
20
21///
1322void cmdExec(const char* _cmd);
1423
1524#endif // CMD_H_HEADER_GUARD
branches/kale/3rdparty/bgfx/examples/common/entry/entry.cpp
r244546r244547
2222   static bool s_exit = false;
2323   static bx::FileReaderI* s_fileReader = NULL;
2424   static bx::FileWriterI* s_fileWriter = NULL;
25   static bx::CrtAllocator s_allocator;
2625
26   extern bx::ReallocatorI* getDefaultAllocator();
27   static bx::ReallocatorI* s_allocator = getDefaultAllocator();
28
29#if ENTRY_CONFIG_IMPLEMENT_DEFAULT_ALLOCATOR
30   bx::ReallocatorI* getDefaultAllocator()
31   {
32      static bx::CrtAllocator s_allocator;
33      return &s_allocator;
34   }
35#endif // ENTRY_CONFIG_IMPLEMENT_DEFAULT_ALLOCATOR
36
2737   bool setOrToggle(uint32_t& _flags, const char* _name, uint32_t _bit, int _first, int _argc, char const* const* _argv)
2838   {
2939      if (0 == strcmp(_argv[_first], _name) )
r244546r244547
137147      s_fileWriter = new bx::CrtFileWriter;
138148#endif // BX_CONFIG_CRT_FILE_READER_WRITER
139149
150      cmdInit();
140151      cmdAdd("mouselock", cmdMouseLock);
141152      cmdAdd("graphics",  cmdGraphics );
142153      cmdAdd("exit",      cmdExit     );
143154
155      inputInit();
144156      inputAddBindings("bindings", s_bindings);
145157
146158      entry::WindowHandle defaultWindow = { 0 };
r244546r244547
148160
149161      int32_t result = ::_main_(_argc, _argv);
150162
163      inputRemoveBindings("bindings");
164      inputShutdown();
165
166      cmdShutdown();
167
151168#if BX_CONFIG_CRT_FILE_READER_WRITER
152169      delete s_fileReader;
153170      s_fileReader = NULL;
r244546r244547
448465
449466   bx::ReallocatorI* getAllocator()
450467   {
451      return &s_allocator;
468      return s_allocator;
452469   }
453470
471   void* TinyStlAllocator::static_allocate(size_t _bytes)
472   {
473      return BX_ALLOC(getAllocator(), _bytes);
474   }
475
476   void TinyStlAllocator::static_deallocate(void* _ptr, size_t /*_bytes*/)
477   {
478      if (NULL != _ptr)
479      {
480         BX_FREE(getAllocator(), _ptr);
481      }
482   }
483
454484} // namespace entry
455485
456486extern "C" bool entry_process_events(uint32_t* _width, uint32_t* _height, uint32_t* _debug, uint32_t* _reset)
branches/kale/3rdparty/bgfx/examples/common/entry/entry_osx.mm
r244546r244547
5757
5858      static int32_t threadFunc(void* _userData)
5959      {
60            CFBundleRef mainBundle = CFBundleGetMainBundle();
61            if ( mainBundle != nil )
62            {
63                CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
64                if ( resourcesURL != nil )
65                {
66                    char path[PATH_MAX];
67                    if (CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX) )
68                    {
69                        chdir(path);
70                    }
71                    CFRelease(resourcesURL);
72                }
73            }
74           
60         CFBundleRef mainBundle = CFBundleGetMainBundle();
61         if ( mainBundle != nil )
62         {
63            CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
64            if ( resourcesURL != nil )
65            {
66               char path[PATH_MAX];
67               if (CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX) )
68               {
69                  chdir(path);
70               }
71               CFRelease(resourcesURL);
72            }
73         }
74
7575         MainThreadEntry* self = (MainThreadEntry*)_userData;
7676         return main(self->m_argc, self->m_argv);
7777      }
branches/kale/3rdparty/bgfx/examples/common/entry/entry_p.h
r244546r244547
66#ifndef ENTRY_PRIVATE_H_HEADER_GUARD
77#define ENTRY_PRIVATE_H_HEADER_GUARD
88
9#define TINYSTL_ALLOCATOR entry::TinyStlAllocator
10
911#include <bx/spscqueue.h>
1012
1113#include "entry.h"
r244546r244547
3739#   error "Both ENTRY_DEFAULT_WIDTH and ENTRY_DEFAULT_HEIGHT must be defined."
3840#endif // ENTRY_DEFAULT_WIDTH
3941
42#ifndef ENTRY_CONFIG_IMPLEMENT_DEFAULT_ALLOCATOR
43#   define ENTRY_CONFIG_IMPLEMENT_DEFAULT_ALLOCATOR 1
44#endif // ENTRY_CONFIG_IMPLEMENT_DEFAULT_ALLOCATOR
45
4046#define ENTRY_IMPLEMENT_EVENT(_class, _type) \
4147         _class(WindowHandle _handle) : Event(_type, _handle) {}
4248
4349namespace entry
4450{
51   struct TinyStlAllocator
52   {
53      static void* static_allocate(size_t _bytes);
54      static void static_deallocate(void* _ptr, size_t /*_bytes*/);
55   };
56
4557   int main(int _argc, char** _argv);
4658
4759   struct Event
branches/kale/3rdparty/bgfx/examples/common/entry/entry_x11.cpp
r244546r244547
1010#define XK_MISCELLANY
1111#define XK_LATIN1
1212#include <X11/keysymdef.h>
13#include <bgfxplatform.h> // will include X11 which #defines None... Don't mess with order of includes.
13#include <X11/Xlib.h> // will include X11 which #defines None... Don't mess with order of includes.
14#include <bgfxplatform.h>
1415
1516#undef None
1617#include <bx/thread.h>
branches/kale/3rdparty/bgfx/examples/common/entry/input.cpp
r244546r244547
88#include "entry_p.h"
99#include "input.h"
1010
11#include <bx/allocator.h>
1112#include <bx/ringbuffer.h>
1213#include <tinystl/allocator.h>
1314#include <tinystl/unordered_map.h>
r244546r244547
249250   Gamepad m_gamepad[ENTRY_CONFIG_MAX_GAMEPADS];
250251};
251252
252static Input s_input;
253static Input* s_input;
253254
255void inputInit()
256{
257   s_input = BX_NEW(entry::getAllocator(), Input);
258}
259
260void inputShutdown()
261{
262   BX_DELETE(entry::getAllocator(), s_input);
263}
264
254265void inputAddBindings(const char* _name, const InputBinding* _bindings)
255266{
256   s_input.addBindings(_name, _bindings);
267   s_input->addBindings(_name, _bindings);
257268}
258269
259270void inputRemoveBindings(const char* _name)
260271{
261   s_input.removeBindings(_name);
272   s_input->removeBindings(_name);
262273}
263274
264275void inputProcess()
265276{
266   s_input.process();
277   s_input->process();
267278}
268279
269280void inputSetMouseResolution(uint16_t _width, uint16_t _height)
270281{
271   s_input.m_mouse.setResolution(_width, _height);
282   s_input->m_mouse.setResolution(_width, _height);
272283}
273284
274285void inputSetKeyState(entry::Key::Enum _key, uint8_t _modifiers, bool _down)
275286{
276   s_input.m_keyboard.setKeyState(_key, _modifiers, _down);
287   s_input->m_keyboard.setKeyState(_key, _modifiers, _down);
277288}
278289
279290void inputChar(uint8_t _len, const uint8_t _char[4])
280291{
281   s_input.m_keyboard.pushChar(_len, _char);
292   s_input->m_keyboard.pushChar(_len, _char);
282293}
283294
284295const uint8_t* inputGetChar()
285296{
286   return s_input.m_keyboard.popChar();
297   return s_input->m_keyboard.popChar();
287298}
288299
289300void inputCharFlush()
290301{
291   s_input.m_keyboard.charFlush();
302   s_input->m_keyboard.charFlush();
292303}
293304
294305void inputSetMousePos(int32_t _mx, int32_t _my, int32_t _mz)
295306{
296   s_input.m_mouse.setPos(_mx, _my, _mz);
307   s_input->m_mouse.setPos(_mx, _my, _mz);
297308}
298309
299310void inputSetMouseButtonState(entry::MouseButton::Enum _button, uint8_t _state)
300311{
301   s_input.m_mouse.setButtonState(_button, _state);
312   s_input->m_mouse.setButtonState(_button, _state);
302313}
303314
304315void inputGetMouse(float _mouse[3])
305316{
306   _mouse[0] = s_input.m_mouse.m_norm[0];
307   _mouse[1] = s_input.m_mouse.m_norm[1];
308   _mouse[2] = s_input.m_mouse.m_norm[2];
309   s_input.m_mouse.m_norm[0] = 0.0f;
310   s_input.m_mouse.m_norm[1] = 0.0f;
311   s_input.m_mouse.m_norm[2] = 0.0f;
317   _mouse[0] = s_input->m_mouse.m_norm[0];
318   _mouse[1] = s_input->m_mouse.m_norm[1];
319   _mouse[2] = s_input->m_mouse.m_norm[2];
320   s_input->m_mouse.m_norm[0] = 0.0f;
321   s_input->m_mouse.m_norm[1] = 0.0f;
322   s_input->m_mouse.m_norm[2] = 0.0f;
312323}
313324
314325bool inputIsMouseLocked()
315326{
316   return s_input.m_mouse.m_lock;
327   return s_input->m_mouse.m_lock;
317328}
318329
319330void inputSetMouseLock(bool _lock)
320331{
321   if (s_input.m_mouse.m_lock != _lock)
332   if (s_input->m_mouse.m_lock != _lock)
322333   {
323      s_input.m_mouse.m_lock = _lock;
334      s_input->m_mouse.m_lock = _lock;
324335      entry::WindowHandle defaultWindow = { 0 };
325336      entry::setMouseLock(defaultWindow, _lock);
326337      if (_lock)
327338      {
328         s_input.m_mouse.m_norm[0] = 0.0f;
329         s_input.m_mouse.m_norm[1] = 0.0f;
330         s_input.m_mouse.m_norm[2] = 0.0f;
339         s_input->m_mouse.m_norm[0] = 0.0f;
340         s_input->m_mouse.m_norm[1] = 0.0f;
341         s_input->m_mouse.m_norm[2] = 0.0f;
331342      }
332343   }
333344}
334345
335346void inputSetGamepadAxis(entry::GamepadHandle _handle, entry::GamepadAxis::Enum _axis, int32_t _value)
336347{
337   s_input.m_gamepad[_handle.idx].setAxis(_axis, _value);
348   s_input->m_gamepad[_handle.idx].setAxis(_axis, _value);
338349}
339350
340351int32_t inputGetGamepadAxis(entry::GamepadHandle _handle, entry::GamepadAxis::Enum _axis)
341352{
342   return s_input.m_gamepad[_handle.idx].getAxis(_axis);
353   return s_input->m_gamepad[_handle.idx].getAxis(_axis);
343354}
branches/kale/3rdparty/bgfx/examples/common/entry/input.h
r244546r244547
2222#define INPUT_BINDING_END { entry::Key::None, entry::Modifier::None, 0, NULL, NULL }
2323
2424///
25void inputInit();
26
27///
28void inputShutdown();
29
30///
2531void inputAddBindings(const char* _name, const InputBinding* _bindings);
2632
2733///
branches/kale/3rdparty/bgfx/examples/common/font/font_manager.cpp
r244546r244547
1313
1414BX_PRAGMA_DIAGNOSTIC_PUSH();
1515BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4245) // error C4245: '=' : conversion from 'int' to 'FT_UInt', signed/unsigned mismatch
16#if BX_COMPILER_MSVC || BX_COMPILER_GCC >= 40300
1617#pragma push_macro("interface")
18#endif
1719#undef interface
1820#include <freetype/freetype.h>
21#if BX_COMPILER_MSVC || BX_COMPILER_GCC >= 40300
1922#pragma pop_macro("interface")
23#endif
2024BX_PRAGMA_DIAGNOSTIC_POP();
2125
2226#include "../common.h"
branches/kale/3rdparty/bgfx/examples/common/font/text_buffer_manager.cpp
r244546r244547
7474   /// Append a wide char unicode string to the buffer using current pen
7575   /// position and color.
7676   void appendText(FontHandle _fontHandle, const wchar_t* _string, const wchar_t* _end = NULL);
77   
77
7878   /// Append a whole face of the atlas cube, mostly used for debugging
7979   /// and visualizing atlas.
8080   void appendAtlasFace(uint16_t _faceIndex);
r244546r244547
250250      }
251251   }
252252
253   BX_CHECK(state == UTF8_ACCEPT, "The string is not well-formed");   
253   BX_CHECK(state == UTF8_ACCEPT, "The string is not well-formed");
254254}
255255
256256void TextBuffer::appendText(FontHandle _fontHandle, const wchar_t* _string, const wchar_t* _end)
r244546r244547
366366
367367      float txtDecals = (font.ascender - m_lineAscender);
368368      m_lineAscender = font.ascender;
369      m_lineGap = font.lineGap;     
369      m_lineGap = font.lineGap;
370370      verticalCenterLastLine( (txtDecals), (m_penY - m_lineAscender), (m_penY + m_lineAscender - m_lineDescender + m_lineGap) );
371371   }
372372
r244546r244547
575575      break;
576576
577577   case bgfx::RendererType::Direct3D11:
578   case bgfx::RendererType::Direct3D12:
578579      vs_font_basic = bgfx::makeRef(vs_font_basic_dx11, sizeof(vs_font_basic_dx11) );
579580      fs_font_basic = bgfx::makeRef(fs_font_basic_dx11, sizeof(fs_font_basic_dx11) );
580581      vs_font_distance_field = bgfx::makeRef(vs_font_distance_field_dx11, sizeof(vs_font_distance_field_dx11) );
branches/kale/3rdparty/bgfx/examples/common/imgui/fs_imgui_latlong.bin.h
r0r244547
1static const uint8_t fs_imgui_latlong_glsl[646] =
2{
3   0x46, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x02, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima
4   0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x07, 0x01, 0x00, 0x00, // geLodEnabled....
5   0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, // ...s_texColor...
6   0x00, 0x01, 0x00, 0x4e, 0x02, 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, // ...N...varying h
7   0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // ighp vec2 v_texc
8   0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, // oord0;.uniform h
9   0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, // ighp vec4 u_imag
10   0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x3b, 0x0a, 0x75, 0x6e, 0x69, // eLodEnabled;.uni
11   0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // form lowp sample
12   0x72, 0x43, 0x75, 0x62, 0x65, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // rCube s_texColor
13   0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, // ;.void main ().{
14   0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x72, 0x65, // .  highp vec3 re
15   0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, // sult_1;.  highp
16   0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, // float tmpvar_2;.
17   0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x76, 0x5f, //   tmpvar_2 = (v_
18   0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x20, 0x2a, 0x20, 0x36, 0x2e, // texcoord0.x * 6.
19   0x32, 0x38, 0x33, 0x31, 0x39, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, // 28319);.  highp
20   0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, // float tmpvar_3;.
21   0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x76, 0x5f, //   tmpvar_3 = (v_
22   0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x79, 0x20, 0x2a, 0x20, 0x33, 0x2e, // texcoord0.y * 3.
23   0x31, 0x34, 0x31, 0x35, 0x39, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, // 14159);.  result
24   0x5f, 0x31, 0x2e, 0x78, 0x20, 0x3d, 0x20, 0x28, 0x73, 0x69, 0x6e, 0x28, 0x74, 0x6d, 0x70, 0x76, // _1.x = (sin(tmpv
25   0x61, 0x72, 0x5f, 0x33, 0x29, 0x20, 0x2a, 0x20, 0x63, 0x6f, 0x73, 0x28, 0x74, 0x6d, 0x70, 0x76, // ar_3) * cos(tmpv
26   0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, // ar_2));.  result
27   0x5f, 0x31, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x73, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, // _1.y = cos(tmpva
28   0x72, 0x5f, 0x33, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, // r_3);.  result_1
29   0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x2d, 0x28, 0x73, 0x69, 0x6e, 0x28, 0x74, 0x6d, 0x70, 0x76, // .z = (-(sin(tmpv
30   0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x73, 0x69, 0x6e, 0x28, 0x74, 0x6d, 0x70, // ar_3)) * sin(tmp
31   0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, // var_2));.  lowp
32   0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, // vec4 tmpvar_4;.
33   0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, //  tmpvar_4.xyz =
34   0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x75, 0x62, 0x65, 0x4c, 0x6f, 0x64, 0x20, 0x20, // textureCubeLod
35   0x20, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x72, //   (s_texColor, r
36   0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x2c, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, // esult_1, u_image
37   0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x78, 0x29, 0x2e, 0x78, 0x79, // LodEnabled.x).xy
38   0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x77, 0x20, // z;.  tmpvar_4.w
39   0x3d, 0x20, 0x28, 0x30, 0x2e, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, 0x2e, 0x38, 0x20, 0x2a, 0x20, // = (0.2 + (0.8 *
40   0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, // u_imageLodEnable
41   0x64, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, // d.y));.  gl_Frag
42   0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, // Color = tmpvar_4
43   0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00,                                                             // ;.}...
44};
45static const uint8_t fs_imgui_latlong_dx9[553] =
46{
47   0x46, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima
48   0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x15, 0x01, 0x00, 0x00, // geLodEnabled....
49   0x01, 0x00, 0x04, 0x02, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x30, 0x00, 0x43, 0x54, 0x41, 0x42, // ..........0.CTAB
50   0x1c, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, // ................
51   0x1c, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, // ............D...
52   0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........P.......
53   0x60, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, // `...........t...
54   0x00, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, // ....s_texColor..
55   0x04, 0x00, 0x0e, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
56   0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, // u_imageLodEnable
57   0x64, 0x00, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, // d...............
58   0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, // ....ps_3_0.Micro
59   0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, // soft (R) HLSL Sh
60   0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, // ader Compiler 9.
61   0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, 0x05, // 29.952.3111.Q...
62   0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x3f, 0xdb, 0x0f, 0xc9, 0x40, 0xdb, 0x0f, 0x49, 0xc0, // .......?...@..I.
63   0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x05, 0x02, 0x00, 0x0f, 0xa0, 0xcd, 0xcc, 0x4c, 0x3f, // ....Q.........L?
64   0xcd, 0xcc, 0x4c, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, // ..L>............
65   0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x98, // ................
66   0x00, 0x08, 0x0f, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0xa0, // ................
67   0x00, 0x00, 0x00, 0x90, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, // ................
68   0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x55, 0xa0, // ..............U.
69   0x01, 0x00, 0xaa, 0xa0, 0x25, 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x80, // ....%...........
70   0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x55, 0x90, 0x01, 0x00, 0x00, 0xa0, // ..........U.....
71   0x01, 0x00, 0x00, 0xa0, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, // ................
72   0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x55, 0xa0, // ..............U.
73   0x01, 0x00, 0xaa, 0xa0, 0x25, 0x00, 0x00, 0x02, 0x02, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x80, // ....%...........
74   0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x80, 0x02, 0x00, 0x55, 0x80, // ..............U.
75   0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x80, 0x01, 0x00, 0x55, 0x80, 0x02, 0x00, 0x55, 0x81, // ..........U...U.
76   0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x02, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x02, // ................
77   0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, // ........_.......
78   0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, 0x80, // ................
79   0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0xa0, // ..............U.
80   0x04, 0x00, 0x00, 0x04, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, 0xa0, // ..........U.....
81   0x02, 0x00, 0x55, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00,                                           // ..U......
82};
83static const uint8_t fs_imgui_latlong_dx11[600] =
84{
85   0x46, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima
86   0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x15, 0x00, 0x30, 0x0a, // geLodEnabled..0.
87   0x01, 0x00, 0x30, 0x02, 0x44, 0x58, 0x42, 0x43, 0x89, 0x11, 0x25, 0xa6, 0xf5, 0x66, 0x12, 0x3f, // ..0.DXBC..%..f.?
88   0xc0, 0x1f, 0x67, 0x9b, 0x6e, 0x4e, 0xac, 0x03, 0x01, 0x00, 0x00, 0x00, 0x30, 0x02, 0x00, 0x00, // ..g.nN......0...
89   0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, // ....,...........
90   0x49, 0x53, 0x47, 0x4e, 0x50, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ISGNP...........
91   0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // 8...............
92   0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........D.......
93   0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, // ................
94   0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, // SV_POSITION.TEXC
95   0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, // OORD....OSGN,...
96   0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ .......
97   0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, // ................
98   0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, // SV_TARGET...SHDR
99   0x70, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, // p...@.......Y...
100   0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, // F. .........Z...
101   0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x30, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, // .`......X0...p..
102   0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, // ....UU..b...2...
103   0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....e.... ......
104   0x68, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, 0x32, 0x00, 0x10, 0x00, // h.......8...2...
105   0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, // ....F........@..
106   0xdb, 0x0f, 0xc9, 0x40, 0xdb, 0x0f, 0x49, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...@..I@........
107   0x4d, 0x00, 0x00, 0x07, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, // M...B...........
108   0x1a, 0x00, 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x06, // ....A.......M...
109   0x32, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x16, 0x05, 0x10, 0x00, // 2...............
110   0x00, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x06, 0x00, 0xd0, 0x00, 0x00, 0x62, 0x00, 0x10, 0x00, // ....M.......b...
111   0x02, 0x00, 0x00, 0x00, 0x06, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, // ............8...
112   0x82, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ........*.......
113   0x1a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, // ........8.......
114   0x02, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, // ................
115   0x02, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H...........
116   0x86, 0x03, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ........F~......
117   0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // .`........ .....
118   0xa3, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x72, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....6...r ......
119   0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0x82, 0x20, 0x10, 0x00, // F.......2.... ..
120   0x00, 0x00, 0x00, 0x00, 0x1a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, // ...... .........
121   0x01, 0x40, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3f, 0x01, 0x40, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3e, // .@....L?.@....L>
122   0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x40, 0x0a,                                                 // >.....@.
123};
branches/kale/3rdparty/bgfx/examples/common/imgui/fs_imgui_latlong.sc
r0r244547
1$input v_texcoord0
2
3/*
4 * Copyright 2014-2015 Dario Manesku. All rights reserved.
5 * License: http://www.opensource.org/licenses/BSD-2-Clause
6 */
7
8#include <bgfx_shader.sh>
9
10uniform vec4 u_imageLodEnabled;
11SAMPLERCUBE(s_texColor, 0);
12
13#define u_imageLod     u_imageLodEnabled.x
14#define u_imageEnabled u_imageLodEnabled.y
15
16vec3 vecFromLatLong(vec2 _uv)
17{
18   float pi    = 3.14159265;
19   float twoPi = 2.0*pi;
20   float phi   = _uv.x * twoPi;
21   float theta = _uv.y *pi;
22
23   vec3 result;
24   result.x = sin(theta)*cos(phi);
25   result.y = cos(theta);
26   result.z = -sin(theta)*sin(phi);
27
28   return result;
29}
30
31void main()
32{
33   vec3 dir = vecFromLatLong(v_texcoord0);
34   vec3 color = textureCubeLod(s_texColor, dir, u_imageLod).xyz;
35   float alpha = 0.2 + 0.8*u_imageEnabled;
36
37   gl_FragColor = vec4(color, alpha);
38}
branches/kale/3rdparty/bgfx/examples/common/imgui/imgui.cpp
r244546r244547
4141#include "fs_imgui_texture.bin.h"
4242#include "vs_imgui_cubemap.bin.h"
4343#include "fs_imgui_cubemap.bin.h"
44#include "vs_imgui_latlong.bin.h"
45#include "fs_imgui_latlong.bin.h"
4446#include "vs_imgui_image.bin.h"
4547#include "fs_imgui_image.bin.h"
4648#include "fs_imgui_image_swizz.bin.h"
r244546r244547
6567static const int32_t AREA_HEADER = 20;
6668static const float s_tabStops[4] = {150, 210, 270, 330};
6769
68static void* imguiMalloc(size_t size, void* /*_userptr*/)
69{
70   return malloc(size);
71}
70// For a custom allocator, define this and implement imguiMalloc and imguiFree somewhere in the project.
71#ifndef IMGUI_CONFIG_CUSTOM_ALLOCATOR
72#   define IMGUI_CONFIG_CUSTOM_ALLOCATOR 0
73#endif // ENTRY_CONFIG_USE_TINYSTL
7274
73static void imguiFree(void* _ptr, void* /*_userptr*/)
74{
75   free(_ptr);
76}
75#if IMGUI_CONFIG_CUSTOM_ALLOCATOR
76   void* imguiMalloc(size_t size, void* /*_userptr*/);
77   void imguiFree(void* _ptr, void* /*_userptr*/);
78#else
79   static void* imguiMalloc(size_t _size, void* /*_userptr*/)
80   {
81      return malloc(_size);
82   }
7783
84   static void imguiFree(void* _ptr, void* /*_userptr*/)
85   {
86      free(_ptr);
87   }
88#endif //IMGUI_CONFIG_CUSTOM_ALLOCATOR
89
7890#define IMGUI_MIN(_a, _b) (_a)<(_b)?(_a):(_b)
7991#define IMGUI_MAX(_a, _b) (_a)>(_b)?(_a):(_b)
8092#define IMGUI_CLAMP(_a, _min, _max) IMGUI_MIN(IMGUI_MAX(_a, _min), _max)
r244546r244547
393405      m_colorProgram.idx      = bgfx::invalidHandle;
394406      m_textureProgram.idx    = bgfx::invalidHandle;
395407      m_cubeMapProgram.idx    = bgfx::invalidHandle;
408      m_latlongProgram.idx    = bgfx::invalidHandle;
396409      m_imageProgram.idx      = bgfx::invalidHandle;
397410      m_imageSwizzProgram.idx = bgfx::invalidHandle;
398411   }
r244546r244547
455468      IMGUI_create(_data, _size, _fontSize);
456469
457470      m_nvg = nvgCreate(1, m_view);
458      nvgCreateFontMem(m_nvg, "default", (unsigned char*)_data, INT32_MAX, 0);
459      nvgFontSize(m_nvg, _fontSize);
460      nvgFontFace(m_nvg, "default");
471       nvgCreateFontMem(m_nvg, "default", (unsigned char*)_data, INT32_MAX, 0);
472       nvgFontSize(m_nvg, _fontSize);
473       nvgFontFace(m_nvg, "default");
461474
462475      for (int32_t ii = 0; ii < NUM_CIRCLE_VERTS; ++ii)
463476      {
r244546r244547
481494      const bgfx::Memory* fs_imgui_texture;
482495      const bgfx::Memory* vs_imgui_cubemap;
483496      const bgfx::Memory* fs_imgui_cubemap;
497      const bgfx::Memory* vs_imgui_latlong;
498      const bgfx::Memory* fs_imgui_latlong;
484499      const bgfx::Memory* vs_imgui_image;
485500      const bgfx::Memory* fs_imgui_image;
486501      const bgfx::Memory* fs_imgui_image_swizz;
r244546r244547
494509         fs_imgui_texture     = bgfx::makeRef(fs_imgui_texture_dx9, sizeof(fs_imgui_texture_dx9) );
495510         vs_imgui_cubemap     = bgfx::makeRef(vs_imgui_cubemap_dx9, sizeof(vs_imgui_cubemap_dx9) );
496511         fs_imgui_cubemap     = bgfx::makeRef(fs_imgui_cubemap_dx9, sizeof(fs_imgui_cubemap_dx9) );
512         vs_imgui_latlong     = bgfx::makeRef(vs_imgui_latlong_dx9, sizeof(vs_imgui_latlong_dx9) );
513         fs_imgui_latlong     = bgfx::makeRef(fs_imgui_latlong_dx9, sizeof(fs_imgui_latlong_dx9) );
497514         vs_imgui_image       = bgfx::makeRef(vs_imgui_image_dx9, sizeof(vs_imgui_image_dx9) );
498515         fs_imgui_image       = bgfx::makeRef(fs_imgui_image_dx9, sizeof(fs_imgui_image_dx9) );
499516         fs_imgui_image_swizz = bgfx::makeRef(fs_imgui_image_swizz_dx9, sizeof(fs_imgui_image_swizz_dx9) );
r244546r244547
501518         break;
502519
503520      case bgfx::RendererType::Direct3D11:
521      case bgfx::RendererType::Direct3D12:
504522         vs_imgui_color       = bgfx::makeRef(vs_imgui_color_dx11, sizeof(vs_imgui_color_dx11) );
505523         fs_imgui_color       = bgfx::makeRef(fs_imgui_color_dx11, sizeof(fs_imgui_color_dx11) );
506524         vs_imgui_texture     = bgfx::makeRef(vs_imgui_texture_dx11, sizeof(vs_imgui_texture_dx11) );
507525         fs_imgui_texture     = bgfx::makeRef(fs_imgui_texture_dx11, sizeof(fs_imgui_texture_dx11) );
508526         vs_imgui_cubemap     = bgfx::makeRef(vs_imgui_cubemap_dx11, sizeof(vs_imgui_cubemap_dx11) );
509527         fs_imgui_cubemap     = bgfx::makeRef(fs_imgui_cubemap_dx11, sizeof(fs_imgui_cubemap_dx11) );
528         vs_imgui_latlong     = bgfx::makeRef(vs_imgui_latlong_dx11, sizeof(vs_imgui_latlong_dx11) );
529         fs_imgui_latlong     = bgfx::makeRef(fs_imgui_latlong_dx11, sizeof(fs_imgui_latlong_dx11) );
510530         vs_imgui_image       = bgfx::makeRef(vs_imgui_image_dx11, sizeof(vs_imgui_image_dx11) );
511531         fs_imgui_image       = bgfx::makeRef(fs_imgui_image_dx11, sizeof(fs_imgui_image_dx11) );
512532         fs_imgui_image_swizz = bgfx::makeRef(fs_imgui_image_swizz_dx11, sizeof(fs_imgui_image_swizz_dx11) );
r244546r244547
519539         fs_imgui_texture     = bgfx::makeRef(fs_imgui_texture_glsl, sizeof(fs_imgui_texture_glsl) );
520540         vs_imgui_cubemap     = bgfx::makeRef(vs_imgui_cubemap_glsl, sizeof(vs_imgui_cubemap_glsl) );
521541         fs_imgui_cubemap     = bgfx::makeRef(fs_imgui_cubemap_glsl, sizeof(fs_imgui_cubemap_glsl) );
542         vs_imgui_latlong     = bgfx::makeRef(vs_imgui_latlong_glsl, sizeof(vs_imgui_latlong_glsl) );
543         fs_imgui_latlong     = bgfx::makeRef(fs_imgui_latlong_glsl, sizeof(fs_imgui_latlong_glsl) );
522544         vs_imgui_image       = bgfx::makeRef(vs_imgui_image_glsl, sizeof(vs_imgui_image_glsl) );
523545         fs_imgui_image       = bgfx::makeRef(fs_imgui_image_glsl, sizeof(fs_imgui_image_glsl) );
524546         fs_imgui_image_swizz = bgfx::makeRef(fs_imgui_image_swizz_glsl, sizeof(fs_imgui_image_swizz_glsl) );
r244546r244547
546568      bgfx::destroyShader(vsh);
547569      bgfx::destroyShader(fsh);
548570
571      vsh = bgfx::createShader(vs_imgui_latlong);
572      fsh = bgfx::createShader(fs_imgui_latlong);
573      m_latlongProgram = bgfx::createProgram(vsh, fsh);
574      bgfx::destroyShader(vsh);
575      bgfx::destroyShader(fsh);
576
549577      vsh = bgfx::createShader(vs_imgui_image);
550578      fsh = bgfx::createShader(fs_imgui_image);
551579      m_imageProgram = bgfx::createProgram(vsh, fsh);
r244546r244547
586614      bgfx::destroyProgram(m_colorProgram);
587615      bgfx::destroyProgram(m_textureProgram);
588616      bgfx::destroyProgram(m_cubeMapProgram);
617      bgfx::destroyProgram(m_latlongProgram);
589618      bgfx::destroyProgram(m_imageProgram);
590619      bgfx::destroyProgram(m_imageSwizzProgram);
591620      nvgDelete(m_nvg);
r244546r244547
15941623      const int32_t yy = area.m_widgetY;
15951624      area.m_widgetY += _height + DEFAULT_SPACING;
15961625
1597      const bool enabled = _enabled && isEnabled(m_areaId);
1598      const bool over = enabled && inRect(xx, yy, _width, _height);
1599      const bool res = buttonLogic(id, over);
1626      if (screenQuad(xx, yy, _width, _height, _originBottomLeft) )
1627      {
1628         const bool enabled = _enabled && isEnabled(m_areaId);
1629         const bool over = enabled && inRect(xx, yy, _width, _height);
1630         const bool res = buttonLogic(id, over);
16001631
1601      const float lodEnabled[4] = { _lod, float(enabled), 0.0f, 0.0f };
1632         const float lodEnabled[4] = { _lod, float(enabled), 0.0f, 0.0f };
1633         bgfx::setUniform(u_imageLodEnabled, lodEnabled);
1634         bgfx::setTexture(0, s_texColor, bgfx::isValid(_image) ? _image : m_missingTexture);
1635         bgfx::setState(BGFX_STATE_RGB_WRITE
1636                     |BGFX_STATE_ALPHA_WRITE
1637                     |BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA)
1638                    );
1639         bgfx::setProgram(m_imageProgram);
1640         setCurrentScissor();
1641         bgfx::submit(m_view);
16021642
1603      screenQuad(xx, yy, _width, _height, _originBottomLeft);
1604      bgfx::setUniform(u_imageLodEnabled, lodEnabled);
1605      bgfx::setTexture(0, s_texColor, bgfx::isValid(_image) ? _image : m_missingTexture);
1606      bgfx::setState(BGFX_STATE_RGB_WRITE
1607                 |BGFX_STATE_ALPHA_WRITE
1608                 |BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA)
1609                 );
1610      bgfx::setProgram(m_imageProgram);
1611      setCurrentScissor();
1612      bgfx::submit(m_view);
1643         return res;
1644      }
16131645
1614      return res;
1646      return false;
16151647   }
16161648
16171649   bool image(bgfx::TextureHandle _image, float _lod, float _width, float _aspect, ImguiAlign::Enum _align, bool _enabled, bool _originBottomLeft)
r244546r244547
16541686      const int32_t yy = area.m_widgetY;
16551687      area.m_widgetY += _height + DEFAULT_SPACING;
16561688
1657      const bool enabled = _enabled && isEnabled(m_areaId);
1658      const bool over = enabled && inRect(xx, yy, _width, _height);
1659      const bool res = buttonLogic(id, over);
1689      if (screenQuad(xx, yy, _width, _height) )
1690      {
1691         const bool enabled = _enabled && isEnabled(m_areaId);
1692         const bool over = enabled && inRect(xx, yy, _width, _height);
1693         const bool res = buttonLogic(id, over);
16601694
1661      screenQuad(xx, yy, _width, _height);
1695         const float lodEnabled[4] = { _lod, float(enabled), 0.0f, 0.0f };
1696         bgfx::setUniform(u_imageLodEnabled, lodEnabled);
16621697
1663      const float lodEnabled[4] = { _lod, float(enabled), 0.0f, 0.0f };
1664      bgfx::setUniform(u_imageLodEnabled, lodEnabled);
1698         float swizz[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
1699         swizz[_channel] = 1.0f;
1700         bgfx::setUniform(u_imageSwizzle, swizz);
16651701
1666      float swizz[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
1667      swizz[_channel] = 1.0f;
1668      bgfx::setUniform(u_imageSwizzle, swizz);
1702         bgfx::setTexture(0, s_texColor, bgfx::isValid(_image) ? _image : m_missingTexture);
1703         bgfx::setState(BGFX_STATE_RGB_WRITE
1704                    |BGFX_STATE_ALPHA_WRITE
1705                    |BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA)
1706                    );
1707         bgfx::setProgram(m_imageSwizzProgram);
1708         setCurrentScissor();
1709         bgfx::submit(m_view);
16691710
1670      bgfx::setTexture(0, s_texColor, bgfx::isValid(_image) ? _image : m_missingTexture);
1671      bgfx::setState(BGFX_STATE_RGB_WRITE
1672                 |BGFX_STATE_ALPHA_WRITE
1673                 |BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA)
1674                 );
1675      bgfx::setProgram(m_imageSwizzProgram);
1676      setCurrentScissor();
1677      bgfx::submit(m_view);
1711         return res;
1712      }
16781713
1679      return res;
1714      return false;
16801715   }
16811716
16821717   bool imageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, float _width, float _aspect, ImguiAlign::Enum _align, bool _enabled)
r244546r244547
16871722      return imageChannel(_image, _channel, _lod, int32_t(width), int32_t(height), _align, _enabled);
16881723   }
16891724
1690   bool cubeMap(bgfx::TextureHandle _cubemap, float _lod, bool _cross, ImguiAlign::Enum _align, bool _enabled)
1725   bool latlong(bgfx::TextureHandle _cubemap, float _lod, ImguiAlign::Enum _align, bool _enabled)
16911726   {
1727      const uint32_t id = getId();
1728
1729      Area& area = getCurrentArea();
1730      int32_t xx;
1731      int32_t width;
1732      if (ImguiAlign::Left == _align)
1733      {
1734         xx = area.m_contentX + SCROLL_AREA_PADDING;
1735         width = area.m_widgetW;
1736      }
1737      else if (ImguiAlign::LeftIndented == _align
1738          ||  ImguiAlign::Right        == _align)
1739      {
1740         xx = area.m_widgetX;
1741         width = area.m_widgetW;
1742      }
1743      else //if (ImguiAlign::Center         == _align
1744          //||  ImguiAlign::CenterIndented == _align).
1745      {
1746         xx = area.m_widgetX;
1747         width = area.m_widgetW - (area.m_widgetX-area.m_scissorX);
1748      }
1749
1750      const int32_t height = width/2;
1751      const int32_t yy = area.m_widgetY;
1752      area.m_widgetY += height + DEFAULT_SPACING;
1753
1754      if (screenQuad(xx, yy, width, height, false) )
1755      {
1756         const bool enabled = _enabled && isEnabled(m_areaId);
1757         const bool over = enabled && inRect(xx, yy, width, height);
1758         const bool res = buttonLogic(id, over);
1759
1760         const float lodEnabled[4] = { _lod, float(enabled), 0.0f, 0.0f };
1761         bgfx::setUniform(u_imageLodEnabled, lodEnabled);
1762
1763         bgfx::setTexture(0, s_texColor, _cubemap);
1764         bgfx::setState(BGFX_STATE_RGB_WRITE
1765                    |BGFX_STATE_ALPHA_WRITE
1766                    |BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA)
1767                    );
1768         bgfx::setProgram(m_latlongProgram);
1769         setCurrentScissor();
1770         bgfx::submit(m_view);
1771
1772         return res;
1773      }
1774
1775      return false;
1776   }
1777
1778   bool cubeMap(bgfx::TextureHandle _cubemap, float _lod, bool _cross, bool _sameHeight, ImguiAlign::Enum _align, bool _enabled)
1779   {
1780      const uint32_t id = getId();
1781
1782      Area& area = getCurrentArea();
1783      int32_t xx;
1784      int32_t width;
1785      if (ImguiAlign::Left == _align)
1786      {
1787         xx = area.m_contentX + SCROLL_AREA_PADDING;
1788         width = area.m_widgetW;
1789      }
1790      else if (ImguiAlign::LeftIndented == _align
1791          ||  ImguiAlign::Right        == _align)
1792      {
1793         xx = area.m_widgetX;
1794         width = area.m_widgetW;
1795      }
1796      else //if (ImguiAlign::Center         == _align
1797          //||  ImguiAlign::CenterIndented == _align).
1798      {
1799         xx = area.m_widgetX;
1800         width = area.m_widgetW - (area.m_widgetX-area.m_scissorX);
1801      }
1802
1803      const bool adjustHeight = (_cross && _sameHeight);
1804      const bool fullHeight   = (_cross && !_sameHeight);
1805
1806      if (adjustHeight)
1807      {
1808         xx += width/6;
1809      }
1810
1811      const int32_t height = fullHeight ? (width*3)/4 : (width/2);
1812      const int32_t yy = area.m_widgetY;
1813      area.m_widgetY += height + DEFAULT_SPACING;
1814
16921815      const uint32_t numVertices = 14;
16931816      const uint32_t numIndices  = 36;
16941817      if (bgfx::checkAvailTransientBuffers(numVertices, PosNormalVertex::ms_decl, numIndices) )
r244546r244547
17601883            indices += addQuad(indices, 10, 12, 13, 11);
17611884         }
17621885
1763         const uint32_t id = getId();
1764
1765         Area& area = getCurrentArea();
1766         int32_t xx;
1767         int32_t width;
1768         if (ImguiAlign::Left == _align)
1769         {
1770            xx = area.m_contentX + SCROLL_AREA_PADDING;
1771            width = area.m_widgetW;
1772         }
1773         else if (ImguiAlign::LeftIndented == _align
1774             ||  ImguiAlign::Right        == _align)
1775         {
1776            xx = area.m_widgetX;
1777            width = area.m_widgetW;
1778         }
1779         else //if (ImguiAlign::Center         == _align
1780             //||  ImguiAlign::CenterIndented == _align).
1781         {
1782            xx = area.m_widgetX;
1783            width = area.m_widgetW - (area.m_widgetX-area.m_scissorX);
1784         }
1785
1786         const uint32_t height = _cross ? (width*3)/4 : (width/2);
1787         const int32_t yy = area.m_widgetY;
1788         area.m_widgetY += height + DEFAULT_SPACING;
1789
17901886         const bool enabled = _enabled && isEnabled(m_areaId);
17911887         const bool over = enabled && inRect(xx, yy, width, height);
17921888         const bool res = buttonLogic(id, over);
17931889
1794         const float scale = float(width/2)+0.25f;
1890         const float widthf = float(width);
1891         const float scale = adjustHeight ? (widthf+0.5f)/3.0f : (widthf*0.5f + 0.25f);
17951892
17961893         float mtx[16];
17971894         bx::mtxSRT(mtx, scale, scale, 1.0f, 0.0f, 0.0f, 0.0f, float(xx), float(yy), 0.0f);
r244546r244547
18171914      return false;
18181915   }
18191916
1917   bool cubeMap(bgfx::TextureHandle _cubemap, float _lod, ImguiCubemap::Enum _display, bool _sameHeight, ImguiAlign::Enum _align, bool _enabled)
1918   {
1919      if (ImguiCubemap::Cross == _display
1920      ||  ImguiCubemap::Hex   == _display)
1921      {
1922         return cubeMap(_cubemap, _lod, (ImguiCubemap::Cross == _display), _sameHeight, _align, _enabled);
1923      }
1924      else //(ImguiCubemap::Latlong == _display).
1925      {
1926         return latlong(_cubemap, _lod, _align, _enabled);
1927      }
1928   }
1929
18201930   bool collapse(const char* _text, const char* _subtext, bool _checked, bool _enabled)
18211931   {
18221932      const uint32_t id = getId();
r244546r244547
25962706#endif // USE_NANOVG_FONT
25972707   }
25982708
2599   void screenQuad(int32_t _x, int32_t _y, int32_t _width, uint32_t _height, bool _originBottomLeft = false)
2709   bool screenQuad(int32_t _x, int32_t _y, int32_t _width, uint32_t _height, bool _originBottomLeft = false)
26002710   {
26012711      if (bgfx::checkAvailTransientVertexBuffer(6, PosUvVertex::ms_decl) )
26022712      {
r244546r244547
26502760         vertex[5].m_v = minv;
26512761
26522762         bgfx::setVertexBuffer(&vb);
2763
2764         return true;
26532765      }
2766
2767      return false;
26542768   }
26552769
26562770   void colorWheelWidget(float _rgb[3], bool _respectIndentation, float _size, bool _enabled)
r244546r244547
30543168   bgfx::ProgramHandle m_colorProgram;
30553169   bgfx::ProgramHandle m_textureProgram;
30563170   bgfx::ProgramHandle m_cubeMapProgram;
3171   bgfx::ProgramHandle m_latlongProgram;
30573172   bgfx::ProgramHandle m_imageProgram;
30583173   bgfx::ProgramHandle m_imageSwizzProgram;
30593174   bgfx::TextureHandle m_missingTexture;
r244546r244547
33483463   return s_imgui.imageChannel(_image, _channel, _lod, _width, _aspect, _align, _enabled);
33493464}
33503465
3351bool imguiCube(bgfx::TextureHandle _cubemap, float _lod, bool _cross, ImguiAlign::Enum _align, bool _enabled)
3466bool imguiCube(bgfx::TextureHandle _cubemap, float _lod, ImguiCubemap::Enum _display, bool _sameHeight, ImguiAlign::Enum _align, bool _enabled)
33523467{
3353   return s_imgui.cubeMap(_cubemap, _lod, _cross, _align, _enabled);
3468   return s_imgui.cubeMap(_cubemap, _lod, _display, _sameHeight, _align, _enabled);
33543469}
33553470
33563471float imguiGetTextLength(const char* _text, ImguiFontHandle _handle)
branches/kale/3rdparty/bgfx/examples/common/imgui/imgui.h
r244546r244547
9494   };
9595};
9696
97struct ImguiCubemap
98{
99   enum Enum
100   {
101      Cross,
102      Latlong,
103      Hex,
104
105      Count,
106   };
107};
108
97109struct ImguiBorder
98110{
99111   enum Enum
r244546r244547
184196bool imguiImage(bgfx::TextureHandle _image, float _lod, float _scale, float _aspect, ImguiAlign::Enum _align = ImguiAlign::LeftIndented, bool _enabled = true, bool _originBottomLeft = false);
185197bool imguiImageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align = ImguiAlign::LeftIndented, bool _enabled = true);
186198bool imguiImageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, float _scale, float _aspect, ImguiAlign::Enum _align = ImguiAlign::LeftIndented, bool _enabled = true);
187bool imguiCube(bgfx::TextureHandle _cubemap, float _lod = 0.0f, bool _cross = true, ImguiAlign::Enum _align = ImguiAlign::LeftIndented, bool _enabled = true);
199bool imguiCube(bgfx::TextureHandle _cubemap, float _lod = 0.0f, ImguiCubemap::Enum _display = ImguiCubemap::Cross, bool _sameHeight = false, ImguiAlign::Enum _align = ImguiAlign::LeftIndented, bool _enabled = true);
188200
189201float imguiGetTextLength(const char* _text, ImguiFontHandle _handle);
190202bool imguiMouseOverArea();
branches/kale/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp
r244546r244547
9999         break;
100100
101101      case bgfx::RendererType::Direct3D11:
102      case bgfx::RendererType::Direct3D12:
102103         vsmem = bgfx::makeRef(vs_ocornut_imgui_dx11, sizeof(vs_ocornut_imgui_dx11));
103104         fsmem = bgfx::makeRef(fs_ocornut_imgui_dx11, sizeof(fs_ocornut_imgui_dx11));
104105         break;
branches/kale/3rdparty/bgfx/examples/common/imgui/vs_imgui_latlong.bin.h
r0r244547
1static const uint8_t vs_imgui_latlong_glsl[337] =
2{
3   0x56, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH.o.><...u_mod
4   0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x09, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj......
5   0x2c, 0x01, 0x00, 0x00, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, 0x69, // ,...attribute hi
6   0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, // ghp vec3 a_posit
7   0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, // ion;.attribute h
8   0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, // ighp vec2 a_texc
9   0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, // oord0;.varying h
10   0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // ighp vec2 v_texc
11   0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, // oord0;.uniform h
12   0x69, 0x67, 0x68, 0x70, 0x20, 0x6d, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // ighp mat4 u_mode
13   0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, // lViewProj;.void
14   0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, // main ().{.  high
15   0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, // p vec4 tmpvar_1;
16   0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, // .  tmpvar_1.w =
17   0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, // 1.0;.  tmpvar_1.
18   0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, // xyz = a_position
19   0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, // ;.  gl_Position
20   0x3d, 0x20, 0x28, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, // = (u_modelViewPr
21   0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, // oj * tmpvar_1);.
22   0x20, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, //   v_texcoord0 =
23   0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, // a_texcoord0;.}..
24   0x00,                                                                                           // .
25};
26static const uint8_t vs_imgui_latlong_dx9[319] =
27{
28   0x56, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH.o.><...u_mod
29   0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x09, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj......
30   0x1c, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // ........#.CTAB..
31   0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, // ..W.............
32   0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, // ......P...0.....
33   0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......@.......u_
34   0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x03, 0x00, // modelViewProj...
35   0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, // ..............vs
36   0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, // _3_0.Microsoft (
37   0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, // R) HLSL Shader C
38   0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, // ompiler 9.29.952
39   0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, // .3111...........
40   0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................
41   0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, // ................
42   0x00, 0x80, 0x01, 0x00, 0x03, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, // ................
43   0xe4, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, // ....U...........
44   0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ................
45   0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, // ................
46   0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, // ................
47   0x00, 0x02, 0x01, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00,       // ...............
48};
49static const uint8_t vs_imgui_latlong_dx11[518] =
50{
51   0x56, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH.o.><...u_mod
52   0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x09, 0x00, 0xe0, 0x09, 0x04, 0x00, // elViewProj......
53   0xdc, 0x01, 0x44, 0x58, 0x42, 0x43, 0xb0, 0x50, 0xdf, 0x0d, 0x1e, 0x85, 0x4e, 0xbe, 0xdd, 0xef, // ..DXBC.P....N...
54   0x92, 0x24, 0x45, 0x46, 0x54, 0x49, 0x01, 0x00, 0x00, 0x00, 0xdc, 0x01, 0x00, 0x00, 0x03, 0x00, // .$EFTI..........
55   0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xd8, 0x00, 0x00, 0x00, 0x49, 0x53, // ..,...........IS
56   0x47, 0x4e, 0x4c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, // GNL...........8.
57   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
58   0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......A.........
59   0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x50, 0x4f, // ..............PO
60   0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, // SITION.TEXCOORD.
61   0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x50, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, // ..OSGNP.........
62   0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, // ..8.............
63   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........D.....
64   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x0c, // ................
65   0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, // ..SV_POSITION.TE
66   0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0xfc, 0x00, // XCOORD....SHDR..
67   0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, // ..@...?...Y...F.
68   0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x72, 0x10, //  ........._...r.
69   0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x01, 0x00, // ......_...2.....
70   0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ..g.... ........
71   0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0x32, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x68, 0x00, // ..e...2 ......h.
72   0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, // ......8.........
73   0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..V.......F. ...
74   0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, // ......2.........
75   0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, 0x00, 0x00, 0x00, 0x06, 0x10, // ..F. ...........
76   0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, // ......F.......2.
77   0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..........F. ...
78   0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa6, 0x1a, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, // ..............F.
79   0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, // ........... ....
80   0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..F.......F. ...
81   0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x32, 0x20, 0x10, 0x00, 0x01, 0x00, // ......6...2 ....
82   0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x02, // ..F.......>.....
83   0x01, 0x00, 0x10, 0x00, 0x30, 0x0a,                                                             // ....0.
84};
branches/kale/3rdparty/bgfx/examples/common/imgui/vs_imgui_latlong.sc
r0r244547
1$input a_position, a_texcoord0
2$output v_texcoord0
3
4/*
5 * Copyright 2015 Dario Manesku. All rights reserved.
6 * License: http://www.opensource.org/licenses/BSD-2-Clause
7 */
8
9#include <bgfx_shader.sh>
10
11void main()
12{
13   gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0) );
14   v_texcoord0 = a_texcoord0;
15}
branches/kale/3rdparty/bgfx/examples/common/nanovg/fontstash.h
r244546r244547
428428   void* errorUptr;
429429};
430430
431#if 0
431432static void* fons__tmpalloc(size_t size, void* up)
432433{
433434   unsigned char* ptr;
r244546r244547
453454   // empty
454455}
455456
457#endif
456458// Copyright (c) 2008-2010 Bjoern Hoehrmann <bjoern@hoehrmann.de>
457459// See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details.
458460
branches/kale/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp
r244546r244547
239239         break;
240240
241241      case bgfx::RendererType::Direct3D11:
242      case bgfx::RendererType::Direct3D12:
242243         vs_nanovg_fill = bgfx::makeRef(vs_nanovg_fill_dx11, sizeof(vs_nanovg_fill_dx11) );
243244         fs_nanovg_fill = bgfx::makeRef(fs_nanovg_fill_dx11, sizeof(fs_nanovg_fill_dx11) );
244245         break;
branches/kale/3rdparty/bgfx/examples/common/shaderlib.sh
r244546r244547
183183   return vec4(toLinear(_rgba.xyz), _rgba.w);
184184}
185185
186vec3 toLinearAccurate(vec3 _rgb)
187{
188   vec3 lo = _rgb / 12.92;
189   vec3 hi = pow( (_rgb + 0.055) / 1.055, vec3_splat(2.4) );
190   vec3 rgb = mix(hi, lo, vec3(lessThanEqual(_rgb, vec3_splat(0.04045) ) ) );
191   return rgb;
192}
193
194vec4 toLinearAccurate(vec4 _rgba)
195{
196   return vec4(toLinearAccurate(_rgba.xyz), _rgba.w);
197}
198
186199float toGamma(float _r)
187200{
188201   return pow(abs(_r), 1.0/2.2);
r244546r244547
198211   return vec4(toGamma(_rgba.xyz), _rgba.w);
199212}
200213
214vec3 toGammaAccurate(vec3 _rgb)
215{
216   vec3 lo  = _rgb * 12.92;
217   vec3 hi  = pow(abs(_rgb), vec3_splat(1.0/2.4) ) * 1.055 - 0.055;
218   vec3 rgb = mix(hi, lo, vec3(lessThanEqual(_rgb, vec3_splat(0.0031308) ) ) );
219   return rgb;
220}
221
222vec4 toGammaAccurate(vec4 _rgba)
223{
224   return vec4(toGammaAccurate(_rgba.xyz), _rgba.w);
225}
226
201227vec3 toReinhard(vec3 _rgb)
202228{
203229   return toGamma(_rgb/(_rgb+vec3_splat(1.0) ) );
branches/kale/3rdparty/bgfx/include/bgfx.c99.h
r244546r244547
265265    uint16_t depth;
266266    uint8_t numMips;
267267    uint8_t bitsPerPixel;
268    bool    cubeMap;
268269
269270} bgfx_texture_info_t;
270271
r244546r244547
724725 *  @param _num Number of vertices.
725726 *  @param _decl Vertex declaration.
726727 */
727BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint16_t _num, const bgfx_vertex_decl_t* _decl, uint8_t _flags);
728BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t* _decl, uint8_t _flags);
728729
729730/**
730731 *  Create dynamic vertex buffer and initialize it.
r244546r244547
815816 *  NOTE:
816817 *    Only 16-bit index buffer is supported.
817818 */
818BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t* _decl, uint16_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint16_t _numIndices);
819BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t* _decl, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices);
819820
820821/**
821822 *  Allocate instance data buffer.
r244546r244547
870871/**
871872 *  Calculate amount of memory required for texture.
872873 */
873BGFX_C_API void bgfx_calc_texture_size(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, bgfx_texture_format_t _format);
874BGFX_C_API void bgfx_calc_texture_size(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, uint8_t _numMips, bgfx_texture_format_t _format);
874875
875876/**
876877 *  Create texture from memory buffer.
branches/kale/3rdparty/bgfx/include/bgfx.h
r244546r244547
4646         Null,         //!< No rendering.
4747         Direct3D9,    //!< Direct3D 9.0
4848         Direct3D11,   //!< Direct3D 11.0
49         OpenGLES = 4, //!< OpenGL ES 2.0+
49         Direct3D12,   //!< Direct3D 12.0
50         OpenGLES,     //!< OpenGL ES 2.0+
5051         OpenGL,       //!< OpenGL 2.1+
5152
5253         Count
r244546r244547
360361      uint16_t depth;             //!< Texture depth.
361362      uint8_t numMips;            //!< Number of MIP maps.
362363      uint8_t bitsPerPixel;       //!< Format bits per pixel.
364      bool    cubeMap;            //!< Texture is cubemap.
363365   };
364366
365367   ///
r244546r244547
685687   ///   When buffer is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated
686688   ///   from CPU.
687689   ///
688   DynamicVertexBufferHandle createDynamicVertexBuffer(uint16_t _num, const VertexDecl& _decl, uint8_t _flags = BGFX_BUFFER_NONE);
690   DynamicVertexBufferHandle createDynamicVertexBuffer(uint32_t _num, const VertexDecl& _decl, uint8_t _flags = BGFX_BUFFER_NONE);
689691
690692   /// Create dynamic vertex buffer and initialize it.
691693   ///
r244546r244547
764766   /// @remarks
765767   ///   Only 16-bit index buffer is supported.
766768   ///
767   bool allocTransientBuffers(TransientVertexBuffer* _tvb, const VertexDecl& _decl, uint16_t _numVertices, TransientIndexBuffer* _tib, uint16_t _numIndices);
769   bool allocTransientBuffers(TransientVertexBuffer* _tvb, const VertexDecl& _decl, uint32_t _numVertices, TransientIndexBuffer* _tib, uint32_t _numIndices);
768770
769771   /// Allocate instance data buffer.
770772   ///
r244546r244547
817819   void destroyProgram(ProgramHandle _handle);
818820
819821   /// Calculate amount of memory required for texture.
820   void calcTextureSize(TextureInfo& _info, uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, TextureFormat::Enum _format);
822   void calcTextureSize(TextureInfo& _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, uint8_t _numMips, TextureFormat::Enum _format);
821823
822824   /// Create texture from memory buffer.
823825   ///
branches/kale/3rdparty/bgfx/include/bgfxplatform.h
r244546r244547
5151} // namespace bgfx
5252
5353#elif BX_PLATFORM_FREEBSD || BX_PLATFORM_LINUX || BX_PLATFORM_RPI
54#   include <X11/Xlib.h>
5554
5655namespace bgfx
5756{
5857   ///
59   void x11SetDisplayWindow(::Display* _display, ::Window _window);
58   void x11SetDisplayWindow(void* _display, uint32_t _window);
6059
6160} // namespace bgfx
6261
branches/kale/3rdparty/bgfx/scripts/bgfx.lua
r244546r244547
1414            "BGFX_SHARED_LIB_BUILD=1",
1515         }
1616
17         configuration { "vs20* or mingw*" }
18            links {
19               "gdi32",
20               "psapi",
21            }
22
1723         configuration { "mingw*" }
1824            linkoptions {
1925               "-shared",
2026            }
21            links {
22               "gdi32",
23            }
2427
2528         configuration {}
2629      end
branches/kale/3rdparty/bgfx/src/bgfx.cpp
r244546r244547
3434      g_bgfxEaglLayer = _layer;
3535   }
3636#elif BX_PLATFORM_LINUX
37   ::Display* g_bgfxX11Display;
38   ::Window   g_bgfxX11Window;
37   void*    g_bgfxX11Display;
38   uint32_t g_bgfxX11Window;
3939
40   void x11SetDisplayWindow(::Display* _display, ::Window _window)
40   void x11SetDisplayWindow(void* _display, uint32_t _window)
4141   {
4242      g_bgfxX11Display = _display;
4343      g_bgfxX11Window  = _window;
r244546r244547
355355         break;
356356
357357      case RendererType::Direct3D11:
358      case RendererType::Direct3D12:
358359         mem = makeRef(vs_debugfont_dx11, sizeof(vs_debugfont_dx11) );
359360         break;
360361
r244546r244547
372373         break;
373374
374375      case RendererType::Direct3D11:
376      case RendererType::Direct3D12:
375377         mem = makeRef(fs_debugfont_dx11, sizeof(fs_debugfont_dx11) );
376378         break;
377379
r244546r244547
552554               fragMem[ii] = makeRef(mem[ii].data, uint32_t(mem[ii].size) );
553555            }
554556         }
555         else if (RendererType::Direct3D11 == g_caps.rendererType)
557         else if (RendererType::Direct3D11 == g_caps.rendererType
558             ||  RendererType::Direct3D12 == g_caps.rendererType)
556559         {
557560            vsh = createShader(makeRef(vs_clear_dx11, sizeof(vs_clear_dx11) ) );
558561
r244546r244547
772775      {
773776         m_key.m_depth  = 0;
774777         m_key.m_view   = _id;
775         m_key.m_seq    = s_ctx->m_seq[_id] & s_ctx->m_seqMask[_id];
778         m_key.m_seq    = s_ctx->m_seq[_id];
776779         s_ctx->m_seq[_id]++;
777780
778781         uint64_t key = m_key.encodeCompute();
r244546r244547
13911394
13921395            if (windowsVersionIs(Condition::GreaterEqual, 0x0602) )
13931396            {
1394               first  = RendererType::Direct3D11 /* Direct3D12 */;
1397               first  = RendererType::Direct3D12;
13951398               second = RendererType::Direct3D11;
13961399               if (!s_rendererCreator[second].supported)
1400               {
13971401                  second = RendererType::Direct3D9;
1402               }
13981403            }
13991404            else if (windowsVersionIs(Condition::GreaterEqual, 0x0601) )
14001405            {
r244546r244547
19261931      uint8_t num = 0;
19271932      for (uint8_t ii = 0; ii < uint8_t(RendererType::Count); ++ii)
19281933      {
1929         if (RendererType::Direct3D11 == ii
1934         if ( (RendererType::Direct3D11 == ii || RendererType::Direct3D12 == ii)
19301935         &&  windowsVersionIs(Condition::LessEqual, 0x0502) )
19311936         {
19321937            continue;
r244546r244547
21612166      s_ctx->destroyDynamicIndexBuffer(_handle);
21622167   }
21632168
2164   DynamicVertexBufferHandle createDynamicVertexBuffer(uint16_t _num, const VertexDecl& _decl, uint8_t _flags)
2169   DynamicVertexBufferHandle createDynamicVertexBuffer(uint32_t _num, const VertexDecl& _decl, uint8_t _flags)
21652170   {
21662171      BGFX_CHECK_MAIN_THREAD();
21672172      BX_CHECK(0 != _decl.m_stride, "Invalid VertexDecl.");
r244546r244547
22372242      return s_ctx->allocTransientVertexBuffer(_tvb, _num, _decl);
22382243   }
22392244
2240   bool allocTransientBuffers(bgfx::TransientVertexBuffer* _tvb, const bgfx::VertexDecl& _decl, uint16_t _numVertices, bgfx::TransientIndexBuffer* _tib, uint16_t _numIndices)
2245   bool allocTransientBuffers(bgfx::TransientVertexBuffer* _tvb, const bgfx::VertexDecl& _decl, uint32_t _numVertices, bgfx::TransientIndexBuffer* _tib, uint32_t _numIndices)
22412246   {
22422247      if (checkAvailTransientBuffers(_numVertices, _decl, _numIndices) )
22432248      {
r244546r244547
23092314      s_ctx->destroyProgram(_handle);
23102315   }
23112316
2312   void calcTextureSize(TextureInfo& _info, uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, TextureFormat::Enum _format)
2317   void calcTextureSize(TextureInfo& _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, uint8_t _numMips, TextureFormat::Enum _format)
23132318   {
2314      _width   = bx::uint32_max(1, _width);
2315      _height  = bx::uint32_max(1, _height);
2319      const ImageBlockInfo& blockInfo = getBlockInfo(_format);
2320      const uint8_t  bpp         = blockInfo.bitsPerPixel;
2321      const uint32_t blockWidth  = blockInfo.blockWidth;
2322      const uint32_t blockHeight = blockInfo.blockHeight;
2323      const uint32_t minBlockX   = blockInfo.minBlockX;
2324      const uint32_t minBlockY   = blockInfo.minBlockY;
2325
2326      _width   = bx::uint32_max(blockWidth  * minBlockX, ( (_width  + blockWidth  - 1) / blockWidth)*blockWidth);
2327      _height  = bx::uint32_max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight);
23162328      _depth   = bx::uint32_max(1, _depth);
23172329      _numMips = bx::uint32_max(1, _numMips);
23182330
23192331      uint32_t width  = _width;
23202332      uint32_t height = _height;
23212333      uint32_t depth  = _depth;
2334      uint32_t sides  = _cubeMap ? 6 : 1;
2335      uint32_t size   = 0;
23222336
2323      uint32_t bpp = getBitsPerPixel(_format);
2324      uint32_t size = 0;
2325
23262337      for (uint32_t lod = 0; lod < _numMips; ++lod)
23272338      {
2328         width  = bx::uint32_max(1, width);
2329         height = bx::uint32_max(1, height);
2339         width  = bx::uint32_max(blockWidth  * minBlockX, ( (width  + blockWidth  - 1) / blockWidth )*blockWidth);
2340         height = bx::uint32_max(blockHeight * minBlockY, ( (height + blockHeight - 1) / blockHeight)*blockHeight);
23302341         depth  = bx::uint32_max(1, depth);
23312342
2332         size += width*height*depth*bpp/8;
2343         size += width*height*depth*bpp/8 * sides;
23332344
23342345         width  >>= 1;
23352346         height >>= 1;
r244546r244547
23412352      _info.height  = _height;
23422353      _info.depth   = _depth;
23432354      _info.numMips = _numMips;
2355      _info.cubeMap = _cubeMap;
23442356      _info.storageSize  = size;
23452357      _info.bitsPerPixel = bpp;
23462358   }
r244546r244547
23622374      &&  NULL != _mem)
23632375      {
23642376         TextureInfo ti;
2365         calcTextureSize(ti, _width, _height, 1, _numMips, _format);
2377         calcTextureSize(ti, _width, _height, 1, false, _numMips, _format);
23662378         BX_CHECK(ti.storageSize == _mem->size
23672379            , "createTexture2D: Texture storage size doesn't match passed memory size (storage size: %d, memory size: %d)"
23682380            , ti.storageSize
r244546r244547
24032415      &&  NULL != _mem)
24042416      {
24052417         TextureInfo ti;
2406         calcTextureSize(ti, _width, _height, _depth, _numMips, _format);
2418         calcTextureSize(ti, _width, _height, _depth, false, _numMips, _format);
24072419         BX_CHECK(ti.storageSize == _mem->size
24082420            , "createTexture3D: Texture storage size doesn't match passed memory size (storage size: %d, memory size: %d)"
24092421            , ti.storageSize
r244546r244547
24432455      &&  NULL != _mem)
24442456      {
24452457         TextureInfo ti;
2446         calcTextureSize(ti, _size, _size, 1, _numMips, _format);
2447         BX_CHECK(ti.storageSize*6 == _mem->size
2458         calcTextureSize(ti, _size, _size, 1, true, _numMips, _format);
2459         BX_CHECK(ti.storageSize == _mem->size
24482460            , "createTextureCube: Texture storage size doesn't match passed memory size (storage size: %d, memory size: %d)"
2449            , ti.storageSize*6
2461            , ti.storageSize
24502462            , _mem->size
24512463            );
24522464      }
r244546r244547
24592471      bx::write(&writer, magic);
24602472
24612473      TextureCreate tc;
2462      tc.m_flags = _flags;
2463      tc.m_width = _size;
2464      tc.m_height = _size;
2465      tc.m_sides = 6;
2466      tc.m_depth = 0;
2474      tc.m_flags   = _flags;
2475      tc.m_width   = _size;
2476      tc.m_height  = _size;
2477      tc.m_sides   = 6;
2478      tc.m_depth   = 0;
24672479      tc.m_numMips = _numMips;
2468      tc.m_format = uint8_t(_format);
2480      tc.m_format = uint8_t(_format);
24692481      tc.m_cubeMap = true;
2470      tc.m_mem = _mem;
2482      tc.m_mem     = _mem;
24712483      bx::write(&writer, tc);
24722484
24732485      return s_ctx->createTexture(mem, _flags, 0, NULL);
r244546r244547
30883100   bgfx::destroyDynamicIndexBuffer(handle.cpp);
30893101}
30903102
3091BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint16_t _num, const bgfx_vertex_decl_t* _decl, uint8_t _flags)
3103BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t* _decl, uint8_t _flags)
30923104{
30933105   const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl;
30943106   union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle;
r244546r244547
31493161   bgfx::allocTransientVertexBuffer( (bgfx::TransientVertexBuffer*)_tvb, _num, decl);
31503162}
31513163
3152BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t* _decl, uint16_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint16_t _numIndices)
3164BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t* _decl, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices)
31533165{
31543166   const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl;
31553167   return bgfx::allocTransientBuffers( (bgfx::TransientVertexBuffer*)_tvb, decl, _numVertices, (bgfx::TransientIndexBuffer*)_tib, _numIndices);
r244546r244547
31943206   bgfx::destroyProgram(handle.cpp);
31953207}
31963208
3197BGFX_C_API void bgfx_calc_texture_size(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, bgfx_texture_format_t _format)
3209BGFX_C_API void bgfx_calc_texture_size(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, uint8_t _numMips, bgfx_texture_format_t _format)
31983210{
31993211   bgfx::TextureInfo& info = *(bgfx::TextureInfo*)_info;
3200   bgfx::calcTextureSize(info, _width, _height, _depth, _numMips, bgfx::TextureFormat::Enum(_format) );
3212   bgfx::calcTextureSize(info, _width, _height, _depth, _cubeMap, _numMips, bgfx::TextureFormat::Enum(_format) );
32013213}
32023214
32033215BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t* _mem, uint32_t _flags, uint8_t _skip, bgfx_texture_info_t* _info)
branches/kale/3rdparty/bgfx/src/bgfx_compute.sh
r244546r244547
2020uvec2 floatBitsToUint(vec2  _x) { return asuint(_x);  }
2121uvec3 floatBitsToUint(vec3  _x) { return asuint(_x);  }
2222uvec4 floatBitsToUint(vec4  _x) { return asuint(_x);  }
23int   floatBitsToInt(float _x)  { return asint(_x);   }
24ivec2 floatBitsToInt(vec2  _x)  { return asint(_x);   }
25ivec3 floatBitsToInt(vec3  _x)  { return asint(_x);   }
26ivec4 floatBitsToInt(vec4  _x)  { return asint(_x);   }
2327
2428#define SHARED groupshared
2529
r244546r244547
3842   return _image.Load(uint3(_uv.xy, 0) );
3943}
4044
45uint imageLoad(Texture2D<uint> _image, ivec2 _uv)
46{
47   return _image.Load(uint3(_uv.xy, 0) );
48}
49
50uint imageLoad(RWTexture2D<uint> _image, ivec2 _uv)
51{
52   return _image[_uv.xy];
53}
54
4155ivec2 imageSize(Texture2D _image)
4256{
4357   ivec2 result;
r244546r244547
4559   return result;
4660}
4761
48//vec4 imageLoad(RWTexture2D<float4> _image, ivec2 _uv)
49//{
50//   return _image[_uv];
51//}
52
5362ivec2 imageSize(RWTexture2D<float4> _image)
5463{
5564   ivec2 result;
r244546r244547
5766   return result;
5867}
5968
69ivec2 imageSize(RWTexture2D<uint> _image)
70{
71   ivec2 result;
72   _image.GetDimensions(result.x, result.y);
73   return result;
74}
75
6076void imageStore(RWTexture2D<float4> _image, ivec2 _uv, vec4 _rgba)
6177{
6278   _image[_uv] = _rgba;
6379}
6480
81void imageStore(RWTexture2D<uint> _image, ivec2 _uv, uvec4 _r)
82{
83   _image[_uv] = _r.x;
84}
85
6586#define __ATOMIC_IMPL_TYPE(_genType, _glFunc, _dxFunc) \
6687         _genType _glFunc(_genType _mem, _genType _data) \
6788         { \
branches/kale/3rdparty/bgfx/src/bgfx_p.h
r244546r244547
201201#elif BX_PLATFORM_IOS
202202   extern void* g_bgfxEaglLayer;
203203#elif BX_PLATFORM_LINUX
204   extern ::Display* g_bgfxX11Display;
205   extern ::Window   g_bgfxX11Window;
204   extern void*    g_bgfxX11Display;
205   extern uint32_t g_bgfxX11Window;
206206#elif BX_PLATFORM_OSX
207207   extern void* g_bgfxNSWindow;
208208#elif BX_PLATFORM_WINDOWS
r244546r244547
21782178         return ptr;
21792179      }
21802180
2181      BGFX_API_FUNC(DynamicVertexBufferHandle createDynamicVertexBuffer(uint16_t _num, const VertexDecl& _decl, uint8_t _flags) )
2181      BGFX_API_FUNC(DynamicVertexBufferHandle createDynamicVertexBuffer(uint32_t _num, const VertexDecl& _decl, uint8_t _flags) )
21822182      {
21832183         DynamicVertexBufferHandle handle = BGFX_INVALID_HANDLE;
21842184         uint32_t size = strideAlign16( (_num+1)*_decl.m_stride, _decl.m_stride);
r244546r244547
26812681                  , (uint16_t)imageContainer.m_width
26822682                  , (uint16_t)imageContainer.m_height
26832683                  , (uint16_t)imageContainer.m_depth
2684                  , imageContainer.m_cubeMap
26842685                  , imageContainer.m_numMips
26852686                  , TextureFormat::Enum(imageContainer.m_format)
26862687                  );
r244546r244547
26892690            {
26902691               _info->format = TextureFormat::Unknown;
26912692               _info->storageSize = 0;
2692               _info->width = 0;
2693               _info->height = 0;
2694               _info->depth = 0;
2693               _info->width   = 0;
2694               _info->height  = 0;
2695               _info->depth   = 0;
26952696               _info->numMips = 0;
26962697               _info->bitsPerPixel = 0;
2698               _info->cubeMap = false;
26972699            }
26982700         }
26992701
r244546r244547
29042906
29052907         if (0 == refs)
29062908         {
2909            for (UniformHashMap::iterator it = m_uniformHashMap.begin(), itEnd = m_uniformHashMap.end(); it != itEnd; ++it)
2910            {
2911               if (it->second.idx == _handle.idx)
2912               {
2913                  m_uniformHashMap.erase(it);
2914                  break;
2915               }
2916            }
2917
29072918            CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyUniform);
29082919            cmdbuf.write(_handle);
29092920            m_submit->free(_handle);
branches/kale/3rdparty/bgfx/src/glcontext_egl.cpp
r244546r244547
185185      ndt = GetDC(g_bgfxHwnd);
186186      nwh = g_bgfxHwnd;
187187#   elif BX_PLATFORM_LINUX
188      ndt = g_bgfxX11Display;
189      nwh = g_bgfxX11Window;
188      ndt = (EGLNativeDisplayType)g_bgfxX11Display;
189      nwh = (EGLNativeWindowType)g_bgfxX11Window;
190190#   endif // BX_PLATFORM_
191191      m_display = eglGetDisplay(ndt);
192192      BGFX_FATAL(m_display != EGL_NO_DISPLAY, Fatal::UnableToInitialize, "Failed to create display %p", m_display);
r244546r244547
254254
255255      success = eglMakeCurrent(m_display, m_surface, m_surface, m_context);
256256      BGFX_FATAL(success, Fatal::UnableToInitialize, "Failed to set context.");
257      m_current = NULL;
257258
258259      eglSwapInterval(m_display, 0);
259260
r244546r244547
311312
312313   void GlContext::swap(SwapChainGL* _swapChain)
313314   {
315      makeCurrent(_swapChain);
316
314317      if (NULL == _swapChain)
315318      {
316         eglMakeCurrent(m_display, m_surface, m_surface, m_context);
317319         eglSwapBuffers(m_display, m_surface);
318320      }
319321      else
320322      {
321         _swapChain->makeCurrent();
322323         _swapChain->swapBuffers();
323324      }
324325   }
325326
326327   void GlContext::makeCurrent(SwapChainGL* _swapChain)
327328   {
328      if (NULL == _swapChain)
329      if (m_current != _swapChain)
329330      {
330         eglMakeCurrent(m_display, m_surface, m_surface, m_context);
331         m_current = _swapChain;
332
333         if (NULL == _swapChain)
334         {
335            eglMakeCurrent(m_display, m_surface, m_surface, m_context);
336         }
337         else
338         {
339            _swapChain->makeCurrent();
340         }
331341      }
332      else
333      {
334         _swapChain->makeCurrent();
335      }
336342   }
337343
338344   void GlContext::import()
branches/kale/3rdparty/bgfx/src/glcontext_egl.h
r244546r244547
1717   struct GlContext
1818   {
1919      GlContext()
20         : m_context(NULL)
20         : m_current(NULL)
21         , m_context(NULL)
2122         , m_display(NULL)
2223         , m_surface(NULL)
2324      {
r244546r244547
4142      }
4243
4344      void* m_eglLibrary;
45      SwapChainGL* m_current;
4446      EGLConfig  m_config;
4547      EGLContext m_context;
4648      EGLDisplay m_display;
branches/kale/3rdparty/bgfx/src/glcontext_glx.cpp
r244546r244547
2929      SwapChainGL(::Window _window, XVisualInfo* _visualInfo, GLXContext _context)
3030         : m_window(_window)
3131      {
32         m_context = glXCreateContext(g_bgfxX11Display, _visualInfo, _context, GL_TRUE);
32         m_context = glXCreateContext( (::Display*)g_bgfxX11Display, _visualInfo, _context, GL_TRUE);
3333      }
3434
3535      ~SwapChainGL()
3636      {
37         glXMakeCurrent(g_bgfxX11Display, 0, 0);
38         glXDestroyContext(g_bgfxX11Display, m_context);
37         glXMakeCurrent( (::Display*)g_bgfxX11Display, 0, 0);
38         glXDestroyContext( (::Display*)g_bgfxX11Display, m_context);
3939      }
4040
4141      void makeCurrent()
4242      {
43         glXMakeCurrent(g_bgfxX11Display, m_window, m_context);
43         glXMakeCurrent( (::Display*)g_bgfxX11Display, m_window, m_context);
4444      }
4545
4646      void swapBuffers()
4747      {
48         glXSwapBuffers(g_bgfxX11Display, m_window);
48         glXSwapBuffers( (::Display*)g_bgfxX11Display, m_window);
4949      }
5050
5151      Window m_window;
r244546r244547
5555   void GlContext::create(uint32_t _width, uint32_t _height)
5656   {
5757      BX_UNUSED(_width, _height);
58      XLockDisplay(g_bgfxX11Display);
58      XLockDisplay( (::Display*)g_bgfxX11Display);
5959
6060      int major, minor;
61      bool version = glXQueryVersion(g_bgfxX11Display, &major, &minor);
61      bool version = glXQueryVersion( (::Display*)g_bgfxX11Display, &major, &minor);
6262      BGFX_FATAL(version, Fatal::UnableToInitialize, "Failed to query GLX version");
6363      BGFX_FATAL( (major == 1 && minor >= 2) || major > 1
6464            , Fatal::UnableToInitialize
r244546r244547
6767            , minor
6868            );
6969
70      int32_t screen = DefaultScreen(g_bgfxX11Display);
70      int32_t screen = DefaultScreen( (::Display*)g_bgfxX11Display);
7171
72      const char* extensions = glXQueryExtensionsString(g_bgfxX11Display, screen);
72      const char* extensions = glXQueryExtensionsString( (::Display*)g_bgfxX11Display, screen);
7373      BX_TRACE("GLX extensions:");
7474      dumpExtensions(extensions);
7575
r244546r244547
9191      GLXFBConfig bestConfig = NULL;
9292
9393      int numConfigs;
94      GLXFBConfig* configs = glXChooseFBConfig(g_bgfxX11Display, screen, attrsGlx, &numConfigs);
94      GLXFBConfig* configs = glXChooseFBConfig( (::Display*)g_bgfxX11Display, screen, attrsGlx, &numConfigs);
9595
9696      BX_TRACE("glX num configs %d", numConfigs);
9797
9898      for (int ii = 0; ii < numConfigs; ++ii)
9999      {
100         m_visualInfo = glXGetVisualFromFBConfig(g_bgfxX11Display, configs[ii]);
100         m_visualInfo = glXGetVisualFromFBConfig( (::Display*)g_bgfxX11Display, configs[ii]);
101101         if (NULL != m_visualInfo)
102102         {
103103            BX_TRACE("---");
r244546r244547
105105            for (uint32_t attr = 6; attr < BX_COUNTOF(attrsGlx)-1 && attrsGlx[attr] != None; attr += 2)
106106            {
107107               int value;
108               glXGetFBConfigAttrib(g_bgfxX11Display, configs[ii], attrsGlx[attr], &value);
108               glXGetFBConfigAttrib( (::Display*)g_bgfxX11Display, configs[ii], attrsGlx[attr], &value);
109109               BX_TRACE("glX %d/%d %2d: %4x, %8x (%8x%s)"
110110                     , ii
111111                     , numConfigs
r244546r244547
141141      BGFX_FATAL(m_visualInfo, Fatal::UnableToInitialize, "Failed to find a suitable X11 display configuration.");
142142
143143      BX_TRACE("Create GL 2.1 context.");
144      m_context = glXCreateContext(g_bgfxX11Display, m_visualInfo, 0, GL_TRUE);
144      m_context = glXCreateContext( (::Display*)g_bgfxX11Display, m_visualInfo, 0, GL_TRUE);
145145      BGFX_FATAL(NULL != m_context, Fatal::UnableToInitialize, "Failed to create GL 2.1 context.");
146146
147147#if BGFX_CONFIG_RENDERER_OPENGL >= 31
r244546r244547
158158            0,
159159         };
160160
161         GLXContext context = glXCreateContextAttribsARB(g_bgfxX11Display, bestConfig, 0, true, contextAttrs);
161         GLXContext context = glXCreateContextAttribsARB( (::Display*)g_bgfxX11Display, bestConfig, 0, true, contextAttrs);
162162
163163         if (NULL != context)
164164         {
165            glXDestroyContext(g_bgfxX11Display, m_context);
165            glXDestroyContext( (::Display*)g_bgfxX11Display, m_context);
166166            m_context = context;
167167         }
168168      }
r244546r244547
170170      BX_UNUSED(bestConfig);
171171#endif // BGFX_CONFIG_RENDERER_OPENGL >= 31
172172
173      XUnlockDisplay(g_bgfxX11Display);
173      XUnlockDisplay( (::Display*)g_bgfxX11Display);
174174
175175      import();
176176
177      glXMakeCurrent(g_bgfxX11Display, g_bgfxX11Window, m_context);
177      glXMakeCurrent( (::Display*)g_bgfxX11Display, (::Window)g_bgfxX11Window, m_context);
178      m_current = NULL;
178179
179180      glXSwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)glXGetProcAddress( (const GLubyte*)"glXSwapIntervalEXT");
180181      if (NULL != glXSwapIntervalEXT)
181182      {
182183         BX_TRACE("Using glXSwapIntervalEXT.");
183         glXSwapIntervalEXT(g_bgfxX11Display, g_bgfxX11Window, 0);
184         glXSwapIntervalEXT( (::Display*)g_bgfxX11Display, (::Window)g_bgfxX11Window, 0);
184185      }
185186      else
186187      {
r244546r244547
203204
204205      glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
205206      glClear(GL_COLOR_BUFFER_BIT);
206      glXSwapBuffers(g_bgfxX11Display, g_bgfxX11Window);
207      glXSwapBuffers( (::Display*)g_bgfxX11Display, (::Window)g_bgfxX11Window);
207208   }
208209
209210   void GlContext::destroy()
210211   {
211      glXMakeCurrent(g_bgfxX11Display, 0, 0);
212      glXDestroyContext(g_bgfxX11Display, m_context);
212      glXMakeCurrent( (::Display*)g_bgfxX11Display, 0, 0);
213      glXDestroyContext( (::Display*)g_bgfxX11Display, m_context);
213214      XFree(m_visualInfo);
214215   }
215216
r244546r244547
219220
220221      if (NULL != glXSwapIntervalEXT)
221222      {
222         glXSwapIntervalEXT(g_bgfxX11Display, g_bgfxX11Window, interval);
223         glXSwapIntervalEXT( (::Display*)g_bgfxX11Display, (::Window)g_bgfxX11Window, interval);
223224      }
224225      else if (NULL != glXSwapIntervalMESA)
225226      {
r244546r244547
248249
249250   void GlContext::swap(SwapChainGL* _swapChain)
250251   {
252      makeCurrent(_swapChain);
253
251254      if (NULL == _swapChain)
252255      {
253         glXMakeCurrent(g_bgfxX11Display, g_bgfxX11Window, m_context);
254         glXSwapBuffers(g_bgfxX11Display, g_bgfxX11Window);
256         glXSwapBuffers( (::Display*)g_bgfxX11Display, (::Window)g_bgfxX11Window);
255257      }
256258      else
257259      {
258         _swapChain->makeCurrent();
259260         _swapChain->swapBuffers();
260261      }
261262   }
262263
263264   void GlContext::makeCurrent(SwapChainGL* _swapChain)
264265   {
265      if (NULL == _swapChain)
266      if (m_current != _swapChain)
266267      {
267         glXMakeCurrent(g_bgfxX11Display, g_bgfxX11Window, m_context);
268         m_current = _swapChain;
269
270         if (NULL == _swapChain)
271         {
272            glXMakeCurrent( (::Display*)g_bgfxX11Display, (::Window)g_bgfxX11Window, m_context);
273         }
274         else
275         {
276            _swapChain->makeCurrent();
277         }
268278      }
269      else
270      {
271         _swapChain->makeCurrent();
272      }
273279   }
274280
275281   void GlContext::import()
branches/kale/3rdparty/bgfx/src/glcontext_glx.h
r244546r244547
1818   struct GlContext
1919   {
2020      GlContext()
21         : m_context(0)
21         : m_current(NULL)
22         , m_context(0)
2223         , m_visualInfo(NULL)
2324      {
2425      }
r244546r244547
4041         return 0 != m_context;
4142      }
4243
44      SwapChainGL* m_current;
4345      GLXContext m_context;
4446      XVisualInfo* m_visualInfo;
4547   };
branches/kale/3rdparty/bgfx/src/glcontext_wgl.cpp
r244546r244547
184184
185185            int result;
186186            uint32_t numFormats = 0;
187            do
187            do
188188            {
189189               result = wglChoosePixelFormatARB(m_hdc, attrs, NULL, 1, &m_pixelFormat, &numFormats);
190190               if (0 == result
r244546r244547
259259
260260         int result = wglMakeCurrent(m_hdc, m_context);
261261         BGFX_FATAL(0 != result, Fatal::UnableToInitialize, "wglMakeCurrent failed!");
262         m_current = NULL;
262263
263264         if (NULL != wglSwapIntervalEXT)
264265         {
r244546r244547
316317      BX_DELETE(g_allocator, _swapChain);
317318   }
318319
319   void GlContext::makeCurrent(SwapChainGL* _swapChain)
320   void GlContext::swap(SwapChainGL* _swapChain)
320321   {
322      makeCurrent(_swapChain);
323
321324      if (NULL == _swapChain)
322325      {
323         wglMakeCurrent(m_hdc, m_context);
324         GLenum err = glGetError();
325         BX_WARN(0 == err, "wglMakeCurrent failed with GL error: 0x%04x.", err); BX_UNUSED(err);
326         if (NULL != g_bgfxHwnd)
327         {
328            SwapBuffers(m_hdc);
329         }
326330      }
327331      else
328332      {
329         _swapChain->makeCurrent();
333         _swapChain->swapBuffers();
330334      }
331335   }
332336
333   void GlContext::swap(SwapChainGL* _swapChain)
337   void GlContext::makeCurrent(SwapChainGL* _swapChain)
334338   {
335      if (NULL == _swapChain)
339      if (m_current != _swapChain)
336340      {
337         if (NULL != g_bgfxHwnd)
341         m_current = _swapChain;
342
343         if (NULL == _swapChain)
338344         {
339345            wglMakeCurrent(m_hdc, m_context);
340            SwapBuffers(m_hdc);
346            GLenum err = glGetError();
347            BX_WARN(0 == err, "wglMakeCurrent failed with GL error: 0x%04x.", err); BX_UNUSED(err);
341348         }
349         else
350         {
351            _swapChain->makeCurrent();
352         }
342353      }
343      else
344      {
345         _swapChain->makeCurrent();
346         _swapChain->swapBuffers();
347      }
348354   }
349355
350356   void GlContext::import()
branches/kale/3rdparty/bgfx/src/glcontext_wgl.h
r244546r244547
6161   struct GlContext
6262   {
6363      GlContext()
64         : m_opengl32dll(NULL)
64         : m_current(NULL)
65         , m_opengl32dll(NULL)
6566         , m_context(NULL)
6667         , m_hdc(NULL)
6768      {
r244546r244547
8788      int32_t m_contextAttrs[9];
8889      int m_pixelFormat;
8990      PIXELFORMATDESCRIPTOR m_pfd;
91      SwapChainGL* m_current;
9092      void* m_opengl32dll;
9193      HGLRC m_context;
9294      HDC m_hdc;
branches/kale/3rdparty/bgfx/src/glimports.h
r244546r244547
230230GL_IMPORT______(false, PFNGLBUFFERSUBDATAPROC,                     glBufferSubData);
231231GL_IMPORT______(true,  PFNGLCHECKFRAMEBUFFERSTATUSPROC,            glCheckFramebufferStatus);
232232GL_IMPORT______(false, PFNGLCLEARPROC,                             glClear);
233GL_IMPORT______(false, PFNGLCLEARBUFFERFVPROC,                     glClearBufferfv);
233GL_IMPORT______(true, PFNGLCLEARBUFFERFVPROC,                     glClearBufferfv);
234234GL_IMPORT______(false, PFNGLCLEARCOLORPROC,                        glClearColor);
235235GL_IMPORT______(false, PFNGLCLEARSTENCILPROC,                      glClearStencil);
236236GL_IMPORT______(false, PFNGLCOLORMASKPROC,                         glColorMask);
branches/kale/3rdparty/bgfx/src/image.cpp
r244546r244547
1212{
1313   static const ImageBlockInfo s_imageBlockInfo[] =
1414   {
15      {   4, 4, 4,  8 }, // BC1
16      {   8, 4, 4, 16 }, // BC2
17      {   8, 4, 4, 16 }, // BC3
18      {   4, 4, 4,  8 }, // BC4
19      {   8, 4, 4, 16 }, // BC5
20      {   8, 4, 4, 16 }, // BC6H
21      {   8, 4, 4, 16 }, // BC7
22      {   4, 4, 4,  8 }, // ETC1
23      {   4, 4, 4,  8 }, // ETC2
24      {   8, 4, 4, 16 }, // ETC2A
25      {   4, 4, 4,  8 }, // ETC2A1
26      {   2, 8, 4,  8 }, // PTC12
27      {   4, 4, 4,  8 }, // PTC14
28      {   2, 8, 4,  8 }, // PTC12A
29      {   4, 4, 4,  8 }, // PTC14A
30      {   2, 8, 4,  8 }, // PTC22
31      {   4, 4, 4,  8 }, // PTC24
32      {   0, 0, 0,  0 }, // Unknown
33      {   1, 8, 1,  1 }, // R1
34      {   8, 1, 1,  1 }, // R8
35      {  16, 1, 1,  2 }, // R16
36      {  16, 1, 1,  2 }, // R16F
37      {  32, 1, 1,  4 }, // R32
38      {  32, 1, 1,  4 }, // R32F
39      {  16, 1, 1,  2 }, // RG8
40      {  32, 1, 1,  4 }, // RG16
41      {  32, 1, 1,  4 }, // RG16F
42      {  64, 1, 1,  8 }, // RG32
43      {  64, 1, 1,  8 }, // RG32F
44      {  32, 1, 1,  4 }, // BGRA8
45      {  64, 1, 1,  8 }, // RGBA16
46      {  64, 1, 1,  8 }, // RGBA16F
47      { 128, 1, 1, 16 }, // RGBA32
48      { 128, 1, 1, 16 }, // RGBA32F
49      {  16, 1, 1,  2 }, // R5G6B5
50      {  16, 1, 1,  2 }, // RGBA4
51      {  16, 1, 1,  2 }, // RGB5A1
52      {  32, 1, 1,  4 }, // RGB10A2
53      {  32, 1, 1,  4 }, // R11G11B10F
54      {   0, 0, 0,  0 }, // UnknownDepth
55      {  16, 1, 1,  2 }, // D16
56      {  24, 1, 1,  3 }, // D24
57      {  32, 1, 1,  4 }, // D24S8
58      {  32, 1, 1,  4 }, // D32
59      {  16, 1, 1,  2 }, // D16F
60      {  24, 1, 1,  3 }, // D24F
61      {  32, 1, 1,  4 }, // D32F
62      {   8, 1, 1,  1 }, // D0S8
15      //  +------------------ bits per pixel
16      //  |  +--------------- block width
17      //  |  |  +------------ block height
18      //  |  |  |   +-------- block size
19      //  |  |  |   |  +----- min blocks x
20      //  |  |  |   |  |  +-- min blocks y
21      //  |  |  |   |  |  |
22      {   4, 4, 4,  8, 1, 1 }, // BC1
23      {   8, 4, 4, 16, 1, 1 }, // BC2
24      {   8, 4, 4, 16, 1, 1 }, // BC3
25      {   4, 4, 4,  8, 1, 1 }, // BC4
26      {   8, 4, 4, 16, 1, 1 }, // BC5
27      {   8, 4, 4, 16, 1, 1 }, // BC6H
28      {   8, 4, 4, 16, 1, 1 }, // BC7
29      {   4, 4, 4,  8, 1, 1 }, // ETC1
30      {   4, 4, 4,  8, 1, 1 }, // ETC2
31      {   8, 4, 4, 16, 1, 1 }, // ETC2A
32      {   4, 4, 4,  8, 1, 1 }, // ETC2A1
33      {   2, 8, 4,  8, 2, 2 }, // PTC12
34      {   4, 4, 4,  8, 2, 2 }, // PTC14
35      {   2, 8, 4,  8, 2, 2 }, // PTC12A
36      {   4, 4, 4,  8, 2, 2 }, // PTC14A
37      {   2, 8, 4,  8, 2, 2 }, // PTC22
38      {   4, 4, 4,  8, 2, 2 }, // PTC24
39      {   0, 0, 0,  0, 1, 1 }, // Unknown
40      {   1, 8, 1,  1, 1, 1 }, // R1
41      {   8, 1, 1,  1, 1, 1 }, // R8
42      {  16, 1, 1,  2, 1, 1 }, // R16
43      {  16, 1, 1,  2, 1, 1 }, // R16F
44      {  32, 1, 1,  4, 1, 1 }, // R32
45      {  32, 1, 1,  4, 1, 1 }, // R32F
46      {  16, 1, 1,  2, 1, 1 }, // RG8
47      {  32, 1, 1,  4, 1, 1 }, // RG16
48      {  32, 1, 1,  4, 1, 1 }, // RG16F
49      {  64, 1, 1,  8, 1, 1 }, // RG32
50      {  64, 1, 1,  8, 1, 1 }, // RG32F
51      {  32, 1, 1,  4, 1, 1 }, // BGRA8
52      {  64, 1, 1,  8, 1, 1 }, // RGBA16
53      {  64, 1, 1,  8, 1, 1 }, // RGBA16F
54      { 128, 1, 1, 16, 1, 1 }, // RGBA32
55      { 128, 1, 1, 16, 1, 1 }, // RGBA32F
56      {  16, 1, 1,  2, 1, 1 }, // R5G6B5
57      {  16, 1, 1,  2, 1, 1 }, // RGBA4
58      {  16, 1, 1,  2, 1, 1 }, // RGB5A1
59      {  32, 1, 1,  4, 1, 1 }, // RGB10A2
60      {  32, 1, 1,  4, 1, 1 }, // R11G11B10F
61      {   0, 0, 0,  0, 1, 1 }, // UnknownDepth
62      {  16, 1, 1,  2, 1, 1 }, // D16
63      {  24, 1, 1,  3, 1, 1 }, // D24
64      {  32, 1, 1,  4, 1, 1 }, // D24S8
65      {  32, 1, 1,  4, 1, 1 }, // D32
66      {  16, 1, 1,  2, 1, 1 }, // D16F
67      {  24, 1, 1,  3, 1, 1 }, // D24F
68      {  32, 1, 1,  4, 1, 1 }, // D32F
69      {   8, 1, 1,  1, 1, 1 }, // D0S8
6370   };
6471   BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_imageBlockInfo) );
6572
r244546r244547
13091316   {
13101317      uint32_t m_format;
13111318      TextureFormat::Enum m_textureFormat;
1312
13131319   };
13141320
1315   static TranslateDdsFormat s_translateDdsFormat[] =
1321   static TranslateDdsFormat s_translateDdsFourccFormat[] =
13161322   {
13171323      { DDS_DXT1,                  TextureFormat::BC1     },
13181324      { DDS_DXT2,                  TextureFormat::BC2     },
r244546r244547
13761382      { DXGI_FORMAT_R10G10B10A2_UNORM,  TextureFormat::RGB10A2 },
13771383   };
13781384
1385   struct TranslateDdsPixelFormat
1386   {
1387      uint32_t m_bitCount;
1388      uint32_t m_bitmask[4];
1389      TextureFormat::Enum m_textureFormat;
1390   };
1391
1392   static TranslateDdsPixelFormat s_translateDdsPixelFormat[] =
1393   {
1394      {  8, { 0x000000ff, 0x00000000, 0x00000000, 0x00000000 }, TextureFormat::R8      },
1395      { 16, { 0x0000ffff, 0x00000000, 0x00000000, 0x00000000 }, TextureFormat::R16     },
1396      { 16, { 0x00000f00, 0x000000f0, 0x0000000f, 0x0000f000 }, TextureFormat::RGBA4   },
1397      { 16, { 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000 }, TextureFormat::R5G6B5  },
1398      { 16, { 0x00007c00, 0x000003e0, 0x0000001f, 0x00008000 }, TextureFormat::RGB5A1  },
1399      { 32, { 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 }, TextureFormat::BGRA8   },
1400      { 32, { 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000 }, TextureFormat::BGRA8   },
1401      { 32, { 0x000003ff, 0x000ffc00, 0x3ff00000, 0xc0000000 }, TextureFormat::RGB10A2 },
1402      { 32, { 0x0000ffff, 0xffff0000, 0x00000000, 0x00000000 }, TextureFormat::RG16    },
1403      { 32, { 0xffffffff, 0x00000000, 0x00000000, 0x00000000 }, TextureFormat::R32     },
1404   };
1405
13791406   bool imageParseDds(ImageContainer& _imageContainer, bx::ReaderSeekerI* _reader)
13801407   {
13811408      uint32_t headerSize;
r244546r244547
14201447      uint32_t fourcc;
14211448      bx::read(_reader, fourcc);
14221449
1423      uint32_t rgbCount;
1424      bx::read(_reader, rgbCount);
1450      uint32_t bitCount;
1451      bx::read(_reader, bitCount);
14251452
1426      uint32_t rbitmask;
1427      bx::read(_reader, rbitmask);
1453      uint32_t bitmask[4];
1454      bx::read(_reader, bitmask, sizeof(bitmask) );
14281455
1429      uint32_t gbitmask;
1430      bx::read(_reader, gbitmask);
1431
1432      uint32_t bbitmask;
1433      bx::read(_reader, bbitmask);
1434
1435      uint32_t abitmask;
1436      bx::read(_reader, abitmask);
1437
14381456      uint32_t caps[4];
14391457      bx::read(_reader, caps);
14401458
r244546r244547
14791497
14801498      if (dxgiFormat == 0)
14811499      {
1482         uint32_t ddsFormat = pixelFlags & DDPF_FOURCC ? fourcc : pixelFlags;
1483
1484         for (uint32_t ii = 0; ii < BX_COUNTOF(s_translateDdsFormat); ++ii)
1500         if (DDPF_FOURCC == (pixelFlags & DDPF_FOURCC) )
14851501         {
1486            if (s_translateDdsFormat[ii].m_format == ddsFormat)
1502            for (uint32_t ii = 0; ii < BX_COUNTOF(s_translateDdsFourccFormat); ++ii)
14871503            {
1488               format = s_translateDdsFormat[ii].m_textureFormat;
1489               break;
1504               if (s_translateDdsFourccFormat[ii].m_format == fourcc)
1505               {
1506                  format = s_translateDdsFourccFormat[ii].m_textureFormat;
1507                  break;
1508               }
14901509            }
14911510         }
1511         else
1512         {
1513            for (uint32_t ii = 0; ii < BX_COUNTOF(s_translateDdsPixelFormat); ++ii)
1514            {
1515               const TranslateDdsPixelFormat& pf = s_translateDdsPixelFormat[ii];
1516               if (pf.m_bitCount   == bitCount
1517               &&  pf.m_bitmask[0] == bitmask[0]
1518               &&  pf.m_bitmask[1] == bitmask[1]
1519               &&  pf.m_bitmask[2] == bitmask[2]
1520               &&  pf.m_bitmask[3] == bitmask[3])
1521               {
1522                  format = pf.m_textureFormat;
1523                  break;
1524               }
1525            }
1526         }
14921527      }
14931528      else
14941529      {
r244546r244547
21032138      const uint32_t blockSize   = blockInfo.blockSize;
21042139      const uint32_t blockWidth  = blockInfo.blockWidth;
21052140      const uint32_t blockHeight = blockInfo.blockHeight;
2141      const uint32_t minBlockX   = blockInfo.minBlockX;
2142      const uint32_t minBlockY   = blockInfo.minBlockY;
21062143
21072144      if (UINT32_MAX == _imageContainer.m_offset)
21082145      {
r244546r244547
21272164            // skip imageSize in KTX format.
21282165            offset += _imageContainer.m_ktx ? sizeof(uint32_t) : 0;
21292166
2130            width  = bx::uint32_max(blockWidth,  ( (width +blockWidth -1)/blockWidth )*blockWidth);
2131            height = bx::uint32_max(blockHeight, ( (height+blockHeight-1)/blockHeight)*blockHeight);
2167            width  = bx::uint32_max(blockWidth  * minBlockX, ( (width  + blockWidth  - 1) / blockWidth )*blockWidth);
2168            height = bx::uint32_max(blockHeight * minBlockY, ( (height + blockHeight - 1) / blockHeight)*blockHeight);
21322169            depth  = bx::uint32_max(1, depth);
21332170
21342171            uint32_t size = width*height*depth*bpp/8;
branches/kale/3rdparty/bgfx/src/image.h
r244546r244547
4343      uint8_t blockWidth;
4444      uint8_t blockHeight;
4545      uint8_t blockSize;
46      uint8_t minBlockX;
47      uint8_t minBlockY;
4648   };
4749
4850   ///
branches/kale/3rdparty/bgfx/src/renderer_d3d11.cpp
r244546r244547
345345   static const GUID IID_IDXGIDevice2          = { 0x05008617, 0xfbfd, 0x4051, { 0xa7, 0x90, 0x14, 0x48, 0x84, 0xb4, 0xf6, 0xa9 } };
346346   static const GUID IID_IDXGIDevice3          = { 0x6007896c, 0x3244, 0x4afd, { 0xbf, 0x18, 0xa6, 0xd3, 0xbe, 0xda, 0x50, 0x23 } };
347347   static const GUID IID_IDXGIAdapter          = { 0x2411e7e1, 0x12ac, 0x4ccf, { 0xbd, 0x14, 0x97, 0x98, 0xe8, 0x53, 0x4d, 0xc0 } };
348   static const GUID IID_ID3D11InfoQueue       = { 0x6543dbb6, 0x1b48, 0x42f5, { 0xab, 0x82, 0xe9, 0x7e, 0xc7, 0x43, 0x26, 0xf6 } };
348349
349350   static const GUID s_deviceIIDs[] =
350351   {
r244546r244547
669670         if (BX_ENABLED(BGFX_CONFIG_DEBUG) )
670671         {
671672            ID3D11InfoQueue* infoQueue;
672            hr = m_device->QueryInterface(__uuidof(ID3D11InfoQueue), (void**)&infoQueue);
673            hr = m_device->QueryInterface(IID_ID3D11InfoQueue, (void**)&infoQueue);
673674
674675            if (SUCCEEDED(hr) )
675676            {
r244546r244547
23642365      BX_CHECK(m_dynamic, "Must be dynamic!");
23652366
23662367      D3D11_MAPPED_SUBRESOURCE mapped;
2367      D3D11_MAP type = m_dynamic && ( (0 == _offset && m_size == _size) || _discard)
2368         ? D3D11_MAP_WRITE_DISCARD
2369         : D3D11_MAP_WRITE_NO_OVERWRITE
2370         ;
2368      BX_UNUSED(_discard);
2369      D3D11_MAP type = D3D11_MAP_WRITE_DISCARD;
23712370      DX_CHECK(deviceCtx->Map(m_ptr, 0, type, 0, &mapped));
23722371      memcpy((uint8_t*)mapped.pData + _offset, _data, _size);
23732372      deviceCtx->Unmap(m_ptr, 0);
branches/kale/3rdparty/bgfx/src/renderer_d3d12.cpp
r244546r244547
55
66#include "bgfx_p.h"
77
8#if BGFX_CONFIG_RENDERER_DIRECT3D12
9#   include "../../d3d12/src/renderer_d3d12.cpp"
10#else
11
812namespace bgfx
913{
1014   RendererContextI* rendererCreateD3D12()
r244546r244547
1620   {
1721   }
1822} // namespace bgfx
23
24#endif // BGFX_CONFIG_RENDERER_DIRECT3D12
branches/kale/3rdparty/bgfx/src/renderer_gl.cpp
r244546r244547
37593759                  }
37603760               }
37613761
3762               writeString(&writer, "precision mediump float;\n");
3762               writeStringf(&writer, "precision %s float;\n"
3763                     , m_type == GL_FRAGMENT_SHADER ? "mediump" : "highp"
3764                     );
37633765
37643766               bx::write(&writer, code, codeLen);
37653767               bx::write(&writer, '\0');
r244546r244547
47854787               &&  0 == draw.m_instanceDataOffset)
47864788               {
47874789                  if (programChanged
4788                  ||  currentState.m_vertexBuffer.idx != draw.m_vertexBuffer.idx
4789                  ||  currentState.m_indexBuffer.idx != draw.m_indexBuffer.idx
4790                  ||  currentState.m_instanceDataBuffer.idx != draw.m_instanceDataBuffer.idx
4790                  ||  baseVertex                        != draw.m_startVertex
4791                  ||  currentState.m_vertexBuffer.idx   != draw.m_vertexBuffer.idx
4792                  ||  currentState.m_indexBuffer.idx    != draw.m_indexBuffer.idx
47914793                  ||  currentState.m_instanceDataOffset != draw.m_instanceDataOffset
4792                  ||  currentState.m_instanceDataStride != draw.m_instanceDataStride)
4794                  ||  currentState.m_instanceDataStride != draw.m_instanceDataStride
4795                  ||  currentState.m_instanceDataBuffer.idx != draw.m_instanceDataBuffer.idx)
47934796                  {
47944797                     bx::HashMurmur2A murmur;
47954798                     murmur.begin();
branches/kale/3rdparty/bx/include/bx/macros.h
r244546r244547
6161#   if BX_COMPILER_CLANG && (BX_PLATFORM_OSX || BX_PLATFORM_IOS)
6262#      define BX_THREAD /* not supported right now */
6363#   else
64#      define BX_THREAD __thread
64#      if (__GNUC__ == 4) && (__GNUC_MINOR__ <= 2)
65#         define BX_THREAD /* not supported right now */   
66#      else
67#         define BX_THREAD __thread
68#      endif // __GNUC__ <= 4.2
6569#   endif // BX_COMPILER_CLANG
6670#   define BX_ATTRIBUTE(_x) __attribute__( (_x) )
6771#   if BX_COMPILER_MSVC_COMPATIBLE
r244546r244547
134138#   define BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG(_x)
135139#endif // BX_COMPILER_CLANG
136140
137#if BX_COMPILER_GCC
141#if BX_COMPILER_GCC && BX_COMPILER_GCC >= 40600
138142#   define BX_PRAGMA_DIAGNOSTIC_PUSH_GCC()        _Pragma("GCC diagnostic push")
139143#   define BX_PRAGMA_DIAGNOSTIC_POP_GCC()         _Pragma("GCC diagnostic pop")
140144#   define BX_PRAGMA_DIAGNOSTIC_IGNORED_GCC(_x)   _Pragma(BX_STRINGIZE(GCC diagnostic ignored _x) )
r244546r244547
169173#endif // BX_COMPILER_
170174
171175///
172#define BX_TYPE_IS_POD(_type) (!__is_class(_type) || __is_pod(_type) )
173
176#if BX_COMPILER_GCC && defined(__is_pod)
177#   define BX_TYPE_IS_POD(t) __is_pod(t)
178#elif BX_COMPILER_MSVC
179#   define BX_TYPE_IS_POD(t) (!__is_class(t) || __is_pod(t))
180#else
181#   define BX_TYPE_IS_POD(t) false
182#endif
174183///
175184#define BX_CLASS_NO_DEFAULT_CTOR(_class) \
176185         private: _class()
branches/kale/3rdparty/bx/tools/bin/darwin/genie
r244546r244547
Previous 199869 Revisions Next


© 1997-2024 The MAME Team