Un­til now, the Plat­form::Sdl2Ap­pli­ca­tion was the go-to so­lu­tion for mostplat­forms in­clud­ing the web and mo­bile. How­ev­er, not ev­ery­body needs all thefea­tures SDL pro­vides and, es­pe­cial­ly on Em­scripten, apart from sim­pli­fy­ingport­ing it doesn’t re­al­ly add any­thing ex­tra on top. On the con­trary, thead­di­tion­al lay­er of trans­la­tion be­tween HTM­L5 and SDL APIs in­creas­es theex­e­cutable size and makes some fea­tures un­nec­es­sar­i­ly hard to ac­cess.

Your Mac’s Recovery Mode is a treasure trove of useful tools, and it’s the easiest way to wipe your computer and start from scratch. Shut down your Mac, turn it on while holding down Command+R. Your Mac will boot into the recovery partition. Data made available by Net Applications credits Mac OS X with a a share of 7.31% of the operating system market with Windows at 91.79%. In that way MS over whelm.

To solve that, the new Plat­form::Em­scripte­nAp­pli­ca­tion, con­trib­uted inmosra/mag­num#300 by @Squareys, is us­ing Em­scripten HTM­L5 APIsdi­rect­ly, open­ing new pos­si­bil­i­ties while mak­ing the code small­er and moreef­fi­cient.

“SDL2” vs SDL2

Since there’s some con­fu­sion about SDL among Em­scripten users, let’s clar­i­fythat first. Us­ing SDL in Em­scripten is ac­tu­al­ly pos­si­ble in two ways — theim­plic­it sup­port, im­ple­ment­ed in li­brary_s­dl.js,gives you a slight­ly strange hy­brid of SDL1 and SDL2 in a rel­a­tive­ly smallpack­age. Not all SDL2 APIs are present there, on the oth­er hand it has enoughfrom SDL2 to make it a vi­able al­ter­na­tive to the SDL2 ev­ery­one is used to. Thisis what Plat­form::Sdl2Ap­pli­ca­tion is us­ing.

This was the first Mac OS X article I wrote, but you'll find a good number of other Mac related articles here now. By the way, if you are completely unfamilar with Unix command line interfaces, you can get a very complete and basic introduction from Take Control of the Mac Command Line with Terminal. That's an inexpensive PDF book that starts. Os X High Sierra Dmg Piratebay How To Use Dmg File In Windows What Is Mac Open Base Dmg 3d Compositing Software Thepiratebay Dmg How To Install Mac Os From Dmg Download Pidgin For Mac Dmg Divinity 2 Does Finesse Weapons Use Finesse Dmg How To Convert A Dmg File To Iso Windows 7 Dmg Doesn't Open After Attaching. The video you just watched is a free appli­ca­tion for Mac OS X called Clut­ter, brought to us by the fine folks over at Sprote Rsrch. Clut­ter allows you to pick albums from your iTunes library that you’d like strewn about on your desk­top.

The oth­er way is a “full SDL2”, avail­able if you pass -s USE_SDL=2 to thelink­er. Two years ago we tried to re­move all Em­scripten-spe­cif­ic work­aroundsfrom Plat­form::Sdl2Ap­pli­ca­tion by switch­ing to this full SDL2, butquick­ly re­al­ized it was a bad de­ci­sion — in to­tal it re­moved 30 lines ofcode, but caused the re­sult­ing code to be al­most 600 kB larg­er. The sizein­crease was so se­ri­ous that it didn’t war­rant the very mi­nor im­prove­ments incode main­tain­abil­i­ty. For the record, the orig­i­nal pull re­quest is archived atmosra/mag­num#218.

The SDL-free Em­scripte­nAp­pli­ca­tion

All ap­pli­ca­tion im­ple­men­ta­tions in Mag­num strive for al­most full APIcom­pat­i­bil­i­ty, with the goal of mak­ing it pos­si­ble to use an im­ple­men­ta­tionop­ti­mal for cho­sen plat­form and use case. This was al­ready the case withPlat­form::GlfwAp­pli­ca­tion and Plat­form::Sdl2Ap­pli­ca­tion, whereswitch­ing from one to the oth­er is in 90% cas­es just a mat­ter of us­ing adif­fer­ent #include and pass­ing a dif­fer­ent com­po­nent to CMake’sfind_package().

The new Plat­form::Em­scripte­nAp­pli­ca­tion con­tin­ues in this fash­ion and weport­ed all ex­ist­ing ex­am­ples and tools that for­mer­ly usedPlat­form::Sdl2Ap­pli­ca­tion to it to en­sure it works in broad use cas­es.Apart from that, the new im­ple­men­ta­tion fix­es some of the long-stand­ing is­sueslike mis­cal­cu­lat­ed event co­or­di­nates on mo­bile web browsers or theDelete key leak­ing through text in­put events.

On­ly two wide­ly used APIs are miss­ing from it right now — thePlat­form::Sdl2Ap­pli­ca­tion::tick­Event() andPlat­form::Sdl2Ap­pli­ca­tion::setSwap­In­ter­val(). The for­mer will getadded to­geth­er with an equiv­a­lent in GLFW ap­pli­ca­tion, while the sec­ondwill be ex­posed dif­fer­ent­ly, al­low­ing to use the ex­tend­ed brows­er APIs.Right now it’s enough to #ifdef around it, as browsers, un­likemost desk­top plat­forms, en­able VSync by de­fault.

Pow­er-ef­fi­cient idle be­hav­ior

Since the very be­gin­ning, all Mag­num ap­pli­ca­tion im­ple­men­ta­tions de­fault tore­draw­ing on­ly when need­ed in or­der to save pow­er — be­cause Mag­num is notjust for games that have to an­i­mate some­thing ev­ery frame, it doesn’t makesense to use up all sys­tem re­sources by de­fault. While this is sim­ple toim­ple­ment ef­fi­cient­ly on desk­top apps where the ap­pli­ca­tion has the fullcon­trol over the main loop (and thus can block in­def­i­nite­ly wait­ing for anin­put event), it’s hard­er in the call­back-based brows­er en­vi­ron­ment.

The orig­i­nal Plat­form::Sdl2Ap­pli­ca­tion makes use ofem­scripten_set_­main_loop(),which pe­ri­od­i­cal­ly calls win­dow.re­ques­tAni­ma­tion­Frame()in or­der to main­tain a steady frame rate. For apps that need to re­draw on­lywhen need­ed this means the call­back will be called 60 times per sec­ond on­ly tobe a no-op. While that’s still sig­nif­i­cant­ly more ef­fi­cient than draw­ingev­ery­thing each time, it still means the brows­er has to wake up 60 times persec­ond to do noth­ing.

Plat­form::Em­scripte­nAp­pli­ca­tion in­stead makes use ofre­ques­tAni­ma­tion­Frame()di­rect­ly — the next an­i­ma­tion frame is im­plic­it­ly sched­uled, but can­celledagain af­ter the draw event if the app doesn’t wish to re­draw im­me­di­ate­ly again.That takes the best of both worlds — re­draws are still VSync’d, but thebrows­er is not loop­ing need­less­ly if the app just wants to wait with a re­drawfor the next in­put event. To give you some num­bers, be­low is a ten-sec­ondout­put of Chrome’s per­for­mance mon­i­tor com­par­ing SDL and Em­scripten appim­ple­men­ta­tion wait­ing for an in­put event. You can re­pro­duce this with theMag­num Play­er — no mat­ter how com­plexan­i­mat­ed scene you throw at it, if you pause the an­i­ma­tion it will use as muchCPU as a plain stat­ic text web page.

DPI aware­ness re­vis­it­ed

Ar­guably to sim­pli­fy port­ing, the Em­scripten SDL em­u­la­tion re­cal­cu­lates allin­put event co­or­di­nates to match frame­buffer pix­els. The ac­tu­al DPI scal­ing(or de­vice pix­el ra­tio) is then be­ing ex­posed through dpiS­cal­ing(),mak­ing it be­have the same as Lin­ux, Win­dows and An­droid on high-DPI screens. Incon­trast, HTM­L5 APIs be­have like mac­OS / iOS andPlat­form::Em­scripte­nAp­pli­ca­tion fol­lows that be­hav­ior —frame­buf­fer­Size()thus match­es de­vice pix­els while win­dow­Size()(to which all events are re­lat­ed) is small­er on HiD­PI sys­tems. For morein­for­ma­tion, check out the DPI aware­ness docs.

It’s im­por­tant to note that even though dif­fer­ent plat­forms ex­pose DPIaware­ness in a dif­fer­ent way, Mag­num APIs are de­signed in a way that makesit pos­si­ble to have the same code be­have cor­rect­ly ev­ery­where. Thesep­a­ra­tion in­to dpiS­cal­ing(),frame­buf­fer­Size() andwin­dow­Size() prop­er­tiesis main­ly for a more fine-grained con­trol where need­ed.

Ex­e­cutable size sav­in­gs

Be­cause we didn’t end up us­ing the heavy­weight “full SDL2” in the first place,the dif­fer­ence in ex­e­cutable size is noth­ing ex­treme — in to­tal, in a Re­leaseWe­bAssem­bly build, the JS size got small­er by about 20 kB, while the WASM filestays rough­ly the same.

Min­i­mal run­time, or brain surgery with a chain­saw

On the oth­er hand, since the new ap­pli­ca­tion doesn’t use any of the emscripten_set_main_loop() APIs from library_browser.js, it makes ita good can­di­date for play­ing with the rel­a­tive­ly re­centMIN­I­MAL_RUN­TIME fea­ture of Em­scripten.Now, while Mag­num is mov­ing in the right di­rec­tion, it’s not yet in a statewhere this would “just work”. Sup­port­ing MINIMAL_RUNTIME re­quires ei­thermov­ing fast and break­ing lots of things or have the APIs slow­ly evolve in­to astate that makes it pos­si­ble. Be­cause re­li­able back­wards com­pat­i­bil­i­ty andpain­less up­grade path is a valu­able as­set in our port­fo­lio, we chose thelat­ter — it will even­tu­al­ly hap­pen, but not right now. An­oth­er rea­son is thatwhile Mag­num it­self can be high­ly op­ti­mized to be com­pat­i­ble with min­i­malrun­time, the usu­al ap­pli­ca­tion code is not able to sat­is­fy those re­quire­mentswith­out re­mov­ing and rewrit­ing most third-par­ty de­pen­den­cies.

Mac Os Download

