qu3e icon indicating copy to clipboard operation
qu3e copied to clipboard

C API?

Open rweichler opened this issue 9 years ago • 5 comments

Any chance of getting one for this library? I'm using another language and can only interface with C.

rweichler avatar Sep 04 '16 00:09 rweichler

I'd be happy with an alternate C api. I don't have the time to do this myself but the code here is written in a way that lends itself to a port. It could be straight-forward of a task. If anyone coming along and reading here, contributing a C api could be a great way to contribute to the library! I'd be happy to take a look at and merge a pull request for this.

RandyGaul avatar Sep 04 '16 00:09 RandyGaul

Oh wow thanks for the fast response. I'll take a look and see if I can port it myself, then.

rweichler avatar Sep 04 '16 00:09 rweichler

Cool! I would suggest looking mostly at q3scene.h and q3body.h, and then perhaps wrapping whatever you like in a C api, perhaps in a header (like q3_c.h or something). The math is already in C format. The only other file I could imagine someone would want exposed is q3Box.h, but scene and body are the main two. I think that's all anyone would need to know to as far as the API goes :)

RandyGaul avatar Sep 04 '16 00:09 RandyGaul

Good to know!

Another question: Is it trivial to implement variable timestep? It seems like I just have to pass in a dt in q3Scene::Step() and set it here: https://github.com/RandyGaul/qu3e/blob/a7c7199d3a0c4ebbe4cc966b8fc9dfa708b8925c/src/scene/q3Scene.cpp#L89

Would this work as expected? Or would there be side effects?

rweichler avatar Sep 04 '16 01:09 rweichler

You can add in variable timestep if you like. The only downside is the lack of floating point determinism (which may or may not matter depending on what you're doing).

RandyGaul avatar Sep 04 '16 01:09 RandyGaul