Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Unified Diff: chrome/browser/android/vr_shell/vr_shell_gl.cc

Issue 2668093002: VrShell background implemented in JS. (Closed)
Patch Set: Fixed tests Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell_gl.h ('k') | chrome/browser/android/vr_shell/vr_shell_renderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/vr_shell_gl.cc
diff --git a/chrome/browser/android/vr_shell/vr_shell_gl.cc b/chrome/browser/android/vr_shell/vr_shell_gl.cc
index 55a45192759441f8afdc0679bb2e433c109d8ec3..58c00bb186fd0a8db4caee4a9f4359f48720a808 100644
--- a/chrome/browser/android/vr_shell/vr_shell_gl.cc
+++ b/chrome/browser/android/vr_shell/vr_shell_gl.cc
@@ -517,7 +517,7 @@ void VrShellGl::UpdateController(const gvr::Vec3f& forward_vector) {
closest_element_distance = distance_to_plane;
Rectf pixel_rect;
- if (plane->content_quad) {
+ if (plane->fill == Fill::CONTENT) {
pixel_rect = {0, 0, content_tex_css_width_, content_tex_css_height_};
} else {
pixel_rect = {plane->copy_rect.x, plane->copy_rect.y,
@@ -528,8 +528,8 @@ void VrShellGl::UpdateController(const gvr::Vec3f& forward_vector) {
target_point_ = plane_intersection_point;
target_element_ = plane.get();
- input_target = plane->content_quad ? InputTarget::CONTENT
- : InputTarget::UI;
+ input_target = (plane->fill == Fill::CONTENT) ? InputTarget::CONTENT
+ : InputTarget::UI;
}
}
SendEventsToTarget(input_target, pixel_x, pixel_y);
@@ -726,9 +726,7 @@ void VrShellGl::DrawVrShell(const gvr::Mat4f& head_pose,
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
- glClearColor(BackgroundRenderer::kFogBrightness,
- BackgroundRenderer::kFogBrightness,
- BackgroundRenderer::kFogBrightness, 1.0f);
+ glClearColor(kFogBrightness, kFogBrightness, kFogBrightness, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
if (!world_elements.empty()) {
@@ -789,10 +787,6 @@ void VrShellGl::DrawUiView(const gvr::Mat4f* head_pose,
buffer_viewport_->GetSourceFov(), kZNear, kZFar),
view_matrix);
- if (!web_vr_mode_) {
- // TODO(tiborg): Enable through the UI API.
- // DrawBackground(render_matrix);
- }
DrawElements(render_matrix, elements);
if (head_pose != nullptr && !web_vr_mode_) {
DrawCursor(render_matrix);
@@ -804,23 +798,44 @@ void VrShellGl::DrawElements(
const gvr::Mat4f& render_matrix,
const std::vector<const ContentRectangle*>& elements) {
for (const auto& rect : elements) {
- Rectf copy_rect;
- jint texture_handle;
- if (rect->content_quad) {
- copy_rect = {0, 0, 1, 1};
- texture_handle = content_texture_id_;
- } else {
- copy_rect.x = static_cast<float>(rect->copy_rect.x) / ui_tex_css_width_;
- copy_rect.y = static_cast<float>(rect->copy_rect.y) / ui_tex_css_height_;
- copy_rect.width = static_cast<float>(rect->copy_rect.width) /
- ui_tex_css_width_;
- copy_rect.height = static_cast<float>(rect->copy_rect.height) /
- ui_tex_css_height_;
- texture_handle = ui_texture_id_;
- }
gvr::Mat4f transform = MatrixMul(render_matrix, rect->transform.to_world);
- vr_shell_renderer_->GetTexturedQuadRenderer()->Draw(
- texture_handle, transform, copy_rect, rect->computed_opacity);
+ switch (rect->fill) {
+ case Fill::SPRITE: {
+ Rectf copy_rect;
+ copy_rect.x = static_cast<float>(rect->copy_rect.x) / ui_tex_css_width_;
+ copy_rect.y =
+ static_cast<float>(rect->copy_rect.y) / ui_tex_css_height_;
+ copy_rect.width =
+ static_cast<float>(rect->copy_rect.width) / ui_tex_css_width_;
+ copy_rect.height =
+ static_cast<float>(rect->copy_rect.height) / ui_tex_css_height_;
+ jint texture_handle = ui_texture_id_;
+ vr_shell_renderer_->GetTexturedQuadRenderer()->Draw(
+ texture_handle, transform, copy_rect, rect->computed_opacity);
+ break;
+ }
+ case Fill::OPAQUE_GRADIENT: {
+ vr_shell_renderer_->GetGradientQuadRenderer()->Draw(
+ transform, rect->edge_color, rect->center_color,
+ rect->computed_opacity);
+ break;
+ }
+ case Fill::GRID_GRADIENT: {
+ vr_shell_renderer_->GetGradientGridRenderer()->Draw(
+ transform, rect->edge_color, rect->center_color,
+ rect->gridline_count, rect->computed_opacity);
+ break;
+ }
+ case Fill::CONTENT: {
+ Rectf copy_rect = {0, 0, 1, 1};
+ jint texture_handle = content_texture_id_;
+ vr_shell_renderer_->GetTexturedQuadRenderer()->Draw(
+ texture_handle, transform, copy_rect, rect->computed_opacity);
+ break;
+ }
+ default:
+ break;
+ }
}
}
@@ -911,10 +926,6 @@ void VrShellGl::DrawWebVr() {
vr_shell_renderer_->GetWebVrRenderer()->Draw(webvr_texture_id_);
}
-void VrShellGl::DrawBackground(const gvr::Mat4f& render_matrix) {
- vr_shell_renderer_->GetBackgroundRenderer()->Draw(render_matrix);
-}
-
void VrShellGl::OnTriggerEvent() {
// Set a flag to handle this on the render thread at the next frame.
touch_pending_ = true;
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell_gl.h ('k') | chrome/browser/android/vr_shell/vr_shell_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698