Skip to content

Commit

Permalink
allow eye spacing to be negative
Browse files Browse the repository at this point in the history
  • Loading branch information
ohgodhowdidthisgethere committed May 6, 2017
1 parent 227d83c commit 127f37a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/common/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ trance_pb::System get_default_system()
system.set_enable_vsync(true);
system.set_renderer(trance_pb::System::MONITOR);
system.mutable_draw_depth()->set_draw_depth(.5f);
system.mutable_eye_spacing()->set_eye_spacing(.5f);
system.mutable_eye_spacing()->set_eye_spacing(1.f / 16);
system.set_image_cache_size(64);
system.set_animation_buffer_size(32);
system.set_font_cache_size(8);
Expand All @@ -465,7 +465,7 @@ void validate_system(trance_pb::System& system)
system.mutable_eye_spacing()->set_eye_spacing(1.f / 16);
}
system.mutable_eye_spacing()->set_eye_spacing(
std::max(0.f, std::min(1.f, system.eye_spacing().eye_spacing())));
std::max(-1.f, std::min(1.f, system.eye_spacing().eye_spacing())));
system.set_image_cache_size(std::max(16u, system.image_cache_size()));
system.set_animation_buffer_size(std::max(8u, system.animation_buffer_size()));
system.set_font_cache_size(std::max(2u, system.font_cache_size()));
Expand Down
5 changes: 3 additions & 2 deletions src/creator/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ namespace

const std::string EYE_SPACING_TOOLTIP =
"Distance between the view for each eye in VR. Adjust this if the 3D effects are "
"out-of-sync or difficult to focus on. The default value is .0625.";
"out-of-sync or difficult to focus on. This can also be made negative to correct "
"problems where the left and right eyes are swapped. The default value is .0625.";
}

SettingsFrame::SettingsFrame(CreatorFrame* parent, trance_pb::System& system)
Expand Down Expand Up @@ -123,7 +124,7 @@ SettingsFrame::SettingsFrame(CreatorFrame* parent, trance_pb::System& system)
_font_cache_size->SetValue(_system.font_cache_size());
_draw_depth->SetToolTip(DRAW_DEPTH_TOOLTIP);
_eye_spacing->SetToolTip(EYE_SPACING_TOOLTIP);
_eye_spacing->SetRange(0., 1.);
_eye_spacing->SetRange(-1., 1.);
_eye_spacing->SetIncrement(1. / 128);
_eye_spacing->SetValue(_system.eye_spacing().eye_spacing());

Expand Down
2 changes: 1 addition & 1 deletion src/trance/director.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void Director::render_image(const Image& image, float alpha, float zoom_origin,
x_flip ? 0.f : 1.f, y_flip ? 1.f : 0.f, x_flip ? 1.f : 0.f, y_flip ? 1.f : 0.f});
};

for (int x = 0; x_size * (2 * x - 1) < 1 + _system.eye_spacing().eye_spacing(); ++x) {
for (int x = 0; x_size * (2 * x - 1) < 1 + std::abs(_system.eye_spacing().eye_spacing()); ++x) {
for (int y = 0; y_size * (2 * y - 1) < 1; ++y) {
add_quad(x, y, x % 2, y % 2);
if (x) {
Expand Down

0 comments on commit 127f37a

Please sign in to comment.