Results 1 to 4 of 4

Thread: Slight hiccup importing a LWO file

  1. #1

    Slight hiccup importing a LWO file

    For some reason when this gets to the PNTS chunk, it returns a HUGE number.

    byte_4 is a 4 dimension char array
    ChunkToUInt takes a chuck, converts it to the correct endian, and returns a number.

    This works fine for TAGS and LAYR, but when it gets to PNTS, the length (here pos) of the chunk is returned as many times greater than even the filesize.

    What am I doing wrong? (This is with LW8, just using save then loading a saved file...)

    Code:
    //  if ( CompareChunk( "LWO2", byte_4 ) == false ){return false;}
    
        do {
        //get chunk stream
        fread( byte_4, 4, 1, mdl );
        foundchunk = false;
      			
      //loading chunk data will be here
    
        if (foundchunk == false) {
        fread( byte_4, 4, 1, mdl );   
        pos = ChunkToUInt( byte_4 );        
        for (int add_cnt = 1; add_cnt <= pos; add_cnt++)
        fread( &ch, 1, 1, mdl );
        if (pos%2 == 1) {    fread( &ch, 1, 1, mdl );}
       }
       } while ( ftell( mdl ) != datasize + 8);

  2. #2
    Edit: I misunderstood your code... please ignore my previous reply.
    Last edited by Adrian Lopez; 03-23-2005 at 09:36 PM.

  3. #3
    well i dont have an answer fr you but looking at your code are you wrighting a mdl importer
    basiclly a hl2 model importer

    hehe nm i understand now

  4. #4
    Have you figured out what's wrong? I'm curious to learn what's going on. Could you send me a copy of the problem file? I have a rudimentary (and quite incomplete) loader and I'd like to find out if it can read the file that's giving you problems. So far I've only tested it with files generated by Lightwave 7.5.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •