1 /* ______ ___ ___
2 * /\ _ \ /\_ \ /\_ \
3 * \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
4 * \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
5 * \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
6 * \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
7 * \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
8 * /\____/
9 * \_/__/
10 *
11 * Math routines, etc.
12 *
13 * By Michael Bukin.
14 *
15 * See readme.txt for copyright information.
16 */
17
18
19 #include "allegro.h"
20 #include "allegro/internal/aintern.h"
21
22
23
24 #ifdef ALLEGRO_NO_ASM
25 /* Empty bank switch routines. Should be used with C calling convention. */
26
_stub_bank_switch(BITMAP * bmp,int y)27 uintptr_t _stub_bank_switch(BITMAP *bmp, int y)
28 {
29 return (uintptr_t)bmp->line[y];
30 }
31
_stub_unbank_switch(BITMAP * bmp)32 void _stub_unbank_switch(BITMAP *bmp)
33 {
34 }
35
_stub_bank_switch_end(void)36 void _stub_bank_switch_end(void)
37 {
38 }
39
40 #else
41
42 /*
43 * For ASM calling convention:
44 * Unix version uses bank switch routines from src/i386/imisc.s.
45 * DOS version uses bank switch routines from -#- or src/c/cmiscs.s.
46 */
47
48 #endif
49
50
51
52 /* apply_matrix_f:
53 * Floating point vector by matrix multiplication routine.
54 */
apply_matrix_f(AL_CONST MATRIX_f * m,float x,float y,float z,float * xout,float * yout,float * zout)55 void apply_matrix_f(AL_CONST MATRIX_f *m, float x, float y, float z,
56 float *xout, float *yout, float *zout)
57 {
58 #define CALC_ROW(n) (x * m->v[(n)][0] + y * m->v[(n)][1] + z * m->v[(n)][2] + m->t[(n)])
59 *xout = CALC_ROW(0);
60 *yout = CALC_ROW(1);
61 *zout = CALC_ROW(2);
62 #undef CALC_ROW
63 }
64
65