2020-04-19 03:28:24 +00:00
|
|
|
#ifndef _Z64MATH_H_
|
|
|
|
#define _Z64MATH_H_
|
|
|
|
|
|
|
|
#include <ultra64.h>
|
|
|
|
|
|
|
|
#define VEC_SET(V,X,Y,Z) V.x=X;V.y=Y;V.z=Z
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
f32 x, y;
|
2020-07-30 19:50:18 +00:00
|
|
|
} Vec2f; // size = 0x08
|
2020-04-19 03:28:24 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
f32 x, y, z;
|
2020-07-30 19:50:18 +00:00
|
|
|
} Vec3f; // size = 0x0C
|
2020-04-19 03:28:24 +00:00
|
|
|
|
2020-07-20 22:06:04 +00:00
|
|
|
typedef struct {
|
|
|
|
u16 x, y, z;
|
2020-07-30 19:50:18 +00:00
|
|
|
} Vec3us; // size = 0x06
|
2020-07-20 22:06:04 +00:00
|
|
|
|
2020-04-19 03:28:24 +00:00
|
|
|
typedef struct {
|
|
|
|
s16 x, y, z;
|
2020-07-30 19:50:18 +00:00
|
|
|
} Vec3s; // size = 0x06
|
2020-04-19 03:28:24 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
s32 x, y, z;
|
2020-07-30 19:50:18 +00:00
|
|
|
} Vec3i; // size = 0x0C
|
2020-04-19 03:28:24 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
Vec3s center;
|
|
|
|
s16 radius;
|
2020-07-30 19:50:18 +00:00
|
|
|
} Sphere16; // size = 0x08
|
2020-04-19 03:28:24 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
Vec3f center;
|
|
|
|
f32 radius;
|
2020-07-30 19:50:18 +00:00
|
|
|
} Spheref; // size = 0x10
|
2020-04-19 03:28:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
Vec3f normal;
|
|
|
|
f32 originDist;
|
2020-07-30 19:50:18 +00:00
|
|
|
} Plane; // size = 0x10
|
2020-04-19 03:28:24 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
Vec3f vtx[3];
|
|
|
|
Plane plane;
|
2020-07-30 19:50:18 +00:00
|
|
|
} TriNorm; // size = 0x34
|
2020-04-19 03:28:24 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
s16 radius;
|
|
|
|
s16 height;
|
|
|
|
s16 yShift;
|
|
|
|
Vec3s pos;
|
2020-07-30 19:50:18 +00:00
|
|
|
} Cylinder16; // size = 0x0C
|
2020-04-19 03:28:24 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
f32 radius;
|
|
|
|
f32 height;
|
|
|
|
f32 yShift;
|
|
|
|
Vec3f pos;
|
2020-07-30 19:50:18 +00:00
|
|
|
} Cylinderf; // size = 0x18
|
2020-04-19 03:28:24 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
Vec3f a;
|
|
|
|
Vec3f b;
|
2020-07-30 19:50:18 +00:00
|
|
|
} Linef; // size = 0x18
|
2020-04-19 03:28:24 +00:00
|
|
|
|
2020-04-30 14:49:11 +00:00
|
|
|
// Defines a point in the spherical coordinate system
|
|
|
|
typedef struct {
|
|
|
|
f32 r; // radius
|
|
|
|
s16 phi; // polar (zenith) angle
|
|
|
|
s16 theta; // azimuthal angle
|
2020-07-30 19:50:18 +00:00
|
|
|
} VecSph; // size = 0x08
|
2020-04-30 14:49:11 +00:00
|
|
|
|
2020-04-19 03:28:24 +00:00
|
|
|
#endif
|