lo48576 / fbxcel-dom

FBX DOM library for Rust. // See https://github.com/lo48576/fbx-viewer for working example application // rework (total rewrite) is planned
Apache License 2.0
24 stars 10 forks source link

Add more examples #8

Open virtualritz opened 3 years ago

virtualritz commented 3 years ago

Specifically, an example of how to load a mesh made of n-gons and different indices for normal/uv data. How would I get to the data of such a mesh?

I.e. I do not want a triangulated mesh, I want the original n-gon data.

On that note: does fbxcel have options to fix meshes with disconnected faces on import? I.e. if a mesh has faces referring to different vertices in the index but the positions of these vertices are equal, in 3D?

lo48576 commented 3 years ago

To get raw vertex (called "control point" in FBX), you should get control point index at first. A polygon (n-gon) is described as a list of "polygon vertex"es, which is a list of pairs of a "control point index" and polygon end marker (i.e. whether the vertex is the last one of the current n-gon). You can get a polygon vertex from "polygon vertex index" and PolygonVertices, and yes, currently there is no way for users to get raw n-gon...!! I completely missed that. 😭

lo48576 commented 3 years ago

And, about merging different vertices at the same position, no it is not supported. There are many multi-level "mapping" types from one index type to another index type (see MappingMode and ReferenceInformation). I've thought it is very hard to deduplicate these info. Merging some "control point"s can break every other indices at any level.