74 [[nodiscard]]
bool running()
const;
76 bool open(
int width = 1280,
int height = 800,
bool resizable =
true,
77 std::string
const& window_name =
"UFOViz",
78 WGPUPowerPreference power_preference = WGPUPowerPreference_Undefined,
79 WGPUBackendType backend_type = WGPUBackendType_Undefined);
89 [[nodiscard]] WGPUDevice device()
const;
91 void addRenderable(std::shared_ptr<Renderable>
const& renderable);
101 void eraseRenderable(std::shared_ptr<Renderable>
const& renderable);
127 void clearRenderables();
129 [[nodiscard]] std::size_t numRenderables()
const;
131 void loadConfig(std::filesystem::path
const& config);
133 void saveConfig(std::filesystem::path
const& file)
const;
136 [[nodiscard]] WGPULimits requiredLimits(WGPUAdapter adapter)
const;
138 [[nodiscard]] WGPUTextureFormat surfaceFormat(
139 WGPUSurfaceCapabilities capabilities)
const;
141 void resizeSurface(
int width,
int height);
143 void updateCamera(
float dt);
145 bool initWindow(
int width,
int height,
bool resizable, std::string
const& title);
147 bool initWGPU(WGPUPowerPreference power_preference, WGPUBackendType backend_type);
156 void onMouseMove(
double x_pos,
double y_pos);
158 void onMouseButton(
int button,
int action,
int modifiers);
160 void onScroll(
double x_offset,
double y_offset);
162 void onKey(
int key,
int scancode,
int action,
int mods);
164 void updateViewMatrix();
167 GLFWwindow* window_ =
nullptr;
169 WGPUInstance instance_ =
nullptr;
170 WGPUSurface surface_ =
nullptr;
171 WGPUAdapter adapter_ =
nullptr;
172 WGPUDevice device_ =
nullptr;
173 WGPUQueue queue_ =
nullptr;
174 WGPUSurfaceConfiguration surface_config_ = WGPU_SURFACE_CONFIGURATION_INIT;
176 WGPUTextureFormat surface_preferred_format_ = WGPUTextureFormat_Undefined;
177 int surface_width_ = 0;
178 int surface_height_ = 0;
180 WGPUTextureFormat depth_texture_format_ = WGPUTextureFormat_Depth24Plus;
181 WGPUTexture depth_texture_ =
nullptr;
182 WGPUTextureView depth_view_ =
nullptr;
184 FineRGBA clear_color_ = FineRGBA(0.45f, 0.55f, 0.60f, 1.00f);
186 bool show_left_panel_ =
true;
187 bool show_right_panel_ =
true;
188 bool show_bottom_panel_ =
true;
189 int control_type_ = 0;
190 int projection_type_ = 0;
192 std::thread render_thread_;
198 std::vector<std::shared_ptr<Renderable>> renderables_;
201 float translation_speed_ = 2.5f;
202 float rotation_speed_ = 90.0f;
207 bool mouse_drag_ =
false;
209 Camera start_camera_state_ = {};
210 float mouse_sense_ = 1.0f;
211 float scroll_sensitivity_ = 0.1f;
213 std::vector<float> frame_times_;