gWorldScalen't
This commit is contained in:
1 parent
3cc9fe8633
commit
ab67e9be4d
4 files changed
+6
-63
No files matched your search
@@ -581,50 +581,6 @@ void mtxf_mul_vec3s(Mat4 mtx, Vec3s b) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert float matrix 'src' to fixed point matrix 'dest'.
|
||||
* The float matrix may not contain entries larger than 65536 or the console
|
||||
* crashes. The fixed point matrix has entries with a 16-bit integer part, so
|
||||
* the floating point numbers are multiplied by 2^16 before being cast to a s32
|
||||
* integer. If this doesn't fit, the N64 and iQue consoles will throw an
|
||||
* exception. On Wii and Wii U Virtual Console the value will simply be clamped
|
||||
* and no crashes occur.
|
||||
|
||||
* Modified into a hybrid of the original function and the worldscale altered function.
|
||||
* Will check if the worldscale is below what's considered safe in vanilla bounds and
|
||||
* just run the faster vanilla function, otherwise it'll run the slower, but safer scale
|
||||
* function, for extended boundaries.
|
||||
*/
|
||||
void mtxf_to_mtx_scale(Mtx *dest, Mat4 src) {
|
||||
Mat4 temp;
|
||||
register s32 i, j;
|
||||
for(i = 0; i < 4; i++) {
|
||||
for(j = 0; j < 3; j++) {
|
||||
temp[i][j] = (src[i][j] / gWorldScale);
|
||||
}
|
||||
temp[i][3] = src[i][3];
|
||||
}
|
||||
guMtxF2L(temp, dest);
|
||||
}
|
||||
|
||||
void mtxf_to_mtx_constant(register s16 *dest, register f32 *src) { //! TODO: asm
|
||||
s32 asFixedPoint;
|
||||
s32 i;
|
||||
for (i = 0; i < 16; i++) {
|
||||
asFixedPoint = (src[i] * (1 << 16));
|
||||
dest[i ] = (asFixedPoint >> 16);
|
||||
dest[i + 16] = (asFixedPoint & 0xFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
void mtxf_to_mtx(void *dest, void *src) {
|
||||
if (gWorldScale > 2.0f) {
|
||||
mtxf_to_mtx_scale(dest, src);
|
||||
} else {
|
||||
mtxf_to_mtx_constant(dest, src);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set 'mtx' to a transformation matrix that rotates around the z axis.
|
||||
*/
|
||||
|
||||
@@ -482,9 +482,10 @@ void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s32 yaw, f32 radius);
|
||||
void mtxf_mul(Mat4 dest, Mat4 a, Mat4 b);
|
||||
void mtxf_scale_vec3f(Mat4 dest, Mat4 mtx, Vec3f s);
|
||||
void mtxf_mul_vec3s(Mat4 mtx, Vec3s b);
|
||||
void mtxf_to_mtx(void *dest, void *src);
|
||||
void mtxf_to_mtx_constant(register s16 *dest, register f32 *src);
|
||||
void mtxf_to_mtx_scale(Mtx *dest, Mat4 src);
|
||||
extern void mtxf_to_mtx_asm(register s16 *dest, register f32 *src);
|
||||
inline void mtxf_to_mtx(register s16 *dest, register f32 *src) {
|
||||
mtxf_to_mtx_asm(dest, src);
|
||||
}
|
||||
void mtxf_rotate_xy(Mtx *mtx, s32 angle);
|
||||
void get_pos_from_transform_mtx(Vec3f dest, Mat4 objMtx, Mat4 camMtx);
|
||||
|
||||
|
||||
Reference in new issue
Block a user