asny / three-d

2D/3D renderer - makes it simple to draw stuff across platforms (including web)
MIT License
1.34k stars 110 forks source link

Run three-d from egui app #440

Closed enomado closed 9 months ago

enomado commented 9 months ago

I have an egui app under eframe and egui_dock.

I want tab with 3d scene. I almost resurrect an old https://github.com/emilk/egui/commit/636a39cbe122ce91ea554920ee7aa4475d8f2de7 example

I want to proxy egui context events to FrameInput events to have camera controls, picking.

But I cant create struct like LogicalPoint( because of pub(crate) ).

Looks like it was designed to be created only inside three-d by handle_winit_window_event helper for now.

How do you think - is it possible at all / is it good idea / should i try something else?

asny commented 9 months ago

That's a really good question. The whole converting between physical and logical pixels have been quite messy, but after a239ca4 I've removed logical pixels (LogicalPoint) entirely from the public API. So now, the position in the events are defined in physical pixels (PhysicalPoint) which is possible to create from outside of the three-d crate. This means you can create the events yourself and don't have to rely on FrameInputGenerator.