Lightwave 7.0 plug in for saving data differently

Started by
2 comments, last by Code Mole 20 years ago
I did this post in the beginners section and didn''t get any replies so I''m gonna try it here. A friend of mine did some art work in Lightwave 7.0 and I now have these .lwo files that i could use for my game if I could only figure out how to get the proper data from them. the files are in hex and I don''t know the format of how the files are saved out so I can''t parse them. I''ve tried finding documention online but no luck. I also couldn''t find any already existing plug ins that could save the files into a different format, (plan ascii text), that way i could easly write code to read in that data. so anyone knows a good web site on light wave or a plug in that already does this, it would greatly help me out. ~code mole~
Advertisement
I know www.UltimateGameProgramming.com will release a demo and arctilce soon about loading lightwave object models (.lwo) and I think scene files too. I definietly know models will be there sooner or later.
The lightwave fileformat uses "chunks" - each chunk has an identifier, followed by a length. This makes it easy to skip chunks your program doesn't need/doesn't understand.

The ammount of code you'd have to write depends pretty much on the number of features you want to support. If you only need minimal features like points, polygons, uv coords and texture names, it shouldn't be that much work.

There are some really good pages about the lwo format
here, and here, complete with all kinds of good examples. Those two pages have almost all the information you will probably need.

*BTW you should know, all data stored in lwo files is stored in big-endian format. That means unless you're on a mac(I know, there are some others), you're going to need to swap the endian.

if you have vs.net, use these defines:
#define SWAP2(q) ((u16)(_byteswap_ulong(q)>>16))
#define SWAP4(q) ((u32)(_byteswap_ulong(q)))
otherwise, use these:
#define SWAP2(q) ((((unsigned short)(q))>>8) | ((((unsigned short)(q))<<8)&0xff00))
#define SWAP4(q) (((((unsigned long) (q)))>>24) | ((((unsigned long) (q))>>8)&0xff00) | ((((unsigned long) (q))<<8)&0xff0000) | ((((unsigned long) (q))<<24)&0xff000000))

EDIT: Had both links pointing to the same url. Fixed now.

[edited by - Melekor on March 21, 2004 10:25:36 PM]
just want to say thanks to playa_151 and Melekor, this helps alot, also a special thanks to Melekor for pointing out the big-endian. Its small things like that which are easy to gloss over and really give you problems down the road.

~code mole~

This topic is closed to new replies.

Advertisement