Skip to content

write_mesh: options struct for backend-specific behavior #26

Description

@csparker247

Track: mesh-io-options_20260904

write_mesh dispatches on file extension across OBJ and PLY, which is the point of it — the caller says "write a mesh here" and does not care about the format. That works until a caller wants to influence backend behavior through the same call.

The immediate instance is PLY binary output (#25). That lands as a PLYFormat parameter on write_ply only, leaving write_mesh untouched, because a PLY-only value is meaningless for half of write_mesh's inputs and there is no good answer to what write_mesh("out.obj", mesh, PLYFormat::Binary) should do. Deferring it also avoided answering that badly under time pressure.

The general shape wanted eventually: an options struct passed to write_mesh carrying backend-specific settings, so callers can control encoding, precision, or writer behavior without dropping to the format-specific entry points and losing extension dispatch.

Open questions for whenever this is scoped:

  • One struct with per-backend nested sub-structs, or a variant selected by extension?
  • What happens when a caller passes options that do not apply to the dispatched backend — ignore silently, warn, or throw? Silent ignore is friendliest and also the easiest way to ship a bug where someone thinks they asked for binary and did not.
  • Does this subsume the format-specific parameters on write_ply/write_obj, or sit alongside them?

Not scoped or scheduled. Filed so the intention is discoverable rather than living only in a design conversation.

Follows from #25.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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