Skip to content

Generate vertex tangents for OBJ files #266

@GrantMoyer

Description

@GrantMoyer

Currently, rendy::mesh::obj::load_from_obj() does not generate vertex tangents when loading OBJ files. This prevents OBJ files from being used with Amethyst's RenderBundle's RenderPbr3D plugin, which needs vertex tangents.

I can implement this, but I want to determine if this is a desired feature, and if so, what tradeoffs are preferred before I start. There are 3 ways I see to implement this:

  1. Just generate the tangents all the time
  • + Just works
  • - Wastes CPU cycles if tangents aren't needed
  1. Add a boolean parameter to specify if tangents are desired
  • - Breaks API
  • - Inflexible; tangents treated as more special than other vertex attributes
  1. Make load_from_obj generic over a new trait and implement the trait for Vec<A> where A: AsVertex and tuples of those types
  • + Leaves room for future extension
  • - Breaks API
  • - Adds type complexity

My intuition is that 1 is the best option if OBJ loading time is considered negligible, and 3 is the best option otherwise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions