Files
tp/include/dolphin/mtx/vec.h
T
TakaRikka e14b04c54a move more of d_save / d_com_inf_game (#141)
* some d_save matches / fixes

* more d_save cleanup

* fopAc_ac_c changes

* move a bunch of d_save / d_com_inf_game stuff

* format + remove asm

* move bit labels to correct header

* format

* move d_item

* fix check_itemno doc

* move

* fixes

* getLayerNo_common_common almost matching

just regalloc issues

* small fixes

* few more matches

* fix
2021-08-23 22:47:18 +02:00

42 lines
1.3 KiB
C

#ifndef VEC_H
#define VEC_H
#include "dolphin/types.h"
struct Vec {
float x, y, z;
float GetX() const { return x; }
float GetY() const { return y; }
float GetZ() const { return z; }
float getXDiff(const Vec* other) const { return x - other->x; }
float getYDiff(const Vec* other) const { return y - other->y; }
float getZDiff(const Vec* other) const { return z - other->z; }
void set(f32 pX, f32 pY, f32 pZ) {
x = pX;
y = pY;
z = pZ;
}
void set(const Vec& other) {
x = other.x;
y = other.y;
z = other.z;
}
};
extern "C" {
void PSVECAdd(const Vec* src_a, const Vec* src_b, Vec* dst);
void PSVECSubtract(const Vec* a, const Vec* b, Vec* dst);
void PSVECScale(const Vec* src, Vec* dst, float scale);
void PSVECNormalize(const Vec* src, Vec* dst);
float PSVECSquareMag(const Vec* vec);
float PSVECMag(const Vec* data);
float PSVECDotProduct(const Vec* a, const Vec* b);
void PSVECCrossProduct(const Vec* src_a, const Vec* src_b, Vec* dst);
void C_VECHalfAngle(const Vec* incident, const Vec* line_of_sight, Vec* out_half);
void C_VECReflect(const Vec* src, const Vec* surface_normal, Vec* dst);
float PSVECSquareDistance(const Vec* a, const Vec* b);
float PSVECDistance(const Vec* a, const Vec* b);
}
#endif /* VEC_H */