Chromium Code Reviews| Index: chrome/browser/android/vr_shell/vr_util.h |
| diff --git a/chrome/browser/android/vr_shell/vr_util.h b/chrome/browser/android/vr_shell/vr_util.h |
| index 53fa9de9c10c306be759079f451d01870e27200f..997acd49527431eae1d478fe1449543619fbf885 100644 |
| --- a/chrome/browser/android/vr_shell/vr_util.h |
| +++ b/chrome/browser/android/vr_shell/vr_util.h |
| @@ -12,12 +12,53 @@ |
| namespace vr_shell { |
| +#define makeRectangularTextureBuffer(left, right, bottom, top) \ |
| + { \ |
| + left, bottom, left, top, right, bottom, left, top, right, top, right, \ |
| + bottom \ |
| + } |
| + |
| +// 2D rectangles. Unlike gvr::Rectf and gvr::Recti, these have width and height |
| +// rather than right and top. |
| +typedef struct Recti { |
|
David Trainor- moved to gerrit
2016/09/08 05:49:30
Just bringing up the gfx version of these things a
mthiesse
2016/09/08 17:44:41
Yes, these structs can easily just be cast and cop
David Trainor- moved to gerrit
2016/09/09 06:28:29
Makes sense. Do we push a lot of these?
|
| + int x; |
| + int y; |
| + int width; |
| + int height; |
| +} Recti; |
| + |
| +typedef struct Rectf { |
| + float x; |
| + float y; |
| + float width; |
| + float height; |
| +} Rectf; |
| + |
| +void setIdentityM(gvr::Mat4f& mat); |
|
David Trainor- moved to gerrit
2016/09/08 05:49:30
setIdentity -> SetIdentity, same with all other me
mthiesse
2016/09/08 17:44:41
Done.
|
| + |
| +void translateM(gvr::Mat4f& tmat, gvr::Mat4f& mat, float x, float y, float z); |
| +void translateMRight(gvr::Mat4f& tmat, |
| + gvr::Mat4f& mat, |
| + float x, |
| + float y, |
| + float z); |
| + |
| +void scaleM(gvr::Mat4f& tmat, gvr::Mat4f& mat, float x, float y, float z); |
| +void scaleMRight(gvr::Mat4f& tmat, gvr::Mat4f& mat, float x, float y, float z); |
| + |
| std::array<float, 16> MatrixToGLArray(const gvr::Mat4f& matrix); |
| // Util functions that are copied from the treasure_hunt NDK demo in |
| // third_party/gvr-andoir-sdk/ folder. |
| gvr::Mat4f MatrixTranspose(const gvr::Mat4f& mat); |
| +std::array<float, 4> MatrixVectorMul(const gvr::Mat4f& matrix, |
| + const std::array<float, 4>& vec); |
| +std::array<float, 3> MatrixVectorMul(const gvr::Mat4f& matrix, |
| + const std::array<float, 3>& vec); |
| +gvr::Vec3f MatrixVectorMul(const gvr::Mat4f& m, gvr::Vec3f v); |
|
David Trainor- moved to gerrit
2016/09/08 05:49:30
const & for the vecs as well?
mthiesse
2016/09/08 17:44:41
Done.
|
| +gvr::Vec3f MatrixVectorRotate(const gvr::Mat4f& m, gvr::Vec3f v); |
| gvr::Mat4f MatrixMul(const gvr::Mat4f& matrix1, const gvr::Mat4f& matrix2); |
| +gvr::Mat4f invertM(gvr::Mat4f mat); |
|
David Trainor- moved to gerrit
2016/09/08 05:49:30
const &
mthiesse
2016/09/08 17:44:41
Done.
|
| gvr::Mat4f PerspectiveMatrixFromView(const gvr::Rectf& fov, |
| float z_near, |
| float z_far); |
| @@ -25,6 +66,9 @@ gvr::Rectf ModulateRect(const gvr::Rectf& rect, float width, float height); |
| gvr::Recti CalculatePixelSpaceRect(const gvr::Sizei& texture_size, |
| const gvr::Rectf& texture_rect); |
| +gvr::Vec3f getForwardVector(gvr::Mat4f matrix); |
|
David Trainor- moved to gerrit
2016/09/08 05:49:30
const &
mthiesse
2016/09/08 17:44:41
Done.
|
| +gvr::Vec3f getTranslation(gvr::Mat4f matrix); |
|
David Trainor- moved to gerrit
2016/09/08 05:49:30
const &
mthiesse
2016/09/08 17:44:41
Done.
|
| + |
| // Compile a shader. |
| GLuint CompileShader(GLenum shader_type, |
| const GLchar* shader_source, |
| @@ -37,6 +81,20 @@ GLuint CreateAndLinkProgram(GLuint vertex_shader_handle, |
| const GLchar** attributes, |
| std::string& error); |
| +gvr::Quatf QuatMultiply(const gvr::Quatf& a, const gvr::Quatf& b); |
| + |
| +gvr::Mat4f QuatToMatrix(const gvr::Quatf& quat); |
| + |
| +float VectorLength(const gvr::Vec3f& vec); |
| + |
| +void NormalizeVector(gvr::Vec3f& vec); |
| + |
| +float VectorDot(gvr::Vec3f& a, gvr::Vec3f& b); |
| + |
| +void NormalizeQuat(gvr::Quatf& quat); |
| + |
| +gvr::Quatf QuatFromAxisAngle(float x, float y, float z, float angle); |
| + |
| } // namespace vr_shell |
| #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_UTIL_H_ |