Chromium Code Reviews| 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 "modules/vr/VRDisplay.h" | 5 #include "modules/vr/VRDisplay.h" |
| 6 | 6 |
| 7 #include "core/css/StylePropertySet.h" | 7 #include "core/css/StylePropertySet.h" |
| 8 #include "core/dom/DOMException.h" | 8 #include "core/dom/DOMException.h" |
| 9 #include "core/dom/DocumentUserGestureToken.h" | 9 #include "core/dom/DocumentUserGestureToken.h" |
| 10 #include "core/dom/FrameRequestCallback.h" | 10 #include "core/dom/FrameRequestCallback.h" |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 605 | 605 |
| 606 gl->Enable(GL_SCISSOR_TEST); | 606 gl->Enable(GL_SCISSOR_TEST); |
| 607 // Use a few pixels to ensure we get a clean color. The resolution for the | 607 // Use a few pixels to ensure we get a clean color. The resolution for the |
| 608 // WebGL buffer may not match the final rendered destination size, and | 608 // WebGL buffer may not match the final rendered destination size, and |
| 609 // texture filtering could interfere for single pixels. This isn't visible | 609 // texture filtering could interfere for single pixels. This isn't visible |
| 610 // since the final rendering hides the edges via a vignette effect. | 610 // since the final rendering hides the edges via a vignette effect. |
| 611 gl->Scissor(0, 0, 4, 4); | 611 gl->Scissor(0, 0, 4, 4); |
| 612 gl->ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); | 612 gl->ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); |
| 613 int idx = m_framePose->poseIndex; | 613 int idx = m_framePose->poseIndex; |
| 614 // Careful with the arithmetic here. Float color 1.f is equivalent to int 255. | 614 // Careful with the arithmetic here. Float color 1.f is equivalent to int 255. |
| 615 gl->ClearColor((idx & 255) / 255.0f, ((idx >> 8) & 255) / 255.0f, | 615 // Use the low byte of the index as the red component, and store an arbitrary |
| 616 ((idx >> 16) & 255) / 255.0f, 1.0f); | 616 // magic number in green/blue. This number must match the reading code in |
| 617 // vr_shell.cc. Avoid all-black/all-white. | |
| 618 gl->ClearColor((idx & 255) / 255.0f, 42 / 255.0f, 142 / 255.0f, 1.0f); | |
|
mthiesse
2016/12/01 21:53:15
Make constants for the magic numbers, here and in
klausw
2016/12/01 22:36:04
Done.
| |
| 617 gl->Clear(GL_COLOR_BUFFER_BIT); | 619 gl->Clear(GL_COLOR_BUFFER_BIT); |
| 618 | 620 |
| 619 // Set the GL state back to what was set by the WebVR application. | 621 // Set the GL state back to what was set by the WebVR application. |
| 620 m_renderingContext->restoreScissorEnabled(); | 622 m_renderingContext->restoreScissorEnabled(); |
| 621 m_renderingContext->restoreScissorBox(); | 623 m_renderingContext->restoreScissorBox(); |
| 622 m_renderingContext->restoreColorMask(); | 624 m_renderingContext->restoreColorMask(); |
| 623 m_renderingContext->restoreClearColor(); | 625 m_renderingContext->restoreClearColor(); |
| 624 | 626 |
| 625 m_display->SubmitFrame(m_framePose.Clone()); | 627 m_display->SubmitFrame(m_framePose.Clone()); |
| 626 m_canUpdateFramePose = true; | 628 m_canUpdateFramePose = true; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 701 visitor->trace(m_capabilities); | 703 visitor->trace(m_capabilities); |
| 702 visitor->trace(m_stageParameters); | 704 visitor->trace(m_stageParameters); |
| 703 visitor->trace(m_eyeParametersLeft); | 705 visitor->trace(m_eyeParametersLeft); |
| 704 visitor->trace(m_eyeParametersRight); | 706 visitor->trace(m_eyeParametersRight); |
| 705 visitor->trace(m_layer); | 707 visitor->trace(m_layer); |
| 706 visitor->trace(m_renderingContext); | 708 visitor->trace(m_renderingContext); |
| 707 visitor->trace(m_scriptedAnimationController); | 709 visitor->trace(m_scriptedAnimationController); |
| 708 } | 710 } |
| 709 | 711 |
| 710 } // namespace blink | 712 } // namespace blink |
| OLD | NEW |