I looked at the xml exporter in the samples folder. Yesterday I wrote some test codes as you suggested. The function SUTextureWriterWriteTexture() needs a texture_id. Yesterday I can’t find a function to get texture id of texture on face. Now I can get the texture id by loading face into texture write by calling the following function: SUTextureWriterLoadFace().
It seems that the comments of the function SUTextureWriterLoadFace() are wrong; the third and forth parameter should be out parameters; not in parameters.
@brief Loads a face object to a texture writer object in order to have its
front and/or back texture written to local disk.
@param[in] writer The texture writer object.
@param[in] face The face object.
@param[in] front_texture_id The texture ID of the front texture.
@param[in] back_texture_id The texture ID of the back texture.
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if writer or face is not a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if the face object has a front face texture
to write, and front_texture_id is NULL
- \ref SU_ERROR_NULL_POINTER_OUTPUT if the face object has a back face texture
to write, and back_texture_id is NULL
- \ref SU_ERROR_GENERIC if the face object does not a texture to write
SU_RESULT SUTextureWriterLoadFace(SUTextureWriterRef writer,
Then now I can generate a new texture after thinking the third/forth parameters as out parameters.
Here are my test codes.
SUTextureRef texture = SU_INVALID;
SUResult result = SUFaceGetFrontMaterial(m_skpface, &material);
if(SU_ERROR_NONE == SUMaterialGetTexture(material, &texture))
long frontId(0), backId(0);
result = SUTextureWriterLoadFace(texture_writer, m_skpface, &frontId, &backId);
long textureId = 0;
result = SUTextureWriterGetTextureIdForFace(texture_writer, m_skpface, bFrontMaterial, &textureId);
bool bIsAffine = false;
result = SUTextureWriterIsTextureAffine(texture_writer, textureId, &bIsAffine);
const char* path = "c:\\phenix.png";
result = SUTextureWriterWriteTexture(texture_writer, textureId, path, false);
Now my questions are:
- I don’t want to always generate a new texture when texture is not with distortion texture. Can I use the function SUTextureWriterIsTextureAffine() to check if a texture is a distortion texture?
- Whether or not there is other functions to get the texture id because i don’t want to get the texture id by the function “SUTextureWriterLoadFace()” because it always loads faces into texture writer.
- If I always load face into texture write, is there performance or capacity issue?
At last, thanks a lot for your support.