Mon, 10/24/2022 - 09:28
I have a bunch of triangles, and all the information about the triangles including texture coordinates.
I want to convert these triangular faces into shapes and export them by RWGltf_CafWriter, so I want to know how to add texture coordinate information to the shape, so that the texture can be displayed correctly in gltf.
Mon, 10/24/2022 - 12:34
Hello,
To create a mesh face "Poly_Triangulation" should be used.
You can set Triangle's Vertexes (Node)
You can set Triangle's 'UV Vertexes (UVNode, 2d nodes, the same with TCoord, the number should be same with Node)
You can set Normals (if exists, the number is the same with Node) or can be generated by Poly::ComputeNormals
You can set Triangles (simple triangles only)
Best regards, Dmitrii.
Mon, 10/24/2022 - 17:16
Hi Dmitry,
Thank you very much for your reply. I have seen "Poly_Triangulation" before, but I am not sure it can work with "RWGltf_CafWriter"(it seems only support "TopoDS_Shape").
Do you know some way to convert "Poly_Triangulation" to "TopoDS_Shape" and keep the texture infomation for gltf?
Thanks with best regards.
Mon, 10/24/2022 - 18:02
Poly_Triangulation is the main part of the shape.
For example, to create a TopoDS_Face you can do the next one:
Best regards, Dmitrii
Tue, 10/25/2022 - 11:12
I wrote a test based the code you provided and it worked well. Thanks again.