SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997 |
09-29-11, 05:10 PM | #1 |
Black Magic
|
GR2 Editor/Viewer/Extractor/Importer
For approximately the last 8 months I've been gathering information on the GR2 format. I've found info from the net and from this one magical place on the net dealing with QuArK. This one magical place has been a major source of the information I've attained about the GR2 format. Another huge source of information was the GrannyViewer app from RAD games (the 'maker' of the granny format - a free app from them). That app tells you everything that is contained in the GR2 file - the trick is figuring where the info displayed resides in the GR2 file. I used that app extensively in the making of this app. Last, but not least, Privateer provided the last missing piece to the puzzle when he released his GR2 template for the 010 editor. I couldn't figure out how to read the very beginning of the file and that template provided information that allowed me to figure it out.
The pointers contained in section 0 of the GR2 file will tell you everything you need to know to do what I've done. The screenshot above shows NSS_Uboat7a (with hull mesh turned off to show rooms). All waypoints are shown also. Since I have all this data and I know how to interpret it correctly I can do basically anything with it. An extractor will be coded in to allow you to extract meshes from the GR2 file into OBJ format (might even code it for Microsoft's X format also). I hope to also figure out how to import new items into the GR2 file via the app. Now I know someone is going to say "We have the goblin editor and Granny viewer to see GR2 files graphically. Why reinvent the wheel?" And that would be a good and valid question. Here's why: - If I can display the information I read from the file graphically and it renders correctly then I'm reading the file correctly. Most important. - To do things that either of them can't do (picking, moving bones, rotating meshes, etc.) For anyone that's curious: - developed using Visual Studio 2008 C# - currently uses DirectX fixed-function pipeline (I plan on converting it to the programmable pipeline [aka shaders] once everything is working). I use the fixed-function pipeline because it's easier to code initially. Goal is to get everything working then go back and polish. - uses DirectX 9.0c for rendering (no OpenGL or anything like that) current version v1.1.459.1: https://www.mediafire.com/?0c360d3g4jx3qah NOTE: CURRENT VERSION IS IN ALPHA STATE. ENSURE TO BACKUP YOUR WORK BEFORE SAVING WITH APP! In hopes of getting some open-source type thing going on here is the C# AntiGranny code file (old and outdated but still full of useful info). Since there was no participation in my open-source adventure I will not be updating the source code below anymore: http://www.gamefront.com/files/20890...10_15_2011_zip Last edited by TheDarkWraith; 08-23-14 at 04:33 PM. |
|
|