Uv c++ and sketchup
-
hello.
I 'm creating a shetchup importer ,that use a texture atlas .
I'm a beginner and i wouldn't go inside the jungle of wrap/tile of texture atlas custom shaders.
my problem now is to recognize what are wrapped/tiled and what are not for process without atlas the tiled/wrapped textures.
I'm creating this function in c++:bool CMesh;;IsTiled() { std;;vector<TEXCOORD*>;;iterator itBegin = m_vTextureCoord.begin(); std;;vector<TEXCOORD*>;;iterator itEnd = m_vTextureCoord.end(); for(;itBegin != itEnd; itBegin++) if(abs((*itBegin)->U) >1 || abs((*itBegin)->V) >1) return true; if(m_pMaterial->GetTypeMaterial() == eTextureDouble){ std;;vector<TEXCOORD*>;;iterator itBegin = m_vTextureCoordBack.begin(); std;;vector<TEXCOORD*>;;iterator itEnd = m_vTextureCoordBack.end(); for(;itBegin != itEnd; itBegin++) if(abs((*itBegin)->U) >1 || abs((*itBegin)->V) >1) return true; } return false; }
but i see that this is wrong:
abs((*itBegin)->U) >1
i removed the abs():
if( ((*itBegin)->U) >1 || ((*itBegin)->U) <0)
return true;//is tiled/wrappedthe problem is that i have some texture UV of U = -0.4 V = 0.2 and with a simple atlas algorithm it work fine !
why?
the texture UV don't be from 0 to 1 ?this is the code for read from sketchup api the uv:
m_pApi->ImportVertexUV(&fu, &fv, &fw, &fub, &fvb, &fqb); TEXCOORD *ptUV = new TEXCOORD; ptUV->U = fu ; ptUV->V = 1- fv ;//this is added from me without explanations , only for ;"so 'works" BAD!!!! ptUV->W = fw; vVectorUV.push_back(ptUV); //ecc... //ecc...
how i can recognize uv and wrapped texture?
I heard that sketchup does not normalizes the coordinates uv, is it possible?
how do I normalizing if this is the problem?thanks.
Advertisement