Commit e44b8a89 authored by Brandon Jones's avatar Brandon Jones Committed by Commit Bot

Adjust VRShell floor grid to align with users physical floor.

If GVR reports a floor offset from the current tracking origin the floor
grid will be adjusted to render at the same offset. This should help
user comfort when using standalone devices.

Bug: 845225
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_vr
Change-Id: I08bd081087f4f6528ec8200ee424d08f9bf9f059
Reviewed-on: https://chromium-review.googlesource.com/1067541
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: default avatarChristopher Grant <cjgrant@chromium.org>
Cr-Commit-Position: refs/heads/master@{#561690}
parent 935ad28e
......@@ -1602,6 +1602,13 @@ void VrShellGl::DrawIntoAcquiredFrame(int16_t frame_index,
&render_info_);
ui_->OnProjMatrixChanged(render_info_.left_eye_model.proj_matrix);
// This may change when the floor height changes so it's computed every frame.
gvr::Value floor_height;
if (gvr_api_->GetCurrentProperties().Get(GVR_PROPERTY_TRACKING_FLOOR_HEIGHT,
&floor_height)) {
ui_->SetFloorHeight(floor_height.f);
}
// Content quad can't have transparency when using the quad layer because we
// can't blend with the quad layer.
bool use_quad_layer = ui_->IsContentVisibleAndOpaque();
......
......@@ -60,6 +60,7 @@ struct Model {
std::vector<TabModel> incognito_tabs;
bool incognito_tabs_view_selected = false;
bool create_tabs_view = false;
float floor_height = 0.0f;
// WebVR state.
WebVrModel web_vr;
......
......@@ -184,6 +184,10 @@ void Ui::OnUiRequestedNavigation() {
model_->pop_mode(kModeEditingOmnibox);
}
void Ui::SetFloorHeight(float floor_height) {
model_->floor_height = floor_height;
}
void Ui::SetSpeechRecognitionEnabled(bool enabled) {
if (enabled) {
model_->speech.recognition_result.clear();
......
......@@ -159,6 +159,7 @@ class Ui : public BrowserUiInterface, public KeyboardUiInterface {
void OnContentBoundsChanged(int width, int height);
void OnPlatformControllerInitialized(PlatformController* controller);
void OnUiRequestedNavigation();
void SetFloorHeight(float floor_height);
Model* model_for_test() { return model_.get(); }
......
......@@ -900,6 +900,9 @@ std::unique_ptr<Grid> CreateGrid(Model* model, UiElementName name) {
grid->set_gridline_count(kFloorGridlineCount);
grid->SetGridColor(model->color_scheme().floor_grid);
grid->set_focusable(false);
grid->AddBinding(VR_BIND(
float, Model, model, model->floor_height, Grid, grid.get(),
view->SetTranslate(0, value ? value : -kSceneHeight / 2.0f, 0.0)));
return grid;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment