how to port c++ scene editor to web

Problems building or running the engine, queries about how to use features etc.
Post Reply
fla666
Greenskin
Posts: 129
Joined: Fri Oct 31, 2014 4:22 am

how to port c++ scene editor to web

Post by fla666 »

hi guys, i have written a visual ogre scene editor using c++ on pc ,and want to port the editor to web , could somebody give some suggestion on the porting work ?

my approach is converting the c++ source code to javascript by emscripten , then i can get a editor sdk of js version , are there better ideas ?
fla666
Greenskin
Posts: 129
Joined: Fri Oct 31, 2014 4:22 am

Re: how to port c++ scene editor to web

Post by fla666 »

the size of single output .js file converted from twenty .cpp files by emscripten is more than 10MB , and my intention is to creare a javascript sdk aumomatically from c++ source code ,the problem is that i found most of functions lost in the .js file

could somebody tell me how can export functions into js sdk ? thanks !
misiak1989
Gnoblar
Posts: 9
Joined: Mon Nov 25, 2013 9:01 pm
x 1

Re: how to port c++ scene editor to web

Post by misiak1989 »

fla666 wrote:hi guys, i have written a visual ogre scene editor using c++ on pc ,and want to port the editor to web , could somebody give some suggestion on the porting work ?

my approach is converting the c++ source code to javascript by emscripten , then i can get a editor sdk of js version , are there better ideas ?
Are you willing to opensource that? If so, maybe put the current c++ code somewhere (github seems to be popular these days... or bitbucket, maybe even more popular among ogre users) so one could look at and try help? ;)
frostbyte
Orc Shaman
Posts: 737
Joined: Fri May 31, 2013 2:28 am
x 65

Re: how to port c++ scene editor to web

Post by frostbyte »

about creating .js bindings with emscripten
http://kripken.github.io/emscripten-sit ... index.html

about .js size
first of all you need to use emscripten optimize for size flag( takes a long time to compile so do it before final build )
i think ogre demo.js is about 1.5mb( without media resources which are fetched from the web as zip archive when you press...)
so eventualy your scene editor should reach similar size
further more on this... i've heard of javaScript libs that compress/archive/extract your code on the fly..
try as an example compressing your .js file to a zip/7z and check if it can help( i think you can shave off about 20%-30% )
also saw similiar .js libs which are optimized for code compression but i think its useless here since supposedly emscripten should already do this optimizations.


anyway it's a good advice to first show a minimal ogre window/splash while resources are loading]
you can use emscripten thread support or maybe use boost?( i didn't realy invastigate on this )...
http://kripken.github.io/emscripten-sit ... lines.html
or you can do it from js with webWorkers
the woods are lovely dark and deep
but i have promises to keep
and miles to code before i sleep
and miles to code before i sleep..

coolest videos link( two minutes paper )...
https://www.youtube.com/user/keeroyz/videos
fla666
Greenskin
Posts: 129
Joined: Fri Oct 31, 2014 4:22 am

Re: how to port c++ scene editor to web

Post by fla666 »

hi frostbyte,do you know why c++ function declared in embind MACRO vanish when using -O2 flag ? if using -O1 , all function can be referenced by Module.functionname normally.
frostbyte
Orc Shaman
Posts: 737
Joined: Fri May 31, 2013 2:28 am
x 65

Re: how to port c++ scene editor to web

Post by frostbyte »

no idea...didn't go that far (-:
since this isnt ogre related issue i suggest you try emscripten forums/groups/submmit bug...

edit:
for example just goggleing "-o2 emscritpen" resulted in :
https://kripken.github.io/emscripten-si ... -Code.html
hint: carfully read the "note"( blue frame )
the woods are lovely dark and deep
but i have promises to keep
and miles to code before i sleep
and miles to code before i sleep..

coolest videos link( two minutes paper )...
https://www.youtube.com/user/keeroyz/videos
Post Reply