U E D R , A S I H C RSS

3DGraphics Foundation/Math Library Template Example

~cpp
typedef float vec_t;
typedef float vec2_t[2];
typedef vec_t vec3_t[3];
typedef vec_t matrix_t[16]; // 4*4 행렬
 
// matrix prototypes
void matrixIdentity (matrix_t p);
void matrixMultiply (matrix_t a, matrix_t b, matrix_t c);
void matrixRotateX (matrix_t p, vec_t angle);
void matrixRotateY (matrix_t p, vec_t angle);
void matrixRotateZ (matrix_t p, vec_t angle);
void matrixRotate (matrix_t m, vec3_t r);
void matrixMultiplyVector (matrix_t m, vec3_t v);
void matrixMultiplyVector2 (matrix_t m, vec3_t v);
void matrixMultiplyVector3 (matrix_t m, vec3_t v);
void matrixTranslate (matrix_t m, vec3_t a);
void matrixCopy(matrix_t a, matrix_t b);
 
void matrix33_inverse (mat33_t mr, mat33_t ma);
int matrix44_inverse (mat44_t mr, mat44_t ma);
int matrix44_inverse2 (mat44_t mr, mat44_t ma);
 
// vector prototypes
void vectorClear (vec3_t a);
void vectorCopy (vec3_t a, vec3_t b);
void vectorCrossProduct (vec3_t v1, vec3_t v2, vec3_t cross);
vec_t vectorDot (vec3_t v1, vec3_t v2);
void vectorSubtract (vec3_t va, vec3_t vb, vec3_t out);
void vectorAdd (vec3_t va, vec3_t vb, vec3_t out);
vec_t vectorNormalize (vec3_t in, vec3_t out);
void vectorScaleV (vec3_t a, vec3_t s);
void vectorScale (vec3_t v, vec_t scale);
 
void NormalRet (vec3_t a, vec3_t b, vec3_t c, vec3_t &out); // 노멀 벡터 계산
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:22:15
Processing time 0.0152 sec