That be­ing said, why not spend one af­ter­noon with a chain­saw and tryde­mol­ish­ing the code to see what could come out? It’s how­ev­er im­por­tant tonote that MINIMAL_RUNTIME is still a very fresh fea­ture and thus it’s verylike­ly that a lot of code will sim­ply not work with it. All the dis­cov­eredprob­lems are list­ed be­low be­cause at this point there are no re­sults at allwhen googling them, so hope­ful­ly this helps oth­er peo­ple stuck in sim­i­larplaces:

  • std::getenv() or the environ vari­able (used byUtil­i­ty::Ar­gu­ments) re­sults in writeAsciiToMemory() be­ingcalled, which is right now ex­plic­it­ly dis­abledfor min­i­mal run­time (and thus you ei­ther get a fail­ure at run­time or theClo­sure Com­pil­er com­plain­ing about these names be­ing un­de­fined). SinceEm­scripten’s en­vi­ron­ment is just a bunch of hard­cod­ed val­ues and Mag­num isus­ing Node.js APIs to get the re­al val­ues for com­mand-line apps any­way,so­lu­tion is to sim­ply not use those func­tions.
  • Right now, Mag­num is us­ing C++ iostreams on three iso­lat­ed places(Util­i­ty::De­bug be­ing the most prom­i­nent) and those us­es aregrad­u­al­ly be­ing phased off. On Em­scripten, us­ing any­thing that evenre­mote­ly touch­es them will make the back­end emit calls tollvm_stacksave() andllvm_stackrestore(). The JavaScript im­ple­men­ta­tionsthen call stackSave() and stackRestore() which how­ev­er do notget pulled in in MINIMAL_RUNTIME, again re­sult­ing in ei­ther a run­timeer­ror ev­ery time you call in­to JS (so al­so allemscripten_set_mousedown_callback() func­tions) or when you use theClo­sure Com­pil­er. Af­ter wast­ing a few hours try­ing to con­vince Em­scriptento emit these two by adding _llvm_stacksave__deps:['$stackSave'] theul­ti­mate so­lu­tion was to kill ev­ery­thing stream-re­lat­ed. Con­sid­er­ingev­ery­one who’s in­ter­est­ed in MINIMAL_RUNTIME prob­a­bly did that al­ready,it ex­plains why this is an­oth­er un­googleable er­ror.
  • If you use C++ streams, the gen­er­at­ed JS driv­er file con­tains a fullJavaScript im­ple­men­ta­tion of strftime() and the on­ly way to get ridof it is re­mov­ing all stream us­age as well. Grep your JS file for Monday— if it’s there, you have a prob­lem.
  • JavaScript Em­scripten APIs like dynCall() or allocate() are notavail­able and putting them in­to ei­ther EXTRA_EXPORTED_RUNTIME_METHODSor RUNTIME_FUNCS_TO_IMPORT ei­ther didn’t do any­thing or moved theer­ror in­to a dif­fer­ent place. For the for­mer it was pos­si­ble to work aroundit by di­rect­ly call­ing one of its spe­cial­iza­tions (in that par­tic­u­lar casedynCall_ii()), the sec­ond re­sult­ed in a frus­trat­ed table­flip and therel­e­vant piece of code get­ting cut off.

Be­low is a break­down of var­i­ous op­ti­miza­tions on a min­i­mal ap­pli­ca­tion thatdoes just a frame­buffer clear, each step chop­ping an­oth­er bit off the to­taldown­load size. All sizes are un­com­pressed, built in Re­lease mode with -Oz,--llvm-lto 1 and --closure 1. Lat­er on in the process,Bloaty McBloat­Face ex­per­i­men­talWe­bAssem­bly sup­port was used to dis­cov­er what func­tions con­trib­ute the most to fi­nalcode size.

Op­er­a­tionJS sizeWASM size
Ini­tial state52.1 kB226.3 kB
En­abling min­i­mal run­time 136.3 kB224.5 kB
Ad­di­tion­al slim­ming flags 235.7 kB224.5 kB
Dis­abling filesys­tem 319.4 kB224.5 kB
Chop­ping off all C++ stream us­age14.7 kB83.6 kB
En­abling COR­RADE_NO_ASSERT14.7 kB75.4 kB
Re­mov­ing a sin­gle use of std::sort()414.7 kB69.3 kB
Re­mov­ing one std::un­or­dered_map414.7 kB62.6 kB
Us­ing em­mal­loc in­stead of dl­mal­loc 514.7 kB56.3 kB
Re­mov­ing all printf() us­age 614.7 kB44 kB (es­ti­mate)
1.
^-s MINIMAL_RUNTIME=2 -s ENVIRONMENT=web -lGL plus tem­po­rar­ilyen­abling al­so -s IGNORE_CLOSURE_COMPILER_ERRORS=1 in or­der to makeClo­sure Com­pil­er sur­vive un­de­fined vari­able er­rors due to iostreams andoth­er, men­tioned above
2.
^-s SUPPORT_ERRNO=0 -s GL_EMULATE_GLES_VERSION_STRING_FORMAT=0 -s GL_EXTENSIONS_IN_PREFIXED_FORMAT=0 -s GL_SUPPORT_AUTOMATIC_ENABLE_EXTENSIONS=0 -s GL_TRACK_ERRORS=0 -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1— ba­si­cal­ly dis­abling what’s en­abled by de­fault. In par­tic­u­lar, theGL_EXTENSIONS_IN_PREFIXED_FORMAT=0 is not sup­port­ed by Mag­num rightnow, caus­ing it to not re­port any ex­ten­sions, but that can be eas­i­ly fixed.The re­sult of dis­abling all these is … un­der­whelm­ing.
3.
^-s FILESYSTEM=0, makes Em­scripten not emit any filesys­tem-re­lat­edcode. Mag­num pro­vides filesys­tem ac­cess through var­i­ous APIs(Util­i­ty::Di­rec­to­ry, GL::Shad­er::addFile(),Trade::Ab­strac­tIm­porter::open­File(), …) and at the mo­ment there’sno pos­si­bil­i­ty to com­pile all these out, so this is a nu­cle­ar op­tion thatworks.
4.
^ abGL::Con­text us­es a std::sort() and astd::un­or­dered_map to check for ex­ten­sion pres­ence and print theirlist in the en­gine start­up log. It was fright­en­ing to see a re­moval of asin­gle std::sort() caus­ing a 10% drop in ex­e­cutable size — sinceWe­bGL has rough­ly two dozens ex­ten­sions (com­pared to > 200 on desk­top andES), maybe a space-ef­fi­cient al­ter­na­tive im­ple­men­ta­tion could be donefor this tar­get in­stead.
5.
^Doug Lea‘smal­loc() is a gen­er­al-pur­pose al­lo­ca­tor, used byglibc among oth­ers. It’s very per­for­mant and a good choice for code thatdoes many small al­lo­ca­tions (std::un­or­dered_map, I’m look­ing atyou). The down­side is its larg­er size, and code do­ing few­er larg­eral­lo­ca­tions might want to use -s MALLOC=emmalloc in­stead. We don’tpre­tend Mag­num is at that state yet, but oth­er projectssucess­ful­ly switched to it, shav­ingmore bytes off the down­load size.
6.
^ Af­ter re­mov­ing all of the above, std::printf() in­ter­nals start­edap­pear­ing at the top of Bloaty’s size re­port, to­talling at about 10% of theex­e­cutable size. Mag­num doesn’t use it any­where di­rect­ly and all tran­si­tiveus­age of it was killed to­geth­er with iostreams; fur­ther dig­ging re­vealedthat it gets called from libc++’s abort_mes­sage(),for ex­am­ple when abort­ing due to a pure vir­tu­al func­tion call. In­de­pen­dentmea­sure­ment showed that std::printf() is around 12 kB of ad­di­tion­alcode com­pared to std::puts(), main­ly due to the in­her­ent com­plex­i­tyof float­ing-point string con­ver­sion. It’s planned to use the muchsim­pler and small­er Ryū al­go­rithmfor Mag­num’s std::printf() re­place­ment, ad­di­tion­al­ly en­sur­ing thatfloat-to-string con­ver­sions can be DCE-dwhen not used. We might be look­ing in­to patch­ing Em­scripten’s libc++ to notuse the ex­pen­sive im­ple­men­ta­tion in its abort mes­sages.

