| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/android/vr_shell/vr_shell_gl.h" | 5 #include "chrome/browser/android/vr_shell/vr_shell_gl.h" |
| 6 | 6 |
| 7 #include <chrono> | 7 #include <chrono> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1125 // existing content in place in the primary buffer without | 1125 // existing content in place in the primary buffer without |
| 1126 // clearing. Currently, there aren't any world elements in WebVR | 1126 // clearing. Currently, there aren't any world elements in WebVR |
| 1127 // mode, this will need further testing if those get added | 1127 // mode, this will need further testing if those get added |
| 1128 // later. | 1128 // later. |
| 1129 } else { | 1129 } else { |
| 1130 // Non-WebVR mode, enable depth testing and clear the primary buffers. | 1130 // Non-WebVR mode, enable depth testing and clear the primary buffers. |
| 1131 glEnable(GL_CULL_FACE); | 1131 glEnable(GL_CULL_FACE); |
| 1132 glEnable(GL_DEPTH_TEST); | 1132 glEnable(GL_DEPTH_TEST); |
| 1133 glDepthMask(GL_TRUE); | 1133 glDepthMask(GL_TRUE); |
| 1134 | 1134 |
| 1135 const vr::Colorf& backgroundColor = scene_->GetBackgroundColor(); | 1135 const SkColor backgroundColor = scene_->GetBackgroundColor(); |
| 1136 glClearColor(backgroundColor.r, backgroundColor.g, backgroundColor.b, | 1136 glClearColor(SkColorGetR(backgroundColor) / 255.0, |
| 1137 backgroundColor.a); | 1137 SkColorGetG(backgroundColor) / 255.0, |
| 1138 SkColorGetB(backgroundColor) / 255.0, |
| 1139 SkColorGetA(backgroundColor) / 255.0); |
| 1138 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | 1140 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
| 1139 } | 1141 } |
| 1140 std::vector<const UiElement*> elements = scene_->GetWorldElements(); | 1142 std::vector<const UiElement*> elements = scene_->GetWorldElements(); |
| 1141 const bool draw_reticle = !(scene_->is_exiting() || ShouldDrawWebVr()); | 1143 const bool draw_reticle = !(scene_->is_exiting() || ShouldDrawWebVr()); |
| 1142 DrawUiView(head_pose, elements, render_size_primary_, | 1144 DrawUiView(head_pose, elements, render_size_primary_, |
| 1143 kViewportListPrimaryOffset, draw_reticle); | 1145 kViewportListPrimaryOffset, draw_reticle); |
| 1144 } | 1146 } |
| 1145 | 1147 |
| 1146 void VrShellGl::DrawOverlayElements(const vr::Mat4f& head_pose) { | 1148 void VrShellGl::DrawOverlayElements(const vr::Mat4f& head_pose) { |
| 1147 std::vector<const UiElement*> elements = scene_->GetOverlayElements(); | 1149 std::vector<const UiElement*> elements = scene_->GetOverlayElements(); |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1597 // This assumes that the initial webvr_surface_size_ was set to the | 1599 // This assumes that the initial webvr_surface_size_ was set to the |
| 1598 // appropriate recommended render resolution as the default size during | 1600 // appropriate recommended render resolution as the default size during |
| 1599 // InitializeGl. Revisit if the initialization order changes. | 1601 // InitializeGl. Revisit if the initialization order changes. |
| 1600 device::mojom::VRDisplayInfoPtr info = | 1602 device::mojom::VRDisplayInfoPtr info = |
| 1601 device::GvrDelegate::CreateVRDisplayInfo(gvr_api_.get(), | 1603 device::GvrDelegate::CreateVRDisplayInfo(gvr_api_.get(), |
| 1602 webvr_surface_size_, device_id); | 1604 webvr_surface_size_, device_id); |
| 1603 browser_->RunVRDisplayInfoCallback(callback, &info); | 1605 browser_->RunVRDisplayInfoCallback(callback, &info); |
| 1604 } | 1606 } |
| 1605 | 1607 |
| 1606 } // namespace vr_shell | 1608 } // namespace vr_shell |
| OLD | NEW |