mirror of
https://github.com/n64decomp/mk64
synced 2026-08-18 05:08:24 -04:00
+40
-37
@@ -39,7 +39,8 @@ UNUSED void func_802B4FF0() {
|
||||
|
||||
}
|
||||
|
||||
s32 func_802B4FF8(Mat4 arg0, s32 arg1) {
|
||||
// set the position, rotation and mode of where to render the next object and check number of object already render
|
||||
s32 render_set_position(Mat4 arg0, s32 arg1) {
|
||||
if (gMatrixObjectCount >= MTX_OBJECT_POOL_SIZE) {
|
||||
return 0;
|
||||
}
|
||||
@@ -72,7 +73,7 @@ f32 func_802B51E8(Vec3f arg0, Vec3f arg1) {
|
||||
return (temp_f2 * temp_f2) + (temp_f12 * temp_f12) + temp_f14 + temp_f14;
|
||||
}
|
||||
//u32 atan2s(f32, f32); // might be s32
|
||||
u32 func_802B5224(Vec3f arg0, Vec3f arg1) {
|
||||
u32 get_angle_between_points(Vec3f arg0, Vec3f arg1) {
|
||||
f32 temp_v1;
|
||||
f32 temp_v2;
|
||||
temp_v1 = arg1[0] - arg0[0];
|
||||
@@ -1030,7 +1031,7 @@ f32 coss(u16 arg0) {
|
||||
return gCosineTable[arg0 >> 4];
|
||||
}
|
||||
|
||||
s32 func_802B8058(u16 arg0, u16 arg1, u16 arg2) {
|
||||
s32 is_visible_between_angle(u16 arg0, u16 arg1, u16 arg2) {
|
||||
if (arg1 < arg0) {
|
||||
if (arg1 >= arg2) {
|
||||
return 0;
|
||||
@@ -1046,65 +1047,67 @@ s32 func_802B8058(u16 arg0, u16 arg1, u16 arg2) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
|
||||
f32 func_802B80D0(Vec3f arg0, Vec3f arg1, u16 arg2, f32 arg3, f32 arg4, f32 arg5) {
|
||||
u16 temp_a2;
|
||||
/**
|
||||
* Returns distance or -1.0f if exceeds render distance.
|
||||
*/
|
||||
f32 is_within_render_distance(Vec3f cameraPos, Vec3f objectPos, u16 orientationY, f32 minDistance, f32 fov, f32 maxDistance) {
|
||||
u16 angleObject;
|
||||
UNUSED u16 pad;
|
||||
u16 temp_v0;
|
||||
f32 temp_f0;
|
||||
f32 temp_f20;
|
||||
f32 temp_f2;
|
||||
s32 temp_t6;
|
||||
s32 temp_t7;
|
||||
f32 distanceX;
|
||||
f32 distance;
|
||||
f32 distanceY;
|
||||
s32 plus_fov_angle;
|
||||
s32 minus_fov_angle;
|
||||
u16 temp;
|
||||
UNUSED s32 pad2[3];
|
||||
u16 temp_v1 = ((u16) arg4 * 0xB6);
|
||||
u16 extended_fov = ((u16) fov * 0xB6);
|
||||
|
||||
temp_f0 = arg1[0] - arg0[0];
|
||||
temp_f0 = temp_f0 * temp_f0;
|
||||
if (arg5 < temp_f0) {
|
||||
distanceX = objectPos[0] - cameraPos[0];
|
||||
distanceX = distanceX * distanceX;
|
||||
if (maxDistance < distanceX) {
|
||||
return -1.0f;
|
||||
}
|
||||
|
||||
temp_f2 = arg1[2] - arg0[2];
|
||||
temp_f2 = temp_f2 * temp_f2;
|
||||
if (arg5 < temp_f2) {
|
||||
distanceY = objectPos[2] - cameraPos[2];
|
||||
distanceY = distanceY * distanceY;
|
||||
if (maxDistance < distanceY) {
|
||||
return -1.0f;
|
||||
}
|
||||
|
||||
temp_f20 = temp_f0 + temp_f2;
|
||||
if (temp_f20 < arg3) {
|
||||
return temp_f20;
|
||||
distance = distanceX + distanceY;
|
||||
if (distance < minDistance) {
|
||||
return distance;
|
||||
}
|
||||
|
||||
if (temp_f20 > arg5) {
|
||||
if (distance > maxDistance) {
|
||||
return -1.0f;
|
||||
}
|
||||
|
||||
temp_a2 = func_802B5224(arg0, arg1);
|
||||
temp_t7 = (arg2 - temp_v1);
|
||||
temp_t6 = (arg2 + temp_v1);
|
||||
angleObject = get_angle_between_points(cameraPos, objectPos);
|
||||
minus_fov_angle = (orientationY - extended_fov);
|
||||
plus_fov_angle = (orientationY + extended_fov);
|
||||
|
||||
if (arg3 == 0.0f) {
|
||||
if (func_802B8058((arg2 + temp_v1), (arg2 - temp_v1), temp_a2) == 1) {
|
||||
return temp_f20;
|
||||
if (minDistance == 0.0f) {
|
||||
if (is_visible_between_angle((orientationY + extended_fov), (orientationY - extended_fov), angleObject) == 1) {
|
||||
return distance;
|
||||
}
|
||||
return -1.0f;
|
||||
}
|
||||
|
||||
if (func_802B8058((u16) temp_t6, (u16) temp_t7, temp_a2) == 1) {
|
||||
return temp_f20;
|
||||
if (is_visible_between_angle((u16) plus_fov_angle, (u16) minus_fov_angle, angleObject) == 1) {
|
||||
return distance;
|
||||
}
|
||||
temp_v0 = func_802B7CA8(arg3 / temp_f20);
|
||||
temp = temp_a2 + temp_v0;
|
||||
temp_v0 = func_802B7CA8(minDistance / distance);
|
||||
temp = angleObject + temp_v0;
|
||||
|
||||
if (func_802B8058(temp_t6, temp_t7, temp) == 1) {
|
||||
return temp_f20;
|
||||
if (is_visible_between_angle(plus_fov_angle, minus_fov_angle, temp) == 1) {
|
||||
return distance;
|
||||
}
|
||||
|
||||
temp = temp_a2 - temp_v0;
|
||||
if (func_802B8058(temp_t6, temp_t7, temp) == 1) {
|
||||
return temp_f20;
|
||||
temp = angleObject - temp_v0;
|
||||
if (is_visible_between_angle(plus_fov_angle, minus_fov_angle, temp) == 1) {
|
||||
return distance;
|
||||
}
|
||||
return -1.0f;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user