corrupted POD files

This topic contains 1 reply, has 2 voices, and was last updated by  Scott 7 years, 10 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #29999

    warmi
    Member

    While writing an exporter for POD files I hit a problem when trying to export EPODDataUnsignedByte based vertex data.

    Essentially when exporting sBoneIdx data I want to keep the whole vertex stream aligned at 4 bytes which means in case of just 1 or 2 bones per vertex I want to pad the sBoneIdx vertex data to 4 bytes.

    To do that I create an instance of CPODData which looks something like this:

    EPVRTDataType eType = EPODDataUnsignedByte;

    unsigned int n      = 1;

    unsigned int nStride = whatever stride I need to keep everything aligned at 4 bytes ( in this case it means padding it with 3 bytes)

    unsigned char * pData

    The problem is that the CPVRTModelPOD.SavePoD(..) method is not taking nStride into account when exporting data.

    What it does is that for each vertex entry it stores CPODData.n worth of data ( in this case just one byte).

    On the other hand the WriteMarker(pFile, ePODFileMeshInterleaved, false, mesh.nNumVertex * mesh.sVertex.nStride)) method

    is storing a marker which correctly reflects the size of the vertex buffer.

    In the end the marker and the stride value stored in the POD file indicate the correct size of the buffer but the actual vertex stream stored in the file is smaller

    than that,which causes CPVRTModelPOD.ReadFromMemory to fail.

    Unless I am missing something here, this makes it impossible to create 4bytes aligned POD files.

    #33582

    Scott
    Moderator
    warmi wrote:
    Unless I am missing something here, this makes it impossible to create 4bytes aligned POD files.

     

    Hi,

     

    You’re correct in the current release this function does make it impossible to create 4 byte aligned POD files. For our 2.6 SDK release to incorporate data alignment in our POD exporters this function has been rewritten. If you send an email to devtech@imgtec.com we’d gladly send you the updated code though as it is still in development it may change between now and our next release and may contain bugs.

     

    Thanks,

     

    Scott
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.