The Ogre COLLADA plugin

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Vectrex
Ogre Magi
Posts: 1266
Joined: Tue Aug 12, 2003 1:53 am
Location: Melbourne, Australia
x 1
Contact:

Post by Vectrex »

nice! Collada would an excellent addition to ogre to help solve the somewhat fuzzy area of whole scene editting and importing
Fup
Gnoblar
Posts: 15
Joined: Tue Nov 01, 2005 6:44 pm
Location: Vienna, Austria
Contact:

First beta released

Post by Fup »

Here my OgreColladaPlugin portal. I hope it could be useful for someone. For questions, bugs and anything else please contact me: pm, email or threads.
User avatar
Kentamanos
Minaton
Posts: 980
Joined: Sat Aug 07, 2004 12:08 am
Location: Dallas, TX

Post by Kentamanos »

Neat project Fup. I'm interested in using COLLADA in an application I'm working on, and this could help me add a preview function if nothing else.

I have one request for your library if possible. COLLADA can reference URL's as I'm sure you're aware (for instance your textures could be a file:// URL inside the COLLADA file). In my application, I'd like to add my own special URL type (haven't named it yet, but something like xyz://blahblahblah). I haven't looked at how your library handles URLs yet (if it does at all actually), but could you make some sort of mechanism for registering your own URL handlers?

For instance if I registered a callback function for xyz:// URL's, I could register a callback function that takes the URL in, and returns an XML node that would be inserted dynamically inline into the document.

I'm not sure how easy it would be to put in your architecture, but being able to handle URL's like svn:// might be something someone could add functionality for.

I hope I described that decently...

PS> Where can I download your sample DAE files? I've tried googling for them, but can't find them at the moment. My apologies if I'm missing something obvious...
Fup
Gnoblar
Posts: 15
Joined: Tue Nov 01, 2005 6:44 pm
Location: Vienna, Austria
Contact:

Post by Fup »

The collada sheme is very friendly, it does not dictate which external refernce to use and how. There should be no problem to take more than the common url protocols (file://, ftp://, http://, svn://, ...) into account. Currently I've no url refernce manager implemented, but thanks for your request, I've noticed it.

I've used the original sample files from colladad public forum, a little bit modified. I will upload them today.
User avatar
Kentamanos
Minaton
Posts: 980
Joined: Sat Aug 07, 2004 12:08 am
Location: Dallas, TX

Post by Kentamanos »

Fup wrote:I've used the original sample files from colladad public forum, a little bit modified. I will upload them today.
Ah...I see them now on their site. Thanks :).
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

Cool. I fixed quite a few compile errors in VC8, all of which went unnoticed because of scoping bugs in VC7.x (VC8 is more standards compliant), most of which were of the form:

Code: Select all

for (int i = 0; i < 10; ++i)
{
}
// error on next line, correct scope for 'i' expired inside the for loop!
if (i < 10)
{
...
I'll add this to ogreaddons under the name 'ColladaPlugin'. nfz's COLLADA entry is still there but I think it's still experimental and incomplete, I'll leave them separate in case nfz want's to resume development on his.

@Fup: Email me your Sourceforge username and I'll give you commit access to it.

2 problems:
- You really should be using ResourceGroupManager to open dae files as a stream, so they can be loaded from regular resource locations like every other file
- More seriously, whilst the plugin works in debug mode, I get nasty crashes in release mode. Probably some uninitialised variables somewhere. :?
[edit]Found it - you didn't init ColladaDocument::mXmlDoc, will fix that too[/edit]
[edit2]Damn, that only fixed one problem, there's another one, looks like it might be a buffer overrun since 'this' is corrupted in the call stack - bleh. Sorry, I can't spend anymore time on this now, please take a look at it.[/edit2]
nfz
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 1263
Joined: Wed Sep 24, 2003 4:00 pm
Location: Halifax, Nova Scotia, Canada

Post by nfz »

Sinbad: you can remove mine.
Fup
Gnoblar
Posts: 15
Joined: Tue Nov 01, 2005 6:44 pm
Location: Vienna, Austria
Contact:

Post by Fup »

sinbad wrote:Cool. I fixed quite a few compile errors in VC8, all of which went unnoticed because of scoping bugs in VC7.x (VC8 is more standards compliant), most of which were of the form:

Code: Select all

for (int i = 0; i < 10; ++i)
{
}
// error on next line, correct scope for 'i' expired inside the for loop!
if (i < 10)
{
...
Well done. I'm sorry, I've not got VC8, what about the free exress version?
sinbad wrote:I'll add this to ogreaddons under the name 'ColladaPlugin'. nfz's COLLADA entry is still there but I think it's still experimental and incomplete, I'll leave them separate in case nfz want's to resume development on his.
Wonderful.
sinbad wrote:@Fup: Email me your Sourceforge username and I'll give you commit access to it.
You've got a pm.
sinbad wrote: 2 problems:
- You really should be using ResourceGroupManager to open dae files as a stream, so they can be loaded from regular resource locations like every other file
- More seriously, whilst the plugin works in debug mode, I get nasty crashes in release mode. Probably some uninitialised variables somewhere. :?
[edit]Found it - you didn't init ColladaDocument::mXmlDoc, will fix that too[/edit]
[edit2]Damn, that only fixed one problem, there's another one, looks like it might be a buffer overrun since 'this' is corrupted in the call stack - bleh. Sorry, I can't spend anymore time on this now, please take a look at it.[/edit2]
Noticed, I'll try to solve them as soon as possible.
nfz
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 1263
Joined: Wed Sep 24, 2003 4:00 pm
Location: Halifax, Nova Scotia, Canada

Post by nfz »

Fup: I've gotten your plugin from cvs and I'll see if I can help out with squashing some of those bugs in VC8.
nfz
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 1263
Joined: Wed Sep 24, 2003 4:00 pm
Location: Halifax, Nova Scotia, Canada

Post by nfz »

Fup: I just commited to cvs a fix for the plugin, the vc8 build now runs in debug and in release with no problems with the supplied dae files. My dae files on the other hand are causing a few problems.

I am moving the manual resource loader from my plugin to yours.
User avatar
Kentamanos
Minaton
Posts: 980
Joined: Sat Aug 07, 2004 12:08 am
Location: Dallas, TX

Post by Kentamanos »

nfz wrote:I am moving the manual resource loader from my plugin to yours.
Just curious nfz, does that potentially handle the question I asked above a few posts up?

I'm designing a system for "asset management" (3D assets being what I focus on first) and I'm really excited about COLLADA for handling 3D assets in a fairly vendor neutral manner.
nfz
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 1263
Joined: Wed Sep 24, 2003 4:00 pm
Location: Halifax, Nova Scotia, Canada

Post by nfz »

Kentamanos: Potentialy yes. libxml2 supports what you are asking for but there is still a little more work to be done to connect ogre resource management to what libxml2 provides for resolving urls.
nfz
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 1263
Joined: Wed Sep 24, 2003 4:00 pm
Location: Halifax, Nova Scotia, Canada

Post by nfz »

Fup: I moved my OgreCOLLADAManager over to your project (renamed OgreColladaManager), merged my OgreCOLLADADocument class with your OgreColladaDocument and now we have Collada documents as ogre resources. The dll makes a singleton instance of the ColladaManager when dllstartplugin is called on dll loading and destroys it when Ogre unloads the dll plugin.

Just have to do a little more testing and then I will commit to cvs.
User avatar
Praetor
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3335
Joined: Tue Jun 21, 2005 8:26 pm
Location: Rochester, New York, US
x 3
Contact:

Post by Praetor »

This sounds great. Collada could be THE resource exchange format. I'd love to have this kind of support. Is there also a way to use your systems without Ogre?

As in, without having to load and start up Ogre, could I use some of your system unmodified to load collada stuff. For instance, in an offline tool to "bake" collada files down to engine-specific game formats.
User avatar
pjcast
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2543
Joined: Fri Oct 24, 2003 2:53 am
Location: San Diego, Ca
x 2
Contact:

Post by pjcast »

The plugin in Addons appears to be LGPL (at least, that is what the license at the top states), which means the code could be used in another LGPL plugin (perhaps one for Visual Ogre Studio :) ), not sure how much can be used without Ogre though, I havn't examined the source or played with it in general yet.
Have a question about Input? Video? WGE? Come on over... http://www.wreckedgames.com/forum/
nfz
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 1263
Joined: Wed Sep 24, 2003 4:00 pm
Location: Halifax, Nova Scotia, Canada

Post by nfz »

Yes, its LGPL.

OgreColladaManager, mods to OgreColladaDocument to make it Ogre resource friendly, and some other fixes are now in cvs.

I'm doing the update on the HTML docs now to reflect the changes in how to use the plugin.

Here is an excerpt:

Code: Select all

void ColladaDemoApplication::createScene(void)
{

    LogManager::getSingleton().logMessage("ColladaDocument - import started");
    try
    {
        ColladaDocumentPtr daeDoc = ColladaManager::getSingleton().load("ColladaTest.dae",
            mSceneMgr);
        // build up scene fully if document was loaded
        if (!daeDoc.isNull())
        {
            daeDoc->getScene()->createOgreInstance(NULL);
            LogManager::getSingleton().logMessage("ColladaDocument - import finished");
        }
    }
    catch(...)
    {
        LogManager::getSingleton().logMessage("ColladaDocument - failed to load");
    }
}

dae resource paths are placed in resources.cfg just like other ogre resource paths are.
User avatar
Kentamanos
Minaton
Posts: 980
Joined: Sat Aug 07, 2004 12:08 am
Location: Dallas, TX

Post by Kentamanos »

Praetor wrote:This sounds great. Collada could be THE resource exchange format. I'd love to have this kind of support. Is there also a way to use your systems without Ogre?

As in, without having to load and start up Ogre, could I use some of your system unmodified to load collada stuff. For instance, in an offline tool to "bake" collada files down to engine-specific game formats.
You might just consider the official C++ DOM API on sourceforge for that purpose (sourceforge is down atm, or I'd give a link).
User avatar
Praetor
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3335
Joined: Tue Jun 21, 2005 8:26 pm
Location: Rochester, New York, US
x 3
Contact:

Post by Praetor »

I obviously could just do the XML reading directly myself. It was more a question of how much work would I have to do myself, since we all know programmers are lazy. Either way this is a good step in the right direction.

I think I will always be in favor of an app-specific format that these intermediate formats can be baked into. I know you guys already conceded collada isn't meant to be a real-time, complete Ogre descriptive format. This functionality is still a great thing.
Fup
Gnoblar
Posts: 15
Joined: Tue Nov 01, 2005 6:44 pm
Location: Vienna, Austria
Contact:

Post by Fup »

@nfz: Wonderful, that are very good news. Currently I've no access to the branch, sf admin is down.

[edit]Very strange, I've checked the email notification but haven't received any reply today for this topic.[/edit]
Fup
Gnoblar
Posts: 15
Joined: Tue Nov 01, 2005 6:44 pm
Location: Vienna, Austria
Contact:

Post by Fup »

Real-time and Collada are not comparable. There is no problem to load Collada files and build up high performance data structures or traversing to Ogre binary format.

Using a DOM API for a Collada plugin especially with Ogre is not very handy, I think. :? See the official Collada public forum and their developments. They have implemented a simple offline Collada viewer too, FSCView.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

Nice work nfz, works great here.

Yes, I think in practice Collada will be a 'quick play' or interchange / tool format, a lot of the time you'll want to compile the information into a faster & smaller runtime format. The advantage of it is that it supports links of all kinds, so you could keep the overall structure and compile the detail data out to binary files and link them in. This is kind of what .scene does.

I still can't get into Sourceforge admin, I don't know what's going on but they still have their logins disabled and their 'unscheduled downtime' signs out. Fup, I'll give you access as soon as I'm able.
nfz
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 1263
Joined: Wed Sep 24, 2003 4:00 pm
Location: Halifax, Nova Scotia, Canada

Post by nfz »

I've got a little demo here that I was using with my old Callada plugin that is now updated and using the latest plugin that I'll put in the demo directory of ColladaPlugin cvs (soon to be created). It has a GUI interface (using CEGUI) that allows you to select Callada documents from a list. The list is updated each time the user selects the combo box so you can load a scene without closing the app when you export from the art app (I've been using Blender). The list is the dae resources found in registered resource paths so you do have to export to one of those registered resource paths. Before I put it into cvs I have to fix a little problem with scene unload and resource reload so that the currently active document reloads when the dae file updates.

[edit] It won't make it into cvs till tomorrow morning. I need to setup a vc8 project file for the demo ( I use Code::Blocks + MinGW + STLPort) then test it in vc8. Its bedtime now. [/edit]
Last edited by nfz on Wed Jun 28, 2006 11:35 pm, edited 1 time in total.
Fup
Gnoblar
Posts: 15
Joined: Tue Nov 01, 2005 6:44 pm
Location: Vienna, Austria
Contact:

Post by Fup »

Absolutely cool. 8)
I anticipate the new plugin. :o
Chr
Gnoblar
Posts: 23
Joined: Mon Aug 08, 2005 10:39 am

Post by Chr »

great thing!
I think Collada has physics support?
Does the collada plugin supports it, or how is it possible to use the physics descriptions of collada?
thx
Fup
Gnoblar
Posts: 15
Joined: Tue Nov 01, 2005 6:44 pm
Location: Vienna, Austria
Contact:

Post by Fup »

Yes indeed. Currently this plugin version supports only Collada Spec 1.3.1. Collada 1.4 supports much more, for more information please see official site http://www.khronos.org/collada/ and the specification.
Post Reply