Fixed compile errors in switch cases

This commit is contained in:
n00b
2024-09-15 22:37:32 -04:00
parent f013e6ba71
commit 526478b618
14 changed files with 2297 additions and 1097 deletions

View File

@@ -8,127 +8,6 @@
// ------------------ 3D Transform Routines --------------------------------
double CalculateFaceZ(double cam_dist, double graph_offset_x, double graph_offset_y, double view_w, double view_h, double view_depth, uint32_t mA, int f_vertex_count, double* columns, double* face_min_z, double* face_max_z, double* z_avg)
{
bool dbg = false;
if(f_vertex_count > 4)
return -1;
double vx, vy, vz[4];
int oi_count = 0;
double n_face_min_z = MatrixValue(mA, 2, (uint32_t)columns[0]);
double n_face_max_z = n_face_min_z;
bool in_zx_range = false;
bool in_zy_range = false;
double face_min_x = 0;
double face_max_x = 0;
double face_min_y = 0;
double face_max_y = 0;
bool zx_min_bound = false;
bool zx_max_bound = false;
bool zy_min_bound = false;
bool zy_max_bound = false;
double distance = 0;
double z_dist = 0; //C3D_CAMERA_LENS - z
double off_x = graph_offset_x;
double off_y = graph_offset_y;
double min_x = (0 - off_x) / cam_dist;
double min_y = (view_h - off_y) / cam_dist * -1;
double max_x = (view_w - off_x) / cam_dist;
double max_y = (0 - off_y) / cam_dist * -1;
double zx_min, zx_max, zy_min, zy_max;
for(int i = 0; i < f_vertex_count; i++)
{
vz[i] = MatrixValue(mA, 2, (uint32_t)columns[i]);
vx = MatrixValue(mA, 0, (uint32_t)columns[i]);
vy = MatrixValue(mA, 1, (uint32_t)columns[i]);
distance = -1*vz[i];
if(distance >= 0 && distance < view_depth)
{
double d = cam_dist - (distance*-1);
zx_min = min_x * d;
zx_max = max_x * d;
zy_min = min_y * d;
zy_max = max_y * d;
in_zx_range = in_zx_range || (vx >= zx_min && vx < zx_max);
in_zy_range = in_zy_range || (vy >= zy_min && vy < zy_max);
zx_min_bound = zx_min_bound || (vx < zx_min);
zx_max_bound = zx_max_bound || (vx >= zx_max);
zy_min_bound = zy_min_bound || (vy < zy_min);
zy_max_bound = zy_max_bound || (vy >= zy_max);
}
else if(vz[i] >= 0 && vz[i] < view_depth)
{
double d = cam_dist - (vz[i]*-1);
zx_min = min_x * d;
zx_max = max_x * d;
zy_min = min_y * d;
zy_max = max_y * d;
in_zx_range = in_zx_range || (vx >= zx_min && vx < zx_max);
in_zy_range = in_zy_range || (vy >= zy_min && vy < zy_max);
zx_min_bound = zx_min_bound || (vx < zx_min);
zx_max_bound = zx_max_bound || (vx >= zx_max);
zy_min_bound = zy_min_bound || (vy < zy_min);
zy_max_bound = zy_max_bound || (vy >= zy_max);
}
n_face_min_z = min(n_face_min_z, vz[i]);
n_face_max_z = max(n_face_max_z, vz[i]);
}
in_zx_range = in_zx_range || (zx_min_bound && zx_max_bound);
in_zy_range = in_zy_range || (zy_min_bound && zy_max_bound);
if( (!in_zx_range) || (!in_zy_range) )
return -1;
//'if key(k_i) and actor = 1 then : print "face = ";face_num : end if
z_avg[0] = (n_face_min_z+n_face_max_z) / 2; //'This is some bullshit math to order the faces with out checking if they are obscured
face_min_z[0] = n_face_min_z;
face_max_z[0] = n_face_max_z;
//C3D_Actor_Face_ZOrder[actor, face_num] = face_min_z
if(face_min_z[0] >= cam_dist)
return -1;
else
return (cam_dist - face_min_z[0]);
}
int GetLinePlaneIntersection(double* line_point, double* line_direction, double* plane_point_1, double* plane_point_2, double* plane_point_3, double* intersection)
{
//' """
@@ -796,26 +675,6 @@ void projectionGeometry(int cam_dist, int f_vertex_count, double* vertex3D, doub
}
void rc_GetProjectionGeometry(int cam_dist, uint32_t mA, int f_vertex_count, double* columns, double* uv, double graph_offset_x, double graph_offset_y, uint32_t color,
double* vertex_count, double* vertex2D, double* ind_count, double* index, double* clip_dist, double* min_x, double* min_y, double* max_x, double* max_y)
{
double vertex3D[18]; // number of vertices * 3 -> ie. (x,y,z) for each vertex
int v_index = 0;
for(int i = 0; i < f_vertex_count; i++)
{
vertex3D[v_index] = MatrixValue(mA, 0, columns[i]);
vertex3D[v_index+1] = MatrixValue(mA, 1, columns[i]);
vertex3D[v_index+2] = MatrixValue(mA, 2, columns[i]);
v_index += 3;
}
projectionGeometry(cam_dist, f_vertex_count, &vertex3D[0], uv, graph_offset_x, graph_offset_y, color,
vertex_count, vertex2D, ind_count, index, clip_dist, min_x, min_y, max_x, max_y);
}
// --------------------------------------------------------------------------