OSDN Git Service

vector and matrix classes for graphics use
authorMathias Agopian <mathias@google.com>
Thu, 22 Aug 2013 06:10:41 +0000 (23:10 -0700)
committerMathias Agopian <mathias@google.com>
Tue, 27 Aug 2013 03:41:13 +0000 (20:41 -0700)
commit595ea77f6bdb5e9d0ddd3305da7a44b56f326b2c
tree7272bd03805086479b7cf0764c3ac58c3ea474af
parentf2e4fcd96c11861bd0af1a9525344c1b691c9de9
vector and matrix classes for graphics use

- this implements vec2, vec3, vec4, which are float vectors
of size 2, 3 and 4 respectively.

the code allows easy instantiation of vectors of a different
type via the tvec{2|3|4}<T> template classes.

- this also implements mat4 which is a float 4x4 matrix. the
tmat44<T> template class allows easy instantiation of a
4x4 matrix of a different value_type.

The vector types have some minimal support for the
glsl style swizzled access; for instance:

  vec4 u;
  vec3 v = u.xyz;

only .x, .xy, .xyz and their .stpq / .rgba equivalent are
supported.

most operators are supported on both vector and matrices:
arithmetic, unary, compound assignment and comparison
(bit-wise operators NOT supported).

- operations available on vectors include:
dot, length, distance, normalize and cross

- operations available on matrices include:
transpose, inverse, trace

- and a few utilities to create matrices:
ortho, frustum, lookAt

Change-Id: I64add89ae90fa78d3f2f59985b63495575378635
include/ui/TMatHelpers.h [new file with mode: 0644]
include/ui/TVecHelpers.h [new file with mode: 0644]
include/ui/mat4.h [new file with mode: 0644]
include/ui/vec2.h [new file with mode: 0644]
include/ui/vec3.h [new file with mode: 0644]
include/ui/vec4.h [new file with mode: 0644]
libs/ui/tests/Android.mk
libs/ui/tests/mat_test.cpp [new file with mode: 0644]
libs/ui/tests/vec_test.cpp [new file with mode: 0644]