Skip to content

Add some progress/callback for file loading #27

@P1nkL1on

Description

@P1nkL1on

Just asking about some progress callback API. It would be convenient to pass something like OpenImage::ProgressCallback onto the rapidobj::ParseFile. E.x.

/// Pointer to a function called periodically by ParseFile.
/// It returns a bool, which if 'true' will STOP the read.
typedef bool (*ProgressCallback)(float portion_done);

inline Result ParseFile(
    const std::filesystem::path& obj_filepath,
    const MaterialLibrary&       mtl_library = MaterialLibrary::Default(),
    const ProgressCallback&      progress_callback = nullptr);

As shown, it also can be used to terminate the reading, returning an error probably. It's a QoL for loading large files / using slow PC.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions