Sign in to follow this  
giugio

texture coord and scale

Recommended Posts

Hello.
I'm trying to create a sketchup importer , This is the first chunk of code :
[code]

double fu, fv, fw;
double fub , fvb, fqb;
fub = fvb = fqb = 0.;
fu = fv = fw = 0.;
m_pApi->ImportVertexUV(&fu, &fv, &fw, &fub, &fvb, &fqb);
TEXCOORD *ptUV = new TEXCOORD();
ptUV->U = fu *0.78;
ptUV->V = (1 - fv);
ptUV->W = fw;

vVectorUV.push_back(ptUV);

TEXCOORD *ptUVb = new TEXCOORD();
ptUVb->U = fub;
ptUVb->V =( 1 -fvb);
ptUVb->W = fqb;

vVectorUVBack.push_back(ptUVb);
[/code]

where
m_pApi->ImportVertexUV(&fu, &fv, &fw, &fub, &fvb, &fqb);
&fu, &fv, &fw are the first UV for front face
and
&fub, &fvb, &fqb are the coord of back face .

I have for each texture an x scale and an y scale
[code]
if(pTexture != NULL)
{
BSTR texturePath = NULL;
hr = pTexture->get_Filename(&texturePath);
std::string bstrFilename = GetFileName(texturePath);
_bstr_t szTexturePath(bstrFilename.c_str());

double width = 0;
double height = 0;
hr = pTexture->get_XScale(&width);
hr = pTexture->get_YScale(&height);

[code]

the resulting textures are not precises , may be the problem are the x and y scale?
I must multiply the scale for the uv coord ?

thanks.

Share this post


Link to post
Share on other sites
Keeping in mind that I know nothing about sketchup, I am extremely skeptical that you're supposed to the multiplying the u/v/w coordinates by anything, and that reversing v seems to imply that you're loading your textures upside down.

Share this post


Link to post
Share on other sites
Also, why would you multiply the front U by 0.73 and not the back U, if at all?

Probably unrelated to your issue: a front [i]and[/i] back UV set??? Im new to programming but not 3d and although you can have more than one UV set, having a front and back UV is something Ive not seen. Is this specific to something your doing? Then again a backface UV set would just be the numerical reverse of the front set. . .

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this