dungeon_crawler
diff prototype/vmath/vmath_types.h @ 1:96de911d05d4
started a rough prototype
author | John Tsiombikas <nuclear@mutantstargoat.com> |
---|---|
date | Thu, 28 Jun 2012 06:05:50 +0300 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/prototype/vmath/vmath_types.h Thu Jun 28 06:05:50 2012 +0300 1.3 @@ -0,0 +1,58 @@ 1.4 +/* 1.5 +libvmath - a vector math library 1.6 +Copyright (C) 2004-2011 John Tsiombikas <nuclear@member.fsf.org> 1.7 + 1.8 +This program is free software: you can redistribute it and/or modify 1.9 +it under the terms of the GNU Lesser General Public License as published 1.10 +by the Free Software Foundation, either version 3 of the License, or 1.11 +(at your option) any later version. 1.12 + 1.13 +This program is distributed in the hope that it will be useful, 1.14 +but WITHOUT ANY WARRANTY; without even the implied warranty of 1.15 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1.16 +GNU Lesser General Public License for more details. 1.17 + 1.18 +You should have received a copy of the GNU Lesser General Public License 1.19 +along with this program. If not, see <http://www.gnu.org/licenses/>. 1.20 +*/ 1.21 + 1.22 +#ifndef VMATH_TYPES_H_ 1.23 +#define VMATH_TYPES_H_ 1.24 + 1.25 +#include "vmath_config.h" 1.26 + 1.27 +#define SMALL_NUMBER 1.e-4 1.28 +#define XSMALL_NUMBER 1.e-8 1.29 +#define ERROR_MARGIN 1.e-6 1.30 + 1.31 + 1.32 +#ifdef SINGLE_PRECISION_MATH 1.33 +typedef float scalar_t; 1.34 +#else 1.35 +typedef double scalar_t; 1.36 +#endif /* floating point precision */ 1.37 + 1.38 +/* vectors */ 1.39 +typedef struct { scalar_t x, y; } vec2_t; 1.40 +typedef struct { scalar_t x, y, z; } vec3_t; 1.41 +typedef struct { scalar_t x, y, z, w; } vec4_t; 1.42 + 1.43 +/* quaternions */ 1.44 +typedef vec4_t quat_t; 1.45 + 1.46 +/* matrices */ 1.47 +typedef scalar_t mat3_t[3][3]; 1.48 +typedef scalar_t mat4_t[4][4]; 1.49 + 1.50 + 1.51 +#ifdef __cplusplus 1.52 +class Vector2; 1.53 +class Vector3; 1.54 +class Vector4; 1.55 +class Quaternion; 1.56 +class Matrix3x3; 1.57 +class Matrix4x4; 1.58 +class SphVector; 1.59 +#endif /* __cplusplus */ 1.60 + 1.61 +#endif /* VMATH_TYPES_H_ */