Skip to content

Implement fast quaternion operations #163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Srekel opened this issue Nov 26, 2022 · 6 comments
Open

Implement fast quaternion operations #163

Srekel opened this issue Nov 26, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@Srekel
Copy link
Member

Srekel commented Nov 26, 2022

Don't have time to write a proper issue but this seemed interesting :)

https://twitter.com/FreyaHolmer/status/1596157832688279552

https://twitter.com/FreyaHolmer/status/1596286428920836096

Cool stuff by Freya!

@crystalthoughts
Copy link

I'd go one further and suggest:
https://github.com/jeremyong/klein

I started to port it but hit a wall. If there's interest...?

@michal-z
Copy link
Collaborator

michal-z commented Dec 8, 2023

I'd go one further and suggest: https://github.com/jeremyong/klein

I started to port it but hit a wall. If there's interest...?

There is interest, sure. I can try to help. What problem do you have?

@crystalthoughts
Copy link

crystalthoughts commented Dec 8, 2023

I'll clean up the repo and make it public and then perhaps we can discuss it further :)
I had to translate the C SIMD intrinsic routines to zig's more basic vector syntax and I was getting different results to the original library. (Only got through about 15% of the full lib so far)

It might take a few weeks or more for me to find the time!

@crystalthoughts
Copy link

crystalthoughts commented Dec 8, 2023

It may also be quicker to create a C interface instead of reimplementing it fully - but I was unsure about how that would affect memory allocation and lifetimes (new to systems stuff especially FFI). Can you use a custom allocator in zig when the library calls a C++ class constructor for example?

@hazeycode hazeycode added the enhancement New feature or request label Jan 10, 2024
@mochalins
Copy link
Contributor

It may also be quicker to create a C interface instead of reimplementing it fully - but I was unsure about how that would affect memory allocation and lifetimes (new to systems stuff especially FFI). Can you use a custom allocator in zig when the library calls a C++ class constructor for example?

Unfortunately, if you're linking to a compiled C library and that library uses traditional malloc or new, etc..., you also have to link in libc/libcpp.

Just my 2c but I think the tradeoff would probably be worth it to get a working layer over the C library into zig-gamedev. Having such a layer working would make further Zig conversion dev work easier, having a backup in case of regressions/incompatible behavior, etc...

@hazeycode
Copy link
Member

hazeycode commented Jan 10, 2024

Often C libs expose a way to override their allocator. We use do this in zstbi for example, see https://github.com/zig-gamedev/zig-gamedev/blob/main/libs/zstbi/libs/stbi/stb_image.c

If a C library doesn't expose a way to override malloc/free it's worth considering making this change upstream or just hacking it using the preprocessor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy