OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_UTIL_H_ |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_UTIL_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g
vr_types.h" |
| 11 #include "ui/gl/gl_bindings.h" |
| 12 |
| 13 namespace vr_shell { |
| 14 |
| 15 std::array<float, 16> MatrixToGLArray(const gvr::Mat4f& matrix); |
| 16 |
| 17 // Util functions that are copied from the treasure_hunt NDK demo in |
| 18 // third_party/gvr-andoir-sdk/ folder. |
| 19 gvr::Mat4f MatrixTranspose(const gvr::Mat4f& mat); |
| 20 gvr::Mat4f MatrixMul(const gvr::Mat4f& matrix1, const gvr::Mat4f& matrix2); |
| 21 gvr::Mat4f PerspectiveMatrixFromView(const gvr::Rectf& fov, |
| 22 float z_near, |
| 23 float z_far); |
| 24 gvr::Rectf ModulateRect(const gvr::Rectf& rect, float width, float height); |
| 25 gvr::Recti CalculatePixelSpaceRect(const gvr::Sizei& texture_size, |
| 26 const gvr::Rectf& texture_rect); |
| 27 |
| 28 // Compile a shader. |
| 29 GLuint CompileShader(GLenum shader_type, |
| 30 const GLchar* shader_source, |
| 31 std::string& error); |
| 32 |
| 33 // Compile and link a program. |
| 34 GLuint CreateAndLinkProgram(GLuint vertex_shader_handle, |
| 35 GLuint fragment_shader_handle, |
| 36 int num_attributes, |
| 37 const GLchar** attributes, |
| 38 std::string& error); |
| 39 |
| 40 } // namespace vr_shell |
| 41 |
| 42 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_UTIL_H_ |
OLD | NEW |