|
coastline 0.0.4
|
The graphics utility routines for matrices and view transforms, and the trigonometry they use. More...


Go to the source code of this file.
Functions | |
| void | guMtxF2L (float mf[4][4], Mtx *m) |
| Convert a floating-point matrix to the fixed-point form of the RSP. | |
| void | guMtxL2F (float mf[4][4], Mtx *m) |
| Convert a fixed-point matrix to floating point. | |
| void | guMtxIdentF (float mf[4][4]) |
| Set a floating-point matrix to the identity. | |
| void | guMtxIdent (Mtx *m) |
| Set a fixed-point matrix to the identity. | |
| void | guMtxCatF (float mf[4][4], float nf[4][4], float res[4][4]) |
| Multiply two floating-point matrices. | |
| void | guMtxCatL (Mtx *m, Mtx *n, Mtx *res) |
| Multiply two fixed-point matrices. | |
| void | guMtxXFMF (float mf[4][4], float x, float y, float z, float *ox, float *oy, float *oz) |
| Transform a point by a floating-point matrix. | |
| void | guMtxXFML (Mtx *m, float x, float y, float z, float *ox, float *oy, float *oz) |
| Transform a point by a fixed-point matrix. | |
| void | guScaleF (float mf[4][4], float x, float y, float z) |
| Build a floating-point scale matrix. | |
| void | guScale (Mtx *m, float x, float y, float z) |
| Build a fixed-point scale matrix. | |
| void | guTranslateF (float mf[4][4], float x, float y, float z) |
| Build a floating-point translation matrix. | |
| void | guTranslate (Mtx *m, float x, float y, float z) |
| Build a fixed-point translation matrix. | |
| void | guRotateF (float mf[4][4], float a, float x, float y, float z) |
| Build a floating-point matrix that rotates by a degrees about an axis. | |
| void | guRotate (Mtx *m, float a, float x, float y, float z) |
| Build a fixed-point matrix that rotates by a degrees about an axis. | |
| void | guNormalize (float *x, float *y, float *z) |
| Scale a vector to unit length in place. | |
| void | guPerspectiveF (float mf[4][4], u16 *perspNorm, float fovy, float aspect, float near, float far, float scale) |
| Build a floating-point perspective projection. | |
| void | guPerspective (Mtx *m, u16 *perspNorm, float fovy, float aspect, float near, float far, float scale) |
| Build a fixed-point perspective projection. | |
| void | guLookAtF (float mf[4][4], float xEye, float yEye, float zEye, float xAt, float yAt, float zAt, float xUp, float yUp, float zUp) |
| Build a floating-point viewing matrix from the eye, the point it looks at and the up vector. | |
| void | guLookAt (Mtx *m, float xEye, float yEye, float zEye, float xAt, float yAt, float zAt, float xUp, float yUp, float zUp) |
| Build a fixed-point viewing matrix. | |
| void | guLookAtReflectF (float mf[4][4], LookAt *l, float xEye, float yEye, float zEye, float xAt, float yAt, float zAt, float xUp, float yUp, float zUp) |
| Build a floating-point viewing matrix and the directions for reflection mapping. | |
| void | guLookAtReflect (Mtx *m, LookAt *l, float xEye, float yEye, float zEye, float xAt, float yAt, float zAt, float xUp, float yUp, float zUp) |
| Build a fixed-point viewing matrix and the directions for reflection mapping. | |
| void | guLookAtHiliteF (float mf[4][4], LookAt *l, Hilite *h, float xEye, float yEye, float zEye, float xAt, float yAt, float zAt, float xUp, float yUp, float zUp, float xl1, float yl1, float zl1, float xl2, float yl2, float zl2, int twidth, int theight) |
| Build a floating-point viewing matrix, the reflection directions and the positions of the highlights of two lights on a texture of the given size. | |
| void | guLookAtHilite (Mtx *m, LookAt *l, Hilite *h, float xEye, float yEye, float zEye, float xAt, float yAt, float zAt, float xUp, float yUp, float zUp, float xl1, float yl1, float zl1, float xl2, float yl2, float zl2, int twidth, int theight) |
| Build a fixed-point viewing matrix with reflection directions and highlights. | |
| float | sinf (float x) |
| Return the sine of an angle in radians. | |
| float | cosf (float x) |
| Return the cosine of an angle in radians. | |
| float | sqrtf (float x) |
| Return the square root. | |
| s16 | sins (u16 x) |
| Return the sine of an angle where 0x10000 is a full turn, in s1.15 fixed point. | |
The graphics utility routines for matrices and view transforms, and the trigonometry they use.
| void guMtxF2L | ( | float | mf[4][4], |
| Mtx * | m ) |
Convert a floating-point matrix to the fixed-point form of the RSP.
| mf | The source matrix, as f32[4][4] in row-major order. |
| m | Receives the matrix in s15.16 fixed point, integer halves first and fractions after. |
| void guMtxL2F | ( | float | mf[4][4], |
| Mtx * | m ) |
Convert a fixed-point matrix to floating point.
| mf | Receives the matrix as f32[4][4]. |
| m | The source matrix in s15.16 fixed point. |
| void guMtxIdentF | ( | float | mf[4][4] | ) |
Set a floating-point matrix to the identity.
| mf | The f32[4][4] matrix set. |
| void guMtxIdent | ( | Mtx * | m | ) |
Set a fixed-point matrix to the identity.
| m | The fixed-point matrix set. |
| void guMtxCatF | ( | float | mf[4][4], |
| float | nf[4][4], | ||
| float | res[4][4] ) |
Multiply two floating-point matrices.
The result may alias either operand.
| mf | The left operand, as f32[4][4]. |
| nf | The right operand, as f32[4][4]. |
| res | Receives the product mf times nf. |
Multiply two fixed-point matrices.
| m | The left operand, in s15.16 fixed point. |
| n | The right operand, in s15.16 fixed point. |
| res | Receives the product m times n. |
| void guMtxXFMF | ( | float | mf[4][4], |
| float | x, | ||
| float | y, | ||
| float | z, | ||
| float * | ox, | ||
| float * | oy, | ||
| float * | oz ) |
Transform a point by a floating-point matrix.
| mf | The transform, as f32[4][4]. |
| x | The X coordinate of the point. |
| y | The Y coordinate of the point. |
| z | The Z coordinate of the point. |
| ox | Receives the transformed X coordinate. |
| oy | Receives the transformed Y coordinate. |
| oz | Receives the transformed Z coordinate. |
| void guMtxXFML | ( | Mtx * | m, |
| float | x, | ||
| float | y, | ||
| float | z, | ||
| float * | ox, | ||
| float * | oy, | ||
| float * | oz ) |
Transform a point by a fixed-point matrix.
| m | The transform, in s15.16 fixed point. |
| x | The X coordinate of the point. |
| y | The Y coordinate of the point. |
| z | The Z coordinate of the point. |
| ox | Receives the transformed X coordinate. |
| oy | Receives the transformed Y coordinate. |
| oz | Receives the transformed Z coordinate. |
| void guScaleF | ( | float | mf[4][4], |
| float | x, | ||
| float | y, | ||
| float | z ) |
Build a floating-point scale matrix.
| mf | Receives the matrix, as f32[4][4]. |
| x | The scale along X. |
| y | The scale along Y. |
| z | The scale along Z. |
| void guScale | ( | Mtx * | m, |
| float | x, | ||
| float | y, | ||
| float | z ) |
Build a fixed-point scale matrix.
| m | Receives the matrix in s15.16 fixed point. |
| x | The scale along X. |
| y | The scale along Y. |
| z | The scale along Z. |
| void guTranslateF | ( | float | mf[4][4], |
| float | x, | ||
| float | y, | ||
| float | z ) |
Build a floating-point translation matrix.
| mf | Receives the matrix, as f32[4][4]. |
| x | The translation along X. |
| y | The translation along Y. |
| z | The translation along Z. |
| void guTranslate | ( | Mtx * | m, |
| float | x, | ||
| float | y, | ||
| float | z ) |
Build a fixed-point translation matrix.
| m | Receives the matrix in s15.16 fixed point. |
| x | The translation along X. |
| y | The translation along Y. |
| z | The translation along Z. |
| void guRotateF | ( | float | mf[4][4], |
| float | a, | ||
| float | x, | ||
| float | y, | ||
| float | z ) |
Build a floating-point matrix that rotates by a degrees about an axis.
| mf | Receives the matrix, as f32[4][4]. |
| a | The angle of the rotation in degrees. |
| x | The X component of the axis, normalised before use. |
| y | The Y component of the axis. |
| z | The Z component of the axis. |
| void guRotate | ( | Mtx * | m, |
| float | a, | ||
| float | x, | ||
| float | y, | ||
| float | z ) |
Build a fixed-point matrix that rotates by a degrees about an axis.
| m | Receives the matrix in s15.16 fixed point. |
| a | The angle of the rotation in degrees. |
| x | The X component of the axis, normalised before use. |
| y | The Y component of the axis. |
| z | The Z component of the axis. |
| void guNormalize | ( | float * | x, |
| float * | y, | ||
| float * | z ) |
Scale a vector to unit length in place.
| x | The X component, replaced by the normalised value. |
| y | The Y component, replaced by the normalised value. |
| z | The Z component, replaced by the normalised value. |
| void guPerspectiveF | ( | float | mf[4][4], |
| u16 * | perspNorm, | ||
| float | fovy, | ||
| float | aspect, | ||
| float | near, | ||
| float | far, | ||
| float | scale ) |
Build a floating-point perspective projection.
| mf | Receives the matrix, as f32[4][4]. |
| perspNorm | Receives the factor that normalises the projected W. Windows requires a pointer and writes 1. N64 permits NULL. |
| fovy | The vertical field of view in degrees. |
| aspect | The ratio of the width of the view to its height. |
| near | The distance to the near clipping plane. |
| far | The distance to the far clipping plane. |
| scale | The factor applied to every element of the N64 matrix. Windows ignores it. |
| void guPerspective | ( | Mtx * | m, |
| u16 * | perspNorm, | ||
| float | fovy, | ||
| float | aspect, | ||
| float | near, | ||
| float | far, | ||
| float | scale ) |
Build a fixed-point perspective projection.
| m | Receives the matrix in s15.16 fixed point. |
| perspNorm | Receives the factor that normalises the projected W, unless it is NULL. |
| fovy | The vertical field of view in degrees. |
| aspect | The ratio of the width of the view to its height. |
| near | The distance to the near clipping plane. |
| far | The distance to the far clipping plane. |
| scale | The factor applied to every element of the matrix. |
| void guLookAtF | ( | float | mf[4][4], |
| float | xEye, | ||
| float | yEye, | ||
| float | zEye, | ||
| float | xAt, | ||
| float | yAt, | ||
| float | zAt, | ||
| float | xUp, | ||
| float | yUp, | ||
| float | zUp ) |
Build a floating-point viewing matrix from the eye, the point it looks at and the up vector.
| mf | Receives the matrix, as f32[4][4]. |
| xEye | The X coordinate of the eye. |
| yEye | The Y coordinate of the eye. |
| zEye | The Z coordinate of the eye. |
| xAt | The X coordinate of the point looked at. |
| yAt | The Y coordinate of the point looked at. |
| zAt | The Z coordinate of the point looked at. |
| xUp | The X component of the up vector. |
| yUp | The Y component of the up vector. |
| zUp | The Z component of the up vector. |
| void guLookAt | ( | Mtx * | m, |
| float | xEye, | ||
| float | yEye, | ||
| float | zEye, | ||
| float | xAt, | ||
| float | yAt, | ||
| float | zAt, | ||
| float | xUp, | ||
| float | yUp, | ||
| float | zUp ) |
Build a fixed-point viewing matrix.
| m | Receives the matrix in s15.16 fixed point. |
| xEye | The X coordinate of the eye. |
| yEye | The Y coordinate of the eye. |
| zEye | The Z coordinate of the eye. |
| xAt | The X coordinate of the point looked at. |
| yAt | The Y coordinate of the point looked at. |
| zAt | The Z coordinate of the point looked at. |
| xUp | The X component of the up vector. |
| yUp | The Y component of the up vector. |
| zUp | The Z component of the up vector. |
| void guLookAtReflectF | ( | float | mf[4][4], |
| LookAt * | l, | ||
| float | xEye, | ||
| float | yEye, | ||
| float | zEye, | ||
| float | xAt, | ||
| float | yAt, | ||
| float | zAt, | ||
| float | xUp, | ||
| float | yUp, | ||
| float | zUp ) |
Build a floating-point viewing matrix and the directions for reflection mapping.
| mf | Receives the matrix, as f32[4][4]. |
| l | Receives the right and up vectors of the view as the two reflection directions. |
| xEye | The X coordinate of the eye. |
| yEye | The Y coordinate of the eye. |
| zEye | The Z coordinate of the eye. |
| xAt | The X coordinate of the point looked at. |
| yAt | The Y coordinate of the point looked at. |
| zAt | The Z coordinate of the point looked at. |
| xUp | The X component of the up vector. |
| yUp | The Y component of the up vector. |
| zUp | The Z component of the up vector. |
| void guLookAtReflect | ( | Mtx * | m, |
| LookAt * | l, | ||
| float | xEye, | ||
| float | yEye, | ||
| float | zEye, | ||
| float | xAt, | ||
| float | yAt, | ||
| float | zAt, | ||
| float | xUp, | ||
| float | yUp, | ||
| float | zUp ) |
Build a fixed-point viewing matrix and the directions for reflection mapping.
| m | Receives the matrix in s15.16 fixed point. |
| l | Receives the right and up vectors of the view as the two reflection directions. |
| xEye | The X coordinate of the eye. |
| yEye | The Y coordinate of the eye. |
| zEye | The Z coordinate of the eye. |
| xAt | The X coordinate of the point looked at. |
| yAt | The Y coordinate of the point looked at. |
| zAt | The Z coordinate of the point looked at. |
| xUp | The X component of the up vector. |
| yUp | The Y component of the up vector. |
| zUp | The Z component of the up vector. |
| void guLookAtHiliteF | ( | float | mf[4][4], |
| LookAt * | l, | ||
| Hilite * | h, | ||
| float | xEye, | ||
| float | yEye, | ||
| float | zEye, | ||
| float | xAt, | ||
| float | yAt, | ||
| float | zAt, | ||
| float | xUp, | ||
| float | yUp, | ||
| float | zUp, | ||
| float | xl1, | ||
| float | yl1, | ||
| float | zl1, | ||
| float | xl2, | ||
| float | yl2, | ||
| float | zl2, | ||
| int | twidth, | ||
| int | theight ) |
Build a floating-point viewing matrix, the reflection directions and the positions of the highlights of two lights on a texture of the given size.
| mf | Receives the matrix, as f32[4][4]. |
| l | Receives the right and up vectors of the view as the two reflection directions. |
| h | Receives the texture coordinates of the two highlights, in units of 1/4 texel. |
| xEye | The X coordinate of the eye. |
| yEye | The Y coordinate of the eye. |
| zEye | The Z coordinate of the eye. |
| xAt | The X coordinate of the point looked at. |
| yAt | The Y coordinate of the point looked at. |
| zAt | The Z coordinate of the point looked at. |
| xUp | The X component of the up vector. |
| yUp | The Y component of the up vector. |
| zUp | The Z component of the up vector. |
| xl1 | The X component of the direction of the first light. |
| yl1 | The Y component of the direction of the first light. |
| zl1 | The Z component of the direction of the first light. |
| xl2 | The X component of the direction of the second light. |
| yl2 | The Y component of the direction of the second light. |
| zl2 | The Z component of the direction of the second light. |
| twidth | The width of the highlight texture in texels. |
| theight | The height of the highlight texture in texels. |
| void guLookAtHilite | ( | Mtx * | m, |
| LookAt * | l, | ||
| Hilite * | h, | ||
| float | xEye, | ||
| float | yEye, | ||
| float | zEye, | ||
| float | xAt, | ||
| float | yAt, | ||
| float | zAt, | ||
| float | xUp, | ||
| float | yUp, | ||
| float | zUp, | ||
| float | xl1, | ||
| float | yl1, | ||
| float | zl1, | ||
| float | xl2, | ||
| float | yl2, | ||
| float | zl2, | ||
| int | twidth, | ||
| int | theight ) |
Build a fixed-point viewing matrix with reflection directions and highlights.
| m | Receives the matrix in s15.16 fixed point. |
| l | Receives the right and up vectors of the view as the two reflection directions. |
| h | Receives the texture coordinates of the two highlights, in units of 1/4 texel. |
| xEye | The X coordinate of the eye. |
| yEye | The Y coordinate of the eye. |
| zEye | The Z coordinate of the eye. |
| xAt | The X coordinate of the point looked at. |
| yAt | The Y coordinate of the point looked at. |
| zAt | The Z coordinate of the point looked at. |
| xUp | The X component of the up vector. |
| yUp | The Y component of the up vector. |
| zUp | The Z component of the up vector. |
| xl1 | The X component of the direction of the first light. |
| yl1 | The Y component of the direction of the first light. |
| zl1 | The Z component of the direction of the first light. |
| xl2 | The X component of the direction of the second light. |
| yl2 | The Y component of the direction of the second light. |
| zl2 | The Z component of the direction of the second light. |
| twidth | The width of the highlight texture in texels. |
| theight | The height of the highlight texture in texels. |
| float sinf | ( | float | x | ) |
Return the sine of an angle in radians.
| x | The angle in radians. |
| float cosf | ( | float | x | ) |
Return the cosine of an angle in radians.
| x | The angle in radians. |
| float sqrtf | ( | float | x | ) |
Return the square root.
| x | The value, at least 0. |
Return the sine of an angle where 0x10000 is a full turn, in s1.15 fixed point.
| x | The angle, where 0x10000 is a full turn and the low 4 bits are ignored. |