13.07.2015 Views

Mali GPU User Interface Engine Application Development Guide

Mali GPU User Interface Engine Application Development Guide

Mali GPU User Interface Engine Application Development Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Matrix and Vector OperationsA.1 Matrix and vector functions in the MDE libraryThe following matrix functions in the MDE library simplify transformations on matrices:matn determinant()matn identity()matn invert()Returns the determinate for the nxn identity matrix. n is in the range 2 to 4.Returns a nxn identity matrix. n is in the range 2 to 4.Attempts to calculate the inverse of the matrix. n is in the range 2 to 4.mat4 matrix = mat4::scale(2.0f, 2.0f, 2.0f);mat4 invertedMatrix;bool isInvertable = matrix.invert(invertedMatrix);mat4 lookAt()Creates a 4x4 lookAt transform matrix, constructed from the given cameraposition, camera target, and camera up vector.mat4 lookAtMatrix = mat4::lookAt(vec3(100.0f, 100.0f, 100.0f), //cameravec3(0.0f, 0.0f, 0.0f), // targetvec3(0.0f, 1.0f, 0.0f)); // upmatn operator float* ()matn operator=(float* d)Converts a matrix into an array of floats. This enables passing a mat4 as aparameter to a function that expects a float array:mat4 matrix;glUniformMatrix4fv(loc, 4, GL_FALSE, matrix);Returns a reference to the matrix element identified by the index.mat4 matrix;matrix[0] = 2.0f;float matn operator[] (int index)Returns a reference to the matrix element identified by the index.mat4 matrix;matrix[0] = 2.0f;float m[16]Returns an array of floats that contains the entries of the 4x4 matrix.matn operator*If the parameter is a nxn matrix, performs matrix multiplication between thematrix and another nxn matrix. This results in a new nxn matrix. n is in the range2 to 4. For example:mat4 m1, m2;mat4 result = m1*m2;Multiplying a 4x4 perspective projection matrix by the 4x4 matrix returned froma lookAt() call results in a world-view projection matrix.If the parameter is a n-element vector, performs matrix multiplication between thematrix and the vector. This results in a new n-element vector. For example:mat4 matrix;vec4 vector;vec4 result = matrix*vector;ARM DUI 0527A-02a Copyright © 2010 ARM. All rights reserved. A-2ID070710Non-Confidential - Draft - Beta

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!