While all of the above size re­duc­tions were done in a hack-and-slash man­ner,the fi­nal ex­e­cutable still ini­tial­izes and ex­e­cutes prop­er­ly, clear­ing theframe­buffer and re­act­ing to in­put events. For ref­er­ence, check out diffs ofthe chainsaw-surgery branch­es in cor­radeand mag­num.

The above is def­i­nite­ly not all that can be done — es­pe­cial­ly con­sid­er­ingthat re­mov­ing two us­es of se­mi-heavy STL APIs led to al­most 20% save in codesize, there are most prob­a­bly more of such low hang­ing fruits. The above taskswere added to mosra/mag­num#293 (if not there al­ready) and will getgrad­u­al­ly in­te­grat­ed in­to master.

Con­clu­sion

Bright times ahead! The new Plat­form::Em­scripte­nAp­pli­ca­tion is the firststep to tru­ly min­i­mal We­bAssem­bly builds and the above hints that it’s pos­si­bleto have down­load sizes not too far from code care­ful­ly writ­ten in plain C.To give a fair com­par­i­son, the ba­sic frame­buffer clear sam­ple from@floooh‘s Sokol Sam­ples is 42kB in to­tal, while the above equiv­a­lent is rough­ly 59 kB. Us­ing C++(11), butnot overus­ing it — and that’s just the be­gin­ning.

WhelmQues­tions? Com­plaints? Share your opin­ion on so­cial net­works:Twit­ter,Red­dit r/cpp,r/We­bAssem­bly,Hack­er News

When look­ing at the changel­og for the lat­est ver­sion, it’s hard to be­lieve thaton­ly six months passed since the last re­lease, 2018.04.The list is — as usu­al — very long, so I’m on­ly cher­ry-pick­ing the mostin­ter­est­ing bits. Scroll way down for the full de­tailed change lists.

An­i­ma­tion im­port and play­back

This long-await­ed fea­ture fi­nal­ly man­aged to rise to the top of the pri­or­i­tylist and so the new re­lease con­tains a brand-new An­i­ma­tion names­pace.Some de­sign ideas are bor­rowed from Ozz-An­i­ma­tion,with one end goal be­ing high-per­for­mance play­back of an­i­ma­tions im­port­ed fromglTF files (with oth­er for­mats com­inglat­er). The oth­er goal is be­ing able to quick­ly it­er­ate on hand-craft­edan­i­ma­tions of ar­bi­trary val­ues when writ­ing a game­play or UI tran­si­tions.

The an­i­ma­tion li­brary sup­ports in­ter­leaved or sep­a­rate keyframe da­ta forcache-op­ti­mized da­ta ac­cess; floats, std::chrono, frame in­dex(or just any­thing) for rep­re­sent­ing time, and yes, you can al­so an­i­matestrings, enum val­ues, bools or even the state of an­oth­er an­i­ma­tion —and why not an­i­mat­ing a time val­ue to make the play­back non-lin­ear! There’s aset of builtin in­ter­po­la­tion modes —con­stant, lin­ear, spher­i­cal lin­ear and spline-based; but you can al­so sup­plyyour own in­ter­po­la­tor func­tion if you need some ease-in/ease-out, or, forex­am­ple, un­pack a quater­nion from a 10–10–10–2 rep­re­sen­ta­tion first.

