My actual goal here is to write N number of uv sets based on what assimp finds in a 3d model it’s importing. However everything I try outside of the below example to accommodate more than 3 uv channels (more than 2 sets) causes an instant crash for TD.
How would I modify the below code to add more than 1 set of uv point coordinates ?
for (int i = 0; i < scene->mMeshes[0]->mNumVertices; i++)
{
pos.x = scene->mMeshes[0]->mVertices[i][0];
pos.y = scene->mMeshes[0]->mVertices[i][1];
pos.z = scene->mMeshes[0]->mVertices[i][2];
output->addPoint(pos);
tex.u = scene->mMeshes[0]->mTextureCoords[0][i][0];
tex.v = scene->mMeshes[0]->mTextureCoords[0][i][1];
tex.w = scene->mMeshes[0]->mTextureCoords[0][i][2];
int numTextures = 1;
output->setTexCoord(
&tex,
numTextures, // number of texture layers. 1-8
i // point index we wish to apply these uv settings to.
);
}
Related issue in SimpleShapesSOP ?
If I take the SimpleShapesSOP sample c++ project straight out of the samples folder, and compile it, I get a working dll that I can load into a c++ SOP:
Next I plug another SOP into the c++ SOP that has 2 uv sets:
Looking at line ~400-425 in the SimpleShapes.cpp, I see this:
if (sinput->getTextures()->numTextureLayers)
{
textures = sinput->getTextures()->textures;
numTextures = sinput->getTextures()->numTextureLayers;
}
for (int i = 0; i < sinput->getNumPoints(); i++)
{
output->addPoint(ptArr[i]);
if (normals)
{
output->setNormal(normals[i], i);
}
if (colors)
{
output->setColor(colors[i], i);
}
if (textures)
{
//output->setTexCoord((float*)(textures + (i * numTextures * 3)), numTextures, i);
output->setTexCoord(textures + (i * numTextures), numTextures, i);
}
}
which leads me to believe that it’s trying to copy N number of uv sets depending on what the input has, though this seems to not be working:
It only copies one uv set, but interestingly it makes all the new data point attributes not vertex attributes.
I feel that this may be a related issue, but not sure. Including it as it’s reproducible with the included sample code.