Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions code/lab/dialogs/lab_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,15 @@ void LabUi::build_options_menu()
{
with_Menu("Options")
{
bool show_widget_menu = getLabManager()->Renderer->getShowOrientationWidget();
MenuItem("Render options", nullptr, &show_render_options_dialog);
MenuItem("Object selector", nullptr, &show_object_selection_dialog);
MenuItem("Background selector", nullptr, &show_background_selection_dialog);
MenuItem("Object options", nullptr, &show_object_options_dialog);
MenuItem("Controls reference", nullptr, &show_controls_reference_dialog);
if (MenuItem("Show orientation cube widget", nullptr, show_widget_menu)) {
getLabManager()->Renderer->setShowOrientationWidget(!show_widget_menu);
}
MenuItem("Reset View", nullptr, &reset_view);
MenuItem("Close lab", "ESC", &close_lab);
}
Expand Down Expand Up @@ -521,6 +525,7 @@ void LabUi::show_render_options()
float emissive_factor = ltp::lab_get_emissive();
float exposure_level = ltp::current_exposure();
auto ppcv = ltp::lab_get_ppc();
show_orientation_widget = getLabManager()->Renderer->getShowOrientationWidget();

bool skip_setting_light_options_this_frame = false;

Expand Down Expand Up @@ -570,6 +575,7 @@ void LabUi::show_render_options()
Checkbox("Hide particles", &no_particles);
Checkbox("Render as wireframe", &use_wireframe_rendering);
Checkbox("Orthographic projection", &use_orthographic_projection);
Checkbox("Show orientation cube widget", &show_orientation_widget);
Checkbox("Render without light", &no_lighting);
Checkbox("Render with emissive lighting", &show_emissive_lighting);
SliderFloat("Light brightness", &light_factor, 0.0f, 10.0f);
Expand Down Expand Up @@ -690,6 +696,7 @@ void LabUi::show_render_options()
getLabManager()->Renderer->setRenderFlag(LabRenderFlag::MoveSubsystems, animate_subsystems);
getLabManager()->Renderer->setRenderFlag(LabRenderFlag::NoParticles, no_particles);
getLabManager()->Renderer->setRenderFlag(LabRenderFlag::UseOrthographicProjection, use_orthographic_projection);
getLabManager()->Renderer->setShowOrientationWidget(show_orientation_widget);
getLabManager()->Renderer->setEmissiveFactor(emissive_factor);
getLabManager()->Renderer->setAmbientFactor(ambient_factor);
getLabManager()->Renderer->setLightFactor(light_factor);
Expand Down
1 change: 1 addition & 0 deletions code/lab/dialogs/lab_ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class LabUi {
bool show_emissive_lighting = false;
bool show_particles = true;
bool use_orthographic_projection = false;
bool show_orientation_widget = true;

std::optional<vec3d> volumetrics_pos_backup = std::nullopt;
};
21 changes: 18 additions & 3 deletions code/lab/manager/lab_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,28 @@ void LabManager::onFrame(float frametime) {
int dx, dy, dz;
mouse_get_delta(&dx, &dy);
mouse_get_wheel_delta(nullptr, &dz);
int mouse_x = 0;
int mouse_y = 0;
mouse_get_pos(&mouse_x, &mouse_y);

const bool lmb_down = mouse_down(MOUSE_LEFT_BUTTON) != 0;
bool lmb_pressed = lmb_down && !LastLmbDown;
LastLmbDown = lmb_down;

if (lmb_pressed && ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow)) {
lmb_pressed = false;
}

if (dz != 0 && ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow)) {
dz = 0;
}
Renderer->getCurrentCamera()->handleInput(dx, dy, dz, mouse_down(MOUSE_LEFT_BUTTON) != 0, mouse_down(MOUSE_RIGHT_BUTTON) != 0, key_get_shift_status());
auto& current_camera = Renderer->getCurrentCamera();
current_camera->handleInput(
dx, dy, dz, lmb_down, lmb_pressed, mouse_down(MOUSE_RIGHT_BUTTON) != 0, key_get_shift_status(), mouse_x, mouse_y);

if (!Renderer->getCurrentCamera()->handlesObjectPlacement()) {
if (mouse_down(MOUSE_LEFT_BUTTON)) {
if (!current_camera->handlesObjectPlacement()) {
const bool over_camera_overlay = Renderer->getShowOrientationWidget() && current_camera->isOverlayHit(mouse_x, mouse_y);
if (lmb_down && !over_camera_overlay) {
angles rot_angle;
vm_extract_angles_matrix_alternate(&rot_angle, &CurrentOrientation);

Expand Down
1 change: 1 addition & 0 deletions code/lab/manager/lab_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ class LabManager {
//float Lab_thrust_len = 0.0f; // Unused
bool Weapons_loaded = false;
bool CloseThis = false;
bool LastLmbDown = false;
LabUi labUi;

void changeShipInternal();
Expand Down
Loading
Loading