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!
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Uv c++ and sketchup

    Scheduled Pinned Locked Moved Developers' Forum
    1 Posts 1 Posters 254 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
      • 1 / 1
      • First post
        Last post
      Buy SketchPlus
      Buy SUbD
      Buy WrapR
      Buy eBook
      Buy Modelur
      Buy Vertex Tools
      Buy SketchCuisine
      Buy FormFonts

      Advertisement