Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/t3d/t3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,9 @@ void t3d_fog_set_range(float near, float far) {
}

// @TODO: refactor in the ucode (right now it's offset and then scale)
float scale = 16384.0f / diff;
float offset = -near * 2.0f;
// offset cancels near, scale spans the full s16 over the range
float scale = 32768.0f / diff;
float offset = -near;

scale = fm_floorf(scale);
scale = CLAMP(scale, -32768.0f, 32767.0f);
Expand Down