Stefan Dösinger wrote:
case WINED3DRS_FOGCOLOR:
/* Valid Values are between 0 and FFFF (4 bytes alpha, red,
green, and blue)) */
if ((Value >= 0) ||
(Value <= 0xFFFF)) break;
Humm, this does not sound right to me. The fog color used to be A8R8G8B8, thus equal values are between 0xFFFFFFFF and 0x00000000. I don't know what native D3D does with the alpha in fog though.
As you can see in dlls/d3d9/tests/visual.c, if you search for D3DRS_FOGCOLOR, there are lots of calls which have color values > 0xFFFF and succeed:
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, 0xFF00FF00 /* A nice green */); ok(hr == D3D_OK, "Turning on fog calculations returned %08x\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, 0xFF00FF00 /* A nice green */); ok(hr == D3D_OK, "Setting fog color failed (%08x)\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, 0xffffffff); ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState returned %08x\n", hr);
hmmmm ok... here is the msdn site I used....
http://doc.51windows.net/Directx9_SDK/?url=/directx9_sdk/graphics/reference/...
ok here is the the definition on the site... typedef DWORD D3DCOLOR
but it says the highest 8 bits are not used... so I am off on the max value it should be actually FFFFFF.
here is the other thing I missed... "Fog color for both pixel and vertex fog is set through the D3DRS_FOGCOLOR render state. The render state values can be any RGB color, specified as an RGBA color. The alpha component is ignored. "
so valid values would be max FFFFFFFF= ALPHA(FF)RED(FF)GREEN(FF)BLUE(FF)
I can change that.. no biggie... how often is SetRenderState called? and if you look most of the if's except a few are relatively small...
Chris