update to new fog parameters

This commit is contained in:
David Rose 2001-11-02 18:53:47 +00:00
parent 9768ef255e
commit 452eb87c07

View File

@ -826,11 +826,12 @@ dx_init( LPDIRECTDRAW7 context,
if((pCurPixFmt->dwRGBBitCount==16) && if((pCurPixFmt->dwRGBBitCount==16) &&
#ifdef MAKE_FPSMETER_TRANSPARENT #ifdef MAKE_FPSMETER_TRANSPARENT
(pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS) && (pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS) &&
(pCurPixFmt->dwRGBAlphaBitMask==0x8000)) (pCurPixFmt->dwRGBAlphaBitMask==0x8000)
#else #else
((pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS)==0) && ((pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS)==0) &&
(pCurPixFmt->dwBBitMask==0x001F)) (pCurPixFmt->dwBBitMask==0x001F)
#endif #endif
) // emacs gets confused if we don't match parens accurately.
break; break;
} }
@ -4451,7 +4452,7 @@ apply_fog(Fog *fog) {
// should probably avoid doing redundant SetRenderStates, but whatever // should probably avoid doing redundant SetRenderStates, but whatever
_d3dDevice->SetRenderState((D3DRENDERSTATETYPE)_doFogType, d3dfogmode); _d3dDevice->SetRenderState((D3DRENDERSTATETYPE)_doFogType, d3dfogmode);
Colorf fog_colr = fog->get_color(); const Colorf &fog_colr = fog->get_color();
_d3dDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, _d3dDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR,
MY_D3DRGBA(fog_colr[0], fog_colr[1], fog_colr[2], 0.0f)); // Alpha bits are not used MY_D3DRGBA(fog_colr[0], fog_colr[1], fog_colr[2], 0.0f)); // Alpha bits are not used
@ -4461,8 +4462,14 @@ apply_fog(Fog *fog) {
switch (panda_fogmode) { switch (panda_fogmode) {
case Fog::M_linear: case Fog::M_linear:
{ {
float fog_start,fog_end; // Linear fog may be world-relative or
fog->get_range(fog_start,fog_end); // camera-relative. The fog object knows how to
// decode its parameters into camera-relative
// properties.
float fog_start, fog_end;
fog->compute_linear_range(fog_start, fog_end,
_current_projection_node,
_coordinate_system);
_d3dDevice->SetRenderState( D3DRENDERSTATE_FOGSTART, _d3dDevice->SetRenderState( D3DRENDERSTATE_FOGSTART,
*((LPDWORD) (&fog_start)) ); *((LPDWORD) (&fog_start)) );
@ -4473,7 +4480,8 @@ apply_fog(Fog *fog) {
case Fog::M_exponential: case Fog::M_exponential:
case Fog::M_exponential_squared: case Fog::M_exponential_squared:
{ {
float fog_density = fog->get_density(); // Exponential fog is always camera-relative.
float fog_density = fog->get_exp_density();
_d3dDevice->SetRenderState( D3DRENDERSTATE_FOGDENSITY, _d3dDevice->SetRenderState( D3DRENDERSTATE_FOGDENSITY,
*((LPDWORD) (&fog_density)) ); *((LPDWORD) (&fog_density)) );
} }