sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🚨 Skimp | 25% Off until March 30 Buy Now

    Uv c++ and sketchup

    Scheduled Pinned Locked Moved Developers' Forum
    1 Posts 1 Posters 305 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G Offline
      giuseppe500
      last edited by

      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/wrapped

      the 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.

      1 Reply Last reply Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better πŸ’—

      Register Login
      • 1 / 1
      • First post
        Last post
      Buy SketchPlus
      Buy SUbD
      Buy WrapR
      Buy eBook
      Buy Modelur
      Buy Vertex Tools
      Buy SketchCuisine
      Buy FormFonts

      Advertisement