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

Unified Diff: chrome/browser/android/vr_shell/vr_shell_renderer.h

Issue 2363553003: VrShell: implement insecure content warning display (Closed)
Patch Set: Ready for review Created 4 years, 3 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
Index: chrome/browser/android/vr_shell/vr_shell_renderer.h
diff --git a/chrome/browser/android/vr_shell/vr_shell_renderer.h b/chrome/browser/android/vr_shell/vr_shell_renderer.h
index 05d6228842d339c2dde0a3ed5127c2c98fae6543..87661abf9a023706dec7cacebcce42236d28aab4 100644
--- a/chrome/browser/android/vr_shell/vr_shell_renderer.h
+++ b/chrome/browser/android/vr_shell/vr_shell_renderer.h
@@ -29,6 +29,8 @@ enum ShaderID {
RETICLE_FRAGMENT_SHADER,
LASER_VERTEX_SHADER,
LASER_FRAGMENT_SHADER,
+ OVERLAY_ICON_VERTEX_SHADER,
+ OVERLAY_ICON_FRAGMENT_SHADER,
SHADER_ID_MAX
};
@@ -130,6 +132,41 @@ class LaserRenderer : public BaseRenderer {
DISALLOW_COPY_AND_ASSIGN(LaserRenderer);
};
+// Renders icons as static overlays.
+enum OverlayIconID {
+ ICON_INSECURE_PERMANENT = 0,
+ ICON_INSECURE_TRANSIENT,
+ ICON_ID_MAX
+};
+
+class OverlayIconRenderer {
+ public:
+ OverlayIconRenderer();
+ ~OverlayIconRenderer();
+
+ void Draw(const gvr::Mat4f& combined_matrix, int icon_num);
+
+ private:
+ static constexpr size_t VERTEX_STRIDE = sizeof(float) * 4;
+ static constexpr size_t POSITION_ELEMENTS = 2;
+ static constexpr size_t TEXCOORD_ELEMENTS = 2;
+ static constexpr size_t POSITION_OFFSET = 0;
+ static constexpr size_t TEXCOORD_OFFSET = sizeof(float) * 2;
+
+ GLuint program_handle_;
+ GLuint tex_uniform_handle_;
+ GLuint texture_data_handles_[ICON_ID_MAX];
+ GLuint src_rect_uniform_handle_;
+ GLuint position_handle_;
+ GLuint texcoord_handle_;
+ GLuint vertex_buffer_;
+ GLuint combined_matrix_handle_;
+
+ gvr::Rectf bounds_;
+
+ DISALLOW_COPY_AND_ASSIGN(OverlayIconRenderer);
+};
+
class VrShellRenderer {
public:
VrShellRenderer();
@@ -151,11 +188,16 @@ class VrShellRenderer {
return laser_renderer_.get();
}
+ OverlayIconRenderer* GetOverlayIconRenderer() {
bajones 2016/09/22 22:13:30 Forgive my ignorance, but it seems like the Textur
+ return overlay_icon_renderer_.get();
+ }
+
private:
std::unique_ptr<TexturedQuadRenderer> textured_quad_renderer_;
std::unique_ptr<WebVrRenderer> webvr_renderer_;
std::unique_ptr<ReticleRenderer> reticle_renderer_;
std::unique_ptr<LaserRenderer> laser_renderer_;
+ std::unique_ptr<OverlayIconRenderer> overlay_icon_renderer_;
DISALLOW_COPY_AND_ASSIGN(VrShellRenderer);
};

Powered by Google App Engine
This is Rietveld 408576698