Static B3D writing support

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: Static B3D writing support

Post by christianclavet »

Thanks Hendu! I used it on my project to save the terrain tiles that I was saving before in XML. Load more than 10 times faster using the B3D format! (The patch worked on my version of Irrlicht SVN 1.9)
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Static B3D writing support

Post by hendu »

If your tiles are small enough, you might be interested in my sm1 format. It should load even faster than b3d, while creating much smaller files.

It's limited to a single mesh buffer with one texture. Max 65k verts, one pair of UVs. In other words, perfect for simple/small meshes.
CuteAlien
Admin
Posts: 9643
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Static B3D writing support

Post by CuteAlien »

Nice. Hendu, can you add a link to this forum post in the patch-tracker? Just to make it a little bit more visible as it looks this could be applied without too much trouble.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Static B3D writing support

Post by hendu »

Posted both this one and the IQE one. I can't change this one from ogles to svn though.
CuteAlien
Admin
Posts: 9643
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Static B3D writing support

Post by CuteAlien »

Thanks.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
JLouisB
Posts: 67
Joined: Tue Jul 24, 2012 12:36 pm
Location: France

Re: Static B3D writing support

Post by JLouisB »

Thanks for this code, it's useful for me.

I have adapted your code to export skinned/animated meshes in the b3d format :
https://dl.dropboxusercontent.com/u/244 ... ations.zip

Note that the structure of the exported mesh is a bit different than the Hendu version, all the mesh is exported in one MESH chunk (Otherwise it's difficult to export animation)

edit : new version
Last edited by JLouisB on Sun Jan 18, 2015 2:16 pm, edited 1 time in total.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: Static B3D writing support

Post by christianclavet »

Hi, I've updated the patch from Hendu on Trunk SVN 5017. So it should be easier to incorporate. The patch has all the files, but each compiler project (MSVC, Codeblock, etc) should be updated the new files added (CB3DMeshWriter.cpp, CB3DMeshWriter.h). (The makefile was updated by Hendu and is also provided) The patch was submitted on the sourceforge project page.

Also you need to enable it in your Irrlichtconfig.h by adding this define:
_IRR_COMPILE_WITH_B3D_WRITER_

Example to use it:

Code: Select all

IMeshWriter* mw = device->getSceneManager()->createMeshWriter(EMWT_B3D);
            if (!mw)
                printf("Failed to create the mesh writer!\n");
 
            IWriteFile* file = device->getFileSystem()->createAndWriteFile(filename.c_str());
            IMesh* mesh = tile->getMesh();  //There is the reference to your model (for IRB, its a terrain tile)
 
            if (mesh && mw && file)
                mw->writeMesh(file,  mesh);
Thanks JLouisB, I'll check this as we could use this to save about anything that we load in Irrlicht and save it as a "generic format" for Irrlicht.
Last edited by christianclavet on Sat Jan 10, 2015 8:34 pm, edited 1 time in total.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Static B3D writing support

Post by hendu »

Your patch includes an unrelated CFileSystem change?
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: Static B3D writing support

Post by christianclavet »

Oups. Sorry, this is the other change I've done for the file list being all forced in uppercase (IRRLICHT BUG that was giving me problem on Linux) this CFileSystem change is unrelated to the B3D Mesh writer patch. It's only fix the file list bug.
JLouisB
Posts: 67
Joined: Tue Jul 24, 2012 12:36 pm
Location: France

Re: Static B3D writing support

Post by JLouisB »

@christianclavet : Ok. I think that it can be good if this writer can be added to Irrlicht with animations support.

I will post a new version of my code in a few days.
JLouisB
Posts: 67
Joined: Tue Jul 24, 2012 12:36 pm
Location: France

Re: Static B3D writing support

Post by JLouisB »

A new version of my code (bugfixs and now the writer can be added to Irrlicht like the original writer (like christianclavet has said in this post)) :
https://dl.dropboxusercontent.com/u/244 ... ations.zip

Made for Irrlicht 1.8.1 (I havn't try to compile with svn version), tested with the models of the media folder + many other meshes.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: Static B3D writing support

Post by christianclavet »

Ok. I will make a diff with the SVN version here and try it. Is that the one that support saving of animations?
JLouisB
Posts: 67
Joined: Tue Jul 24, 2012 12:36 pm
Location: France

Re: Static B3D writing support

Post by JLouisB »

Yes, rigg and animations support.
CuteAlien
Admin
Posts: 9643
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Static B3D writing support

Post by CuteAlien »

OK, I'll wait until there's a patch for trunk before applying it (shouldn't be really different in this case I think).
Or until christianclavet tested it with trunk and says it works.

@JLouisB: If you are able to get involved in Irrlicht development like that I'd recommend switching to svn trunk. We always try to have that stable and fix it quickly when new problems show up. And rebuilding the engine just takes a few minutes. You get more features and bugfixes there than from official releases. And it makes it easier to apply your patches then for us :-)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply