1 |
2 |
specular |
//=======================================================================
|
2 |
|
|
// Project Monophony
|
3 |
|
|
// Wire-Frame 3D Graphics Accelerator IP Core
|
4 |
|
|
//
|
5 |
|
|
// File:
|
6 |
|
|
// mp_matrix4.h
|
7 |
|
|
//
|
8 |
|
|
// Abstract:
|
9 |
|
|
// 4x4 matrix header
|
10 |
|
|
//
|
11 |
|
|
// Author:
|
12 |
|
|
// Kenji Ishimaru (kenji.ishimaru@prtissimo.com)
|
13 |
|
|
//
|
14 |
|
|
//======================================================================
|
15 |
|
|
//
|
16 |
|
|
// Copyright (c) 2015, Kenji Ishimaru
|
17 |
|
|
// All rights reserved.
|
18 |
|
|
//
|
19 |
|
|
// Redistribution and use in source and binary forms, with or without
|
20 |
|
|
// modification, are permitted provided that the following conditions are met:
|
21 |
|
|
//
|
22 |
|
|
// -Redistributions of source code must retain the above copyright notice,
|
23 |
|
|
// this list of conditions and the following disclaimer.
|
24 |
|
|
// -Redistributions in binary form must reproduce the above copyright notice,
|
25 |
|
|
// this list of conditions and the following disclaimer in the documentation
|
26 |
|
|
// and/or other materials provided with the distribution.
|
27 |
|
|
//
|
28 |
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
29 |
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
30 |
|
|
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
31 |
|
|
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
32 |
|
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
33 |
|
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
34 |
|
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
35 |
|
|
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
36 |
|
|
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
37 |
|
|
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
38 |
|
|
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
39 |
|
|
//
|
40 |
|
|
// Revision History
|
41 |
|
|
|
42 |
|
|
#ifndef __MP_MATRIX4_H__
|
43 |
|
|
#define __MP_MATRIX4_H__
|
44 |
|
|
|
45 |
|
|
#include "mp_vector3.h"
|
46 |
|
|
#include "mp_vector4.h"
|
47 |
|
|
#include "mp_matrix3.h"
|
48 |
|
|
|
49 |
|
|
typedef struct _mp_matrix4 {
|
50 |
|
|
float a[16];
|
51 |
|
|
|
52 |
|
|
} mp_matrix4;
|
53 |
|
|
|
54 |
|
|
// functions
|
55 |
|
|
void mp_matrix4_init(mp_matrix4 *dst);
|
56 |
|
|
void mp_matrix4_set0(mp_matrix4 *dst, float b[]);
|
57 |
|
|
void mp_matrix4_set0_t(mp_matrix4 *dst, float b[]);
|
58 |
|
|
void mp_matrix4_set1(mp_matrix4 *dst, unsigned int b[]);
|
59 |
|
|
void mp_matrix4_set2(mp_matrix4 *dst, mp_matrix4 *t);
|
60 |
|
|
|
61 |
|
|
void mp_matrix4_identity(mp_matrix4 *dst);
|
62 |
|
|
void mp_matrix4_assign(mp_matrix4 *dst, mp_matrix4 *v);
|
63 |
|
|
void mp_matrix4_multiply_vector4(mp_vector4 *dst, mp_matrix4 *m, mp_vector4 *v);
|
64 |
|
|
void mp_matrix4_multiply_f(mp_matrix4 *m, float *v);
|
65 |
|
|
void mp_matrix4_multiply_f2(mp_matrix4 *m, float *dst ,float *src);
|
66 |
|
|
|
67 |
|
|
void mp_matrix4_multiply_matrix4(mp_matrix4 *dst, mp_matrix4 *mm, mp_matrix4 *b);
|
68 |
|
|
void mp_matrix4_multiply_matrix4i(mp_matrix4 *dst, mp_matrix4 *mm, mp_matrix4 *b);
|
69 |
|
|
void mp_matrix4_transpose(mp_matrix4 *dst,mp_matrix4 *src);
|
70 |
|
|
void mp_matrix4_inverse(mp_matrix4 *dst,mp_matrix4 *src);
|
71 |
|
|
void mp_matrix4_rotate(mp_matrix4 *dst, mp_vector3 *v, float theta);
|
72 |
|
|
void mp_matrix4_get_elements(mp_matrix4 *dst, unsigned int *b);
|
73 |
|
|
|
74 |
|
|
#endif
|