simnalamburt / obj-rs

:shipit: Wavefront obj parser for Rust

Home Page:https://docs.rs/obj-rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Type structure

simnalamburt opened this issue · comments

Goals

  • Ease of use
  • Beauty
  • SIMD aware

Low-level API

Low-level API provides one-to-one correspondent rust binding of obj format.

Obj
name ← String
required mtl files ← Vec

vertices ← Vec
texture coordinates ← Vec
normals ← Vec
parametric vertices ← Vec

points ← Vec
lines ← Vec
polygons ← Vec

groups ← HashMap<String, Group>
meshes ← HashMap<String, Group>
smoothing_groups ← VecMap
merging_groups ← VecMap

Other types

Point ← index of vertex

Line ← [(index of vertex); 2]
Line ← [(index of vertex, index of texture coordinate); 2]

Polygon ← Vec
Polygon ← Vec<(index of vertex, index of texture coordinate)>
Polygon ← Vec<(index of vertex, index of normal)>
Polygon ← Vec<(index of vertex, index of texture coordinate, index of normal)>

Group
points ← Vec
lines ← Vec
polygon ← Vec

Range
start ← uint
end ← uint

Current version of Rust doesn't support non-power-of-2 simd type

High-level API

High-level API wraps low-level API and makes it easy to interoperate with OpenGL. It triangulates polygons, normalizes indices, etc.