At the mo­ment the An­i­ma­tion li­brary is marked as ex­per­i­men­talLabyr1nth mac os. as its API is not set in stone yet. There’s a lot to ex­plain, so stay tuned forde­tailed in­tro­duc­to­ry blog­posts (and ex­am­ples) for all fea­tures. For a briefover­view, check the An­i­ma­tion::Track and An­i­ma­tion::Play­er classdocs.

An­i­ma­tion im­port is done through the new Trade::An­i­ma­tion­Da­ta class andat the mo­ment the Trade::Ab­strac­tIm­porter in­ter­faces han­dle just ba­sicob­ject trans­for­ma­tion. Skin­ning and mor­ph­ing will need some more-or-lessbreak­ing changes to some Trade APIs and so these fea­tures are sched­uledfor next re­leas­es. Along with that, the goal for the Trade li­brary isal­low­ing ze­ro-copy as­set im­port — for ex­am­ple play­ing back an an­i­ma­tiondi­rect­ly from a mem­o­ry-mapped glTF file, with no da­ta copies in be­tween. Seemosra/mag­num#240 for fur­ther work in this area.

The fun barely started!

I had to stop adding new fea­tures be­cause the re­lease would oth­er­wise nev­ermake it out. There’s al­ready more in the buf­fer — builtin eas­ingfunc­tions, in­ter­po­la­tor chain­ing and more. See mosra/mag­num#101help want­ed for de­tails. There’s lot of small andself-con­tained things to work on, so if you feel brave and want to help,let us know!

Mag­num Play­er

While the An­i­ma­tion API it­self doesn’t have any ded­i­cat­ed ex­am­ple yet,there’s now a new app, Mag­num Play­er, that can play back a scene fileyou throw at it. The fi­nal goal for this app will be show­cas­ing the full Mag­numfea­ture set — de­bug­ging and in­tro­spec­tion tools, ma­te­ri­al tweak­ing etc. Checkout the on­line ver­sion be­low — it sup­ports mul­ti-file drag&drop, so sim­plydrop a glTF file on it to play it. If you don’t have any glTF file handy,there’s the of­fi­cial Khronos glTF sam­ple mod­el re­pos­i­to­ryon GitHub. Sketch­fab al­so has 1000s of mod­elsdown­load­able as glTF.

Ini­tial work on the Vulkan back­end

Af­ter the hard work of re­mov­ing manda­to­ry OpenGL de­pen­den­cy was done in2018.04, Mag­num is slow­ly gain­ing bits and pieces need­ed for Vulkan sup­port. InJune I took over a main­tain­er­ship of flextGL and addedVulkan sup­port to it. Short­ly af­ter, Mag­num gained a Vk li­brary thatpro­vides plat­form-in­de­pen­dent func­tion point­er load­ing. It gives you a choicewhether you want glob­al func­tion point­ers (like with OpenGL) or man­age themlo­cal­ly. See the orig­i­nal post about flextGLfor de­tails.

The Vk li­brary al­so pro­vides con­ver­sion of gener­ic Pix­elFor­mat,Sam­pler­Fil­ter, Mesh­Prim­i­tive, … enums to Vulkan-spe­cif­icVk­For­mat, Vk­Fil­ter, VkPrim­i­tive­Topol­o­gy, … val­ues.That al­lows you to use Mag­num as­set man­age­ment APIs to load im­age and sceneda­ta and use them di­rect­ly with­out time-con­sum­ing man­u­al for­mat con­ver­sion.There is al­so a new ex­am­ple fo­cused on ren­der­ing a sim­ple tri­an­gle to anoff­screen buf­fer us­ing a hand­craft­ed SPIR-V shad­er and then sav­ing it as a PNGus­ing the Mag­num PngIm­age­Con­vert­er plug­in.

There will be more

Fur­ther ad­di­tions like shad­er/SPIR-V tools, de­vice/in­stance ab­strac­tionsand ini­tial pieces of the Vulkan back­end are sched­uled for next re­leas­es.Sub­scribe to mosra/mag­num#234 for up­dates. Red desert render mac os.

HiD­PI sup­port

Long gone are the days of a stan­dard 1024×768 res­o­lu­tion and fixed 96 DPI— dense screens are now a com­mon fea­ture for high­er-end lap­tops and desk­tops.In the 2018.10 re­lease, Mag­num is DPI-aware on mac­OS, iOS, Lin­ux andEm­scripten. The us­abil­i­ty goal is that re­quest­ing an 800×600 win­dow willmake it the same phys­i­cal size as an 800×600 win­dow would have on a 96DPI screen — so ba­si­cal­ly with no ex­tra in­volve­ment from the us­er. For weband mo­bile, Mag­num sim­ply en­sures that for giv­en can­vas / screen size you’llget all the pix­els that are there, with no scal­ing on top. If you have a HiD­PIscreen, check out the We­bGL demos on the Show­casepage — ev­ery­thing should be nice­ly crisp. This top­ic is way more com­plex thanit might seem, see DPI aware­ness for a de­tailed over­viewof DPI-aware­ness on all plat­forms and what that means for you as a de­vel­op­er.

Un­for­tu­nate­ly out-of-the-box Win­dows sup­port didn’t make it to the re­lease(though you are able to force ar­bi­trary scal­ing with a --magnum-dpi-scalingpa­ram­e­ter). Full An­droid sup­port and ad­vanced things like DPI change eventswhen drag­ging a win­dow across dif­fer­ent­ly dense mon­i­tors are al­so wait­ing to bedone, see mosra/mag­num#243help want­ed for de­tails.

