PDA

View Full Version : Best Library for Cross Platform 3D development?



jdarling
20-01-2010, 03:54 PM
I have a client that wants the ability to load a set of models (CAD DWG/DXF, possibly MD2, others are just nice to haves) and let a user walk around in a 3D world. This isn't anything fancy at all (if it were I'd be looking for someone to do the work LOL), just load a model (or set of models) of the campus and load an actor to walk around within the model.

The campus model(s) are exported from AutoCAD and include elevation and basic building mesh details (I'll have them turn off MEP layers).

Now, I know that GLScene can do this and does it quite well (in Delphi), but I've Never been able to get it to work cross platform on MAC. So, is there a library for Lazarus/FPC that works on all 3 desktop OS's (Windows, Linux, and MAC) that is simple to use? I don't typically do 3D and I'm not horridly interested in learning all the in's and outs, so any help on a general direction (or start from code) would be greatly appreciated.

- Jeremy

noeska
20-01-2010, 06:27 PM
What other export options do you have? Cad DWG/DXF are closed file format from autocad. Getting to support .3ds in glModel due to that fact was hard enough. I dont know how cross platform friendly glModel is, but it gives .3ds .obj and milkshape ascii file animation support.

jdarling
20-01-2010, 07:18 PM
Honestly, its been years since I worked in AutoCAD so I don't know what else it can export to. I just know the clients all have architectural drawings in AutoCAD format. At one point in time I had a DXF loader I wrote, but looking around I can't find it any more :(.

Google tells me that http://google.com/codesearch/p?hl=en#93sG5NkuQsA/scottpinkham/delphi/DXF_read.zip|RUgt3iXrb60/DXF_read.pas&q=lang:pascal%20dxf contains a minimal implementation of a DXF loader and I know that Autodesk puts the DXF spec out quite often (every update of their app) at http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=12272454&linkID=10809853.

Main problem is, I've NEVER been able to wrap my head around 3D :(. I've bought books, read books, read articles, played around and the whole nine yards. But once I get into actually trying to do something, POOF my brain quits working.

I know I can easily write a DXF parser that would be able to load all symbols in the spec, no problems there. But what to do with all that information and how to get it to the screen, LOL big problem!

- Jeremy

jdarling
20-01-2010, 07:22 PM
Well, did find the GLScene DXF Loader on my FTP site so far: http://www.eonclash.com/temp/GLFileDXF.zip (Don't remember where this came from, but its there)

- Jeremy

Stoney
20-01-2010, 07:23 PM
I think Irrlicht would fit your needs. It can load MD2, there seems to be a community loader for DXF, but hasn't been updated since 2006. Irrlicht has a nice editor called IrrEdit, which is unfortunately Windows only, but the generated *.irr-files can be read on any platform.

Irrlicht has currently a lot of interfaces to Delphi/FreePascal:
- There are Irrlicht.NET and IrrPascal which don't seem to be maintained any more
- Irr4Delphi by djoker: http://www.pascalgamedevelopment.com/forum/index.php?topic=5258.0
Not (completely) open source and windows only as far as I know
- IrrDelphi: http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=36182
Interfaces directly with the Irrlicht DLL, no wrapper necessary, only Visual C++ DLL works at the moment, so Windows only, at least at the moment
- IrrlichtPas: http://sourceforge.net/projects/irrlichtpas/ started by me :)
In an early alpha stage, which won't change in the near future due to lack of time
Advantages:
Works on Windows, Linux and Mac OS X
Library is statically compiled into the executable on Mac OS X
Based on http://www.freebasic.net/forum/viewtopic.php?t=3584&postdays=0&postorder=asc&start=0 and a few examples have already been converted to FreePascal
Disadvantages:
Flat wrapper => Just a bunch of functions and procedures, no class structure
Might be buggy and there are some performance issues
Just OpenGL and Software renderer available at the moment



There is also the Horde3D engine which requires an OpenGL 2.0 graphics card and can only load Collada files for 3D models. Mac OS X is not working properly at the moment (there seems to be a problem when loading the content), but Linux should work (I will test it later) and Windows works like a charm.


Leaf2 is another engine for FreePascal, but it would need some work to be compatible for Mac OS X: http://leafproject.com.sapo.pt/leaf2.html