Hi all,
I searched for a while and browsed this forum but I can’t find a clear and definitive answer so… I decided to ask
I want to modify the converter from my firm format to Sketchup that uses the C API so that I can set the vertex normal vectors even maybe have different normal vectors for a vertex wether it is in a face or another…
The vertices and face are are created the following way:
SUGeometryInputRef skpGeomInput;
SUSetInvalid(skpGeomInput);
SUGeometryInputCreate(&skpGeomInput);
// we add all the object vertices to the geometry input
SUPoint3D * objectVtx = new SUPoint3D[object.nb_sommet];
getObjectVertices(sdmdb, iobj, object.nb_sommet, objectVtx);
SUGeometryInputSetVertices(skpGeomInput, object.nb_sommet, objectVtx);
and the faces are created a little further:
SUPoint3D * faceVtx = new SUPoint3D[nbVertex];
for(ivtx = 0; ivtx < nbVertex; ivtx++)
{
int skpVtxIndex = face.ind_sommet[ivtx];
skpFaceVtxIndices[ivtx] = skpVtxIndex;
SULoopInputAddVertexIndex(skpFaceLoop, skpVtxIndex);
faceVtx[ivtx] = objectVtx[skpVtxIndex];
}
if(computeArealNormalVectorLength(nbVertex, faceVtx) > EPS)
{
// since at this point we are sure to create the face, we deal with the shading
if((aspectFaceComplet.type_omb == GOURAUD)||(aspectFaceComplet.type_omb == PHONG))
{
for(ivtx=0; ivtx < nbVertex; ivtx++)
SULoopInputEdgeSetSmooth(skpFaceLoop, ivtx, true);
}
SUGeometryInputAddFace(skpGeomInput, &skpFaceLoop, &skpFaceIndex);
// if we have to convert the materials, we set its aspect
if(_convertMaterials)
createFaceTextureAndColor(sdmdb, iobj, iface, sdmMat, sdmMot, aspectFaceComplet, skpFaceIndex, skpFaceVtxIndices, nbVertex, &skpGeomInput);
}
delete [] faceVtx;
Is there a way to do that ?
Thanks for your help and have a good day