Math good­ies

In­tro­duc­tion of the An­i­ma­tion li­brary re­quired quite a few ad­di­tions tothe Math li­brary — there’s a new Math::Cu­bicH­er­mite class forCu­bic Her­mite splines. As a gener­ic base for TCB curves and Cat­mull-Rom splinesthey are eas­i­ly con­vert­ible to and from Math::Bezi­er.

Cubic spline interpolation is henceforth referred to as splerp

— Thew (@AmazingThew) December 24, 2016

And be­cause spline stor­age is use­less on its own, the zoo of in­ter­po­la­tionfunc­tions got ex­tend­ed with Math::splerp() vari­ants. Be­sides that, theex­ist­ing Math::lerp() was ex­tend­ed to al­low lin­ear in­ter­po­la­tion ofMath::Cu­bicH­er­mite points, if you ev­er need that, and there’s a newMath::se­lect() util­i­ty that does con­stant in­ter­po­la­tion of all ex­ist­ingmath types. And al­so strings, enums or bool­eans. See thefull list in the doc­u­men­ta­tion. There’sal­so a re­cent blog post aboutne­glect­ed op­ti­miza­tion op­por­tu­ni­ties in quater­nion in­ter­po­la­tion.

As a side-prod­uct of Squareys’ bach­e­lor the­sis,Mag­num gained a large col­lec­tion of cone in­ter­sec­tion func­tions in theMath::In­ter­sec­tion names­pace. The Math::Range class gotin­ter­sec­tion meth­ods as well, along with oth­er niceties.

Many projects ei­ther use or in­ter­face with the GLMli­brary and so it made sense to be in­ter­op­er­a­ble with it. Sim­ply in­clude one ofthe head­ers in the GlmInte­gra­tion li­brary and you’ll get con­ver­sion ofall vec­tor, ma­trix and quater­nion types and al­so an abil­i­ty to print the GLMtypes us­ing Util­i­ty::De­bug:

List­ing all the ad­di­tions to Math li­brary would be be­yond over­whelm­ing, jumpto the com­plete changel­og for the rest.

Lit­tle big de­tails

We’re still un­sure if the up­com­ing Vulkan back­end will be able to dosim­i­lar amount of work in such a terse ex­pres­sion. That could be botha bad and a good thing.

Yes, it’s now pos­si­ble to get a GL::Mesh di­rect­ly fromTrade::Mesh­Da­tawith a sin­gle click —just use the brand new Mesh­Tools::com­pile() reim­ple­men­ta­tion and it’lldrag all GL::Buf­fer in­stances along with it­self, with­out you need­ing toman­age them. Of course there are flex­i­bil­i­ty trade­offs, so when us­ing the meshAPIs di­rect­ly, you have the op­tion of GL::Mesh::ad­dVer­texBuffer() ei­thertak­ing a non-own­ing ref­er­ence to the buf­fer or ful­ly tak­ing over its own­er­ship.

There’s a new Con­tain­ers::Sco­pe­dEx­it class that sim­ply calls a passedex­it / close / de­stroy func­tion on giv­en val­ue at the end of scope. Very use­fulwhen in­ter­act­ing with low-lev­el C APIs and much eas­i­er than wrestling withstd::unique_p­tr, try­ing to con­vince it to do the same.

If you ev­er need to it­er­ate on a ar­ray of in­ter­leaved val­ues and take al­waysthe third val­ue, there’s now Con­tain­ers::StridedAr­rayView that ab­stractsit away. It’s used in­ter­nal­ly by the An­i­ma­tion::Track­View APIs to al­lowfor both flex­i­ble and cache-ef­fi­cient lay­out of keyframe da­ta.

There’s a new Util­i­ty::for­mat() fam­i­ly offunc­tions for Python-style type-safe string for­mat­ting. The rea­son I’m addingthis is be­cause std::os­tream (and to some ex­tent printf())is no­to­ri­ous­ly in­ef­fi­cient, neg­a­tive­ly af­fect­ing ex­e­cutable size es­pe­cial­ly onasm.js / We­bAssem­bly tar­gets. How­ev­er the full im­ple­men­ta­tion didn’t make itin­to the re­lease, on­ly the sur­face APIs, Mag­num is not port­ed away from streamsjust yet — there will be a de­tailed post about all this lat­er 😉

More of an in­ter­nal thing, the De­bug­Tools::Com­pareIm­age util­i­ty got aCom­pareIm­ageToFile coun­ter­part,to­geth­er with oth­er com­bi­na­tions. In sub­se­quent up­dates, these will get usedfor fuzzy shad­er out­put ver­i­fi­ca­tion — very im­por­tant for im­ple­ment­ing PBRshaders that are lat­er on the roadmap.

Pro­to­typ­ing

Shown above is a new Prim­i­tives::gra­di­en­t2D() func­tion (to­geth­er withits 3D coun­ter­part), use­ful for sim­ple back­drops. The Shaders::Phongshad­er got a long-re­quest­ed sup­port for mul­ti­ple lights and there’s now al­phamask­ing sup­port in both Shaders::Phong and Shaders::Flat —use­ful for quick’n’dirty pro­to­typ­ing when you don’t want to both­er your­selfwith depth sort­ing or OIT.

As­set man­age­ment im­prove­ments

Since the TinyGlt­fIm­porter plug­in ini­tialre­lease in 2018.04, it’s re­ceiv­ing an end­less stream of up­dates. While thebig­gest new fea­ture is an­i­ma­tion im­port, it al­so re­ceived sup­port formul­ti-prim­i­tive mesh­es, name map­ping for all da­ta, cam­era as­pect ra­tio im­portand var­i­ous con­for­mance fix­es and per­for­mance im­prove­ments. It’s now eas­i­er toac­cess its in­ter­nal state, in case youwant to parse cus­tom glTF prop­er­ties or ac­cess da­ta that the im­porter does notsup­port yet.

