Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3508 Members - Latest Member: NevilleKemp

26. May 2012, 05:28:09 pm
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)loading MD2 model with no GL commands fails
Pages: [1]
Print
Author Topic: loading MD2 model with no GL commands fails  (Read 204 times)
kerno
Just dropped in

Offline Offline

Posts: 18


View Profile
« on: 21. May 2011, 10:27:42 pm »

Hi,
it seems that MD2Model.readGLCommands loops infinitely when no GL commands are defined in the file (and the GL commands offset is 0, which is the case in newest UFO: AI files).
I could overcome the problem by just not entering the GL commands loop (from line 364) if the header.numGlCommandBytes is 0 (numGlCommandBytes wasn't used anywhere before).
Just mentioning in case someone could fix/commit it in Jagatoo...
Thanks & regards



Code:
# patch for src/org/jagatoo/loaders/models/md2/MD2File.java
@@ -361,6 +361,7 @@
          */
         
         //for ( int i = 0; i < numCommands; i++ )
+        if(header.numGlCommandBytes > 0)
         while ( true )
         {
             int indicator = in.readInt();
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #1 on: 22. May 2011, 02:04:32 pm »

Thanks for the patch. I have committed your fix.
Logged
kerno
Just dropped in

Offline Offline

Posts: 18


View Profile
« Reply #2 on: 22. May 2011, 08:34:30 pm »

Thanks for quick response.
It seems I was happy a bit too early. While the fix makes the loader accept the MD2 files with no GL commands, it does not help the model to load properly. If I understood the loader code correctly - the triangles' section is ignored and the loader relies on the GL commands to create shapes (correct me, please, if I'm wrong). I didn't notice at first that some models 'disappeared' from my scene.
I just switched back to some older MD2s with the proper GL commands which is no big deal for me but if you could give some guidance - I could try to see if I can fix the loader to load models with no GL cmds. Where should I start looking? (or just RTFM for MD2? Wink )
Thanks & regards
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic