hello.
Is possible in sketchup make all the used texture an unique texture?
like a texture atlas ?
Or i must do it in a plugin?
Posts
-
Unique texture
-
RE: Importer in the same wind order
thanks TIG.
Now i must find a method for import all faces in correct wing order:
1)i see that there is a m_pMesh->GetPolygonPointIndex(m_nCurrPoly+1, m_nCurrPoint+1, &m_idx);
is sufficent have the correct indexes of the vertexes for import all in the correct windorder ?
2) or i must separate the importation of vertexes like the sketchup example SkpToXml of the sdk?
The sample project do that:
extract the loopshr = pFace->get_Loops(&pLoops);
long nLoops;
hr = pLoops->get_Count(&nLoops);//If this is a simple face (no loops)
if (nLoops==1){/////////////////////////////////////////////////////////////////is a simple face
//import vertex in counterclockwise orderCComPtr<ISkpLoop> pLoop;
hr = pFace->get_OuterLoop(&pLoop);
CComPtr<ISkpVertices> pVerts;
hr = pLoop->get_Vertices(&pVerts);
}
else ///////////////////////////////////////////////////////////////////is a complex face tessellate it with:pFace->CreateMeshWithUVHelper(3, pUVHelper, &pMesh);
and imports vertex in clockwise order?????
//there i must place the m_pMesh->GetPolygonPointIndex??? and import in specific order????
ecc....is sufficent????
Thanks a lot.
-
Importer in the same wind order
hello.
I'm trying to finish a sketchup importer for opengl in c++ .
My problem is that the shaders that represent the materials of sketchup are five:
1)front color back color
2)front color back texture
3)texture front, back color
4)double color
5)double texture.in these shaders i use the gl_frontfacing (that return true if the face is front and false if the face is back )for draw the different materials.
For example ,in case 2: in the pixel shader:if(gl_frontFacing)
{
gl_color = frontColor
}
else
{
gl_color = texture color
}ecc...
I see that the gl_frontFacing return true if the vertexes are in counterclockwise order or the opposite, i'm not remember good, The problem is that in my importer i have some faces that are counterclockwise and others that are clockwise , then i get a wrong model.
I think that the problem is the indexes order of the vertexes , how i can get all the faces in an unique wind order?
thanks. -
Face material not set
hello.
I created a sketchup importer in c++ for opengl.
I have a problem:
Is possible to know if a face material is not set?
Whitout read his color?
For exemple if i set a texture on a face in front texture , and nothing on back face,is possible to know this "not set" material?
with the c++ sdk.
thanks. -
RE: Gui api in sketchup
If i can make a c++ extension(i don't know how) i can call c++ functions from the ruby gui!
is possible?
How i can make a c++ extension ?
There is some documentation or specifics?Thanks
-
Gui api in sketchup
hello.
Is possible to use some gui(graphical user interface) in sketchup ?
and is possible to program the gui in c++ ?
I wish find some plugin that do this for see how to do in c++ sources.
What do you advice to me ?
only opensurce clearly.Thanks.
-
RE: Reverse face and uv
I don't have really clear what are the difference between faces and reversed faces, so in my importer i use an atlas and I calculate the new uv with an
newU = abs(U) * scaleMatrixU + offsetU;
newV = abs(V) * scaleMatrixV + offsetV;and this in non reversed face seems correct , the problem is when i have a reverse face , the texture UV are wrong .
if i don't use the abs the UV are wrong at all both in reversed that in non reversed faces.
But what mean a negative U or a negative V in sketchup?
is a form of tile or wrap?
I not understandthanks.
-
Reverse face and uv
Hello.
I'm creating a sketchup importer in c++ and opengl.
I have a problem with th UV mapping.
I see that in sketchup the uvs can be positive or negative , and if i reverse a face the UV changes , but is not only inverted the sign , whats changes and how i can import it in opengl system UV. -
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.
-
RE: Sketchup front back face
thanks tig.
I understand, you were very kind, but I just can not find property Normal.
I'm Using sketchup 8 and C + +, perhaps in the 'SDK for C + + is called in another way.
can 'be?
else:
I have seen examples in the SDK that tests if the loops are == 1, and the commentary says it is a simple face, if not then use the "== 1" it use the
"CreateMesh (PolygonMeshPoints | PolygonMeshNormals, m_pPerspective, & m_pMesh);"
in this case the faces are always counter-clockwise or do I need to know the normal property ?
I see that there is a property get_Plane, i can use this?
but how?
thanks.ps sorry for my english
-
Sketchup front back face
hello.
I have created a sketchup importer for opengl 2 in c++.
My problem is that i wish recognize if a face is front face or backface.
I'm ispired from the skpToXml demo , and i read about outer loop and inner loop.
When I'm import simple models all work , but for certain models i don't see part of the scene or textures are flipped.
then:1)is possible recognize a front/back face from the importer(not in the shader)?How?
2)is possible that a complex face ( nLoops>1 like the example skpToXml)is a back face? because i read that outer loop are always in ccg order or always cw i dont remember.I'm trying to flip all the backface or flip all the front face for reach an uniformity(all front face or all back face), this clearly is all to do only in importation phase , then i create a custom xml or serialize all in binary for speed up the loading.
In the shader i see if a face is a front face or back face with the FACE semantic (is automatic and already done), in cg for example FACE return < 0 if the face is a backface and > 0 if the face is a front face.
Thanks.
-
Back face front face?
hello.
I have created a sketchup importer for opengl 2 in c++.
My problem is that i wish recognize if a face is front face or backface.
I'm ispired from the skpToXml demo , and i read about outer loop and inner loop.
When I'm import simple models all work , but for certain models i don't see part of the scene or textures are flipped.
then:1)is possible recognize a front/back face from the importer(not in the shader)?How?
2)is possible that a complex face ( nLoops>1 like the example skpToXml)is a back face? because i read that outer loop are always in ccg order or always cw i dont remember.I'm trying to flip all the backface or flip all the front face for reach an uniformity(all front face or all back face), this clearly is all to do only in importation phase , then i create a custom xml or serialize all in binary for speed up the loading.
In the shader i see if a face is a front face or back face with the FACE semantic (is automatic and already done), in cg for example FACE return < 0 if the face is a backface and > 0 if the face is a front face.
Thanks.