Skip to content

Commit 0d2dc31

Browse files
committed
improved reflection lighting/fog calculation
1 parent 1857d14 commit 0d2dc31

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

3dsystem/3d_gen.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,14 @@ static void phd_PutEnvmapPolygons(__int16 *ptrEnv) {
256256
// make sure that reflection will be drawn after normal poly
257257
PhdVBuf[i].zv -= (double)(W2V_SCALE/2);
258258
// set lighting that depends only from fog distance
259-
PhdVBuf[i].g = (LsAdder + 0x1000) / 2;
259+
PhdVBuf[i].g = 0x1000;
260+
int depth = PhdMatrixPtr->_23 >> W2V_SHIFT;
261+
#ifdef FEATURE_VIEW_IMPROVED
262+
PhdVBuf[i].g += CalculateFogShade(depth);
263+
#else // !FEATURE_VIEW_IMPROVED
264+
if( depth > DEPTHQ_START ) // fog begin
265+
PhdVBuf[i].g += depth - DEPTHQ_START;
266+
#endif // FEATURE_VIEW_IMPROVED
260267
CLAMP(PhdVBuf[i].g, 0x1000, 0x1FFF); // reflection can be darker but not brighter
261268

262269
// rotate normal vectors for X/Y, no translation

0 commit comments

Comments
 (0)