▲ | galangalalgol 2 days ago | |||||||||||||||||||||||||
Without lifetimes arcs boxes or refcells do you have a lot of clones? Or a lot of unsafe? Or is it mostly single threaded? | ||||||||||||||||||||||||||
▲ | mvx64 2 days ago | parent [-] | |||||||||||||||||||||||||
It's all single threaded. Just structs being passed around. For example, the mesh drawing call is: drawmeshindexed(m: &Mesh, mat: &Mat4x4, tex: &Image, uv_off: &TexCoord, li: &LightingInfo, cam: &Camera, buf: &mut Framebuffer) so there is also no global state/objects. All state is passed down into the functions. There were some cases that RefCells came in handy (like having an array of references of all models in the scene) and lifetimes were suggested by the compiler at some other similar functions, by I ended up not using that specific code. To be clear, I have nothing against those (on the contrary), it just happened that I didn't need them. One small exception: I have a Vec of Boxes for the scenes, as SceneCommon is an interface and you can't just have an array of it, obviously. | ||||||||||||||||||||||||||
|