What we ended up with was a plugin structure for lua.
Its not optimal but it works well. We have a main executable that really doesnt know much about the world, but it has a lua-state and it knows how to "load a plugin and register it to lua".
So what we can do is take for example a class:
class MyApp
MyApp();
void run(); // starts my app and do whatever
void doOtherthings()
bool shutTheWholeThingDown()
...
}
write a LuaPlugin class:
LuaMyApp : public LuaPlugin
{
virtual void init(); // will be called during loading
}
Run MyApp class through tolua++ and generate interface binder code, call that from LuaPlugin::init() which registrates the MyApp class into lua.
This results in a .dll/.so luaplugin_myapp.dll
So by starting the main app:
DOS> main_app myapp.lua
with a lua-file that specifies:
myapp.lua:
------------------
requestPlugin("myapp")
myapp = MyApp:new()
myapp = MyApp:run()
--------------------------------
So its up to the author of the LuaMainApp plugin if he want to export all of the interface to lua or just the kick-off code.
main_app doesnt know anything about MyApp.
There are of course a few Singletons to enable access to a scenegraph and some other things.
All this said, I would love to see a slick API/toolset that makes it possible to get COM:ish functionality, while still portable and with a small overhead mainly in use!
/Anders
On 10/10/06, Dmitry Baikov <[EMAIL PROTECTED]> wrote:
Chris Hanson wrote:
> As I mentioned above, OSG's plugin design is suitable for OSG, but
> pretty much lacks many of the important criteria I'm looking for.
> Think of how 3dsMax breaks plugin compatibility everytime they release
> a new version, versus Photoshop which can run plugins written in the
> 3.0 era.
>
It all depends on the complexity of data structures that will be
manupulated and/or passed between plugins.
On possible solution is to use some scripting language with good
C-interface as a glue and write all plugins as language-modules.
For us Lua (http://www.lua.org) is sufficient. Many projects use Python
(as being more powerful, but complex).
Dmitry.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
--
________________________________________________________________
Anders Backman Email: [EMAIL PROTECTED]
HPC2N/VRlab Phone: +46 (0)90-786 9936
Umea university Cellular: +46 (0)70-392 64 67
S-901 87 UMEA SWEDEN Fax: +46 90-786 6126
http://www.cs.umu.se/~andersb
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
