rust3ds / citro3d-rs

Rust bindings and safe wrappers for citro3d
https://rust3ds.github.io/citro3d-rs
14 stars 11 forks source link

[Feature] Indexed drawing #42

Open 0x00002a opened 9 months ago

0x00002a commented 9 months ago

This adds a wrapper for C3D_DrawElements which is index based drawing. It is marked unsafe for reasons which are explained in the doc comment and #41. I've also added an example to both test it works and demonstrate its usage

Meziu commented 9 months ago

Quick drop-in opinion: I don’t think it makes sense to have unsafe wrappers to what could definitely be safe functions. I would much rather these functions to be defined using the already existing wrapping functionality (like LinearAllocator requirements rather than generic “pointer is linear” functions). Not saying these tools aren’t useful or good, but the objective of this crate is to provide a safe overlay, above all things.

0x00002a commented 9 months ago

Quick drop-in opinion: I don’t think it makes sense to have unsafe wrappers to what could definitely be safe functions. I would much rather these functions to be defined using the already existing wrapping functionality (like LinearAllocator requirements rather than generic “pointer is linear” functions). Not saying these tools aren’t useful or good, but the objective of this crate is to provide a safe overlay, above all things.

Yeah so I agree on both points. The first one see #41 for the issues there, for the second one I would like to statically ensure that its in linear memory but I don't think we can do that without requiring some kind of wrapper like LinearVec or something (which is actually what I do in my downstream code, but thats not a library so it can be more opinionated about data storage)