ARX  1.0
The next-generation open source augmented reality toolkit.
Loading...
Searching...
No Matches
mtx.h
Go to the documentation of this file.
1/*
2 * mtx.h
3 * artoolkitX
4 *
5 * This file is part of artoolkitX.
6 *
7 * artoolkitX is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * artoolkitX is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with artoolkitX. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * As a special exception, the copyright holders of this library give you
21 * permission to link this library with independent modules to produce an
22 * executable, regardless of the license terms of these independent modules, and to
23 * copy and distribute the resulting executable under terms of your choice,
24 * provided that you also meet, for each linked independent module, the terms and
25 * conditions of the license of that module. An independent module is a module
26 * which is neither derived from nor based on this library. If you modify this
27 * library, you may extend this exception to your version of the library, but you
28 * are not obligated to do so. If you do not wish to do so, delete this exception
29 * statement from your version.
30 *
31 * Copyright 2018 Realmax, Inc.
32 * Copyright 2015 Daqri, LLC.
33 * Copyright 2013-2015 ARToolworks, Inc.
34 *
35 * Author(s): Philip Lamb
36 */
37
38/*
39 *
40 * Matrix routines that emulate the identical OpenGL 1.0-3.0 / OpenGL ES 1.0-1.1 routines,
41 * but with the current matrix passed as the first parameter, rather than being controlled
42 * by glMatrixMode calls. For documentation, read the relevant gl* manual pages (e.g.
43 * 'man 3 glLoadIdentity')
44 *
45 * mtx is available as part of libARG.
46 *
47 */
48
49#ifndef __mtx_h__
50#define __mtx_h__
51
52#ifdef __cplusplus
53extern "C" {
54#endif
55
56#ifdef _WIN32
57# ifdef ARG_STATIC
58# define MTX_EXTERN
59# else
60# ifdef ARX_EXPORTS
61# define MTX_EXTERN __declspec(dllexport)
62# else
63# define MTX_EXTERN __declspec(dllimport)
64# endif
65# endif
66#else
67# define MTX_EXTERN
68#endif
69
70MTX_EXTERN void mtxLoadIdentityf(float M[16]); // Replace matrix M with the identity matrix.
71MTX_EXTERN void mtxLoadMatrixf(float M[16], const float T[16]); // Replace matrix M with the specified matrix T.
72MTX_EXTERN void mtxMultMatrixf(float M[16], const float T[16]); // Multiply matrix M with matrix T.
73MTX_EXTERN void mtxTranslatef(float M[16], const float x, const float y, const float z); // Multiply M by a translation matrix.
74MTX_EXTERN void mtxRotatef(float M[16], const float q, const float x, const float y, const float z); // Multiply matrix M by a rotation matrix. q in degrees.
75MTX_EXTERN void mtxScalef(float M[16], const float x, const float y, const float z); // Multiply matrix M by a general scaling matrix.
76MTX_EXTERN void mtxOrthof(float M[16], float left, float right, float bottom, float top, float zNear, float zFar); // Multiply matrix M with an orthographic matrix.
77MTX_EXTERN void mtxFrustumf(float M[16], float left, float right, float bottom, float top, float zNear, float zFar); // Multiply matrix M by a perspective matrix.
78MTX_EXTERN void mtxPerspectivef(float M[16], float fovy, float aspect, float zNear, float zFar); // Multiply matrix M by a perspective matrix. fovy in degrees.
79MTX_EXTERN void mtxLookAtf(float M[16], float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ); // Multiply matrix M by a viewing matrix derived from an eye point, a reference point indicating the center of the scene, and an UP vector.
80
81MTX_EXTERN void mtxLoadIdentityd(double M[16]); // Replace matrix M with the identity matrix.
82MTX_EXTERN void mtxLoadMatrixd(double M[16], const double T[16]); // Replace matrix M with the specified matrix T.
83MTX_EXTERN void mtxMultMatrixd(double M[16], const double T[16]); // Multiply matrix M with matrix T.
84MTX_EXTERN void mtxTranslated(double M[16], const double x, const double y, const double z); // Multiply M by a translation matrix.
85MTX_EXTERN void mtxRotated(double M[16], const double q, const double x, const double y, const double z); // Multiply matrix M by a rotation matrix. q in degrees.
86MTX_EXTERN void mtxScaled(double M[16], const double x, const double y, const double z); // Multiply matrix M by a general scaling matrix.
87MTX_EXTERN void mtxOrthod(double M[16], double left, double right, double bottom, double top, double zNear, double zFar); // Multiply matrix M with an orthographic matrix.
88MTX_EXTERN void mtxFrustumd(double M[16], double left, double right, double bottom, double top, double zNear, double zFar); // Multiply matrix M by a perspective matrix.
89MTX_EXTERN void mtxPerspectived(double M[16], double fovy, double aspect, double zNear, double zFar); // Multiply matrix M by a perspective matrix. fovy in degrees.
90MTX_EXTERN void mtxLookAtd(double M[16], double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ); // Multiply matrix M by a viewing matrix derived from an eye point, a reference point indicating the center of the scene, and an UP vector.
91
92#ifdef __cplusplus
93}
94#endif
95#endif // !__mtx_h__
MTX_EXTERN void mtxScalef(float M[16], const float x, const float y, const float z)
Definition: mtx.c:195
MTX_EXTERN void mtxLookAtd(double M[16], double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ)
Definition: mtx.c:589
MTX_EXTERN void mtxFrustumf(float M[16], float left, float right, float bottom, float top, float zNear, float zFar)
Definition: mtx.c:241
MTX_EXTERN void mtxLoadMatrixf(float M[16], const float T[16])
Definition: mtx.c:80
MTX_EXTERN void mtxLoadIdentityf(float M[16])
Definition: mtx.c:72
MTX_EXTERN void mtxRotated(double M[16], const double q, const double x, const double y, const double z)
Definition: mtx.c:412
#define MTX_EXTERN
Definition: mtx.h:67
MTX_EXTERN void mtxPerspectived(double M[16], double fovy, double aspect, double zNear, double zFar)
Definition: mtx.c:556
MTX_EXTERN void mtxFrustumd(double M[16], double left, double right, double bottom, double top, double zNear, double zFar)
Definition: mtx.c:522
MTX_EXTERN void mtxRotatef(float M[16], const float q, const float x, const float y, const float z)
Definition: mtx.c:131
MTX_EXTERN void mtxLoadMatrixd(double M[16], const double T[16])
Definition: mtx.c:361
MTX_EXTERN void mtxOrthod(double M[16], double left, double right, double bottom, double top, double zNear, double zFar)
Definition: mtx.c:488
MTX_EXTERN void mtxLookAtf(float M[16], float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ)
Definition: mtx.c:308
MTX_EXTERN void mtxMultMatrixd(double M[16], const double T[16])
Definition: mtx.c:369
MTX_EXTERN void mtxScaled(double M[16], const double x, const double y, const double z)
Definition: mtx.c:476
MTX_EXTERN void mtxTranslated(double M[16], const double x, const double y, const double z)
Definition: mtx.c:400
MTX_EXTERN void mtxMultMatrixf(float M[16], const float T[16])
Definition: mtx.c:88
MTX_EXTERN void mtxTranslatef(float M[16], const float x, const float y, const float z)
Definition: mtx.c:119
MTX_EXTERN void mtxPerspectivef(float M[16], float fovy, float aspect, float zNear, float zFar)
Definition: mtx.c:275
MTX_EXTERN void mtxLoadIdentityd(double M[16])
Definition: mtx.c:353
MTX_EXTERN void mtxOrthof(float M[16], float left, float right, float bottom, float top, float zNear, float zFar)
Definition: mtx.c:207