To sup­port load­ing da­ta from mem­o­ry, from AAssetManager on An­droid orfor ex­am­ple voa drag&drop on Em­scripten, all scene and im­age im­porters nowsup­port file load­ing call­backs.For you it means you can con­tin­ue load­ing as­sets as usu­al — us­ing theirfile­names — and on­ly set up a dif­fer­ent file call­back for each plat­form. Theim­ple­men­ta­tion was done in a way that makes all ex­ist­ing (and fu­ture) plug­insim­plic­it­ly work with file call­backs, more­over theTinyGlt­fIm­porter,As­simpIm­porter andOpenGex­Im­porter al­so use pro­vid­ed filecall­backs for ex­ter­nal da­ta ref­er­enced from scene files (such as im­ages or da­tabuf­fers).

There’s fi­nal­ly a JpegIm­age­Con­vert­er plug­infor com­press­ing JPEG files, us­ing a lib­JPEG im­ple­men­ta­tion of your choice —be it the vanil­la im­ple­men­ta­tion, lib­jpeg-tur­boor, for ex­am­ple, MozJPEG. Sim­i­lar­ly, thestb_im­age-based StbIm­age­Con­vert­ergot up­dat­ed to sup­port JPEG out­put as well — and you can load ei­ther of themus­ing the JpegImageConverter alias. Both plug­ins sup­port spec­i­fy­ing theout­put qual­i­ty via a run­time set­ting; more en­cod­ing op­tions may be added in thefu­ture.

Among oth­er things, the Stb­True­Type­Font wasup­dat­ed to a new ver­sion of stb_truetype, gain­ing OTF sup­port, and you cannow load it (along with the oth­er Harf­Buz­z­Font andFreeType­Font im­ple­men­ta­tions) via the gener­icOpenTypeFont alias.

There’s al­ways some­thing to im­prove in the docs

If you hap­pen to be us­ing Mag­num with a buildsys­tem oth­er than CMake, there’snow a high-lev­el guide, point­ing out the big­gestpain points. The Math::Ma­trix4 and Ma­trix3 docsare im­proved with equa­tions vi­su­al­iz­ing most op­er­a­tions; theMath::In­ter­sec­tion and Math::Dis­tance func­tions andMath::Con­stants got up­dat­ed equa­tions as well.

The Us­ing the scene graph guide now has a vis­ual in­tro, ex­plain­ing the ba­siccon­cepts; the JavaScript, HTM­L5 and We­bGL and An­droid guideswere ex­tend­ed with fur­ther tips and trou­bleshoot­ing items. Oh, and theShaders and Prim­i­tives docs now have im­ages that look prop­er­lycrisp on HiD­Pi screens.

Not all roads led to Rome

Mag­num is now over eight years old and it be­came ap­par­ent that some ear­lyfunc­tion­al­i­ty didn’t stand the test of time — ei­ther be­cause it de­pend­ed ona now-out­dat­ed tool­kit, be­cause the re­quired time in­vest­ment for con­tin­uedmain­te­nance was not worth it or sim­ply be­cause it was a de­sign ex­per­i­ment thatfailed. The fol­low­ing li­braries are now marked as dep­re­cat­ed, are not built byde­fault (in case they ev­er were) and will be com­plete­ly re­moved in about sixmonths time.

  • The Shapesob­so­lete li­brary, to­geth­er withDebugTools::ShapeRendererob­so­lete and theBulletIntegration::convertShape()ob­so­lete func­tion.Failed de­sign ex­per­i­ment that couldn’t ev­er be made per­for­mant (and abus­ing% op­er­a­tors for col­li­sion queries was just plain wrong).

    Re­lat­ed ge­om­e­try al­go­rithms were moved to Math::Dis­tance andMath::In­ter­sec­tion names­paces. If you need a full-fledged physicsli­brary, please have look at Bul­let, whichhas Mag­num in­te­gra­tion in Bul­let­Inte­gra­tion (to­geth­er with de­bugdraw im­ple­ment­ed in Bul­let­Inte­gra­tion::De­bug­Draw), or atBox2D, which has a Mag­num ex­am­pleas well.

  • The Platform::GlutApplicationob­so­lete ap­pli­ca­tion. It’sbased on an out­dat­ed GLUT tool­kit, has porta­bil­i­ty is­sues and doesn’t makesense on the path for­ward to Vulkan. Con­sid­er switch­ing to ei­therPlat­form::Sdl2Ap­pli­ca­tion or Plat­form::GlfwAp­pli­ca­tion. https://os-bee-mac-torrentjoomla-rush-rlf.peatix.com.

  • The ColladaImporterob­so­lete plug­in, be­cause it’s based onan out­dat­ed Qt4 tool­kit. More­over, due to the sheer com­plex­i­ty of theCOL­LA­DA for­mat and poor con­for­mance of var­i­ous ex­porters it’s not fea­si­bleto main­tain a builtin im­porter any­more. Con­sid­er ei­ther us­ingAs­simpIm­porter for COL­LA­DA im­port orswitch­ing to bet­ter-de­signed and bet­ter-sup­port­ed for­mats such as glTF orOpenGEX us­ing TinyGlt­fIm­porter orOpenGex­Im­porter. There’s al­so the of­fi­cialCOL­LADA2GLTF con­vert­er.

