1
Support / How do I read UV values?
« on: March 25, 2013, 09:35:28 am »
Hello,
When I searched the boards, I found this way to calculate the posion of Uvs.
float fX = (sourceTexture.width) * UVs[0].x;
float fY = (sourceTexture.height) * UVs[2].y;
float fX2 = (sourceTexture.width) * UVs[1].x;;
float fY2 = (sourceTexture.height) * UVs[0].y;
float fWidth = fX2 - fX;
float fHeight = -(fY2 - fY);
Almost of all sprite has no problem with this code,
but just some of sprites in the same Collection has got a problem.
They have zero value for 'fWidth'
I attached a JPG.
As you see, some of my sprites has the same value for Uvs[0].x and Uvs[1].x
What is the problem?
How can I read the value of Uvs?
Help me please~~
When I searched the boards, I found this way to calculate the posion of Uvs.
float fX = (sourceTexture.width) * UVs[0].x;
float fY = (sourceTexture.height) * UVs[2].y;
float fX2 = (sourceTexture.width) * UVs[1].x;;
float fY2 = (sourceTexture.height) * UVs[0].y;
float fWidth = fX2 - fX;
float fHeight = -(fY2 - fY);
Almost of all sprite has no problem with this code,
but just some of sprites in the same Collection has got a problem.
They have zero value for 'fWidth'
I attached a JPG.
As you see, some of my sprites has the same value for Uvs[0].x and Uvs[1].x
What is the problem?
How can I read the value of Uvs?
Help me please~~