PistonDevelopers / geometry

A structure for storing and look up 3D geometry
MIT License
6 stars 2 forks source link

Transforming OBJ uv and normal index to vertex buffer #19

Closed bvssvni closed 9 years ago

bvssvni commented 9 years ago

Geometry::add_geometry should construct vertices when reading indices, but also push new indices to an index buffer. The new index buffer can remove duplicate vertices in a separate step.

The number of uvs and normals must either be 0 or match the number of positions.

pub enum VertexFormat {
    Position,
    PositionTexture,
    PositionNormal,
    PositionTextureNormal,
}
pub enum VertexFormatError {
    ExpectedSameVertexFormatPerGeometry,
}

The custom vertex format must implement Default, and piston-quack can be used to get/set position, texture and normal coordinates.

Should return (Geometry, Result<VertexFormat, VertexFormatError>).