Skip to content

Commit

Permalink
improved reflection lighting/fog calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Arsunt committed Sep 18, 2021
1 parent 1857d14 commit 0d2dc31
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion 3dsystem/3d_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,14 @@ static void phd_PutEnvmapPolygons(__int16 *ptrEnv) {
// make sure that reflection will be drawn after normal poly
PhdVBuf[i].zv -= (double)(W2V_SCALE/2);
// set lighting that depends only from fog distance
PhdVBuf[i].g = (LsAdder + 0x1000) / 2;
PhdVBuf[i].g = 0x1000;
int depth = PhdMatrixPtr->_23 >> W2V_SHIFT;
#ifdef FEATURE_VIEW_IMPROVED
PhdVBuf[i].g += CalculateFogShade(depth);
#else // !FEATURE_VIEW_IMPROVED
if( depth > DEPTHQ_START ) // fog begin
PhdVBuf[i].g += depth - DEPTHQ_START;
#endif // FEATURE_VIEW_IMPROVED
CLAMP(PhdVBuf[i].g, 0x1000, 0x1FFF); // reflection can be darker but not brighter

// rotate normal vectors for X/Y, no translation
Expand Down

0 comments on commit 0d2dc31

Please sign in to comment.