Visual Studio 2017

With a heavy heart I have to say that re­cent up­dates of MSVC 2017 werere­gress­ing in­stead of im­prov­ing with their C++11 con­for­mance, crash­ing withIn­ter­nal Com­pil­er Er­ror on code in­volv­ing constexpr. While weman­aged to re­pro­duce and work around all re­port­ed is­sues so far, it mayhap­pen that your code trig­gers some new cor­ner case. Try to up­date to thelat­est ver­sion first and if the prob­lem per­sists,let us know. Thank you and sor­ry for the bumps.

Note that MSVC 2015 is not af­fect­ed by these.

Whelm Mac Os Download

New ex­am­ples

Two new ex­am­ples were con­trib­uted by our great com­mu­ni­ty, name­ly an in­te­gra­tionof the Box2D physics en­gine and an ad­vanced depth-aware mouse in­ter­ac­tionex­am­ple. Both are port­ed to We­bGL and you can play with them right now:

HTTPS 🔒

The Mag­num web­site is nev­er stor­ing any cook­ies or do­ing us­er track­ing (anddoesn’t plan to be do­ing that), so there’s no need to be wor­ried about yourda­ta be­ing com­pro­mised. Nev­er­the­less, it’s now served over HTTPS, with acer­tifi­cate from Let’s En­crypt. Some trade­offswere made as it’s ei­ther full se­cu­ri­ty or sup­port­ing the not-most-re­centbrowsers (but not both), so if you ex­pe­ri­ence any is­sues, please let us know.

Some­times ahard kickis all it takes to get things done.

Con­tri­bu­tions wel­come

WHELM Mac OS

Mag­num is now part­ner­ing with a few uni­ver­si­ties with a goal of im­prov­ingcom­put­er graph­ics cour­ses by of­fer­ing stu­dents things that are fun to playwith. You’re in­vit­ed to the par­ty as well — each GitHub re­pos­i­to­rynow has is­sues marked with a help want­ed la­bel and theseis­sues are specif­i­cal­ly picked to be self-con­tained, ex­cer­cise a well-de­finedarea of knowl­edge and to not re­quire deep un­der­stand­ing of Mag­num in­ter­nals.The most re­ward­ing among these are var­i­ous ex­am­ples, you can al­so im­ple­ment afan­cy al­go­rithm, in­te­grate sup­port for a new file for­mat or share yourex­per­tise in an area you know the best. If you pick some­thing, let us knowand we’ll help you get on the right path.

There’s al­so a pos­si­bil­i­ty to write a guest postfor this very blog and share in­ter­est­ing de­tails about a Mag­num-re­lat­ed thingyou’re work­ing on.

Whelm Mac Os Download

Up­grad­ing from pre­vi­ous ver­sions

In con­trast to 2018.04, this re­lease is more of an evo­lu­tion­al one.Nev­er­the­less, even though we’re al­ways go­ing to ex­treme lengths to pre­serveback­wards com­pat­i­bil­i­ty, it may hap­pen that some changes will have neg­a­tiveaf­fect on your code. Please check the Dep­re­cat­ed APIs and Po­ten­tialcom­pat­i­bil­i­ty is­sues sec­tions in the com­plete changel­og be­low for morein­for­ma­tion.

Thanks to @mat­jam there’s now aPPA re­pos­i­to­rycon­tain­ing pre­built pack­ages for Ubun­tu 14.04, 16.04 and 18.04. If you fol­lowthe #mov­ing­tog­it­lab move­ment,Mag­num now has a mir­ror on Git­Lab, butnote that pri­ma­ry de­vel­op­ment, roadmap and mile­stone plan­ning is stillhap­pen­ing on GitHub and will stay there for the fore­see­able fu­ture.

The 2018.10 re­lease is al­ready avail­able in Home­brewand Arch­Lin­ux AUR. At thetime of writ­ing, the PPA repos­i­to­ry, Vcp­kg andArch­Lin­ux re­pos are not up­dat­ed yet, we’rework­ing on get­ting the lat­est ver­sion there as well.

Com­plete changel­og

It’s longer than you might ex­pect 😉

Spe­cial thanks

Lots of work in this re­lease is done thanks to ex­ter­nal con­trib­u­tors:

  • Jonathan Hale (@Squareys) — tire­less main­te­nance of all thingsVR, in­ter­sec­tion al­go­rithms, glTF, OpenGEX, As­simp im­porter up­dates andVcp­kg ex­per­tise
  • @sc­tur­tle — the Mouse In­ter­ac­tion ex­am­ple
  • Michal Miku­la — the Box2D ex­am­ple
  • Nathan Olleren­shaw (@mat­jam) — Ubun­tu PPA repos­i­to­ry main­te­nance
  • Alex­an­der F Rød­seth (@xypro­to) — con­tin­ued Arch­Lin­ux [community]pack­age main­te­nance
  • Patrick Wer­ner (@boon­to) — An­droid port of theMod­el View­er ex­am­ple
  • Ivan P. (@uzer­name) — on­go­ing ef­fort with im­prov­ing thedoc­u­men­ta­tion and mak­ing the li­brary more ap­proach­able for new­com­ers

Again thanks a lot to ev­ery­one, not to for­get all peo­ple who re­port­ed is­sues,sug­gest­ed im­prove­ments or just wrote en­cour­ag­ing mes­sages on theGit­ter chat. Cheers!

Whelm Mac Os Catalina

Dis­cus­sion: Twit­ter,Red­dit r/cpp,r/gamedev,r/gltf,Hack­er News,mail­ing list