|
PS2SDK
PS2 Homebrew Libraries
|
#include <tamtypes.h>
Include dependency graph for math3d.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Macros | |
| #define | LIGHT_AMBIENT 0 |
| #define | LIGHT_DIRECTIONAL 1 |
Typedefs | |
| typedef float VECTOR[4] | __attribute__((__aligned__(16))) |
Functions | |
| void | vector_apply (VECTOR output, VECTOR input0, MATRIX input1) |
| void | vector_clamp (VECTOR output, VECTOR input0, float min, float max) |
| void | vector_copy (VECTOR output, VECTOR input0) |
| float | vector_innerproduct (VECTOR input0, VECTOR input1) |
| void | vector_multiply (VECTOR output, VECTOR input0, VECTOR input1) |
| void | vector_normalize (VECTOR output, VECTOR input0) |
| void | vector_outerproduct (VECTOR output, VECTOR input0, VECTOR input1) |
| void | vector_add (VECTOR sum, VECTOR addend, VECTOR summand) |
| void | vector_cross_product (VECTOR product, VECTOR multiplicand, VECTOR multiplier) |
| void | vector_triangle_normal (VECTOR output, VECTOR a, VECTOR b, VECTOR c) |
| void | matrix_copy (MATRIX output, MATRIX input0) |
| void | matrix_inverse (MATRIX output, MATRIX input0) |
| void | matrix_multiply (MATRIX output, MATRIX input0, MATRIX input1) |
| void | matrix_rotate (MATRIX output, MATRIX input0, VECTOR input1) |
| void | matrix_scale (MATRIX output, MATRIX input0, VECTOR input1) |
| void | matrix_translate (MATRIX output, MATRIX input0, VECTOR input1) |
| void | matrix_transpose (MATRIX output, MATRIX input0) |
| void | matrix_unit (MATRIX output) |
| void | create_local_world (MATRIX local_world, VECTOR translation, VECTOR rotation) |
| void | create_local_light (MATRIX local_light, VECTOR rotation) |
| void | create_world_view (MATRIX world_view, VECTOR translation, VECTOR rotation) |
| void | create_view_screen (MATRIX view_screen, float aspect, float left, float right, float bottom, float top, float near, float far) |
| void | create_local_screen (MATRIX local_screen, MATRIX local_world, MATRIX world_view, MATRIX view_screen) |
| void | calculate_normals (VECTOR *output, int count, VECTOR *normals, MATRIX local_light) |
| void | calculate_lights (VECTOR *output, int count, VECTOR *normals, VECTOR *light_directions, VECTOR *light_colours, const int *light_types, int light_count) |
| void | calculate_colours (VECTOR *output, int count, VECTOR *colours, VECTOR *lights) |
| void | calculate_vertices (VECTOR *output, int count, VECTOR *vertices, MATRIX local_screen) |
3D math functions.
Definition in file math3d.h.
| void vector_apply | ( | VECTOR | output, |
| VECTOR | input0, | ||
| MATRIX | input1 | ||
| ) |
| void vector_clamp | ( | VECTOR | output, |
| VECTOR | input0, | ||
| float | min, | ||
| float | max | ||
| ) |
Clamp a vector's values by cutting them off at a minimum and maximum value.
Definition at line 50 of file math3d.c.
References vector_copy().
Referenced by calculate_colours().
| void vector_copy | ( | VECTOR | output, |
| VECTOR | input0 | ||
| ) |
Copy a vector.
Definition at line 73 of file math3d.c.
Referenced by vector_add(), vector_clamp(), vector_cross_product(), vector_multiply(), and vector_triangle_normal().
| float vector_innerproduct | ( | VECTOR | input0, |
| VECTOR | input1 | ||
| ) |
| void vector_multiply | ( | VECTOR | output, |
| VECTOR | input0, | ||
| VECTOR | input1 | ||
| ) |
| void vector_normalize | ( | VECTOR | output, |
| VECTOR | input0 | ||
| ) |
Normalize a vector by determining its length and dividing its values by this value.
Definition at line 121 of file math3d.c.
Referenced by vector_triangle_normal().
| void vector_outerproduct | ( | VECTOR | output, |
| VECTOR | input0, | ||
| VECTOR | input1 | ||
| ) |
| void vector_add | ( | VECTOR | sum, |
| VECTOR | addend, | ||
| VECTOR | summand | ||
| ) |
Add two vectors
Definition at line 173 of file math3d.c.
References vector_copy().
Referenced by vector_triangle_normal().
| void vector_cross_product | ( | VECTOR | product, |
| VECTOR | multiplicand, | ||
| VECTOR | multiplier | ||
| ) |
Calculate the cross product of two vectors
Definition at line 182 of file math3d.c.
References vector_copy().
Referenced by vector_triangle_normal().
| void vector_triangle_normal | ( | VECTOR | output, |
| VECTOR | a, | ||
| VECTOR | b, | ||
| VECTOR | c | ||
| ) |
Calculates the normal of 3 vectors
Definition at line 191 of file math3d.c.
References vector_add(), vector_copy(), vector_cross_product(), and vector_normalize().
| void matrix_copy | ( | MATRIX | output, |
| MATRIX | input0 | ||
| ) |
Copy a matrix.
Definition at line 207 of file math3d.c.
Referenced by matrix_inverse(), and matrix_transpose().
| void matrix_inverse | ( | MATRIX | output, |
| MATRIX | input0 | ||
| ) |
Calculate the inverse of a matrix.
Definition at line 233 of file math3d.c.
References matrix_copy(), and matrix_transpose().
| void matrix_multiply | ( | MATRIX | output, |
| MATRIX | input0, | ||
| MATRIX | input1 | ||
| ) |
Multiply two matrices together.
Definition at line 251 of file math3d.c.
Referenced by create_local_screen(), matrix_rotate(), matrix_scale(), and matrix_translate().
| void matrix_rotate | ( | MATRIX | output, |
| MATRIX | input0, | ||
| VECTOR | input1 | ||
| ) |
Create a rotation matrix and apply it to the specified input matrix.
Definition at line 317 of file math3d.c.
References matrix_multiply(), and matrix_unit().
Referenced by create_local_light(), create_local_world(), and create_world_view().
| void matrix_scale | ( | MATRIX | output, |
| MATRIX | input0, | ||
| VECTOR | input1 | ||
| ) |
Create a scaling matrix and apply it to the specified input matrix.
Definition at line 346 of file math3d.c.
References matrix_multiply(), and matrix_unit().
| void matrix_translate | ( | MATRIX | output, |
| MATRIX | input0, | ||
| VECTOR | input1 | ||
| ) |
Create a translation matrix and apply it to the specified input matrix.
Definition at line 358 of file math3d.c.
References matrix_multiply(), and matrix_unit().
Referenced by create_local_world(), and create_world_view().
| void matrix_transpose | ( | MATRIX | output, |
| MATRIX | input0 | ||
| ) |
Transpose a matrix.
Definition at line 370 of file math3d.c.
References matrix_copy().
Referenced by matrix_inverse().
| void matrix_unit | ( | MATRIX | output | ) |
Create a unit matrix.
Definition at line 396 of file math3d.c.
Referenced by create_local_light(), create_local_screen(), create_local_world(), create_view_screen(), create_world_view(), matrix_rotate(), matrix_scale(), and matrix_translate().
| void create_local_world | ( | MATRIX | local_world, |
| VECTOR | translation, | ||
| VECTOR | rotation | ||
| ) |
Create a local_world matrix given a translation and rotation. Commonly used to describe an object's position and orientation.
Definition at line 409 of file math3d.c.
References matrix_rotate(), matrix_translate(), and matrix_unit().
| void create_local_light | ( | MATRIX | local_light, |
| VECTOR | rotation | ||
| ) |
Create a local_light matrix given a rotation. Commonly used to transform an object's normals for lighting calculations.
Definition at line 418 of file math3d.c.
References matrix_rotate(), and matrix_unit().
| void create_world_view | ( | MATRIX | world_view, |
| VECTOR | translation, | ||
| VECTOR | rotation | ||
| ) |
Create a world_view matrix given a translation and rotation. Commonly used to describe a camera's position and rotation.
Definition at line 426 of file math3d.c.
References matrix_rotate(), matrix_translate(), and matrix_unit().
| void create_view_screen | ( | MATRIX | view_screen, |
| float | aspect, | ||
| float | left, | ||
| float | right, | ||
| float | bottom, | ||
| float | top, | ||
| float | near, | ||
| float | far | ||
| ) |
Create a view_screen matrix given an aspect and clipping plane values. Functionally similar to the opengl function: glFrustum()
Definition at line 448 of file math3d.c.
References matrix_unit().
| void create_local_screen | ( | MATRIX | local_screen, |
| MATRIX | local_world, | ||
| MATRIX | world_view, | ||
| MATRIX | view_screen | ||
| ) |
Create a local_screen matrix given a local_world, world_view and view_screen matrix. Commonly used with vector_apply() to transform vertices for rendering.
Definition at line 466 of file math3d.c.
References matrix_multiply(), and matrix_unit().
| void calculate_normals | ( | VECTOR * | output, |
| int | count, | ||
| VECTOR * | normals, | ||
| MATRIX | local_light | ||
| ) |
| void calculate_lights | ( | VECTOR * | output, |
| int | count, | ||
| VECTOR * | normals, | ||
| VECTOR * | light_directions, | ||
| VECTOR * | light_colours, | ||
| const int * | light_types, | ||
| int | light_count | ||
| ) |
| void calculate_colours | ( | VECTOR * | output, |
| int | count, | ||
| VECTOR * | colours, | ||
| VECTOR * | lights | ||
| ) |
Calculate colour values given an array of light intensity values.
Definition at line 571 of file math3d.c.
References count, and vector_clamp().