OLD | NEW |
(Empty) | |
| 1 #ifndef EXAMPLES_HELLO_WORLD_GLES_MATRIX_H |
| 2 #define EXAMPLES_HELLO_WORLD_GLES_MATRIX_H |
| 3 |
| 4 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. |
| 7 */ |
| 8 |
| 9 /** @file matrix.cc |
| 10 * Implements simple matrix manipulation functions. |
| 11 */ |
| 12 |
| 13 //----------------------------------------------------------------------------- |
| 14 #define _USE_MATH_DEFINES 1 |
| 15 #include <limits.h> |
| 16 #include <math.h> |
| 17 #include <GLES2/gl2.h> |
| 18 |
| 19 typedef GLfloat Matrix_t[16]; |
| 20 |
| 21 /// Since GLES2 doesn't have all the nifty matrix transform functions that GL |
| 22 /// has, we emulate some of them here for the sake of sanity from: |
| 23 /// http://www.opengl.org/wiki/GluPerspective_code |
| 24 void glhFrustumf2(Matrix_t mat, GLfloat left, GLfloat right, GLfloat bottom, |
| 25 GLfloat top, GLfloat znear, GLfloat zfar); |
| 26 |
| 27 void glhPerspectivef2(Matrix_t mat, GLfloat fovyInDegrees, |
| 28 GLfloat aspectRatio, GLfloat znear, GLfloat zfar); |
| 29 |
| 30 |
| 31 void identity_matrix(Matrix_t mat); |
| 32 void multiply_matrix(const Matrix_t a, const Matrix_t b, Matrix_t mat); |
| 33 void rotate_matrix(GLfloat x_deg, GLfloat y_deg, GLfloat z_deg, Matrix_t mat); |
| 34 void translate_matrix(GLfloat x, GLfloat y, GLfloat z, Matrix_t mat); |
| 35 |
| 36 #endif // EXAMPLES_HELLO_WORLD_GLES_MATRIX_H |
| 37 |
OLD | NEW |