Imported Upstream version 2.81
[platform/upstream/libbullet.git] / Demos / NativeClient / transforms.h
1 // Copyright (c) 2011 The Native Client 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 EXAMPLES_TUMBLER_TRANSFORMS_H_
6 #define EXAMPLES_TUMBLER_TRANSFORMS_H_
7
8 #include <GLES2/gl2.h>
9
10 // A very simple set of 4x4 matrix routines.  In all these routines, the input
11 // matrix is assumed to be a 4x4 of GLfloats.
12
13 namespace transform_4x4 {
14
15 // Pre-multply |m| with a projection transformation 4x4 matrix from a
16 // truncated pyramid viewing frustum.
17 void Frustum(GLfloat* m,
18              GLfloat left,
19              GLfloat right,
20              GLfloat bottom,
21              GLfloat top,
22              GLfloat near_z,
23              GLfloat far_z);
24
25 // Replace |m| with the 4x4 identity matrix.
26 void LoadIdentity(GLfloat* m);
27
28 // |m| <- |a| . |b|.  |m| can point at the same memory as either |a| or |b|.
29 void Multiply(GLfloat *m, GLfloat *a, GLfloat* b);
30
31 // Pre-multiply |m| with a single-point perspective matrix based on the viewing
32 // frustum whose view angle is |fovy|.
33 void Perspective(GLfloat* m,
34                  GLfloat fovy,
35                  GLfloat aspect,
36                  GLfloat near_z,
37                  GLfloat far_z);
38
39 // Pre-multiply |m| with a matrix that represents a translation by |tx|, |ty|,
40 // |tz|.
41 void Translate(GLfloat* m, GLfloat tx, GLfloat ty, GLfloat tz);
42 }  // namespace transform_4x4
43
44 #endif  // EXAMPLES_TUMBLER_TRANSFORMS_H_
45