Input UV map format
The UV map format used by the packer contains information about UV vertices and UV faces and how they relate (which vertices form a given face). Using this information the packer divides faces to UV islands by itself. After that it sends this division to the application using the UvpIslandsMessgeT message (so the application doesn’t have to maintain island information by itself).
A UV map is passed to the packer using the m_UvData member of the UvpOperationInputT class. The application has to convert the UV map from its internal format into two arrays:
- UV vertex array (array of objects of the UvVertT type)
- UV face array (array of objects of the UvFaceT type).
The application has to store the pointer to the UV vertex array in the m_pVertArray field and the pointer to the UV face array in the m_pFaceArray filed of the m_UvData member.
The packer does not take ownership over any of these arrays - it only reads UV information from pointers provided by the application. The application has to maintain memory allocations pointed by these arrays by itself and it has to make sure they are eventually deallocated after the operation is done.
UV VALIDITY
In order for UV data to be processed correctly by the packer, the following conditions must be satisfied:
- every UV face must consist of at least 3 vertices.
- no UV face can contain duplicated vertices i.e. the same vertex index cannot be present in the m_Verts array of a single UV face twice. A single vertex may be part of many different UV faces though. Also a single UV face may contain different vertices having exactly the same UV coordinates.
The application has to be written in such a way that the above conditions are always satisfied, otherwise the result of the packing operation will be undefined. The validate method checks whether the above conditions are satisfied, though it should only be used when debugging the application (not in production).