Dear Mike and Dear Forum Users,
Please, i'd like to put two questions:
the first is how to retrive material information in a SoCallbackAction performing triangle vertex and normal collection as in the code below showed
The second question is a little bit more complicated (as to me): is it possible to perform a partition or a part splitting starting from a complex shape node?
These questions arise from the following neccesity:
For example i have a inverntor or VRML 3d model file containing material informations, as the image below
Immagine 2020-11-24 111805.jpg
i'd like to split the main model into three pieces so i can be able to call the "TriangleCallbackSimpe" and apply the different material found to the three sub-nodes
in order to have both triangle-normal and material informations.
I hope my trouble is well explained; please ask if my request isn't clear.
Many thanks in advance for Your help and suggestions.
Best Regards,
Vincenzo
Please, i'd like to put two questions:
the first is how to retrive material information in a SoCallbackAction performing triangle vertex and normal collection as in the code below showed
Code:
void TriangleCallbackSimple(void *userData, SoCallbackAction *action, const SoPrimitiveVertex *v1, const SoPrimitiveVertex *v2, const SoPrimitiveVertex *v3) { SoMyCustomSahepNode* pToThis = (SoMyCustomSahepNode*)userData; ASSERT(pToThis != NULL); if (pToThis == NULL) return; SbVec3f v[3] = { v1->getPoint(), v2->getPoint(), v3->getPoint() }; pToThis->m_vTriangleVertex.push_back(v[0]); pToThis->m_vTriangleVertex.push_back(v[1]); pToThis->m_vTriangleVertex.push_back(v[2]); pToThis->m_vTriangleNormal.push_back(v1->getNormal()); pToThis->m_vTriangleNormal.push_back(v2->getNormal()); pToThis->m_vTriangleNormal.push_back(v3->getNormal()); }
These questions arise from the following neccesity:
For example i have a inverntor or VRML 3d model file containing material informations, as the image below
Immagine 2020-11-24 111805.jpg
i'd like to split the main model into three pieces so i can be able to call the "TriangleCallbackSimpe" and apply the different material found to the three sub-nodes
in order to have both triangle-normal and material informations.
I hope my trouble is well explained; please ask if my request isn't clear.
Many thanks in advance for Your help and suggestions.
Best Regards,
Vincenzo
Comment