Skip to content

Interesting lib design #2

@attilaz

Description

@attilaz

This is not an issue, I just didn't manage to add a comment on your article with a twitter account...

I really like this lean and mean API design. Probably needs a higher level interface for adding removing bodies/colliders etc but it is very easy to add on top of this. And I think an interface like this is way better than traditional OO interfaces like bullet3d with a hundred .h files and tons of classes with public functions and of course ( with private/protected stuffz that a user didn't really care about)

About the multithreading, how about an interface like this?

generateJobs(JobsData* j);
bool doJob(JobsData* j, int processJobCount);
void waitForJobs(JobsData* j)

threads could call doJob so JobsData needs to be thread-safe, I think an atomic int could be enough for stepping.
JobsData could also store number of finished jobs with atomic int for waiting, or could implementing with some higher level multithreading primitive to avoid spinning.

or instead of the two fuction ( doJob, waitForJobs) maybe
bool doJob(JobsData* j, int processJobCount, bool waitForFinish);

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