#ifndef __MATH33_H__ #define __MATH33_H__ #include "types33.h" typedef f64 Vec2[2]; typedef f64 Vec3[3]; typedef f64 Vec4[4]; typedef f64 Mat4[16]; #define V4PRINT( x, y, v ) {\ QPRINTF( x, y, "[%.2lf, %.2lf, %.2lf, %.2lf]", v[0], v[1], v[2], v[3] );\ } #define V3PRINT( x, y, v ) {\ QPRINTF( x, y, "[%.2lf, %.2lf, %.2lf]", v[0], v[1], v[2] );\ } #define V2PRINT( x, y, v ) {\ QPRINTF( x, y, "[%.2lf, %.2lf]", v[0], v[1] );\ } #define M2PRINT( x, y, m ) {\ QPRINTF( x, y, "[%.2lf, %.2lf]", m[0], m[1] );\ QPRINTF( x, y+defFont.h, "[%.2lf, %.2lf]", m[4], m[5] );\ } #define M3PRINT( x, y, m ) {\ const Size Y = defFont.h;\ QPRINTF( x, y, "[%.2lf, %.2lf, %.2lf]", m[0], m[1], m[2] );\ QPRINTF( x, y+Y, "[%.2lf, %.2lf, %.2lf]", m[4], m[5], m[6] );\ QPRINTF( x, y+Y+Y, "[%.2lf, %.2lf, %.2lf]", m[8], m[9], m[10] );\ } #define M4PRINT( x, y, m ) {\ const Size Y = defFont.h;\ QPRINTF( x, y, "[%.2lf, %.2lf, %.2lf, %.2lf]", m[0], m[1], m[2], m[3] );\ QPRINTF( x, y+Y, "[%.2lf, %.2lf, %.2lf, %.2lf]", m[4], m[5], m[6], m[7] );\ QPRINTF( x, y+Y+Y, "[%.2lf, %.2lf, %.2lf, %.2lf]", m[8], m[9], m[10], m[11] );\ QPRINTF( x, y+Y+Y+Y, "[%.2lf, %.2lf, %.2lf, %.2lf]", m[12], m[13], m[14], m[15] );\ } void M4I( Mat4 m ); void V4xMt( Vec4 dst, Vec4 v, Mat4 m ); void MxM4( Mat4 a, Mat4 b ); void VxP( Mat4 v, Mat4 p ); void math33_create_translation_matrix( f64 x, f64 y, f64 z, Mat4 m ); void math33_create_view_rotation_matrix( f64 x, f64 y, Mat4 m ); void math33_create_view_matrix( Vec3 t, Vec3 r, Mat4 m ); void math33_create_rotation_matrix( f64 x, f64 y, f64 z, Mat4 m ); void math33_create_scale_matrix( f64 x, f64 y, f64 z, Mat4 m ); void math33_create_world_matrix( Vec3 t, Vec3 r, Vec3 s, Mat4 m ); #endif /** MATH33_H **/