Skip to content

Commit

Permalink
reverts variable name changes in function definition, formats code
Browse files Browse the repository at this point in the history
  • Loading branch information
bobtista committed May 17, 2023
1 parent c29707e commit d047e44
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/game/client/baseheightmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ void BaseHeightMapRenderObjClass::Do_The_Light(VertexFormatXYZDUV2 *vb,
alpha);
}

float BaseHeightMapRenderObjClass::Get_Height_Map_Height(float input_x, float input_y, Coord3D *pos) const
float BaseHeightMapRenderObjClass::Get_Height_Map_Height(float x, float y, Coord3D *pos) const
{
WorldHeightMap *height_map;

Expand All @@ -978,8 +978,8 @@ float BaseHeightMapRenderObjClass::Get_Height_Map_Height(float input_x, float in
}

if (height_map != nullptr) {
float scaled_x = input_x * 0.1f;
float scaled_y = input_y * 0.1f;
float scaled_x = x * 0.1f;
float scaled_y = y * 0.1f;
float floor_x = GameMath::Fast_Float_Floor(scaled_x);
float floor_y = GameMath::Fast_Float_Floor(scaled_y);
float fract_x = scaled_x - floor_x;
Expand All @@ -1000,10 +1000,14 @@ float BaseHeightMapRenderObjClass::Get_Height_Map_Height(float input_x, float in
// If fractional y is less than or equal to fractional x, our point is in the top right triangle of the cell
if (fract_y <= fract_x) {
float top_right_height = height_data[current_point_index + 1];
interpolated_height = ((bottom_right_height - top_right_height) * fract_y + top_right_height + (1.0f - fract_x) * (top_left_height - top_right_height)) * HEIGHTMAP_SCALE;
interpolated_height = ((bottom_right_height - top_right_height) * fract_y + top_right_height
+ (1.0f - fract_x) * (top_left_height - top_right_height))
* HEIGHTMAP_SCALE;
} else {
float bottom_left_height = height_data[map_width + current_point_index];
interpolated_height = ((1.0f - fract_y) * (top_left_height - bottom_left_height) + bottom_left_height + (bottom_right_height - bottom_left_height) * fract_x) * HEIGHTMAP_SCALE;
interpolated_height = ((1.0f - fract_y) * (top_left_height - bottom_left_height) + bottom_left_height
+ (bottom_right_height - bottom_left_height) * fract_x)
* HEIGHTMAP_SCALE;
}

// Calculate the normal vector if pos is provided
Expand All @@ -1029,10 +1033,12 @@ float BaseHeightMapRenderObjClass::Get_Height_Map_Height(float input_x, float in
float slope_7 = down_two_neighbor_height_data - current_cell_height_data;
float interpolated_slope_x_difference = (1.0f - fract_x) * slope_1 + fract_x * slope_2;
float interpolated_slope_y_difference = (1.0f - fract_x) * slope_2 + fract_x * slope_3;
float interpolated_normal_x = interpolated_slope_x_difference * (1.0f - fract_y) + fract_y * interpolated_slope_y_difference;
float interpolated_normal_x =
interpolated_slope_x_difference * (1.0f - fract_y) + fract_y * interpolated_slope_y_difference;
float interpolated_height_x_difference = (1.0f - fract_x) * slope_4 + fract_x * slope_7;
float interpolated_height_y_difference = (1.0f - fract_x) * slope_5 + fract_x * slope_6;
float interpolated_normal_y = interpolated_height_x_difference * (1.0f - fract_y) + fract_y * interpolated_height_y_difference;
float interpolated_normal_y =
interpolated_height_x_difference * (1.0f - fract_y) + fract_y * interpolated_height_y_difference;
Vector3 v_x_axis;
Vector3 v_y_axis;
Vector3 normal_vector;
Expand Down

0 comments on commit d047e44

Please sign in to comment.